/* Iliya Keyvan — matte black / ivory / muted gold theme override */
:root {
  --black: #101110;
  --black-2: #181917;
  --bone: #f2ede3;
  --bone-2: #ddd4c5;
  --gold: #b29a72;
  --muted: #aaa398;
  --ink: #181815;
  --line-dark: rgba(242, 237, 227, .16);
  --line-light: rgba(24, 24, 21, .16);
}

body {
  background: var(--black);
  color: var(--bone);
}

/* Header navigation: larger, calmer and more legible */
.header-center,
.reference-nav {
  font-size: clamp(.78rem, .92vw, 1rem);
  font-weight: 520;
  line-height: 1.5;
  letter-spacing: .015em;
  color: rgba(242, 237, 227, .76);
}

.reference-nav a {
  padding: .72rem .08rem;
  transition: color .25s ease, transform .25s ease;
}

.reference-nav a:hover,
.reference-nav a.current {
  color: var(--bone);
  transform: translateY(-1px);
}

.reference-nav a:after {
  bottom: .3rem;
  height: 1px;
  background: var(--gold);
  opacity: .9;
}

/* Editorial page titles */
.page-hero h1,
.course-hero h1,
.reference-hero-copy h1 {
  position: relative;
  color: var(--bone);
  font-weight: 540;
  line-height: .96;
  letter-spacing: -.035em;
  text-shadow: 0 10px 36px rgba(0, 0, 0, .28);
  padding-bottom: clamp(1.2rem, 2vw, 1.75rem);
}

/* Course pages use a light bone background, so their main title must be dark. */
.course .course-hero h1 {
  color: #593a32;
  text-shadow: none;
}

.page-hero h1:after,
.course-hero h1:after,
.reference-page .reference-hero-copy h1:after {
  content: "";
  display: block;
  width: clamp(3rem, 6vw, 5.5rem);
  height: 2px;
  margin-top: clamp(.85rem, 1.5vw, 1.25rem);
  background: var(--gold);
  opacity: .82;
}

.eyebrow,
.overline,
.section-label {
  color: var(--gold);
  font-size: clamp(.75rem, .82vw, .88rem);
  letter-spacing: .035em;
}

/* Muted gold is reserved for interaction and small details */
.cta,
.button,
.theme-button,
.text-button,
.auth-tabs button {
  transition: color .25s ease, background-color .25s ease,
    border-color .25s ease, transform .25s ease;
}

.cta.filled,
.cta.cream {
  background: var(--bone);
  color: var(--ink);
}

.cta.filled:hover,
.cta.cream:hover,
.button:hover,
.theme-button:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--black);
}

.cta.ghost:hover,
.text-button:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.auth-tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

/* Academy entry link: readable while preserving the compact composition */
.reference-page .academy-reference-copy > a {
  align-items: center;
  gap: 1.15rem;
  padding: .55rem 0 .62rem;
  border-bottom: 1px solid rgba(24, 24, 21, .62);
  color: #201e1a;
  font-size: clamp(.68rem, .78vw, .82rem);
  font-weight: 580;
  line-height: 1.5;
  letter-spacing: .01em;
}

.reference-page .academy-reference-copy > a span,
.reference-page .academy-reference-copy > a b {
  font-size: 1rem;
  line-height: 1;
}

.reference-page .academy-reference-copy > a:hover {
  color: #000;
  border-bottom-color: var(--gold);
}

::selection {
  background: var(--gold);
  color: var(--black);
}

@media (max-width: 760px) {
  .header-center,
  .reference-nav {
    font-size: .82rem;
  }

  .page-hero h1,
  .course-hero h1,
  .reference-hero-copy h1 {
    letter-spacing: -.02em;
  }
}

/* 2026 site-wide editorial refinement */
html {
  max-width: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  max-width: 100%;
  overflow-x: clip;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

main {
  isolation: isolate;
}

:where(main section, main article, main header, .footer, .header) {
  min-width: 0;
}

:where(p, li) {
  line-height: 1.95;
}

:where(a, button, input, textarea, select):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.header.cinematic-header {
  border-bottom: 1px solid rgba(242, 237, 227, .08);
  background: linear-gradient(180deg, rgba(8, 9, 8, .9), rgba(8, 9, 8, .2));
  backdrop-filter: blur(12px);
}

.header .wordmark strong {
  font-size: clamp(.84rem, 1vw, 1rem);
  line-height: .92;
}

.reference-nav {
  gap: clamp(1.25rem, 2.25vw, 2.7rem);
  font-size: clamp(.86rem, .95vw, 1rem) !important;
}

.reference-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.page-hero {
  overflow: hidden;
}

.page-hero > *,
.filmography-section > *,
.journal-page > *,
.contact-page > *,
.legal-page > *,
.account-page > * {
  min-width: 0;
  max-width: 100%;
}

.work-row > a,
.journal-card,
.journal-reference-card {
  border-radius: 2px;
}

.work-row h3,
.journal-card h2,
.journal-card h3 {
  text-wrap: balance;
}

input,
textarea,
select {
  min-height: 48px;
  border-radius: 0 !important;
  border-color: rgba(178, 154, 114, .34) !important;
}

textarea { min-height: 150px; }

@media (max-width: 760px) {
  .header.cinematic-header {
    width: 100%;
    padding-inline: 1.25rem;
  }

  .header-tools {
    gap: .9rem;
  }

  .menu-trigger {
    width: 44px;
    height: 44px;
  }

  .reference-hero-copy {
    width: calc(100% - 3rem) !important;
    inset-inline: 1.5rem !important;
  }

  .reference-page .reference-hero-copy h1 {
    font-size: clamp(3.5rem, 17vw, 5.1rem) !important;
    line-height: 1.08 !important;
  }

  .page-hero {
    width: 100% !important;
    padding-inline: 1.5rem !important;
  }

  .page-hero h1 {
    max-width: 100%;
    font-size: clamp(3rem, 15vw, 4.8rem) !important;
    line-height: 1.08 !important;
    overflow-wrap: anywhere;
  }

  .filmography-section,
  .journal-grid,
  .journal-page section,
  .contact-page section,
  .legal-page section,
  .account-page section {
    width: 100% !important;
    max-width: 100% !important;
    padding-inline: 1.5rem !important;
    margin-inline: 0 !important;
  }

  .filmography-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .filmography-heading h2 {
    font-size: clamp(2.25rem, 11vw, 3.6rem) !important;
    overflow-wrap: anywhere;
  }

  .works-list,
  .work-row,
  .work-row > a,
  .journal-grid,
  .journal-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .work-row > a {
    padding-inline: .2rem !important;
  }

  .reference-footer,
  .footer {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 2.25rem 1.5rem !important;
    padding-inline: 1.5rem !important;
  }

  .footer-brand,
  .footer > small {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .reference-footer,
  .footer {
    grid-template-columns: 1fr !important;
  }

  .footer-brand,
  .footer > small {
    grid-column: auto;
  }
}

.cms-empty {
  grid-column: 1 / -1;
  min-height: 18rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(2rem, 5vw, 5rem);
  border: 1px solid var(--line-dark);
  background: rgba(242, 237, 227, .025);
}

.cms-empty span {
  color: var(--gold);
  font-size: .7rem;
  letter-spacing: .18em;
}

.cms-empty h2 {
  margin: 1rem 0 .5rem;
  color: var(--bone);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 500;
}

.cms-empty p { color: var(--muted); }

.cms-image-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: var(--bone);
  background: radial-gradient(circle at 50% 35%, rgba(178,154,114,.14), transparent 48%), #131411;
  font-size: clamp(1.4rem, 3vw, 2.5rem);
  text-align: center;
}

.journal-reference-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile containment — must remain last so compiled page rules cannot override it. */
@media (max-width: 760px) {
  html,
  body,
  #main,
  main {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .page-hero,
  .page-body {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
    padding-inline: 1.5rem !important;
  }

  .page-hero h1 {
    width: 100% !important;
    max-width: 100% !important;
    font-size: clamp(2.85rem, 13vw, 4rem) !important;
    letter-spacing: -.035em !important;
    overflow-wrap: anywhere !important;
  }

  .post-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .post-card,
  .post-card > * {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere;
  }

  .filmography-page,
  .filmography-page .page-hero,
  .filmography-page .filmography-section,
  .filmography-page .filmography-section > div {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }

  .filmography-page .filmography-section {
    padding-inline: 1.5rem !important;
  }
}

/* Featured stories carousel */
.featured-works {
  position: relative;
}

.featured-grid[data-carousel-ready="true"] {
  display: block;
  overflow: hidden;
  direction: rtl;
  cursor: grab;
  outline: none;
}

.featured-grid[data-carousel-ready="true"]:active {
  cursor: grabbing;
}

.featured-track {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  width: 100%;
  will-change: transform;
}

.featured-track.is-moving {
  transition: transform .72s cubic-bezier(.22, 1, .36, 1);
}

.featured-track .featured-card {
  flex: 0 0 calc((100% - clamp(2rem, 4vw, 4rem)) / 3);
  min-width: 0;
  opacity: .38;
  transform: scale(.955) translateY(12px);
  filter: saturate(.7);
  transition: opacity .6s ease, transform .72s cubic-bezier(.22, 1, .36, 1),
    filter .6s ease;
}

.featured-track .featured-card.is-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  filter: saturate(1);
}

.featured-track .featured-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-controls {
  display: flex;
  direction: rtl;
  align-items: center;
  justify-content: flex-end;
  gap: .8rem;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.featured-control {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid rgba(242, 237, 227, .24);
  border-radius: 50%;
  background: transparent;
  color: var(--bone);
  cursor: pointer;
  font-size: 1.15rem;
  transition: color .25s ease, background .25s ease, border-color .25s ease,
    transform .3s cubic-bezier(.22, 1, .36, 1), opacity .25s ease;
}

.featured-control:hover:not(:disabled) {
  color: var(--black);
  background: var(--gold);
  border-color: var(--gold);
  transform: translateY(-3px);
}

.featured-control:disabled {
  opacity: .25;
  cursor: default;
}

.featured-counter {
  min-width: 4.6rem;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .14em;
  text-align: center;
  direction: ltr;
}

@media (max-width: 1020px) {
  .featured-track .featured-card {
    flex-basis: calc((100% - clamp(1rem, 2vw, 2rem)) / 2);
  }
}

@media (max-width: 680px) {
  .featured-track .featured-card {
    flex-basis: 100%;
  }

  .featured-controls {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .featured-track,
  .featured-track .featured-card,
  .featured-control {
    transition-duration: .01ms !important;
  }
}

/* Full filmography */
.filmography-page .page-hero > p:last-child {
  max-width: 52rem;
  color: rgba(242, 237, 227, .68);
  font-size: clamp(.9rem, 1.15vw, 1.08rem);
  line-height: 2;
}

.filmography-section {
  padding-top: clamp(4rem, 8vw, 8rem);
  padding-bottom: clamp(4rem, 8vw, 8rem);
}

.filmography-section.alt {
  background: #151614;
}

.filmography-heading {
  display: flex;
  align-items: flex-start;
  gap: clamp(1rem, 3vw, 3rem);
  margin-bottom: clamp(2.5rem, 5vw, 5rem);
}

.filmography-heading > span {
  color: var(--gold);
  font-size: .68rem;
  letter-spacing: .14em;
  padding-top: .6rem;
}

.filmography-heading h2 {
  margin: 0;
  color: var(--bone);
  font-size: clamp(2.4rem, 5vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -.035em;
}

.filmography-heading p {
  margin: .65rem 0 0;
  color: var(--muted);
}

.filmography-page .work-row a {
  transition: background-color .3s ease, padding .35s cubic-bezier(.22, 1, .36, 1);
}

.filmography-page .work-row a:hover {
  background: rgba(178, 154, 114, .055);
  padding-right: 1rem;
  padding-left: 1rem;
}

.filmography-page .work-row small {
  display: block;
  margin-top: .45rem;
  color: rgba(242, 237, 227, .52);
  font-size: clamp(.68rem, .78vw, .78rem);
}

.filmography-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-dark);
  border: 1px solid var(--line-dark);
}

.filmography-note {
  display: flex;
  gap: 1.25rem;
  min-height: 10rem;
  padding: clamp(1.5rem, 3vw, 2.7rem);
  background: var(--black);
}

.filmography-section.alt .filmography-note {
  background: #151614;
}

.filmography-note > span {
  color: var(--gold);
  font-size: .75rem;
  white-space: nowrap;
}

.filmography-note h3 {
  margin: 0 0 .8rem;
  color: var(--bone);
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  font-weight: 520;
}

.filmography-note p,
.filmography-note small {
  color: var(--muted);
  line-height: 1.8;
}

.filmography-detail {
  align-items: start;
}

.filmography-detail .detail-image {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #151614;
}

.filmography-detail .detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  border: 1px solid rgba(178, 154, 114, .35);
  text-align: center;
  background: radial-gradient(circle at 50% 35%, rgba(178,154,114,.12), transparent 48%), #111210 !important;
}

.poster-placeholder:before,
.poster-placeholder:after {
  content: "";
  width: 4rem;
  height: 1px;
  background: var(--gold);
}

.poster-placeholder span,
.poster-placeholder small {
  color: var(--muted);
  font-size: .65rem;
  letter-spacing: .14em;
}

.poster-placeholder strong {
  color: var(--bone);
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 480;
}

.detail-lead {
  margin-top: 0;
  color: var(--bone) !important;
  font-size: clamp(1.05rem, 1.45vw, 1.3rem);
  line-height: 2.15;
}

.work-credits {
  margin: clamp(2rem, 4vw, 4rem) 0;
  border-top: 1px solid var(--line-dark);
}

.work-credits > div {
  display: grid;
  grid-template-columns: minmax(8rem, .7fr) 1.5fr;
  gap: 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line-dark);
}

.work-credits dt {
  color: var(--muted);
  font-size: .76rem;
}

.work-credits dd {
  margin: 0;
  color: var(--bone);
}

@media (max-width: 760px) {
  .filmography-notes { grid-template-columns: 1fr; }
  .filmography-page .work-row small { display: none; }
  .work-credits > div { grid-template-columns: 1fr; gap: .4rem; }
}

/* Compact cinematic home page — tuned against the approved composition */
@media (min-width: 761px) {
  .reference-page .header {
    height: 56px;
  }

  .reference-page .reference-hero {
    height: clamp(430px, 48vw, 640px);
  }

  .reference-page .reference-hero-copy {
    top: 49%;
    transform: translateY(-43%);
  }

  .reference-page .reference-hero-copy h1 {
    font-size: clamp(4.15rem, 7.15vw, 7.25rem);
  }

  .reference-page .reference-quote {
    margin-bottom: 1rem;
  }

  .reference-page .reference-band {
    padding-block: clamp(1.35rem, 2.55vw, 2.45rem);
  }

  .reference-page .reference-side-heading h2 {
    font-size: clamp(1.85rem, 3.15vw, 3.25rem);
    margin-bottom: 1.35rem;
  }

  .reference-page .featured-grid,
  .reference-page .journal-reference-grid {
    gap: clamp(.5rem, .9vw, .9rem);
  }

  .reference-page .featured-image {
    aspect-ratio: 1.18 / 1;
  }

  .reference-page .featured-meta {
    min-height: 54px;
    padding-top: .5rem;
  }

  .reference-page .academy-reference {
    min-height: clamp(250px, 28vw, 380px);
  }

  .reference-page .academy-reference-copy {
    padding-block: clamp(1.6rem, 3.3vw, 3.2rem);
  }

  .reference-page .academy-reference-copy h2 {
    font-size: clamp(2.65rem, 4.8vw, 4.8rem);
  }

  .reference-page .academy-features {
    padding-block: clamp(1.5rem, 2.8vw, 2.7rem);
  }

  .reference-page .academy-features article {
    min-height: 104px;
    padding-block: .65rem;
  }

  .reference-page .journal-reference-image {
    aspect-ratio: 1.72 / 1;
    margin-bottom: .5rem;
  }

  .reference-page .reference-footer {
    padding-top: 2rem;
    padding-bottom: 1rem;
  }
}

@media (max-width: 760px) {
  .reference-page .reference-hero {
    min-height: 600px;
  }

  .reference-page .reference-band {
    padding-block: 3.4rem;
  }

  .reference-page .reference-side-heading {
    margin-bottom: 2rem;
  }

  .reference-page .academy-reference-intro {
    min-height: 430px;
  }

  .reference-page .academy-features {
    padding-block: 2rem;
  }

  .reference-page .reference-footer {
    padding-block: 2.5rem 1.25rem;
  }

  .reference-page .academy-reference-copy > a {
    font-size: .78rem;
    gap: 1rem;
  }
}
