/* =========================================================
   Cavalier — Modals, dialogs, responsive, motion
   ========================================================= */

/* ---------- Modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bone);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal::backdrop {
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.modal__panel {
  width: min(100% - 32px, 1080px);
  margin: 4vh auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #111110;
  box-shadow: 0 60px 140px -40px #000;
  animation: modalIn 0.45s var(--ease);
}

.modal--brief .modal__panel { width: min(100% - 32px, 700px); }

.modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.modal__bar .sep { color: var(--muted-2); margin: 0 4px; }
.modal__bar .mono { font-size: 9.5px; }

.modal__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.modal__close:hover { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.modal__close svg { width: 16px; height: 16px; }

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player__loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.player__loader.is-loading { opacity: 1; }
.player__loader span {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.modal__info {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 36px;
  padding: 28px;
}

.modal__text .mono { color: var(--muted-2); font-size: 9px; }
.modal__text h2 {
  margin-top: 10px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}
.modal__text p:last-child {
  margin-top: 10px;
  max-width: 44ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.modal__chapters {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: start;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.chapter-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.chapter-btn span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}
.chapter-btn:hover { background: rgba(255, 255, 255, 0.04); color: var(--bone); }
.chapter-btn.is-active { background: rgba(255, 255, 255, 0.06); color: var(--bone); }
.chapter-btn.is-active span { color: var(--accent); }

/* ---------- Brief modal ---------- */

.brief-modal__body,
.brief-modal__success { padding: 30px 32px 34px; }

.brief-modal__body h2,
.brief-modal__success h2 {
  margin-top: 14px;
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.042em;
}

.brief-modal__body > .muted { margin-top: 12px; font-size: 14px; }

.brief-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 26px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field .mono { color: var(--muted-2); font-size: 8.5px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--bone);
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239b978d' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.field select option { background: #151515; color: var(--bone); }

.field textarea { min-height: 104px; resize: vertical; line-height: 1.5; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(255, 90, 54, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--muted-2); }

.form-note {
  color: var(--muted-2);
  font-size: 8.5px;
  text-align: center;
}

.brief-modal__success { padding-top: 46px; padding-bottom: 46px; }
.brief-modal__success .eyebrow { color: var(--accent); }
.brief-modal__success p:not(.eyebrow) {
  margin: 16px 0 28px;
  max-width: 42ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

/* ---------- Responsive: large desktop ---------- */

@media (max-width: 1240px) {
  .nav { gap: 22px; }
  .hero__title { font-size: clamp(3.4rem, 8.3vw, 7rem); }
  .hud__frame { display: none; }
}

/* ---------- Responsive: tablet ---------- */

@media (max-width: 1024px) {
  :root { --header-h: 72px; }

  .nav { gap: 18px; }
  .nav a { font-size: 13px; }
  .header-actions { gap: 12px; }
  .header-link { display: none; }

  .hero__content { padding-top: 8vh; }
  .hero__title { font-size: clamp(3.3rem, 8.6vw, 5.8rem); }
  .hero__lede { max-width: 420px; }

  .section-head { grid-template-columns: 1fr; gap: 26px; }
  .section-head__side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    text-align: left;
    padding-bottom: 0;
  }

  .studio__head { grid-template-columns: 1fr; gap: 24px; }
  .studio__head .lede { max-width: 56ch; }

  .method__grid { gap: 56px; }
  .method__intro { position: static; }
  .faq__grid { grid-template-columns: 1fr; gap: 38px; }
  .faq__intro { position: static; }

  .footer__top { grid-template-columns: 1fr; gap: 44px; }
  .footer__word { font-size: 16.3vw; }
  .footer__bottom { justify-content: flex-start; }
  .footer__bottom span:nth-child(2) { flex: none; }
}

/* ---------- Responsive: small tablet ---------- */

@media (max-width: 900px) {
  .nav { display: none; }
  .menu-btn { display: block; }
  .header-actions .btn { display: none; }

  .hero__facts { display: none; }
  .hero__rail { gap: 16px; }
  .hero__now { gap: 12px; }

  .brief__grid { grid-template-columns: 1fr; gap: 32px; }
  .brief__head .h2 { font-size: clamp(2.4rem, 7vw, 3.5rem); }
  .brief__note { max-width: 46ch; }

  .films__grid { gap: 14px; }
  .film-card,
  .film-card--wide,
  .film-card:nth-child(2) { grid-column: span 6; }
  .film-card:first-child { grid-column: span 12; }
  .film-card:first-child .film-card__media { aspect-ratio: 16 / 8.4; }

  .studio__stage { aspect-ratio: 16 / 9; }
  .studio__features { grid-template-columns: 1fr; }
  .feature {
    padding: 24px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    align-items: baseline;
  }
  .feature:last-child { border-bottom: 0; }
  .feature:not(:first-child) { padding-left: 0; }
  .feature__num { margin-bottom: 0; }
  .feature h3 { grid-column: 2; }
  .feature p { grid-column: 2; margin-top: 0; max-width: 48ch; }

  .manifesto { min-height: 78vh; }
  .manifesto blockquote { font-size: clamp(2.6rem, 7.6vw, 4.6rem); }
  .manifesto__stats-row { grid-template-columns: 1fr 1fr; gap: 0; }
  .stat { padding: 18px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
  .stat:nth-child(1),
  .stat:nth-child(2) { border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
  .stat:nth-child(3),
  .stat:nth-child(4) { border-bottom: 0; }
  .stat:nth-child(odd) { padding-left: 0; }
  .stat:nth-child(even) { border-right: 0; }
  .stat { padding-left: 0; }

  .method__grid { grid-template-columns: 1fr; gap: 46px; }
  .method__intro { position: static; }
  .method__aside { margin-top: 28px; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }

  .vault__grid { grid-auto-rows: 148px; }
  .vault__item { grid-column: span 3; }
  .vault__item:nth-child(1) { grid-column: span 6; }
  .vault__item:nth-child(8) { grid-column: span 6; }

  .plans { grid-template-columns: 1fr; gap: 14px; }
  .plan { padding: 26px 24px; }
  .plan--featured { margin-top: 16px; }
  .plan__features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }

  .modal__info { grid-template-columns: 1fr; gap: 24px; }
  .modal__chapters {
    flex-direction: row;
    overflow-x: auto;
    padding: 0 0 4px;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 18px;
    scrollbar-width: none;
  }
  .modal__chapters::-webkit-scrollbar { display: none; }
  .chapter-btn { flex: none; white-space: nowrap; }
}

/* ---------- Responsive: mobile ---------- */

@media (max-width: 720px) {
  :root { --gutter: 20px; }

  .section { padding-block: 74px; }

  .h2 { font-size: clamp(2.35rem, 10.5vw, 3.5rem); }

  .site-header__inner { gap: 12px; }

  .hero { padding-top: calc(var(--header-h) + 18px); padding-bottom: 20px; }
  .hero__scrim {
    background:
      linear-gradient(180deg, rgba(10, 10, 10, 0.55) 0%, rgba(10, 10, 10, 0.06) 22%, rgba(10, 10, 10, 0.34) 48%, rgba(10, 10, 10, 0.96) 100%),
      linear-gradient(90deg, rgba(10, 10, 10, 0.74) 0%, rgba(10, 10, 10, 0.26) 58%, rgba(10, 10, 10, 0.14) 100%);
  }
  .hero__content { padding-top: 8vh; }
  .hero__eyebrow { margin-bottom: 18px; font-size: 9px; letter-spacing: 0.14em; }
  .hero__title { font-size: clamp(3.2rem, 13.6vw, 5.2rem); line-height: 0.88; }
  .hero__lede { margin-top: 20px; max-width: 38ch; font-size: 15px; line-height: 1.55; }
  .hero__actions { margin-top: 26px; gap: 8px; }
  .hero__actions .btn { flex: 1 1 auto; }
  .hero__rail { align-items: center; padding-top: 14px; }
  .hero__now { align-items: flex-start; flex-direction: column; gap: 4px; }
  .hero__now-title strong { font-size: 13.5px; }
  .hero__now-sub { font-size: 10.5px; }
  .hero__scroll { font-size: 9px; }
  .scroll-line { width: 34px; }

  .brief { padding-top: 62px; padding-bottom: 56px; }
  .brief__head .h2 { font-size: clamp(2.3rem, 10vw, 3.2rem); }
  .brief__form { margin-top: 2px; }
  .composer { border-radius: 16px; }
  .composer__row { padding: 10px 6px 10px 12px; gap: 10px; }
  .composer__submit { width: 46px; height: 46px; }
  .composer__spark { font-size: 16px; }
  .composer__meta { padding: 10px 8px 4px 12px; align-items: flex-start; flex-direction: column; gap: 10px; }
  .composer__hint { display: none; }
  .composer__input { font-size: 14.5px; }
  .chips { gap: 5px; }
  .chip { font-size: 8.5px; padding: 6px 9px; }
  .brief__foot { gap: 12px; font-size: 8.5px; }
  .brief__foot span + span::before { margin-right: 12px; }

  .marquee { padding: 12px 0; }
  .marquee__track { font-size: 1.5rem; }
  .marquee__track span,
  .marquee__track i { margin-right: 24px; }

  .section-head { margin-bottom: 32px; }
  .section-head__side {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .section-head__side .mono { font-size: 9px; }

  .film-card,
  .film-card--wide,
  .film-card:nth-child(2),
  .film-card:first-child { grid-column: span 12; }
  .film-card:first-child .film-card__media { aspect-ratio: 16 / 9; }
  .film-card__play { opacity: 1; transform: none; width: 40px; height: 40px; }
  .film-card__body p { font-size: 13px; }
  .films__foot { margin-top: 28px; font-size: 9px; }

  .studio__stage { aspect-ratio: 4 / 3; border-radius: 16px; }
  .hud { padding: 16px; }
  .hud__top { gap: 10px; }
  .hud__brand { font-size: 8.5px; }
  .hud__live { padding: 6px 9px; font-size: 8px; }
  .hud__bottom { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hud__chips { gap: 5px; }
  .hud__chip { padding: 6px 8px; font-size: 7.5px; }
  .hud__chip:nth-child(2) { display: none; }
  .hud__open { font-size: 8.5px; padding: 8px 12px; }
  .studio__features { margin-top: 28px; }
  .feature { padding: 20px 0; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
  .feature p { font-size: 13.5px; }

  .cast__rail { gap: 12px; padding-left: var(--gutter); padding-right: var(--gutter); }
  .cast-card { flex-basis: 78vw; }
  .cast-card figcaption h3 { font-size: 14px; }
  .cast__foot { margin-top: 22px; font-size: 8.5px; }
  .cast__rail-wrap::before,
  .cast__rail-wrap::after { display: none; }

  .manifesto { min-height: 76vh; }
  .manifesto__inner { padding-top: 22vh; padding-bottom: 48px; }
  .manifesto blockquote { font-size: clamp(2.35rem, 10.8vw, 3.6rem); max-width: 13ch; }
  .manifesto__by { margin-top: 20px; font-size: 9px; }
  .manifesto__stats-row { padding: 18px 0; }
  .stat { padding: 14px 14px 14px 0; }
  .stat:not(:first-child) { padding-left: 15px; }
  .stat__value { font-size: 2rem; }
  .stat__label { font-size: 8px; }

  .method__steps { border-top: 1px solid var(--line); }
  .step { grid-template-columns: 28px minmax(0, 1fr) 86px; gap: 12px; padding: 22px 0; }
  .step:hover { padding-inline: 8px; }
  .step__num { font-size: 9px; }
  .step__body h3 { font-size: 1.5rem; }
  .step__body p { font-size: 13px; }
  .step__img { width: 86px; border-radius: 8px; }
  .method__aside { gap: 18px; }
  .method__note strong { font-size: 17px; }

  .vault__grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 116px; gap: 10px; }
  .vault__item,
  .vault__item:nth-child(1),
  .vault__item:nth-child(8) { grid-column: span 3; grid-row: span 1; }
  .vault__item:nth-child(1),
  .vault__item:nth-child(8) { grid-column: span 6; grid-row: span 2; }
  .vault__item:nth-child(6),
  .vault__item:nth-child(7) { grid-row: span 1; }
  .vault__item figcaption { right: 10px; bottom: 9px; left: 10px; }
  .vault__item figcaption strong { font-size: 12px; }
  .vault__item figcaption span { font-size: 8px; }

  .pricing__head { margin-bottom: 34px; }
  .pricing__head .h2 { font-size: clamp(2.35rem, 10.5vw, 3.5rem); }
  .pricing__head .lede { font-size: 15px; }
  .billing { margin-top: 24px; }
  .plans { gap: 12px; }
  .plan { padding: 24px 20px; border-radius: 16px; }
  .plan__price { margin-top: 24px; }
  .price { font-size: 2.7rem; }
  .plan__features { grid-template-columns: 1fr; gap: 10px; }
  .plan__features li { font-size: 13px; }
  .pricing__note { font-size: 8.5px; }

  .faq__grid { gap: 30px; }
  .faq__q { padding: 21px 0; gap: 16px; font-size: 1.02rem; }
  .faq__a p { padding-right: 12px; padding-bottom: 21px; font-size: 14px; }

  .cta { padding: 96px 0; }
  .cta__title { font-size: clamp(2.6rem, 11.5vw, 3.9rem); max-width: 14ch; }
  .cta__inner .lede { font-size: 15px; max-width: 36ch; }
  .cta__form { margin-top: 28px; }
  .cta__micro { font-size: 8.5px; line-height: 1.6; }

  .footer { padding-top: 48px; }
  .footer__top { gap: 36px; padding-bottom: 40px; }
  .footer__cols { gap: 16px; }
  .footer__cols h4 { font-size: 8.5px; margin-bottom: 12px; }
  .footer__cols a { font-size: 13px; padding: 5px 0; }
  .footer__word { font-size: 21vw; margin-bottom: 16px; }
  .footer__bottom { font-size: 8px; gap: 10px; padding-bottom: 22px; }
  .footer__bottom span:nth-child(2) { flex: 1 1 100%; text-align: left; }

  .modal__panel {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .modal--brief .modal__panel { width: 100%; }
  .modal__bar { position: sticky; top: 0; z-index: 5; background: #111110; }
  .player { aspect-ratio: 16 / 10; }
  .modal__info { padding: 22px 20px 30px; }
  .modal__text h2 { font-size: 2rem; }
  .modal__chapters { padding-top: 14px; }
  .brief-modal__body,
  .brief-modal__success { padding: 26px 20px 34px; }
  .field-row { grid-template-columns: 1fr; gap: 12px; }
  .brief-form { gap: 14px; }
}

@media (max-width: 420px) {
  .hero__title { font-size: 3.15rem; }
  .hero__actions { flex-direction: column; }
  .hero__actions .btn { width: 100%; }
  .cta__form { flex-direction: column; padding: 8px; border-radius: 16px; }
  .cta__form input { padding: 10px 12px; min-height: 42px; }
  .cta__form .btn { width: 100%; }
  .footer__cols { grid-template-columns: 1fr 1fr; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal,
  .rise { opacity: 1; transform: none; }

  .hero__media video { animation: none; }
  .manifesto__bg { animation: none; }
  .marquee__track { animation: none; }

  .reveal { transition-delay: 0s !important; }
}
