/* ------------------------------------------------------------------------------------------
   Tokens. Dark by default; follows the system's light preference.
   ------------------------------------------------------------------------------------------ */
:root {
  color-scheme: dark;
  /* Brand, from the anz-games logo: navy, teal and orange. */
  --brand-navy: #042858;
  --brand-teal: #1890a8;
  --brand-orange: #f58a1f;

  --bg: #0a1220;
  --grid: rgb(255 255 255 / 0.045);
  --surface: #101b2e;
  --surface-2: #17253c;
  --border: #22324d;
  --border-strong: #354a6b;
  --text: #e9eef6;
  --muted: #9aa8bd;
  --accent: #33bcd0;
  --accent-hover: #5ccfe0;
  --accent-ink: #06121f;
  --cta: #f58a1f;
  --cta-hover: #ff9e40;
  --cta-ink: #0b1f3d;
  --warm: #f7a04a;
  --warm-bg: rgb(245 138 31 / 0.14);
  --glow: rgb(24 144 168 / 0.32);
  --shadow: 0 18px 40px -24px rgb(0 0 0 / 0.85);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --gutter: 16px;
  --max: 1120px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f7fb;
    --grid: rgb(4 40 88 / 0.06);
    --surface: #ffffff;
    --surface-2: #edf2f8;
    --border: #d8e1ec;
    --border-strong: #b9c8da;
    --text: #0d2547;
    --muted: #52627a;
    --accent: #0e7287;
    --accent-hover: #0a5b6c;
    --accent-ink: #ffffff;
    --cta: #f58a1f;
    --cta-hover: #ff9a35;
    --cta-ink: #0b1f3d;
    --warm: #a8530a;
    --warm-bg: rgb(245 138 31 / 0.14);
    --glow: rgb(24 144 168 / 0.18);
    --shadow: 0 18px 40px -28px rgb(4 40 88 / 0.4);
  }
}

@media (min-width: 720px) {
  :root { --gutter: 32px; }
}

/* ------------------------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }

p { margin: 0; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.wrap.narrow { max-width: calc(760px + 2 * var(--gutter)); }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* ------------------------------------------------------------------------------------------
   Header & footer
   ------------------------------------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark { width: 36px; height: 40px; flex: none; }
.wordmark { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; line-height: 1; }
.wordmark span { color: var(--accent); }

.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--muted); text-decoration: none; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.site-footer { border-top: 1px solid var(--border); margin-top: 96px; padding-block: 28px; color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }

/* ------------------------------------------------------------------------------------------
   Shared pieces
   ------------------------------------------------------------------------------------------ */
.eyebrow {
  font: 600 0.78rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 16px;
}

.lede { font-size: 1.125rem; color: var(--muted); max-width: 62ch; }
.lede a { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 42px; padding: 9px 16px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 0.95rem; line-height: 1.2; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover { color: var(--text); border-color: var(--muted); transform: translateY(-1px); }
.btn-primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); color: var(--cta-ink); }
.btn .ext { font-size: 0.85em; opacity: 0.75; }

.link-row { display: flex; flex-wrap: wrap; gap: 10px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tags li {
  font: 500 0.75rem/1 var(--mono); color: var(--muted);
  padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
}

.status {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  font: 600 0.75rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--warm); background: var(--warm-bg); padding: 6px 10px; border-radius: 999px;
}
.status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
}

.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 24px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

.empty { color: var(--muted); }

/* Tile-map grid behind page heads, a nod to game maps. */
.hero, .project-hero, .page-head {
  position: relative; isolation: isolate;
}
.hero::before, .project-hero::before, .page-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
  mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 30%, transparent 75%);
}

/* ------------------------------------------------------------------------------------------
   Home
   ------------------------------------------------------------------------------------------ */
.hero { padding-block: 56px 40px; }
.hero-grid { display: grid; gap: 24px; align-items: center; }
.hero-emblem { position: relative; isolation: isolate; justify-self: start; width: 112px; }
.hero-emblem::before {
  content: ""; position: absolute; inset: -30%; z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent);
}
.hero-emblem img { width: 100%; }

@media (max-width: 819px) {
  .hero-emblem { order: -1; }
}
@media (min-width: 820px) {
  .hero { padding-block: 72px 48px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 48px; }
  .hero-emblem { width: 260px; justify-self: end; margin-right: 24px; }
}
.hero h1 { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 800; letter-spacing: -0.035em; max-width: 16ch; margin-bottom: 20px; }

.section { padding-top: 40px; }
.section + .section { padding-top: 72px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { font-size: 1.5rem; }
.section-head a { font-weight: 600; text-decoration: none; }

.project-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}

.project-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.project-shot { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.project-shot img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 0.4s ease; }
.project-card:hover .project-shot img { transform: scale(1.03); }

.project-body { display: flex; flex-direction: column; gap: 14px; padding: 22px; flex: 1; }
.project-body h3 { font-size: 1.6rem; font-weight: 750; }
.project-body h3 a { color: var(--text); text-decoration: none; }
.project-body h3 a:hover { color: var(--accent); }
.project-desc { color: var(--muted); }

.card-devlogs { margin-top: 6px; padding-top: 16px; border-top: 1px dashed var(--border-strong); }
.card-devlogs h4 { font: 600 0.75rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 10px; }
.card-devlogs ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.card-devlogs li a {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: baseline;
  padding: 6px 8px; margin-inline: -8px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none;
}
.card-devlogs li a:hover { background: var(--surface-2); color: var(--accent); }
.card-devlogs time { font: 0.8rem var(--mono); color: var(--muted); white-space: nowrap; }
.card-devlogs .more { display: inline-block; margin-top: 8px; font-weight: 600; font-size: 0.9rem; text-decoration: none; }

/* The first project is featured: full width, screenshot beside the text. */
@media (min-width: 900px) {
  .project-card:first-child {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
  .project-card:first-child .project-shot { aspect-ratio: auto; min-height: 100%; border-bottom: 0; border-right: 1px solid var(--border); }
  /* Keep the game's HUD in the top-left corner visible when the tall card crops the sides. */
  .project-card:first-child .project-shot img { object-position: left top; }
  .project-card:first-child .project-body { padding: 32px; }
  .project-card:first-child h3 { font-size: 2.1rem; }
}

/* ------------------------------------------------------------------------------------------
   Devlog lists
   ------------------------------------------------------------------------------------------ */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.post-item {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: start;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.post-item:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.post-item:hover h3 { color: var(--accent); }
.post-thumb { width: 112px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.post-item-text { display: grid; gap: 6px; }
.post-item h3 { font-size: 1.15rem; font-weight: 700; }
.post-summary { color: var(--muted); font-size: 0.95rem; }
.post-meta { font: 0.8rem/1.4 var(--mono); color: var(--muted); }
.post-meta a { color: var(--muted); }

@media (min-width: 640px) {
  .post-item { grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding: 16px; }
  .post-thumb { width: 180px; aspect-ratio: 16 / 10; }
}

/* ------------------------------------------------------------------------------------------
   Project page
   ------------------------------------------------------------------------------------------ */
.project-hero { padding-block: 32px 48px; border-bottom: 1px solid var(--border); }
.project-hero-grid { display: grid; gap: 32px; align-items: center; }
.project-hero-grid > div { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.project-hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -0.035em; }
.hero-shot { width: 100%; border-radius: var(--radius); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }

@media (min-width: 900px) {
  .project-hero { padding-block: 40px 64px; }
  .project-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; }
}

.block { padding-top: 56px; }
.block > h2 { font-size: 1.5rem; margin-bottom: 20px; }

.gallery {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.gallery figure { margin: 0; }
.gallery a { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.gallery img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: transform 0.3s ease; }
.gallery a:hover img { transform: scale(1.04); }
.gallery figcaption { margin-top: 8px; font-size: 0.9rem; color: var(--muted); }

/* ------------------------------------------------------------------------------------------
   Page heads (devlog index, 404)
   ------------------------------------------------------------------------------------------ */
.page-head { padding-block: 56px 32px; }
.page-head h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 14px; }
.section-tight { padding-top: 8px; }
.not-found { padding-block: 96px; }

/* ------------------------------------------------------------------------------------------
   Devlog post
   ------------------------------------------------------------------------------------------ */
.post { padding-top: 40px; }
.post-header { margin-bottom: 32px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.post-header h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.03em; margin-top: 12px; }

.cta {
  display: grid; gap: 20px; margin-top: 56px; padding: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.cta > div { display: grid; gap: 12px; justify-items: start; }
.cta-title { font-size: 1.3rem; font-weight: 750; }
.cta p:not(.cta-title) { color: var(--muted); }
.cta-shot { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius-sm); }
@media (min-width: 640px) {
  .cta { grid-template-columns: 220px minmax(0, 1fr); align-items: center; }
}

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.pager a {
  display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-weight: 600;
}
.pager a:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pager span { font: 0.8rem var(--mono); color: var(--muted); font-weight: 400; }
.pager-newer { text-align: right; grid-column: 2; }

/* ------------------------------------------------------------------------------------------
   Prose (markdown)
   ------------------------------------------------------------------------------------------ */
.prose { font-size: 1.0625rem; line-height: 1.75; max-width: 72ch; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 1.55rem; margin-top: 2em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.7em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.5em; }
.prose li > p + * { margin-top: 0.8em; }
.prose strong { color: var(--text); font-weight: 700; }
.prose img {
  margin: 1.2em 0; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.prose p:has(> img:only-child) img { margin: 0; }
.prose blockquote {
  margin-inline: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: var(--muted);
}
.prose code { font: 0.9em var(--mono); background: var(--surface-2); padding: 0.15em 0.4em; border-radius: 5px; }
.prose pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 0.88rem; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin-block: 2em; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.prose th { color: var(--muted); font-weight: 600; }
