@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;800&family=Inter:wght@400;500&display=swap');

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

:root {
  --bg:      #0b0b0c;
  --text:    #f2efe8;
  --muted:   #8d887e;
  --faint:   #57534c;
  --line:    rgba(255,255,255,0.11);
  --line-2:  rgba(255,255,255,0.18);
  --accent:  #e1512b;            /* the single spark — the only "fire" */
  --grotesk: 'Archivo', system-ui, sans-serif;
  --sans:    'Inter', system-ui, sans-serif;
  --kr:      'Pretendard Variable', Pretendard, system-ui, sans-serif;
  --pad:     clamp(22px, 5vw, 72px);
  --maxw:    1040px;             /* content column — keeps things centered on wide screens */
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ─── HEADER ─── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 62px;
  padding: 0 var(--pad);
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
}
/* once scrolled, a glass bar keeps the brand + nav readable over page content */
header.scrolled {
  background: rgba(11, 11, 12, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom-color: var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--grotesk);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  width: 12px;
  height: 20px;
  flex: none;
  background: var(--accent);
  -webkit-mask: url(/flame.png) center / contain no-repeat;
          mask: url(/flame.png) center / contain no-repeat;
  transition: filter 0.25s ease;
}
.brand:hover .brand-mark { filter: brightness(1.25); }
nav { display: flex; gap: 26px; }
nav a {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}
nav a:hover { color: var(--text); }

/* ─── HERO (RT3D ember-geode stage) ─── */
.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
}
#geode {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
}
#geode.ready { opacity: 1; }

.hero-top {
  position: absolute;
  top: 86px;
  left: var(--pad);
  z-index: 2;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-top .spark {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px 1px var(--accent);
  animation: ember 3.4s ease-in-out infinite;
}
@keyframes ember { 0%,100%{opacity:.5;} 50%{opacity:1;} }

.hero-foot {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: clamp(38px, 7vh, 88px);
  z-index: 2;
}
.hero-kicker {
  font-family: var(--kr);
  font-weight: 600;
  font-size: clamp(15px, 2.3vw, 26px);
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 12px;
  text-shadow: 0 1px 20px rgba(0,0,0,0.7);
}
.hero-kicker .ko { color: var(--accent); }
.hero h1 {
  font-family: var(--grotesk);
  font-weight: 800;
  font-size: clamp(40px, 12vw, 185px);
  line-height: 0.9;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 2px 50px rgba(0,0,0,0.55);
}
.hero h1 .dot { color: var(--accent); }
.hero-role {
  margin-top: 14px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-shadow: 0 1px 20px rgba(0,0,0,0.7);
}

/* ─── SECTIONS ─── */
.section {
  padding: clamp(72px, 11vw, 150px) var(--pad);
  max-width: var(--maxw);
  margin: 0 auto;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(28px, 4vw, 48px);
}
.section-label {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(242,239,232,0.82);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.09);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  backdrop-filter: blur(8px) saturate(1.2);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}
/* gyro/pointer-driven sheen — a soft highlight that glides across the glass as
   the device tilts (--gx/--gy set by hero3d.js / app.js, -1..1). Kept subtle. */
.section-label::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: radial-gradient(
    90px circle at calc(50% + var(--gx, 0) * 45%) calc(45% + var(--gy, 0) * 45%),
    rgba(255,255,255,0.16),
    rgba(255,255,255,0) 62%
  );
  pointer-events: none;
}
.section-index {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ─── REVEAL ─── */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1);
}
.js [data-reveal].in { opacity: 1; transform: none; }

/* ─── WORK LIST ─── */
.work-row {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto 24px;
  align-items: center;
  gap: 28px;
  padding: clamp(24px, 3vw, 36px) 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  position: relative;
}
.work-row:last-child { border-bottom: 1px solid var(--line); }
/* stack name over description — spans are inline by default, which let a long
   desc flow onto the same line as the name and orphan its last word */
.work-info { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.work-num {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  align-self: start;
  padding-top: 8px;
}
.work-name {
  font-family: var(--grotesk);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 52px);
  letter-spacing: -0.02em;
  line-height: 1.02;
  color: var(--text);
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1);
}
.work-desc {
  margin-top: 9px;
  font-size: 14px;
  color: var(--muted);
  max-width: 46ch;
}
.work-tags {
  display: flex;
  gap: 18px;
  justify-self: end;
  text-align: right;
}
.work-tags span {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.work-arrow {
  font-size: 18px;
  color: var(--faint);
  justify-self: end;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), color 0.25s;
}
.work-row:hover .work-name { transform: translateX(10px); }
.work-row:hover .work-arrow { transform: translate(4px,-4px); color: var(--accent); }

/* ─── PROSE ─── */
.prose {
  max-width: 60ch;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.7;
  color: var(--text);
}
.prose.dim { color: var(--muted); }

/* ─── MEDIA / CTA ─── */
.media-row { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 26px; }
.cta-link {
  font-family: var(--grotesk);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-2);
  transition: border-color 0.2s, color 0.2s;
}
.cta-link:hover { color: var(--accent); border-color: var(--accent); }

/* ─── FOOTER ─── */
footer {
  border-top: 1px solid var(--line);
  padding: 34px var(--pad);
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
footer span, footer a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
footer a:hover { color: var(--text); }
footer a:hover { color: var(--text); }

/* ─── MOBILE ─── */
@media (max-width: 680px) {
  .work-row {
    grid-template-columns: 32px 1fr;
    grid-template-areas: "num name" ". desc" ". tags";
    gap: 4px 14px;
    padding: 26px 0;
  }
  .work-num { grid-area: num; }
  .work-row > .work-info { grid-area: name; }
  .work-desc { grid-area: desc; }
  .work-tags { grid-area: tags; justify-self: start; text-align: left; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
  .work-arrow { display: none; }
  .work-row:hover .work-name { transform: none; }
}

/* ─── GAME SCROLL SHIELD ─── */
/* Mobile: transparent layer over the game iframe so a touch-drag scrolls the
   page instead of being captured by the game. The fullscreen button sits above
   it (higher z-index) and stays tappable. Desktop scrolls fine via wheel, so
   the shield is removed there and the game is directly interactive. */
.game-scroll-shield {
  position: absolute;
  inset: 0;
  z-index: 5;
}
@media (pointer: fine) {
  .game-scroll-shield { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero-top .spark { animation: none; }
  html { scroll-behavior: auto; }
}
