/* Shared base for every route: homepage, mod library, game pages and licence.
   The site is built like a game's front end: a warm graphite ground lit from
   the upper right, warm off-white type, thin warm rules for frames, vermilion
   for the selected item and the one primary action, and gold for focus and
   unlocked states. Menus carry diamond markers on a rail. Page-specific
   layouts live in home.css (homepage) and mods.css (library, games, licence). */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("fonts/archivo/archivo-latin-ext-wdth-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("fonts/archivo/archivo-latin-wdth-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("fonts/archivo/archivo-latin-ext-wdth-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("fonts/archivo/archivo-latin-wdth-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Saira sets only the name plate on the title screen. */
@font-face {
  font-family: "Saira";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 50% 125%;
  src: url("fonts/saira/saira-latin-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF;
}

:root {
  --backdrop: #0b0a09;
  --panel: #14120f;
  --raised: #1b1814;
  --field: #24201b;
  --hover: #2e2923;
  --line: rgb(232 196 140 / 0.16);
  --line-strong: rgb(232 196 140 / 0.32);
  --text: #f3ead9;
  --muted: #b3a690;
  --dim: #7d7364;
  --mark: #e8b04e;
  --vermilion: #e5482d;
  --vermilion-fill: #d43f24;
  --vermilion-hover: #b8321b;
  --green: #84c98f;

  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --page: 75rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section: clamp(5rem, 9vw, 8.5rem);
  --radius: 6px;
  --control: 4px;
  --notch: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--backdrop);
  color: var(--text);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  font-stretch: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }

h1, h2, h3 { font-weight: 600; text-wrap: balance; }

h1 {
  font-size: clamp(2.125rem, 1.4rem + 3.4vw, 4rem);
  line-height: 1.04;
}

/* Section titles read like a game menu screen: a heavy upright title and a
   warm rule running out to the edge of the column. Italic is kept for the
   title screen's name plate and tagline. */
h2 {
  font-size: clamp(1.875rem, 1.3rem + 1.9vw, 3rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--mark);
}

p { text-wrap: pretty; }

a { color: inherit; }

p a, li a, figcaption a, dd a {
  color: var(--text);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgb(232 176 78 / 0.55);
  text-underline-offset: 0.2em;
}
p a:hover, li a:hover, figcaption a:hover, dd a:hover { text-decoration-color: var(--mark); }

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

.fine { color: var(--muted); font-size: 0.9375rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; top: 0.75rem; left: 0.75rem; z-index: 100;
  padding: 0.6rem 1rem; border-radius: var(--control);
  background: var(--text); color: var(--backdrop); font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Buttons. The primary is a slanted vermilion plate, like the selected item
   in a game menu; the rest are flat warm charcoal. */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0 1.2rem;
  border: 0;
  border-radius: var(--control);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, translate 200ms var(--ease);
}
.btn:hover { background: var(--hover); }
.btn:active { translate: 0 1px; }
.btn:disabled { opacity: 0.45; cursor: default; translate: none; }
.btn:disabled:hover { background: var(--field); }

.btn--primary {
  padding-inline: 1.5rem;
  border-radius: 0;
  background: var(--vermilion-fill);
  color: #fff;
  font-weight: 650;
  clip-path: polygon(0.7rem 0, 100% 0, calc(100% - 0.7rem) 100%, 0 100%);
}
.btn--primary:hover { background: var(--vermilion-hover); }
.btn--primary:disabled:hover { background: var(--vermilion-fill); }

.btn--small { min-height: 2.25rem; padding: 0 0.9rem; font-size: 0.875rem; }
.btn--primary.btn--small { padding-inline: 1.15rem; clip-path: polygon(0.55rem 0, 100% 0, calc(100% - 0.55rem) 100%, 0 100%); }
.btn--tiny { min-height: 1.75rem; padding: 0 0.6rem; font-size: 0.8125rem; border-radius: 3px; }

/* Layout */

/* Every route shares one content column. */
.bar, .foot, .page {
  width: min(100% - 2 * var(--gutter), var(--page));
  margin-inline: auto;
}

/* Panels are framed like game HUD panels: a thin warm rule and one clipped
   corner. */
.panel {
  background: var(--panel);
  border-radius: 0;
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
}

/* Navigation: the brand mark, then menu items with diamond markers. */

.bar {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 4.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-right: auto;
  font-size: 1.125rem;
  font-weight: 750;
  text-decoration: none;
}
.wordmark svg { width: 1.9rem; height: auto; color: var(--text); }

.bar__links { display: flex; gap: 1.75rem; }
.bar__links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 140ms ease;
}
.bar__links a::before {
  content: "";
  width: 6px;
  height: 6px;
  rotate: 45deg;
  box-shadow: inset 0 0 0 1px currentColor;
  opacity: 0.6;
  transition: background-color 140ms ease, opacity 140ms ease;
}
.bar__links a:hover, .bar__links a[aria-current] { color: var(--text); }
.bar__links a:hover::before, .bar__links a[aria-current]::before { background: var(--vermilion); box-shadow: none; opacity: 1; }

.bar__menu { display: none; position: relative; }
.bar__menu summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  border-radius: var(--control);
  background: var(--field);
  font-size: 0.9375rem;
  font-weight: 600;
}
.bar__menu summary::-webkit-details-marker { display: none; }
.bar__menu[open] summary { background: var(--hover); }
.bar__menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 50;
  min-width: 14rem;
  padding: 0.4rem;
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line), 0 18px 40px rgb(0 0 0 / 0.55);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
}
.bar__menu li a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  text-decoration: none;
  font-weight: 500;
}
.bar__menu li a::before {
  content: "";
  width: 6px;
  height: 6px;
  rotate: 45deg;
  box-shadow: inset 0 0 0 1px var(--muted);
}
.bar__menu li a:hover { background: var(--field); }
.bar__menu li a:hover::before { background: var(--vermilion); box-shadow: none; }

/* Browser surfaces */

::selection { background: rgb(229 72 45 / 0.38); color: #fff; }
html { scrollbar-color: #3b342b var(--backdrop); accent-color: var(--vermilion); caret-color: var(--mark); }

/* Screens are shown whole inside a thin warm frame with one clipped corner. */
.shot {
  display: block;
  overflow: hidden;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
  cursor: zoom-in;
}
.shot img { width: 100%; padding: 1px; }
.shot:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }

figcaption {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: baseline;
  margin-top: var(--section);
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}
.foot__mark { margin-right: auto; color: var(--text); font-weight: 750; font-size: 1rem; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--text); }

/* Footers on secondary pages group their links; they flow like the homepage's. */
.foot__lines { display: contents; }

/* Screenshot viewer */

.viewer {
  width: min(100vw - 2rem, 120rem);
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--raised);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
.viewer::backdrop { background: rgb(6 5 4 / 0.86); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0.75rem 0.75rem 1.25rem;
}
.viewer__title { font-size: 1rem; font-weight: 650; color: var(--text); }
.viewer__count { color: var(--muted); font-size: 0.875rem; }
.viewer__tools { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-left: auto; }
.viewer__stage { flex: 1; min-height: 0; overflow: hidden; padding: 0 0.75rem; }
.viewer__stage img { width: 100%; height: 100%; max-height: calc(100dvh - 9rem); object-fit: contain; }
.viewer.is-actual .viewer__stage { overflow: auto; }
.viewer.is-actual .viewer__stage img { width: auto; height: auto; max-width: none; max-height: none; }
.viewer__caption { padding: 0.75rem 1.25rem 1rem; color: var(--muted); font-size: 0.875rem; }

/* Narrow layouts */

@media (max-width: 960px) {
  .bar__links { display: none; }
  .bar__menu { display: block; }
  .bar { gap: 0.75rem; }
}

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .bar__buy { display: none; }
  .viewer { width: 100vw; max-height: 100dvh; }
  .viewer__bar { padding-left: 1rem; }
}

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