/* Brand tokens, fonts, buttons, links, loader and the flight trail live in
   ui/recre-ui.css (shared with the guide at kilavuz/). This file is the page
   layout; main.js WORLDS snaps --bg/--fg/--muted/--accent/--dolgu per scene. */

/* ---------- layout tokens ---------- */
:root {
  --gutter: clamp(16px, 2.2vw, 32px);
  --nav-h: 88px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* ---------- canvas + fade ---------- */
#stage {
  position: fixed; inset: 0;
  width: 100vw; height: 100lvh;
  display: block; z-index: 0;
}
.fade {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  --fade: var(--bg);
  background: linear-gradient(to bottom, var(--fade) 0%, transparent 22%, transparent 84%, var(--fade) 100%);
}

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; color: var(--fg); }
.hud a { pointer-events: auto; }
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 80rem; margin: 0 auto; padding: 24px 32px;
}
.nav__logo { display: block; color: var(--fg); text-decoration: none; line-height: 0; border-radius: 4px; }
.logo-yatay { display: block; height: 44px; width: auto; overflow: visible; }
.logo-ink { fill: var(--fg); }
.logo-muted { fill: var(--muted); }
.nav__menu { display: flex; gap: 32px; list-style: none; margin: 0; padding: 0; }
.nav__menu a {
  font-size: 14px; color: var(--muted); text-decoration: none;
  transition: color 0.2s ease;
}
.nav__menu a:hover, .nav__menu a[aria-current="true"] { color: var(--fg); }
.nav__menu a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }

.hud__chapter {
  position: absolute; bottom: var(--gutter); left: var(--gutter);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.hud__progress {
  position: absolute; bottom: calc(var(--gutter) - 3px); right: var(--gutter);
  width: min(160px, 30vw); aspect-ratio: 170 / 18;   /* the flight trail's viewBox */
}

/* ---------- copy ---------- */
.copy-layer { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.copy {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--nav-h) clamp(24px, 6vw, 96px) 64px;
  visibility: hidden;
}
.copy a { pointer-events: auto; }
.display {
  margin: 0; font-family: var(--font-display); font-weight: 500; font-optical-sizing: auto;
  font-size: clamp(42px, 5.8vw, 88px); line-height: 1; letter-spacing: -0.02em;
  text-wrap: balance;
}
/* one word per headline: italic, kiremit (kiremit-açık on dark) */
.display em { font-style: italic; font-weight: 500; color: var(--accent); }
.lede { margin: 28px 0 0; max-width: 34rem; font-size: 18px; line-height: 1.625; color: var(--muted); }
.eyebrow {
  margin: 0 0 20px; font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}

/* intro: centred, top of the frame; the phone lies below it */
.copy--hero {
  justify-content: flex-start; align-items: center; text-align: center;
  padding-top: calc(var(--nav-h) + 8rem - 75px); padding-bottom: 160px;
}
.copy--hero .display { max-width: 80rem; font-size: clamp(46px, 6.4vw, 92px); }
.copy--hero .lede { max-width: 42rem; margin-top: 32px; }
.copy--hero .r-btn { margin-top: 48px; }

.copy--left { align-items: flex-start; }
.copy--left > * { max-width: min(40rem, 44vw); }
.copy--right { align-items: flex-end; text-align: left; }
.copy--right > * { max-width: min(36rem, 42vw); width: 100%; }
.copy--top-left { justify-content: flex-start; padding-top: calc(var(--nav-h) + 48px); }
.copy--top-left > * { max-width: min(38rem, 46vw); }

.contact { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; margin-top: 40px; }
.contact .r-link { font-size: 16px; }

/* split-text: each word a mask; inner span slides */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.w > * { display: inline-block; will-change: transform; }

/* intro fade-rise. Fill "backwards" only, so the button's press state still
   works once the animation has finished. */
@keyframes fade-rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
html:not(.is-ready) :is(.animate-fade-rise, .animate-fade-rise-delay, .animate-fade-rise-delay-2) { opacity: 0; }
.is-ready .animate-fade-rise { animation: fade-rise 0.8s var(--ease-out) backwards; }
.is-ready .animate-fade-rise-delay { animation: fade-rise 0.8s var(--ease-out) 0.2s backwards; }
.is-ready .animate-fade-rise-delay-2 { animation: fade-rise 0.8s var(--ease-out) 0.4s backwards; }

#story { position: relative; z-index: 1; }

/* ---------- small screens: copy on top, device below ---------- */
@media (max-width: 768px) {
  :root { --nav-h: 72px; }
  .nav { padding: 18px 20px; }
  .logo-yatay { height: 36px; }
  .nav__menu { display: none; }
  .copy { justify-content: flex-start; padding: calc(var(--nav-h) + 24px) 20px 40px; }
  .copy--left > *, .copy--right > *, .copy--top-left > * { max-width: 100%; }
  .copy--right { align-items: flex-start; }
  .copy--hero { padding-top: calc(var(--nav-h) + 32px); }
  .display, .copy--hero .display { font-size: clamp(40px, 11vw, 56px); letter-spacing: -0.02em; }
  .lede { font-size: 16px; margin-top: 18px; }
  .copy--hero .r-btn { margin-top: 28px; }
  .r-btn--lg { min-height: 54px; padding: 0 32px; }
  .contact { margin-top: 24px; gap: 14px 20px; }
}

/* ---------- fallback: no WebGL ---------- */
.no-webgl #stage, .no-webgl .r-loader, .no-webgl #story, .no-webgl .fade { display: none; }
.no-webgl .copy-layer { position: static; }
.no-webgl .copy { position: relative; visibility: visible; min-height: 100vh; }

@media (prefers-reduced-motion: reduce) {
  .w > * { transform: none !important; }
  .is-ready :is(.animate-fade-rise, .animate-fade-rise-delay, .animate-fade-rise-delay-2) { animation: none; }
}
