/* ============================================================
   nathanbaker.lol
   Editorial serif type over full-resolution JWST skies, a bento grid of glass tiles,
   one aurora accent, and a few hand-drawn marks. Motion is scroll- and cursor-driven
   (see js/site.js) and switches off for anyone who prefers less motion.
   ============================================================ */

:root {
  --bg: #07070b;
  --ink: #f3f1ec;              /* warm white, like paper under a lamp */
  --soft: #c2c0cb;
  --dim: #8b8996;
  --line: rgba(255, 255, 255, 0.11);
  --glass: rgba(12, 12, 20, 0.5);
  --aurora: linear-gradient(100deg, #7cf3d6 0%, #7aa8ff 34%, #c69bff 66%, #ffb08a 100%);
  --radius: 26px;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Bradley Hand', cursive;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 72px;
  --p: 0;                      /* hero scroll progress, 0 → 1 (set by js/site.js) */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  background: var(--bg); color: var(--ink);
  font: 400 17px/1.65 var(--sans); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: rgba(198, 155, 255, 0.35); }

/* ---------- Page transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 360ms var(--ease) both fade-out; }
::view-transition-new(root) { animation: 560ms var(--ease) both fade-in; }
::view-transition-group(site-header) { animation-duration: 0s; }
@keyframes fade-out { to { opacity: 0; filter: blur(6px); } }
@keyframes fade-in { from { opacity: 0; filter: blur(10px); } }
@supports not (view-transition-name: none) { main { animation: fade-in 700ms var(--ease) both; } }

/* ---------- The sky ----------
   A blurred thumbnail shows at once; the full-resolution image fades in over it. The sky drifts with the
   cursor and pushes in slowly as you scroll through the hero. */
.sky { position: fixed; inset: 0; z-index: -3; overflow: hidden; pointer-events: none; background: var(--bg); }
.sky .lq { position: absolute; inset: -6%; width: 112%; height: 112%; max-width: none; object-fit: cover; filter: blur(28px) saturate(1.2); }
.sky .hd {
  position: absolute; inset: -3%; width: 106%; height: 106%; max-width: none; object-fit: cover;
  opacity: 0; transition: opacity 1.4s var(--ease);
  transform: translate3d(var(--mx, 0px), calc(var(--my, 0px) + var(--p) * -3vh), 0) scale(calc(1.02 + var(--p) * 0.08));
  will-change: transform;
}
.sky .hd.ready { opacity: 1; }
/* Darkening for legibility: a vignette, a fade to charcoal at the bottom, and more as you scroll */
.veil {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(130% 95% at 50% 32%, transparent 0%, rgba(7, 7, 11, 0.5) 66%, rgba(7, 7, 11, 0.9) 100%),
    linear-gradient(180deg, rgba(7, 7, 11, 0.42) 0%, transparent 28%, rgba(7, 7, 11, 0.65) 100%);
}
.veil::after { content: ''; position: absolute; inset: 0; background: var(--bg); opacity: calc(0.08 + var(--p) * 0.35); }
/* Print grain: a faint paper texture over everything */
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none; transition: top 200ms; }
.skip:focus { top: 12px; }
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(16px, 4vw, 44px);
  view-transition-name: site-header; border-bottom: 1px solid transparent;
  transition: background 400ms var(--ease), border-color 400ms var(--ease);
}
.site-header.scrolled { background: rgba(7, 7, 11, 0.62); border-bottom-color: var(--line); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%); }
.home-link { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; border-radius: 14px; padding: 4px 8px 4px 4px; }
.monogram {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  font: 600 19px/1 var(--serif); font-variation-settings: 'opsz' 48, 'SOFT' 100; letter-spacing: -0.02em; color: var(--ink);
  background: rgba(255, 255, 255, 0.06); transition: transform 400ms var(--ease);
}
.monogram::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: var(--aurora);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.85; }
.home-link:hover .monogram { transform: rotate(-6deg) scale(1.06); }
.home-name { font: 500 15px/1 var(--sans); letter-spacing: 0.01em; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; color: var(--soft); text-decoration: none; transition: color 250ms, background 250ms;
}
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.nav a[aria-current="page"] { color: var(--ink); background: rgba(255, 255, 255, 0.1); }
.nav svg { width: 15px; height: 15px; flex: none; }

/* ---------- Layout ---------- */
.wrap { width: min(1200px, 100% - clamp(32px, 8vw, 96px)); margin: 0 auto; }
.section { padding: clamp(72px, 13vh, 140px) 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--header-h) + 32px) 0 72px;
}
.hero.short { min-height: 72vh; min-height: 72svh; justify-content: flex-end; padding-bottom: 40px; }
.eyebrow { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; font: 500 13px/1 var(--sans); letter-spacing: 0.3em; text-transform: uppercase; color: var(--soft); }
.eyebrow::before { content: ''; width: 36px; height: 1px; background: currentColor; opacity: 0.6; }

/* Supersized variable headline: weight, size and position shift as you scroll (--p) */
.display {
  margin: 0; font-family: var(--serif); font-weight: 300; line-height: 0.9; letter-spacing: -0.035em;
  font-size: clamp(72px, 16.5vw, 250px);
  font-variation-settings: 'opsz' 144, 'SOFT' 50, 'wght' calc(300 + var(--p) * 380);
  transform: translate3d(0, calc(var(--p) * -6vh), 0) scale(calc(1 - var(--p) * 0.14)); transform-origin: left center;
  text-shadow: 0 0 60px rgba(150, 170, 255, 0.22), 0 2px 30px rgba(0, 0, 0, 0.45);
}
.display.small { font-size: clamp(64px, 12vw, 190px); }
.display .line { display: block; }
.display em { font-style: italic; }
.display .aurora { background: var(--aurora); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; padding-right: 0.06em; }
/* Letters rise in one by one on load */
.display .ch { display: inline-block; opacity: 0; transform: translateY(0.35em) rotate(4deg); animation: rise 1.1s var(--ease) forwards; animation-delay: calc(var(--i) * 45ms + 120ms); }
.display .aurora .ch { background: inherit; -webkit-background-clip: text; background-clip: text; }
@keyframes rise { to { opacity: 1; transform: none; } }

.lede { position: relative; max-width: 30em; margin: 34px 0 0; font: 400 clamp(19px, 2.1vw, 23px)/1.55 var(--sans); color: var(--soft); }
.lede strong { color: var(--ink); font-weight: 500; }

/* Hand-drawn marks: a scribbled underline that draws itself, and handwritten notes with arrows */
.has-scribble { position: relative; display: inline-block; }
.scribble { position: absolute; left: -2%; bottom: -0.12em; width: 104%; height: 0.28em; overflow: visible; pointer-events: none; }
.scribble path { fill: none; stroke: #ffd9a8; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.3s var(--ease) 1.3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.note { display: inline-flex; align-items: flex-end; gap: 6px; font: 600 27px/1 var(--hand); color: #ffd9a8; transform: rotate(-4deg); }
.note svg { width: 62px; height: 42px; overflow: visible; }
.note svg path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s var(--ease) 1.9s forwards; }
.hero-note { position: absolute; right: 0; bottom: 110px; }

.scroll-cue {
  margin-top: clamp(44px, 9vh, 96px); display: inline-flex; align-items: center; gap: 14px; align-self: flex-start;
  color: var(--dim); font: 500 12.5px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; text-decoration: none;
}
.scroll-cue i { position: relative; width: 1px; height: 42px; background: linear-gradient(var(--dim), transparent); overflow: hidden; }
.scroll-cue i::after { content: ''; position: absolute; left: -1px; top: -12px; width: 3px; height: 12px; border-radius: 2px; background: var(--ink); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { to { transform: translateY(54px); } }

/* Editorial section heads: a number, a big serif title, a short line */
.section-head { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 10px 28px; margin-bottom: 40px; }
.section-num { font: 400 15px/1 var(--serif); color: var(--dim); letter-spacing: 0.08em; padding-bottom: 14px; }
.section-title { margin: 0; font: 300 clamp(44px, 6.5vw, 92px)/0.95 var(--serif); font-variation-settings: 'opsz' 144, 'SOFT' 60; letter-spacing: -0.03em; }
.section-title em { font-style: italic; }
.section-sub { grid-column: 2; margin: 0; max-width: 36em; color: var(--soft); }

/* ---------- Glass tiles (cursor light + slight 3D tilt from js/site.js) ---------- */
.tile {
  position: relative; display: flex; flex-direction: column; overflow: hidden; isolation: isolate;
  border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line); text-decoration: none;
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 600ms var(--ease), border-color 400ms;
}
.tile.tilting { transition: transform 140ms linear, border-color 400ms; }
.tile::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 400ms;
  background: radial-gradient(440px circle at var(--lx, 50%) var(--ly, 50%), rgba(255, 255, 255, 0.1), transparent 50%); }
.tile::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: 1px; pointer-events: none; background: var(--aurora); opacity: 0; transition: opacity 400ms;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
a.tile:hover::before, a.tile:focus-visible::before { opacity: 1; }
a.tile:hover::after, a.tile:focus-visible::after { opacity: 0.9; }
.tile-body { position: relative; display: flex; flex-direction: column; gap: 10px; padding: clamp(22px, 2.6vw, 34px); flex: 1; }
.kicker { font: 500 12px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; color: var(--dim); }
.tile h3 { margin: 0; font: 300 clamp(32px, 3.4vw, 50px)/1 var(--serif); font-variation-settings: 'opsz' 144, 'SOFT' 50; letter-spacing: -0.025em; }
.tile p { margin: 0; color: var(--soft); max-width: 30em; }
.go { margin-top: auto; padding-top: 18px; display: inline-flex; align-items: center; gap: 10px; font-weight: 500; font-size: 15px; color: var(--ink); }
.go svg { width: 18px; height: 18px; transition: transform 500ms var(--ease); }
a.tile:hover .go svg { transform: translateX(6px); }
.tile.quiet { background: rgba(12, 12, 20, 0.32); border-style: dashed; }

/* Bento grid: one big feature, smaller tiles around it */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(200px, auto); gap: 18px; }
.span-2 { grid-column: span 2; } .span-4 { grid-column: span 4; } .rows-2 { grid-row: span 2; }

.feature-shot { position: relative; flex: 1; min-height: 260px; overflow: hidden; border-bottom: 1px solid var(--line); }
.feature-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.03); transition: transform 1.4s var(--ease); }
a.tile:hover .feature-shot img { transform: scale(1.08); }
.feature-shot::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(7, 7, 11, 0.55)); }
.feature-shot .note { position: absolute; right: 22px; top: 16px; z-index: 1; color: #fff3d6; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }

.li-badge { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: #0a66c2; color: #fff; margin-bottom: 6px; }
.li-badge svg { width: 26px; height: 26px; }

/* The sky behind this page: an editorial caption */
.caption { flex-direction: row; }
.caption-thumb { width: clamp(140px, 24%, 260px); flex: none; background: var(--thumb) center / cover; border-right: 1px solid var(--line); }
.caption .tile-body { gap: 6px; justify-content: center; }
.caption h3 { font-size: clamp(28px, 2.6vw, 38px); font-style: italic; }
.caption small { color: var(--dim); font-size: 13.5px; }
.caption small a { color: var(--soft); text-underline-offset: 3px; }

/* ---------- Games ---------- */
.game-list { display: grid; gap: 24px; margin: 0; padding: 0; list-style: none; }
.game { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.game .feature-shot { min-height: 380px; border-bottom: 0; border-right: 1px solid var(--line); }
.game .feature-shot::after { background: linear-gradient(90deg, transparent 60%, rgba(7, 7, 11, 0.4)); }
.game .tile-body { justify-content: center; }
.game h3 { font-size: clamp(46px, 5vw, 76px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.chips li { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--soft); }
/* The big button */
.play {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; padding: 18px 26px;
  border-radius: 16px; font-weight: 600; font-size: 17px; color: #0b0b12; background: var(--aurora);
  box-shadow: 0 14px 40px -12px rgba(150, 160, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 400ms var(--ease), box-shadow 400ms var(--ease);
}
.play svg { width: 20px; height: 20px; transition: transform 500ms var(--ease); }
a.tile:hover .play { transform: translateY(-2px); box-shadow: 0 20px 50px -12px rgba(150, 160, 255, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
a.tile:hover .play svg { transform: translateX(5px); }
.soon { align-items: center; justify-content: center; min-height: 170px; text-align: center; }
.soon .tile-body { align-items: center; justify-content: center; }
.soon h3 { font-size: 32px; font-style: italic; color: var(--soft); }
.soon p { color: var(--dim); font-size: 15px; }

/* ---------- Footer ---------- */
.site-footer { padding: 44px 0 40px; border-top: 1px solid var(--line); background: linear-gradient(180deg, transparent, rgba(7, 7, 11, 0.85)); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; font-size: 13.5px; color: var(--dim); }
.site-footer a { color: var(--soft); text-underline-offset: 3px; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; translate: 0 32px; transition: opacity 1s var(--ease), translate 1s var(--ease), transform 600ms var(--ease), border-color 400ms; transition-delay: var(--delay, 0ms); }
.reveal.in { opacity: 1; translate: 0 0; }
.no-js .reveal { opacity: 1; translate: 0 0; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid #c69bff; outline-offset: 3px; }

/* ---------- Smaller screens ---------- */
@media (max-width: 960px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-4 { grid-column: span 2; }
  .rows-2 { grid-row: auto; }
  .game { grid-template-columns: 1fr; }
  .game .feature-shot { min-height: 0; aspect-ratio: 16 / 10; flex: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-note { display: none; }
}
@media (max-width: 600px) {
  :root { --header-h: 62px; }
  .display { font-size: clamp(64px, 24vw, 130px); }
  .display.small { font-size: clamp(60px, 21vw, 110px); }
  body { font-size: 16px; }
  .home-name { display: none; }
  .nav a { padding: 8px 11px; font-size: 14px; }
  .nav .ext-label { display: none; }
  .bento { grid-template-columns: 1fr; }
  .span-2, .span-4 { grid-column: auto; }
  .feature-shot { min-height: 0; aspect-ratio: 16 / 10; flex: none; }
  .section-head { grid-template-columns: 1fr; }
  .section-sub { grid-column: 1; }
  .section-num { padding-bottom: 0; }
  .caption { flex-direction: column; }
  .caption-thumb { width: 100%; height: 150px; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---------- Less motion when asked ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sky .hd { transform: none; transition: none; }
  .display { transform: none; font-variation-settings: 'opsz' 144, 'SOFT' 50, 'wght' 300; }
  .display .ch { animation: none; opacity: 1; transform: none; }
  .scribble path, .note svg path { animation: none; stroke-dashoffset: 0; }
  .reveal { opacity: 1; translate: 0 0; transition: none; }
  .tile { transform: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .scroll-cue i::after { animation: none; }
}
