/* Fringe Theory Games — "Neon Premiere, blue sunset" theme.
   Brand pink/teal are sampled from assets/fringe-theory-mark.png; keep them at full saturation and use sparingly. */

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("/fonts/playfair-display-italic-700.woff2") format("woff2");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

:root {
  --pink: #ff5cd5;
  --pink-deep: #d1218a;
  --pink-glow: rgb(255 92 213 / 0.55);
  --teal: #69fdfd;
  --teal-glow: rgb(105 253 253 / 0.5);
  --gold: #e9b765;
  --ink: #fdf1f9;
  --ink-soft: #e8cfe0;
  --bg: #14040f;
  --bg-raised: #230a1d;
  --panel: rgb(52 10 42 / 0.62);
  --panel-edge: rgb(255 92 213 / 0.55);

  --font-body: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-display: "Playfair Display", "Didot", "Bodoni 72", Georgia, serif;

  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 1360px;
  --header-h: 5rem;
  --hero-h: clamp(34rem, 56.3vw, 62rem); /* the supplied layers are 1672×941 */
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-underline-offset: 0.2em; }
a:hover { color: #fff; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: 0.6rem 1rem; background: var(--teal); color: #06191a; border-radius: 0.5rem; font-weight: 600; }
.skip-link:focus { top: 1rem; }
.icon { width: 1.1em; height: 1.1em; flex: none; }
.icon { stroke: currentColor; }

/* ───────── Header ───────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgb(20 4 15 / 0.96), rgb(20 4 15 / 0.82));
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgb(255 92 213 / 0.7), 0 6px 30px -6px var(--pink-glow);
}
.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.brand__mark { height: 3.7rem; width: auto; filter: drop-shadow(0 0 10px rgb(105 253 253 / 0.35)); }
.brand__lockup { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; }
.brand__wordmark-wrap { position: relative; display: block; margin-bottom: -0.4rem; }
.brand__wordmark { display: block; height: 3.3rem; width: auto; transition: opacity 0.5s; }
.brand__games {
  display: flex; align-items: center; gap: 0.7rem;
  color: var(--teal); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.55em; text-transform: uppercase; padding-left: 0.55em;
}
.brand__games::before, .brand__games::after { content: ""; width: 2rem; height: 1px; background: var(--teal); box-shadow: 0 0 6px var(--teal-glow); }

.site-nav { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2.25rem); font-size: 1.15rem; }
.site-nav a:not(.pill-link) { color: var(--ink); text-decoration: none; padding: 0.35rem 0; border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s, text-shadow 0.2s; }
.site-nav a:not(.pill-link):hover { text-shadow: 0 0 12px var(--pink-glow); border-color: var(--pink); }
.site-nav a[aria-current="page"] { border-color: var(--pink); }
.site-nav__divider { width: 1px; height: 1.6rem; background: rgb(255 92 213 / 0.6); }
.pill-link { --neon: var(--pink); color: var(--ink); text-decoration: none; padding: 0.4rem 1.4rem; border-radius: 999px; background: rgb(255 92 213 / 0.06); font-size: 1rem; }
.pill-link:hover { color: #fff; background: rgb(255 92 213 / 0.22); }

.nav-toggle { display: none; }

/* Home: the stage artwork's purple valance is the header. It sits over the hero and scrolls away with the page. */
.is-home .site-header { position: absolute; inset: 0 0 auto; background: none; backdrop-filter: none; box-shadow: none; }
.is-home .site-header__inner { height: calc(var(--hero-h) * 0.13); }

/* ───────── Header ident (js/ident.js) ─────────
   The mark flickers on, the script is written out by a spark on a canvas laid over the wordmark, then the exact
   wordmark image fades in over it. Plays on the first page of a session and on every hover. Everything is inert (logo
   simply visible) without JS or with reduced motion. */
.ident-canvas { position: absolute; pointer-events: none; width: calc(100% * 1518 / 1421); left: calc(-100% * 47 / 1421); top: calc(-100% * 35 / 342); height: auto; }
.ident-pending .brand__wordmark, .is-writing .brand__wordmark { opacity: 0; }
.ident-pending .brand__games, .is-writing .brand__games { opacity: 0; }
.brand__games { transition: opacity 0.6s; }
.ident-pending .brand__mark, .is-igniting .brand__mark { animation: mark-ignite 0.9s steps(1, end) both; }
@keyframes mark-ignite {
  0%   { opacity: 0.08; }
  12%  { opacity: 0.9; }
  18%  { opacity: 0.1; }
  34%  { opacity: 0.85; }
  40%  { opacity: 0.3; }
  52%  { opacity: 1; }
  60%  { opacity: 0.55; }
  100% { opacity: 1; }
}

/* ───────── Neon type & buttons ───────── */
.eyebrow { margin: 0; display: flex; justify-content: center; }
.eyebrow span {
  display: inline-flex; align-items: center; gap: 1.1rem;
  color: var(--teal); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.5em; text-transform: uppercase; text-shadow: 0 0 10px var(--teal-glow);
}
.eyebrow span::before, .eyebrow span::after { content: ""; width: clamp(1.5rem, 6vw, 4rem); height: 1px; background: var(--teal); box-shadow: 0 0 6px var(--teal-glow); }

/* Small text rendering of the title for cards; the hero uses the supplied title artwork. */
.title-script--sm { margin: 0; font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.15; text-shadow: 0 0 14px rgb(255 92 213 / 0.6); }

/* Neon tube (buttons and portal cards): near-white core edge, tight inner glow, wide coloured halo. Override --neon per element. */
.btn, .portal, .pill-link {
  --neon: var(--pink);
  border: 2px solid color-mix(in srgb, var(--neon) 55%, #fff);
  box-shadow:
    0 0 2px rgb(255 255 255 / 0.9),
    0 0 7px var(--neon),
    0 0 16px var(--neon),
    0 0 34px color-mix(in srgb, var(--neon) 65%, transparent),
    0 0 64px color-mix(in srgb, var(--neon) 35%, transparent),
    inset 0 0 6px color-mix(in srgb, var(--neon) 90%, transparent),
    inset 0 0 20px color-mix(in srgb, var(--neon) 45%, transparent);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.btn:hover, .portal:hover, .pill-link:hover {
  animation: neon-flicker 0.32s linear;
  border-color: #fff;
  box-shadow:
    0 0 3px #fff,
    0 0 10px var(--neon),
    0 0 24px var(--neon),
    0 0 48px var(--neon),
    0 0 90px color-mix(in srgb, var(--neon) 55%, transparent),
    inset 0 0 8px var(--neon),
    inset 0 0 26px color-mix(in srgb, var(--neon) 60%, transparent);
}
/* The tube stutters once on hover, then settles into the full hover glow (the keyframes end at the hover box-shadow). */
@keyframes neon-flicker {
  0%, 18%, 46% { box-shadow: 0 0 1px rgb(255 255 255 / 0.4), 0 0 4px color-mix(in srgb, var(--neon) 50%, transparent), inset 0 0 4px color-mix(in srgb, var(--neon) 40%, transparent); }
  30%          { box-shadow: 0 0 3px #fff, 0 0 10px var(--neon), 0 0 24px var(--neon), 0 0 48px var(--neon), inset 0 0 8px var(--neon); }
  60%          { box-shadow: 0 0 3px #fff, 0 0 14px var(--neon), 0 0 34px var(--neon), 0 0 70px var(--neon), 0 0 110px color-mix(in srgb, var(--neon) 55%, transparent), inset 0 0 10px var(--neon), inset 0 0 30px color-mix(in srgb, var(--neon) 65%, transparent); }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-width: 14.5rem; padding: 0.6rem 1.6rem; border-radius: 999px; text-decoration: none;
  font-size: 1.2rem; font-weight: 600; color: #fff;
}
.btn:hover { transform: translateY(-2px); color: #fff; }
.btn--pink { --neon: var(--pink); background: linear-gradient(180deg, #e8309d 0%, #9b0c63 100%); }
.btn--teal { --neon: var(--teal); background: rgb(8 20 30 / 0.85); }

.badge {
  display: inline-block; margin: 0; padding: 0.2rem 0.9rem; border: 1px solid var(--teal); border-radius: 999px;
  color: var(--teal); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
}

/* ───────── Home hero ─────────
   Three supplied layers: cityscape (back), stage & curtains (front, transparent opening), title artwork (content). */
.hero { position: relative; isolation: isolate; height: var(--hero-h); overflow: hidden; }
.hero__scene { position: absolute; inset: 0; z-index: -1; background: #0a0b18; clip-path: inset(0); /* clips the fixed cityscape to the hero */ }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
/* The cityscape is pinned to the viewport while the stage and curtains scroll over it. At scroll 0 it lines up exactly with the hero. */
.hero .layer--city { position: fixed; inset: 0 0 auto; height: var(--hero-h); }
/* Push the skyline up and the Hollywood sign clear of the right-hand curtain. */
.layer--city { transform: translateX(-5%) scale(1.1); transform-origin: 50% 100%; }
.hero__shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 70%, var(--bg) 100%); }
.hero__content { position: relative; z-index: 1; padding: calc(var(--hero-h) * 0.165) var(--gutter) 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero__title { margin: 0.4rem 0 0; width: clamp(19rem, 42vw, 44rem); filter: drop-shadow(0 6px 14px rgb(0 0 0 / 0.5)); }
.hero__title img { width: 100%; height: auto; }
.hero__lede { max-width: 38rem; margin: -0.6rem 0 1.4rem; font-size: clamp(1.05rem, 1.6vw, 1.35rem); text-shadow: 0 1px 10px #000, 0 0 24px rgb(20 4 15 / 0.9); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: center; }

/* ───────── Portals ───────── */
.portals {
  position: relative; z-index: 1; max-width: var(--max); margin: calc(var(--hero-h) * -0.23) auto 0; padding: 0 var(--gutter) 3.5rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
}
.portal {
  --neon: var(--pink);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding: 0.9rem 1.4rem 0.9rem 0.6rem; border-radius: 1.1rem;
  background: linear-gradient(180deg, rgb(70 12 56 / 0.72), rgb(34 6 28 / 0.82)); backdrop-filter: blur(6px);
  color: var(--ink); text-decoration: none;
}
.portal:hover { transform: translateY(-3px); color: var(--ink); }
.portal__icon { width: 6rem; height: auto; margin: -0.4rem 0; }
.portal__text { display: flex; flex-direction: column; gap: 0.15rem; }
.portal__title { font-size: 1.6rem; font-weight: 600; line-height: 1.15; }
.portal__desc { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.35; }
.portal__go { color: var(--pink); width: 1.4rem; height: 1.4rem; filter: drop-shadow(0 0 5px var(--pink)); transition: transform 0.2s; }
.portal:hover .portal__go { transform: translateX(4px); }

/* ───────── Inner pages ───────── */
.page-hero {
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) 2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
  background: radial-gradient(60% 100% at 50% 0%, rgb(255 92 213 / 0.18), transparent 70%);
}
.page-hero .hero__title { margin: 0; }
.page-title { margin: 0; font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: clamp(2.8rem, 7vw, 5rem); line-height: 1.05; text-shadow: 0 0 22px var(--pink-glow); }
.page-lede { margin: 0; max-width: 38rem; font-size: 1.25rem; color: var(--ink-soft); }
.page-body { max-width: var(--max); margin: 0 auto; padding: 1rem var(--gutter) 5rem; }
.prose { max-width: 44rem; font-size: 1.15rem; }
.note { color: var(--ink-soft); font-style: italic; }
.feature-card {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; overflow: hidden; border-radius: 1.2rem; border: 1.5px solid var(--panel-edge); background: var(--panel);
  box-shadow: 0 0 28px rgb(255 92 213 / 0.25);
}
.feature-card__art { min-height: 18rem; position: relative; }
.feature-card__art { overflow: hidden; }
.feature-card__text { padding: clamp(1.5rem, 4vw, 3rem); display: flex; flex-direction: column; gap: 1.2rem; align-items: flex-start; justify-content: center; }
.feature-card__text p { margin: 0; }


.ownership { color: var(--ink-soft); font-style: italic; }

/* ───────── Footer ───────── */
.site-footer { margin-top: auto; padding: 2.5rem var(--gutter) 2rem; background: linear-gradient(180deg, transparent, #0b0208 60%); border-top: 1px solid rgb(255 92 213 / 0.3); }
.site-footer__inner { max-width: var(--max); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; align-items: center; }
.site-footer__brand { display: flex; align-items: center; gap: 1rem; max-width: 34rem; color: var(--ink-soft); font-size: 0.95rem; }
.site-footer__brand img { width: 3rem; height: auto; }
.site-footer__brand p { margin: 0; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; }
.site-footer__links a { color: var(--ink); text-decoration: none; }
.site-footer__links a:hover { color: var(--teal); text-decoration: underline; }
.site-footer__legal { max-width: var(--max); margin: 1.5rem auto 0; color: #bfa0b4; font-size: 0.85rem; }

/* ───────── Responsive ───────── */
@media (max-width: 960px) {
  .portals { grid-template-columns: 1fr; margin-top: -4rem; }
  .feature-card { grid-template-columns: 1fr; }
  .js .nav-toggle {
    display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; border: 2px solid var(--pink); background: transparent; cursor: pointer; color: var(--ink);
    box-shadow: 0 0 12px rgb(255 92 213 / 0.4);
  }
  .nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after { display: block; width: 1.3rem; height: 2px; background: currentColor; border-radius: 2px; transition: transform 0.2s, background 0.2s; }
  .nav-toggle__bars { position: relative; }
  .nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
  .nav-toggle__bars::before { top: -6px; }
  .nav-toggle__bars::after { top: 6px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }
  .site-nav { flex-wrap: wrap; justify-content: flex-end; }
  .js .site-nav {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0.25rem; padding: 1rem var(--gutter) 1.5rem;
    background: rgb(20 4 15 / 0.98); box-shadow: 0 12px 30px -8px var(--pink-glow); border-bottom: 1px solid rgb(255 92 213 / 0.6);
    visibility: hidden; opacity: 0; transform: translateY(-0.5rem); transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  }
  .js .site-nav[data-open="true"] { visibility: visible; opacity: 1; transform: none; }
  .site-nav a:not(.pill-link) { padding: 0.7rem 0; border-bottom: 1px solid rgb(255 92 213 / 0.2); }
  .site-nav__divider { display: none; }
  .pill-link { text-align: center; margin-top: 0.8rem; }
}
@media (max-width: 560px) {
  :root { --header-h: 4.25rem; }
  .brand__mark { height: 2.6rem; }
  .brand__wordmark { height: 1.9rem; }
  .brand__games { font-size: 0.6rem; gap: 0.4rem; }
  .brand__games::before, .brand__games::after { width: 1rem; }
  .eyebrow span { font-size: 0.7rem; letter-spacing: 0.3em; gap: 0.6rem; }
  .btn { min-width: 0; width: 100%; font-size: 1.1rem; }
  .hero__actions { width: 100%; gap: 1rem; }
  .portal { padding: 0.8rem 1.1rem 0.8rem 0.5rem; }
  .portal__icon { width: 4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hero .layer--city { position: absolute; height: 100%; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .btn:hover, .portal:hover, .pill-link:hover { transform: none; animation: none; }
}

/* Narrow screens crop the scene to its centre; keep a hint of the curtains at the edges. */
@media (max-width: 960px) {
  .hero { height: auto; min-height: 36rem; padding-bottom: 6rem; }
  .is-home .site-header { background: linear-gradient(180deg, rgb(20 4 15 / 0.9), transparent); }
  .is-home .site-header__inner { height: var(--header-h); }
  .hero__content { padding-top: calc(var(--header-h) + 1.5rem); }
  .layer--stage { display: none; } /* the curtain frame only works at desktop proportions */
  .hero .layer--city { height: 100svh; transform: none; object-position: 38% 100%; }
  .hero__shade { background: linear-gradient(90deg, rgb(194 35 127 / 0.55), transparent 14%, transparent 86%, rgb(194 35 127 / 0.55)), linear-gradient(180deg, rgb(20 4 15 / 0.45) 0%, rgb(20 4 15 / 0.2) 60%, var(--bg) 100%); }
}
