:root {
  --ink: #0c0c0c;
  --paper: #f2f0eb;
  --silver: #b8b4ac;
  --line: rgba(242, 240, 235, 0.22);
  --glass: rgba(12, 12, 12, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Bebas Neue", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  height: 100%;
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  /* Cascade: older iOS → modern dynamic/small viewport (last wins when supported) */
  min-height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  min-height: 100svh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-touch-callout: default;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 5;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  min-height: 100svh;
  display: grid;
  place-items: safe center;
  padding:
    max(1.1rem, var(--safe-top))
    max(1rem, var(--safe-right))
    max(1.25rem, var(--safe-bottom))
    max(1rem, var(--safe-left));
  isolation: isolate;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  background-size: cover;
  background-position: center 42%;
  pointer-events: none;
}

.media__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center 42%;
  filter: grayscale(1) contrast(1.05) brightness(0.72);
  transform: scale(1.02);
}

.media__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 12, 12, 0.35) 0%, rgba(12, 12, 12, 0.15) 35%, rgba(12, 12, 12, 0.82) 100%),
    radial-gradient(ellipse 70% 55% at 50% 38%, transparent 0%, rgba(12, 12, 12, 0.55) 100%);
}

.content {
  position: relative;
  z-index: 2;
  width: min(100%, 22rem);
  max-width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: 0.25rem;
}

.brand {
  margin: 0 0 1rem;
  animation: rise 0.85s var(--ease) 0.05s forwards;
  opacity: 0;
  transform: translateY(12px);
}

.brand__sign {
  margin: 0;
  max-width: 100%;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  letter-spacing: 0.08em;
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: break-word;
  color: var(--paper);
  text-shadow:
    0 0 40px rgba(0, 0, 0, 0.8),
    0 2px 0 rgba(0, 0, 0, 0.9);
}

.brand__tag {
  margin: 0.45rem 0 0;
  max-width: 100%;
  font-size: clamp(0.58rem, 2.6vw, 0.72rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1.35;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--silver);
}

.headline {
  margin: 0 0 1.35rem;
  max-width: 16ch;
  width: 100%;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 7vw, 2.35rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-wrap: balance;
  line-height: 1;
  color: var(--paper);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.9s var(--ease) 0.18s forwards;
}

.headline[hidden],
.brand__tag[hidden] {
  display: none;
}

.cta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.95s var(--ease) 0.32s forwards;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 3.1rem;
  min-width: 0;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(0.88rem, 3.6vw, 0.95rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
  border: 1px solid var(--line);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform 0.3s var(--ease),
    background 0.3s var(--ease),
    border-color 0.3s var(--ease),
    color 0.3s var(--ease);
}

.btn__label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.btn__arrow {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.85;
}

.btn--primary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.btn--primary:active {
  transform: scale(0.98);
}

.btn--secondary {
  background: rgba(12, 12, 12, 0.45);
  color: var(--paper);
  border-color: rgba(242, 240, 235, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.btn--secondary:active {
  background: rgba(242, 240, 235, 0.12);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  width: 100%;
}

.btn--ghost {
  min-height: 2.85rem;
  background: transparent;
  color: rgba(242, 240, 235, 0.88);
  border-color: rgba(242, 240, 235, 0.28);
  font-size: clamp(0.78rem, 3.2vw, 0.86rem);
}

.btn--ghost:active {
  border-color: rgba(242, 240, 235, 0.6);
  background: rgba(255, 255, 255, 0.06);
}

.btn--primary:focus-visible,
.btn--secondary:focus-visible,
.btn--ghost:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  }

  .btn--secondary:hover {
    border-color: var(--paper);
    background: rgba(242, 240, 235, 0.1);
  }

  .btn--ghost:hover {
    border-color: rgba(242, 240, 235, 0.55);
    color: #fff;
  }
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand,
  .headline,
  .cta {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .media__video {
    display: none;
  }

  .media {
    background:
      linear-gradient(rgba(12, 12, 12, 0.4), rgba(12, 12, 12, 0.75)),
      url("assets/hero-poster.png") center 42% / cover no-repeat;
  }
}

@media (max-width: 899px) {
  .grain {
    opacity: 0.045;
  }
}

@media (max-width: 380px) {
  .btn-row {
    grid-template-columns: 1fr;
  }

  .brand__sign {
    letter-spacing: 0.05em;
    font-size: clamp(2.1rem, 10vw, 2.6rem);
  }

  .brand__tag {
    letter-spacing: 0.12em;
  }

  .headline {
    margin-bottom: 1rem;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .stage {
    place-items: safe start center;
    padding-top: max(0.65rem, var(--safe-top));
    padding-bottom: max(0.75rem, var(--safe-bottom));
  }

  .content {
    padding-block: 0.35rem;
  }

  .brand {
    margin-bottom: 0.45rem;
  }

  .brand__sign {
    font-size: clamp(1.65rem, 5.5vw, 2rem);
  }

  .brand__tag {
    margin-top: 0.3rem;
    letter-spacing: 0.12em;
  }

  .headline {
    margin-bottom: 0.65rem;
    font-size: clamp(1.25rem, 4.5vw, 1.45rem);
  }

  .cta {
    gap: 0.4rem;
  }

  .btn {
    min-height: 2.75rem;
    padding-block: 0.6rem;
  }

  .btn--ghost {
    min-height: 2.65rem;
  }
}

@media (max-height: 380px) and (orientation: landscape) {
  .headline {
    display: none;
  }

  .brand {
    margin-bottom: 0.35rem;
  }

  .brand__sign {
    font-size: 1.55rem;
  }

  .brand__tag {
    font-size: 0.56rem;
  }

  .cta {
    gap: 0.32rem;
  }

  .btn {
    min-height: 2.55rem;
    font-size: 0.78rem;
  }

  .btn--ghost {
    min-height: 2.45rem;
    font-size: 0.72rem;
  }
}

@media (min-width: 700px) {
  .content {
    width: min(100%, 24rem);
  }
}

@media (min-width: 900px) {
  .content {
    width: min(100%, 26rem);
  }

  .brand__sign {
    letter-spacing: 0.1em;
  }
}

.theme-fx {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 4;
  opacity: 0;
}

/* ── B · Cinema — letterbox + spotlight ───────────────────────── */
[data-theme="cinema"] {
  --paper: #ece8e0;
  --silver: #a8a39a;
}

[data-theme="cinema"] .grain {
  opacity: 0.11;
}

[data-theme="cinema"] .media__video {
  filter: grayscale(1) contrast(1.08) brightness(0.66);
  object-position: center 38%;
}

[data-theme="cinema"] .media::before,
[data-theme="cinema"] .media::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: clamp(2.5rem, 11vh, 5rem);
  background: #000;
  z-index: 2;
  pointer-events: none;
}

[data-theme="cinema"] .media::before {
  top: 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}

[data-theme="cinema"] .media::after {
  bottom: 0;
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.55);
}

[data-theme="cinema"] .media__scrim {
  background:
    radial-gradient(ellipse 55% 42% at 50% 42%, transparent 0%, rgba(12, 12, 12, 0.72) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(12, 12, 12, 0.08) 42%, rgba(0, 0, 0, 0.82) 100%);
}

[data-theme="cinema"] .content {
  width: min(100%, 20.5rem);
}

[data-theme="cinema"] .brand__sign {
  letter-spacing: 0.12em;
}

[data-theme="cinema"] .btn {
  background: transparent;
  box-shadow: none;
}

[data-theme="cinema"] .btn--primary {
  color: var(--paper);
  border: 2px solid var(--paper);
  box-shadow:
    inset 0 0 0 1px rgba(242, 240, 235, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.35);
}

[data-theme="cinema"] .btn--secondary {
  border: 1px solid rgba(242, 240, 235, 0.72);
  background: rgba(12, 12, 12, 0.35);
}

[data-theme="cinema"] .btn--ghost {
  border-color: rgba(242, 240, 235, 0.38);
}

@media (hover: hover) and (pointer: fine) {
  [data-theme="cinema"] .btn--primary:hover {
    background: rgba(242, 240, 235, 0.08);
  }
}

/* ── C · Noir — тёмный, контент у низа ──────────────────────── */
[data-theme="noir"] {
  --paper: #f2f0eb;
  --silver: #8f8a82;
}

[data-theme="noir"] .stage {
  align-items: end;
  padding-bottom: max(1.6rem, calc(var(--safe-bottom) + 0.5rem));
}

[data-theme="noir"] .media__video {
  filter: grayscale(1) contrast(1.18) brightness(0.52);
  object-position: center 36%;
}

[data-theme="noir"] .media__scrim {
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0.25) 0%, rgba(5, 5, 5, 0.08) 28%, rgba(5, 5, 5, 0.92) 100%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(0, 0, 0, 0.35), transparent 70%);
}

[data-theme="noir"] .brand__sign,
[data-theme="noir"] .headline {
  text-shadow:
    0 0 24px rgba(0, 0, 0, 0.95),
    0 2px 0 #000,
    0 4px 16px rgba(0, 0, 0, 0.85);
}

[data-theme="noir"] .headline {
  margin-bottom: 1.1rem;
  font-size: clamp(1.5rem, 6.5vw, 2.1rem);
}

[data-theme="noir"] .btn--primary {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}

[data-theme="noir"] .btn--secondary,
[data-theme="noir"] .btn--ghost {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(242, 240, 235, 0.42);
  backdrop-filter: blur(4px);
}

[data-theme="noir"] .btn-row {
  gap: 0.5rem;
}

@media (min-width: 700px) {
  [data-theme="noir"] .content {
    width: min(100%, 23rem);
  }
}

/* ── D · Intertitle — титры немого кино ─────────────────────── */
[data-theme="intertitle"] {
  --font-display: "Oswald", "Bebas Neue", sans-serif;
  --paper: #f0ece4;
  --silver: #b0aaa0;
}

[data-theme="intertitle"] .media__video {
  filter: grayscale(1) contrast(1.04) brightness(0.68) sepia(0.12);
}

[data-theme="intertitle"] .media__scrim {
  background:
    linear-gradient(180deg, rgba(12, 12, 12, 0.5) 0%, rgba(12, 12, 12, 0.18) 40%, rgba(12, 12, 12, 0.88) 100%);
}

[data-theme="intertitle"] .content {
  width: min(100%, 23rem);
  padding: clamp(1.15rem, 4vw, 1.45rem) clamp(1rem, 3.5vw, 1.25rem);
  background: rgba(10, 10, 10, 0.78);
  border: 3px double rgba(242, 240, 235, 0.72);
  box-shadow:
    0 0 0 1px rgba(242, 240, 235, 0.12) inset,
    0 18px 40px rgba(0, 0, 0, 0.45);
}

[data-theme="intertitle"] .brand {
  position: relative;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
}

[data-theme="intertitle"] .brand::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 240, 235, 0.55), transparent);
}

[data-theme="intertitle"] .brand__sign {
  letter-spacing: 0.16em;
  font-weight: 600;
}

[data-theme="intertitle"] .headline {
  letter-spacing: 0.14em;
  margin-bottom: 1.15rem;
}

[data-theme="intertitle"] .btn {
  border-radius: 0;
  min-height: 2.95rem;
  letter-spacing: 0.1em;
  font-family: var(--font-display);
  font-weight: 600;
}

[data-theme="intertitle"] .btn--primary {
  background: var(--paper);
  color: var(--ink);
}

[data-theme="intertitle"] .btn--secondary {
  background: transparent;
  border-color: rgba(242, 240, 235, 0.62);
}

[data-theme="intertitle"] .btn--ghost {
  border-color: rgba(242, 240, 235, 0.32);
  min-height: 2.75rem;
}

/* ── E · Marquee — как вывеска FelixGateWay ─────────────────── */
[data-theme="marquee"] {
  --paper: #f4f1ea;
  --silver: #c8c2b8;
}

[data-theme="marquee"] .media__video {
  filter: grayscale(1) contrast(1.06) brightness(0.78);
  object-position: center 40%;
}

[data-theme="marquee"] .media__scrim {
  background:
    linear-gradient(180deg, rgba(12, 12, 12, 0.12) 0%, rgba(12, 12, 12, 0.05) 35%, rgba(12, 12, 12, 0.78) 100%);
}

[data-theme="marquee"] .content {
  width: min(100%, 23.5rem);
  padding: clamp(1.1rem, 4vw, 1.4rem) clamp(1rem, 3.5vw, 1.2rem);
  background: rgba(8, 8, 8, 0.62);
  border: 2px solid rgba(242, 240, 235, 0.38);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 32px rgba(242, 240, 235, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.42);
}

[data-theme="marquee"] .brand__sign {
  display: inline-block;
  padding: 0.35rem 0.85rem 0.25rem;
  letter-spacing: 0.1em;
  background: rgba(242, 240, 235, 0.94);
  color: #111;
  text-shadow: none;
  box-shadow:
    0 0 18px rgba(242, 240, 235, 0.35),
    0 2px 0 rgba(0, 0, 0, 0.35);
}

[data-theme="marquee"] .brand__tag {
  margin-top: 0.65rem;
  color: rgba(242, 240, 235, 0.78);
}

[data-theme="marquee"] .headline {
  margin-top: 0.15rem;
  color: rgba(242, 240, 235, 0.92);
}

[data-theme="marquee"] .btn {
  border-radius: 1px;
}

[data-theme="marquee"] .btn--primary {
  background: var(--paper);
  color: #111;
  border-color: var(--paper);
}

[data-theme="marquee"] .btn--secondary {
  background: rgba(242, 240, 235, 0.08);
  border-color: rgba(242, 240, 235, 0.55);
}

[data-theme="marquee"] .btn--ghost {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(242, 240, 235, 0.28);
}

@media (hover: hover) and (pointer: fine) {
  [data-theme="marquee"] .btn--secondary:hover,
  [data-theme="marquee"] .btn--ghost:hover {
    background: rgba(242, 240, 235, 0.12);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  [data-theme="cinema"] .media::before,
  [data-theme="cinema"] .media::after {
    height: clamp(0.85rem, 5vh, 1.75rem);
  }

  [data-theme="intertitle"] .content,
  [data-theme="marquee"] .content {
    padding: 0.75rem 0.85rem;
  }

  [data-theme="intertitle"] .brand {
    margin-bottom: 0.55rem;
    padding-bottom: 0.55rem;
  }

  [data-theme="marquee"] .brand__sign {
    padding: 0.25rem 0.65rem 0.2rem;
  }
}

@media (max-height: 380px) and (orientation: landscape) {
  [data-theme="intertitle"] .content,
  [data-theme="marquee"] .content {
    padding: 0.55rem 0.7rem;
  }
}
