/* Case study pages (/case-studies/ and /case-studies/<game>/). Colours and type match index.html. */
:root {
  --bg: #fefbf8;
  --surface: #ffffff;
  --surface-2: #f6efe6;
  --ink: #22140a;
  --ink-soft: #5a4a3e;
  --line: #e9ded1;
  --orange: #e8641a;
  --orange-deep: #b44a0c;
  --on-orange: #ffffff;
  --shadow: 0 1px 2px rgba(34, 20, 10, .06), 0 8px 24px rgba(34, 20, 10, .07);
  --paper: #f6f1e8;
  --pixel: "Pixelify Sans", "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121010;
    --surface: #1b1816;
    --surface-2: #231e1a;
    --ink: #f7efe4;
    --ink-soft: #c2b4a6;
    --line: #332b25;
    --orange: #f07a2c;
    --orange-deep: #f08a45;
    --on-orange: #1a0d04;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --paper: #231e1a;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.65 "Outfit", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); font-size: .76rem; letter-spacing: .03em; }
.pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }

/* Header (same as the home page) */
.site-header { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.brand { flex: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand b { color: var(--orange); font-weight: 600; }
nav { display: flex; gap: 20px; font-weight: 500; font-size: .95rem; }
nav a { text-decoration: none; color: var(--ink-soft); white-space: nowrap; }
nav a:hover, nav a[aria-current="page"] { color: var(--orange); }

/* Hero */
.cs-hero { padding: 40px 0 28px; }
.cs-hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: center; }
.cs-hero figure { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.cs-hero figure img { width: 100%; }
.kicker { margin: 0 0 10px; color: var(--orange-deep); text-transform: uppercase; }
.cs-hero h1 { font-family: var(--pixel); font-weight: 700; font-size: clamp(2.4rem, 6vw, 3.8rem); line-height: 1; margin: 0 0 14px; }
.cs-hero .lede { margin: 0 0 20px; font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 999px; font: inherit; font-weight: 600; font-size: .98rem; text-decoration: none; border: 2px solid var(--orange); transition: transform .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--orange); color: var(--on-orange); }
.btn.ghost { color: var(--ink); background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }

/* Facts strip */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 0; }
.facts div { background: var(--surface); padding: 12px 16px; }
.facts dt { color: var(--orange-deep); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: .95rem; }

/* Article */
.cs-body { padding: 24px 0 72px; }
.cs-body section { max-width: 720px; margin: 48px auto 0; }
.cs-body h2 { font-family: var(--pixel); font-weight: 700; font-size: clamp(1.7rem, 3.6vw, 2.3rem); line-height: 1.05; margin: 0 0 14px; }
.cs-body h3 { font-size: 1.15rem; font-weight: 600; margin: 0 0 6px; }
.cs-body p { margin: 0 0 14px; }
.cs-body ul { margin: 0 0 14px; padding-left: 1.2em; }
.cs-body li { margin-bottom: 6px; }
.cs-body .wide { max-width: 1000px; margin-inline: auto; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0 6px; padding: 0; list-style: none; }
.stats li { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 0; }
.stats b { display: block; font-family: var(--mono); font-weight: 700; font-size: 1.6rem; letter-spacing: -.02em; font-variant-numeric: lining-nums; line-height: 1.05; color: var(--orange-deep); margin-bottom: 6px; }
.stats span { font-size: .88rem; color: var(--ink-soft); }

.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 40px auto 0; }
.shots figure { margin: 0; }
.shots img { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.shots.portrait { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shots figcaption, .sprites figcaption { margin-top: 6px; color: var(--ink-soft); font-size: .9rem; }

.problem { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px 8px; box-shadow: var(--shadow); margin-bottom: 18px; }
.problem .tag { display: inline-block; color: var(--orange-deep); margin-bottom: 4px; }
.problem h3 { font-family: var(--pixel); font-weight: 700; font-size: 1.35rem; margin-bottom: 10px; }
.problem .fix { border-top: 1px dashed var(--line); padding-top: 12px; }

.sprites { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 20px 0 6px; }
.sprites figure { margin: 0; }
.sprites .px { position: relative; background: #f6f1e8; border: 1px solid #e9ded1; border-radius: 10px; aspect-ratio: 1; overflow: hidden; }
.sprites .px img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); max-width: none; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; }
.sprites.smooth .px img { image-rendering: auto; }

blockquote { margin: 0 0 16px; padding: 4px 0 4px 18px; border-left: 3px solid var(--orange); color: var(--ink-soft); }
blockquote p { margin: 0 0 4px; }
blockquote cite { font-style: normal; font-size: .85rem; }

.pending { background: var(--surface-2); border-radius: 14px; padding: 16px 18px; }

.ai { background: var(--surface-2); border-radius: 18px; padding: 24px 26px 12px; }
.ai h2 { margin-bottom: 10px; }

.cs-next { border-top: 1px solid var(--line); margin-top: 64px; padding-top: 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.cs-next a.more { font-weight: 600; color: var(--orange-deep); text-decoration: none; }
.cs-next a.more:hover { text-decoration: underline; }

/* Index of case studies */
.cs-index-head { padding: 40px 0 8px; }
.cs-index-head h1 { font-family: var(--pixel); font-weight: 700; font-size: clamp(2.4rem, 6vw, 3.6rem); line-height: 1; margin: 0 0 12px; }
.cs-index-head p { margin: 0; color: var(--ink-soft); max-width: 40em; }
.cs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; padding: 28px 0 80px; }
.cs-card { display: grid; grid-template-rows: auto 1fr; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease; }
.cs-card:hover { transform: translateY(-3px); border-color: var(--orange); }
.cs-card .cv { aspect-ratio: 16 / 10; background: var(--paper); overflow: hidden; }
.cs-card .cv img { width: 100%; height: 100%; object-fit: cover; }
.cs-card .tx { padding: 14px 16px 18px; display: grid; gap: 4px; align-content: start; }
.cs-card .st { color: var(--orange-deep); }
.cs-card h2 { margin: 0; font-family: var(--pixel); font-size: 1.6rem; line-height: 1.05; }
.cs-card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.cs-card .go { margin-top: 6px; font-weight: 600; color: var(--orange-deep); }

footer { border-top: 3px solid var(--ink); }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 18px 40px; color: var(--ink-soft); font-size: .9rem; }
footer a { text-decoration: none; }
footer a:hover { color: var(--orange); }

@media (max-width: 760px) {
  .cs-hero .wrap { grid-template-columns: 1fr; gap: 24px; }
  .shots { grid-template-columns: 1fr; }
  .shots.portrait { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand span { display: none; }
  nav { gap: 12px; font-size: .9rem; }
  nav .hide-sm { display: none; }
  .cs-body section { margin-top: 40px; }
}
@media (max-width: 420px) {
  nav .hide-xs { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .cs-card { transition: none; }
}
