/* haroldware.games
 * Dark warm editorial catalogue. One chapter per game; the whole page retints to the
 * game's own palette as its chapter reaches the middle of the viewport (site.js sets
 * data-theme on <html>). Without JS the base theme stays and only accents change.
 * Type: Fraunces (display, variable: opsz/SOFT/WONK) · Instrument Sans (body) · IBM Plex Mono (meta).
 */

@font-face { font-family: "Fraunces"; src: url("assets/fonts/fraunces-normal-300-900.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("assets/fonts/fraunces-italic-300-900.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("assets/fonts/instrument-sans-normal-400-700.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("assets/fonts/instrument-sans-italic-400-700.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("assets/fonts/plex-mono-normal-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("assets/fonts/plex-mono-normal-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* ---------------------------------------------------------------- tokens */
:root {
  --paper:      oklch(16% 0.012 70);
  --paper-2:    oklch(20% 0.014 70);
  --ink:        oklch(93% 0.02 85);
  --ink-dim:    oklch(66% 0.02 80);
  --rule:       oklch(30% 0.015 70);
  --accent:     oklch(80% 0.11 80);
  --accent-2:   oklch(70% 0.13 40);
  --accent-ink: oklch(16% 0.012 70);
  --shadow:     0 30px 80px -20px oklch(0% 0 0 / 0.6);

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --dur: 700ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --wrap: 76rem;
}
:root[data-theme="hoi"] {
  --paper: oklch(19% 0.06 258); --paper-2: oklch(24% 0.07 258);
  --ink: oklch(94% 0.02 240); --ink-dim: oklch(70% 0.05 240); --rule: oklch(34% 0.07 258);
  --accent: oklch(80% 0.12 222); --accent-2: oklch(76% 0.13 60); --accent-ink: oklch(15% 0.05 258);
}
:root[data-theme="wyrm"] {
  --paper: oklch(97% 0.012 230); --paper-2: oklch(100% 0 0);
  --ink: oklch(27% 0.04 250); --ink-dim: oklch(50% 0.03 250); --rule: oklch(88% 0.02 230);
  --accent: oklch(58% 0.17 255); --accent-2: oklch(88% 0.17 90); --accent-ink: oklch(99% 0 0);
  --shadow: 0 30px 80px -24px oklch(27% 0.04 250 / 0.35);
}
:root[data-theme="xeno"] {
  --paper: oklch(13% 0.028 258); --paper-2: oklch(20% 0.035 262);
  --ink: oklch(90% 0.043 253); --ink-dim: oklch(62% 0.043 262); --rule: oklch(33% 0.062 266);
  --accent: oklch(84% 0.128 191); --accent-2: oklch(78% 0.106 87); --accent-ink: oklch(13% 0.028 258);
}
:root[data-theme="petri"] {
  --paper: oklch(15% 0.022 55); --paper-2: oklch(20% 0.03 55);
  --ink: oklch(94% 0.03 90); --ink-dim: oklch(66% 0.03 80); --rule: oklch(30% 0.03 55);
  --accent: oklch(86% 0.21 130); --accent-2: oklch(70% 0.25 340); --accent-ink: oklch(15% 0.022 55);
}
/* Chapter-local accents so the buttons are right even before JS runs. */
.hoi   { --accent: oklch(80% 0.12 222); --accent-2: oklch(76% 0.13 60); --accent-ink: oklch(15% 0.05 258); }
.wyrm  { --accent: oklch(58% 0.17 255); --accent-2: oklch(88% 0.17 90); --accent-ink: oklch(99% 0 0); }
.xeno  { --accent: oklch(84% 0.128 191); --accent-2: oklch(78% 0.106 87); --accent-ink: oklch(13% 0.028 258); }
.petri { --accent: oklch(86% 0.21 130); --accent-2: oklch(70% 0.25 340); --accent-ink: oklch(15% 0.022 55); }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: color-mix(in oklch, var(--accent) 60%, transparent); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
figcaption { margin-top: 0.75rem; color: var(--ink-dim); }

.skip { position: absolute; left: 1rem; top: -4rem; padding: 0.6rem 1rem; background: var(--accent); color: var(--accent-ink); z-index: 100; border-radius: 4px; }
.skip:focus { top: 1rem; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.mono { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; }
.dim { color: var(--ink-dim); }
.eyebrow { color: var(--ink-dim); margin: 0 0 1.25rem; }

.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
  letter-spacing: -0.025em;
  line-height: 0.92;
  margin: 0;
  text-wrap: balance;
}
.display i, .mark i { font-style: italic; font-weight: 400; }

/* ---------------------------------------------------------------- top bar */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: color-mix(in oklch, var(--paper) 72%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid color-mix(in oklch, var(--rule) 70%, transparent);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.mark { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.02em; text-decoration: none; font-variation-settings: "opsz" 24, "SOFT" 60, "WONK" 1; }
.mark.small { font-size: 1.75rem; margin: 0 0 0.5rem; }
.top nav { display: flex; gap: 1.5rem; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.top nav a { text-decoration: none; color: var(--ink-dim); }
.top nav a:hover { color: var(--ink); }
@media (max-width: 40em) { .top nav a:last-child { display: none; } }

/* ---------------------------------------------------------------- hero */
.hero {
  min-height: 100svh;
  display: grid; align-content: end;
  padding: 7rem 1.25rem 3rem;
  width: min(100%, var(--wrap) + 2.5rem); margin-inline: auto;
  position: relative;
}
.hero h1 {
  font-size: clamp(4.4rem, 17.5vw, 15.5rem);
  font-weight: 600;
  line-height: 0.82;
  letter-spacing: -0.045em;
  margin: 0 0 1.5rem -0.06em;
  display: flex; flex-wrap: wrap; column-gap: 0.02em;
}
.hero h1 .w2 { font-style: italic; font-weight: 400; color: var(--accent); }
.hero h1 span { display: inline-block; animation: rise 1.1s var(--ease) both; }
.hero h1 .w2 { animation-delay: 0.12s; }
.lede { max-width: 34rem; font-size: clamp(1.1rem, 1.5vw, 1.35rem); line-height: 1.45; color: var(--ink); margin-bottom: 3.5rem; }

.index { border-top: 1px solid var(--rule); }
.index li { border-bottom: 1px solid var(--rule); }
.index a {
  display: grid; grid-template-columns: 3rem 1fr auto; grid-template-areas: "no ttl st" "no what st";
  align-items: baseline; column-gap: 1rem; padding: 1rem 0;
  text-decoration: none; transition: padding-left 300ms var(--ease);
}
.index .no { grid-area: no; color: var(--ink-dim); }
.index .ttl { grid-area: ttl; font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2.2rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; font-variation-settings: "opsz" 48, "SOFT" 40, "WONK" 1; }
.index .what { grid-area: what; color: var(--ink-dim); font-size: 0.95rem; }
.index .st { grid-area: st; color: var(--ink-dim); text-align: right; white-space: nowrap; }
.index a:hover { padding-left: 0.6rem; }
.index a:hover .ttl { color: var(--accent); }
@media (max-width: 40em) {
  .index a { grid-template-columns: 2.4rem 1fr; grid-template-areas: "no ttl" "no what" "no st"; }
  .index .st { text-align: left; margin-top: 0.35rem; }
}

/* ---------------------------------------------------------------- chapters */
.chapter, .about { position: relative; padding: clamp(5rem, 12vw, 10rem) 0; }
.chapter + .chapter, .chapter + .about { border-top: 1px solid var(--rule); }
.num {
  position: absolute; top: clamp(1rem, 4vw, 3rem); right: -0.05em;
  font-size: clamp(9rem, 34vw, 30rem); line-height: 1; font-weight: 700;
  color: transparent; -webkit-text-stroke: 1px color-mix(in oklch, var(--accent) 22%, transparent);
  pointer-events: none; user-select: none; z-index: 0;
}
.chapter .wrap { position: relative; z-index: 1; }
.ch-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.ch-head h2 { font-size: clamp(3rem, 8vw, 6.5rem); margin-bottom: 1.25rem; }
.tag { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: clamp(1.35rem, 2.4vw, 1.9rem); line-height: 1.25; letter-spacing: -0.01em; color: var(--accent); font-variation-settings: "opsz" 36, "SOFT" 70, "WONK" 1; margin: 0; }

.ch-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
@media (min-width: 60em) { .ch-body { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.text { max-width: 38rem; }
.text p { font-size: 1.0625rem; }
.text p:first-child::first-letter { font-family: var(--font-display); font-weight: 600; font-size: 3.1em; float: left; line-height: 0.78; margin: 0.06em 0.12em 0 0; color: var(--accent); font-variation-settings: "opsz" 96, "SOFT" 40, "WONK" 1; }

.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 0; margin: 1.75rem 0 1.75rem; color: var(--ink-dim); }
.facts li { padding-right: 0.9rem; margin-right: 0.9rem; border-right: 1px solid var(--rule); line-height: 1.3; }
.facts li:last-child { border-right: 0; margin-right: 0; padding-right: 0; }

.ctas { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1.25rem; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  border: 1px solid var(--accent);
  transition: transform 200ms var(--ease), background-color 200ms, color 200ms, box-shadow 200ms;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px color-mix(in oklch, var(--accent) 60%, transparent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn::after { content: "\2197"; font-family: var(--font-body); font-size: 0.9rem; line-height: 1; }
.text p.credit { margin-top: 1.5rem; font-size: 0.75rem; color: var(--ink-dim); text-transform: none; letter-spacing: 0.02em; }

/* media */
.media img { border-radius: 10px; box-shadow: var(--shadow); }
.shots li img { border-radius: 8px; box-shadow: var(--shadow); border: 1px solid color-mix(in oklch, var(--rule) 60%, transparent); }

/* 01: cover + phones */
.hoi .ch-body { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 60em) { .hoi .ch-body { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.cover { max-width: 26rem; transform: rotate(-2deg); transition: transform 600ms var(--ease); }
@media (max-width: 60em) { .cover { max-width: 17rem; } }
.cover:hover { transform: rotate(0deg) scale(1.01); }
.phones { display: flex; gap: 1rem; margin-top: clamp(3rem, 6vw, 5rem); overflow-x: auto; scroll-snap-type: x mandatory; padding: 1rem 0.25rem 1.5rem; scrollbar-width: thin; }
.phones li { flex: 0 0 auto; width: clamp(11rem, 18vw, 14rem); scroll-snap-align: start; transition: transform 400ms var(--ease); }
.phones li:nth-child(odd) { transform: translateY(1.25rem); }
.phones li:hover { transform: translateY(-0.5rem); }
.phones img { border-radius: 1.4rem; border: 3px solid oklch(30% 0.05 258); box-shadow: var(--shadow); }
@media (min-width: 60em) { .phones { overflow: visible; justify-content: space-between; } }

/* 02: key art on top, text + stacked shots */
.wyrm .keyart { margin-bottom: clamp(3rem, 6vw, 5rem); }
.wyrm .keyart img { border-radius: 14px; }
.shots.stack { display: grid; gap: 1.25rem; }
.shots.stack li:nth-child(2) { margin-left: clamp(0rem, 6vw, 4rem); }

/* 03: full-bleed hero behind */
.xeno .bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.xeno .bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; opacity: 0.32; filter: saturate(1.1); mask-image: linear-gradient(to bottom, transparent, black 12%, black 60%, transparent); -webkit-mask-image: linear-gradient(to bottom, transparent, black 12%, black 60%, transparent); }
.xeno .num { z-index: 0; }
.capsule img { border-radius: 10px; border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent); }
.shots.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: clamp(3rem, 6vw, 5rem); }
@media (max-width: 40em) { .shots.grid { grid-template-columns: 1fr; } }

/* 04: key art left, text right */
.petri .ch-body { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 60em) { .petri .ch-body { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.petri .keyart img { border-radius: 14px; border: 1px solid color-mix(in oklch, var(--accent) 22%, transparent); }

/* ---------------------------------------------------------------- about + footer */
.about .ch-head h2 { font-size: clamp(3rem, 8vw, 6.5rem); }
.about-body { max-width: 44rem; }
.about-body .big { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 2.6vw, 2.1rem); line-height: 1.3; letter-spacing: -0.01em; font-variation-settings: "opsz" 40, "SOFT" 50, "WONK" 1; margin-bottom: 1.5rem; }
.about-body .contact { margin-top: 2rem; font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2.4rem); font-weight: 500; letter-spacing: -0.02em; }
.about-body .contact a { text-decoration: none; color: var(--accent); }
.about-body .contact a:hover { text-decoration: underline; }
.foot { border-top: 1px solid var(--rule); padding: 3rem 0 3.5rem; color: var(--ink-dim); }
.foot p { margin: 0 0 0.5rem; }
.foot a { color: var(--ink); text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- motion */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 900ms var(--ease), transform 900ms var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
@keyframes rise { from { opacity: 0; transform: translateY(0.25em); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
