/* TickRate Games — the whole site's styling.
   Look: the game's document surface (11_ART_DIRECTION AD-55) — parchment,
   dark ink, brass rules, woad for the Crown, colour only in small points.
   To change a colour everywhere, change it in :root below. */

:root {
  --paper: #ECE5D5;       /* page background */
  --paper-deep: #E2D9C5;  /* tags */
  --card: #F4EFE4;        /* feature and link cards */
  --ink: #2A221A;         /* text */
  --muted: #5E5244;       /* secondary text, captions */
  --rule: #CDBFA4;        /* borders */
  --brass: #A47C3A;       /* ornaments, logo */
  --woad: #3F5F80;        /* links, icons, main button */
  --cinnabar: #9A3421;    /* drop cap, numbers, link hover */
  --serif: "Alegreya", Georgia, serif;
  --sans: "Alegreya Sans", system-ui, sans-serif;
}

/* ---------- Fonts: the game's own (OFL, licences in fonts/) ---------- */

@font-face { font-family: "Alegreya"; src: url("/fonts/alegreya.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("/fonts/alegreya-italic.woff2") format("woff2"); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Unifraktur"; src: url("/fonts/unifraktur.woff2") format("woff2"); font-display: swap; }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
h1, h2, h3, p, figure, ul { margin: 0; }
img { display: block; max-width: 100%; height: auto; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
  /* Paper, kept faint (AD-49): a fine fibre grain over slow, soft mottling.
     To make it weaker or stronger, change the last number of each
     feColorMatrix (alpha offset) or remove a layer. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.3 0 0 0 0 0.24 0.16 0 0 0 -0.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.37 0 0 0 0 0.25 0.14 0 0 0 -0.04'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}
a { color: var(--woad); text-underline-offset: 0.18em; }
a:hover { color: var(--cinnabar); }
.wrap { width: min(100% - 2rem, 68rem); margin-inline: auto; }
.narrow { width: min(100% - 2rem, 44rem); margin-inline: auto; }

/* The game's SVG icons are white shapes; as masks they take the text colour. */
.icon {
  display: inline-block; width: 1.5em; height: 1.5em; flex: none;
  background: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat;
          mask: var(--src) center / contain no-repeat;
}

/* Logo (logo.svg, "The Tick"): sized by height. */
.logo { height: 2.1rem; width: auto; }
footer .logo { height: 1.7rem; }

/* ---------- Header ---------- */

header.top {
  position: sticky; top: 0; z-index: 10; font-family: var(--sans);
  background: rgb(236 229 213 / 0.86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent; transition: border-color 0.2s;
}
header.top.scrolled { border-bottom-color: var(--rule); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.9rem; }
.studio { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; letter-spacing: 0.02em; text-decoration: none; color: var(--ink); }
header nav { display: flex; gap: 1.4rem; font-size: 1rem; }
header nav a { color: var(--muted); text-decoration: none; }
header nav a:hover { color: var(--ink); }
.menu-toggle { display: none; padding: 0.3rem; margin: -0.3rem; border: 0; background: none; color: var(--ink); cursor: pointer; }
.menu-toggle svg { width: 1.6rem; height: 1.6rem; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (max-width: 40rem) {
  .menu-toggle { display: block; }
  header nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule); box-shadow: 0 12px 24px -16px rgb(42 34 26 / 0.4);
  }
  header nav a { padding: 0.85rem 1rem; border-top: 1px solid var(--paper-deep); color: var(--ink); }
  header.top.open nav { display: flex; }
}
html { scroll-padding-top: 4.5rem; }

/* ---------- Hero ---------- */

.hero { text-align: center; padding-block: 2.5rem 0; }
.kicker { font: 500 0.85rem/1 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-weight: 500; font-size: clamp(2.6rem, 7vw, 5rem); line-height: 1.02; letter-spacing: -0.01em; margin-top: 0.9rem; }
.hero h1 em { display: block; font-size: 0.42em; font-weight: 400; color: var(--muted); margin-bottom: 0.3em; letter-spacing: 0.02em; }
/* Section ornament: rules either side of ornament.svg (a grain ear between leaves). */
.ornament { display: flex; align-items: center; justify-content: center; gap: 0.7rem; color: var(--brass); margin: 1.3rem auto; max-width: 17rem; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, currentColor); }
.ornament::after { background: linear-gradient(90deg, currentColor, transparent); }
.ornament i { width: 3rem; height: 1.5rem; background: currentColor; -webkit-mask: url("/ornament.svg") center / contain no-repeat; mask: url("/ornament.svg") center / contain no-repeat; }
.lede { font-size: 1.3rem; line-height: 1.5; max-width: 36rem; margin-inline: auto; }
.ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; margin-top: 1.8rem; font-family: var(--sans); }
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.75rem 1.3rem; border-radius: 3px;
  font-weight: 700; font-size: 1rem; text-decoration: none; border: 1.5px solid var(--ink); color: var(--ink);
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--woad); border-color: var(--woad); color: #F4EEE2; }
.btn.primary:hover { background: #2F4A66; border-color: #2F4A66; color: #fff; }
.btn small { font-weight: 400; opacity: 0.8; }
.status { margin-top: 1rem; font: 0.95rem var(--sans); color: var(--muted); }

.plate { margin-top: 3rem; }
.plate img { width: 100%; border: 1px solid var(--rule); box-shadow: 0 1px 0 #fff8, 0 24px 50px -24px rgb(42 34 26 / 0.45); border-radius: 2px; }
figcaption { font: 0.9rem/1.4 var(--sans); color: var(--muted); }
.plate figcaption { margin-top: 0.6rem; text-align: right; }

/* Caption labels: <span class="tag">Look-dev</span>, <span class="tag game">In-game</span> */
.tag { display: inline-block; font: 700 0.7rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; padding: 0.3em 0.55em; border-radius: 2px; background: var(--paper-deep); color: var(--muted); margin-right: 0.4em; vertical-align: 0.1em; }
.tag.game { background: #D7DFE4; color: var(--woad); }

/* ---------- Sections ---------- */

section { padding-block: 5rem 0; }
h2 { font-weight: 500; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.15; text-align: center; }
h2 + p { text-align: center; color: var(--muted); margin-top: 0.6rem; }
.prose { font-size: 1.2rem; }
.prose p + p { margin-top: 1em; }
/* Framed initial: <span class="initial">T</span>he … */
.initial {
  float: left; margin: 0.35rem 0.6rem 0 0; width: 3.6rem; height: 3.6rem;
  display: grid; place-items: center;
  font: 700 2.5rem/1 var(--serif); color: var(--cinnabar);
  background: var(--card); border: 3px double var(--brass); outline: 1px solid var(--rule); outline-offset: 3px;
}

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1.2rem; margin-top: 2.6rem; counter-reset: feature; }
.feature { position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 1.5rem 1.5rem 1.6rem; counter-increment: feature; }
/* Numbers I–VI come from CSS, so reordering cards renumbers them. */
.feature::after { content: counter(feature, upper-roman); position: absolute; top: 1.3rem; right: 1.4rem; font: 600 0.95rem/1 var(--serif); letter-spacing: 0.08em; font-variant: small-caps; color: var(--cinnabar); opacity: 0.85; }
.feature .icon { width: 3.1rem; height: 3.1rem; color: var(--woad); -webkit-mask-size: 1.65rem; mask-size: 1.65rem; }
.feature::before { content: ""; position: absolute; top: 1.5rem; left: 1.5rem; width: 3.1rem; height: 3.1rem; border: 1px solid var(--brass); border-radius: 50%; box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px rgb(164 124 58 / 0.35); }
.feature h3 { font-size: 1.35rem; font-weight: 700; margin: 0.7rem 0 0.35rem; line-height: 1.2; }
.feature p { font-size: 1.05rem; color: #3E342A; }
.range { font-family: var(--sans); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--cinnabar); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; }
@media (max-width: 48rem) { .split { grid-template-columns: 1fr; } }
.split h2, .split h2 + p { text-align: left; }
.split p + p { margin-top: 1em; }
.split figure img { border: 1px solid var(--rule); border-radius: 2px; }
.split figcaption { margin-top: 0.5rem; }
/* Season slider (site.js sets --pos) */
.compare { position: relative; overflow: hidden; border: 1px solid var(--rule); border-radius: 2px; --pos: 50%; user-select: none; }
.compare img { width: 100%; border: 0; }
.compare .after { position: absolute; inset: 0; height: 100%; object-fit: cover; clip-path: inset(0 0 0 var(--pos)); }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; translate: -1px 0; background: #F4EFE4; box-shadow: 0 0 6px rgb(0 0 0 / 0.35); pointer-events: none; }
.compare .handle::after {
  content: "‹ ›"; position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center;
  font: 700 1.1rem/1 var(--sans); letter-spacing: 0.1em; color: var(--ink);
  background: #F4EFE4; border: 1px solid var(--brass); box-shadow: 0 2px 10px rgb(0 0 0 / 0.3);
}
.compare .label { position: absolute; bottom: 0.7rem; font: 700 0.7rem/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); background: rgb(244 239 228 / 0.85); padding: 0.35em 0.6em; border-radius: 2px; pointer-events: none; }
.compare .label.left { left: 0.7rem; }
.compare .label.right { right: 0.7rem; }
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.compare:has(input:focus-visible) .handle::after { outline: 2px solid var(--woad); outline-offset: 2px; }
.swatches { display: flex; gap: 0.35rem; margin-top: 1.4rem; }
.swatches span { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid rgb(42 34 26 / 0.15); }

/* Screenshots: two columns; <figure class="wide"> spans both. */
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem 1.2rem; margin-top: 2.6rem; }
.gallery figure.wide { grid-column: 1 / -1; }
@media (max-width: 40rem) { .gallery { grid-template-columns: 1fr; } }
.gallery a { display: block; overflow: hidden; border: 1px solid var(--rule); border-radius: 2px; }
.gallery img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 0.4s ease; }
.gallery .wide img { aspect-ratio: 21 / 9; }
.gallery a:hover img { transform: scale(1.03); }
.gallery figcaption { margin-top: 0.5rem; }

.links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 2.4rem; font-family: var(--sans); }
@media (max-width: 48rem) { .links { grid-template-columns: 1fr; } }
.links a, .links .mail {
  display: grid; grid-template-columns: auto 1fr; column-gap: 0.9rem; align-items: center;
  padding: 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  text-decoration: none; color: var(--ink); transition: border-color 0.15s, transform 0.15s;
}
.links a:hover { border-color: var(--brass); transform: translateY(-2px); }
.links .icon { grid-row: span 2; width: 1.9rem; height: 1.9rem; color: var(--woad); }
.links strong { font-size: 1.15rem; line-height: 1.2; }
.links span:not(.icon) { color: var(--muted); font-size: 0.95rem; line-height: 1.3; }
.links .mail span:not(.icon) { user-select: all; }


footer { margin-top: 6rem; padding-block: 2rem 3rem; border-top: 1px solid var(--rule); font: 0.95rem var(--sans); color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.2rem; }
footer p { margin-top: 0.3rem; }
footer .social { display: flex; align-items: center; gap: 1.1rem; }
footer .social a { color: var(--muted); display: flex; }
footer .social a:hover { color: var(--woad); }
footer .social .icon { width: 1.3rem; height: 1.3rem; }

/* ---------- Screenshot viewer (site.js) ---------- */

.viewer { padding: 0; border: 0; background: transparent; max-width: min(96vw, 1800px); max-height: 96vh; color: #E4DCCB; }
.viewer::backdrop { background: rgb(14 11 9 / 0.88); }
.viewer img { max-height: 84vh; width: auto; margin: 0 auto; border-radius: 4px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.5); }
.viewer p { font: 1rem/1.4 var(--sans); text-align: center; margin-top: 0.8rem; }
.viewer button {
  position: fixed; top: 50%; translate: 0 -50%; width: 3rem; height: 3rem; border-radius: 50%;
  border: 1px solid rgb(228 220 203 / 0.3); background: rgb(28 24 20 / 0.7); color: inherit;
  font-size: 1.4rem; cursor: pointer;
}
.viewer button:hover, .viewer button:focus-visible { border-color: #C29A52; outline: none; }
.viewer .prev { left: 1rem; }
.viewer .next { right: 1rem; }
.viewer .close { top: 1.6rem; right: 1rem; translate: none; }

/* ---------- Dev blog (pages generated by build.js from posts/) ---------- */

.post, .blog { padding-top: 3rem; }
.post .kicker { text-align: center; }
.post .kicker a { color: inherit; }
.post h1, .blog h1 { font-weight: 500; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; text-align: center; margin-top: 0.8rem; }
.blog h1 + p { text-align: center; color: var(--muted); margin-top: 0.6rem; font-family: var(--sans); }
.post > p, .post > ul, .post > ol, .post > blockquote { font-size: 1.2rem; margin-top: 1em; }
.post h2 { text-align: left; font-size: 1.8rem; margin-top: 2.2rem; }
.post h2 + p { text-align: left; color: inherit; }
.post h3 { font-size: 1.35rem; margin-top: 1.8rem; }
.post li + li { margin-top: 0.3em; }
.post blockquote { margin-inline: 0; padding-left: 1.2rem; border-left: 3px double var(--brass); font-style: italic; }
.post code { font-size: 0.9em; background: var(--paper-deep); padding: 0.1em 0.3em; border-radius: 2px; }
.post pre { background: var(--card); border: 1px solid var(--rule); padding: 1rem; overflow-x: auto; font-size: 0.95rem; margin-top: 1em; }
.post pre code { background: none; padding: 0; }
.post .back { margin-top: 3rem; font: 1rem var(--sans); }
/* Screenshots break out of the text column to up to 60rem. */
.post .shot, .post .gallery { width: min(100vw - 2rem, 60rem); margin: 2rem 0 2rem 50%; translate: -50%; }
.post .shot img { width: 100%; border: 1px solid var(--rule); border-radius: 2px; box-shadow: 0 18px 40px -22px rgb(42 34 26 / 0.45); }
.post .shot figcaption { margin-top: 0.5rem; }

.posts { list-style: none; padding: 0; margin-top: 1rem; }
.posts li + li { margin-top: 1.2rem; }
.posts a {
  display: grid; grid-template-columns: 12rem 1fr; gap: 1.2rem; align-items: center;
  padding: 1rem; background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  text-decoration: none; color: var(--ink); transition: border-color 0.15s, transform 0.15s;
}
.posts a:hover { border-color: var(--brass); transform: translateY(-2px); }
.posts a:not(:has(img)) { grid-template-columns: 1fr; }
.posts img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; }
.posts span { display: flex; flex-direction: column; gap: 0.2rem; }
.posts time { font: 500 0.8rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.posts strong { font-size: 1.45rem; font-weight: 600; line-height: 1.2; }
.posts span span { font: 1rem/1.4 var(--sans); color: var(--muted); }
@media (max-width: 34rem) { .posts a { grid-template-columns: 1fr; } }

/* Homepage: the three newest posts (filled in by build.js). */
.latest { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2rem; margin-top: 2.6rem; font-family: var(--sans); }
.latest a {
  flex: 0 1 21.5rem; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.9rem 0.9rem 1.2rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  text-decoration: none; color: var(--ink); transition: border-color 0.15s, transform 0.15s;
}
.latest a:hover { border-color: var(--brass); transform: translateY(-2px); }
.latest img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; margin-bottom: 0.6rem; }
.latest time { font: 500 0.8rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.latest strong { font: 600 1.35rem/1.2 var(--serif); }
.latest span { color: var(--muted); line-height: 1.4; }

/* Homepage: the newest post, at the top of the hero (filled in by build.js). */
.newest {
  display: inline-grid; grid-template-columns: auto auto; column-gap: 0.8rem; align-items: center; text-align: left;
  margin-bottom: 1.6rem; padding: 0.45rem 1rem 0.45rem 0.45rem; max-width: 100%;
  background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  font-family: var(--sans); text-decoration: none; color: var(--ink); transition: border-color 0.15s;
}
.newest:not(:has(img)) { grid-template-columns: auto; padding-left: 1rem; }
.newest:hover { border-color: var(--brass); color: var(--ink); }
.newest img { grid-row: span 2; width: 5.3rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; }
.newest time { font-size: 0.85rem; color: var(--muted); }
.newest strong { font: 600 1.1rem/1.25 var(--serif); }
.newest strong span { color: var(--woad); }
