/*
  tsryo.github.io
  Amber CRT terminal meets old-school gothic RPG: dark, warm, orange glow.
  Effects stay in the hero, headings and accents; body text stays plain.

  Fonts (self-hosted, SIL Open Font License 1.1):
  IBM Plex Sans (IBM), Cinzel (Natanael Gama), Ruslan Display (Denis Masharov,
  subset to the letters of "Цеко"), VT323 (Peter Hull).
  Cyrillic stand-ins, loaded only on pages that use Cyrillic: IBM Plex Sans
  Cyrillic, Cormorant SC (Christian Thalmann) for Cinzel, Tiny5 (Stefie
  Justprince) for VT323.
*/

@font-face {
  font-family: "Plex";
  src: url("../assets/fonts/plex-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex";
  src: url("../assets/fonts/plex-sans-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel";
  src: url("../assets/fonts/cinzel-var.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
/* Cyrillic: same family names, so the browser picks these per glyph. */
@font-face {
  font-family: "Plex";
  src: url("../assets/fonts/plex-sans-cyr.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Plex";
  src: url("../assets/fonts/plex-sans-italic-cyr.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cinzel";
  src: url("../assets/fonts/cormorant-sc-700-cyr.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  size-adjust: 112%;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "VT323";
  src: url("../assets/fonts/tiny5-cyr.woff2") format("woff2");
  font-display: swap;
  size-adjust: 84%;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Ruslan";
  src: url("../assets/fonts/ruslan-tseko.woff2") format("woff2");
  unicode-range: U+0426, U+0435, U+043A, U+043E;
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("../assets/fonts/vt323.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #1a120c;
  --bg-deep: #130d08;
  --surface: #22170e;
  --surface-2: #2c1e12;
  --text: #eee4d2;
  --muted: #b3a48f;

  --amber: #ffb000;
  --amber-dim: #c98f1c;
  --orange: #ff7a1a;
  --ember: #ff4d00;
  --gold: #ecc77f;
  --unique: #c7b377;
  --magic: #8585ff;
  --waypoint: #4fd1c5;
  --tile: #2fb3c0;
  --blood: #c4281c;

  --iron: #5e4126;
  --trim: #a07d4a;
  --line: rgba(212, 175, 110, 0.22);

  /* Dusk sky; each language leans it toward its home (see the html[lang] rules). */
  --sky-1: #161a33;
  --sky-2: #3a2648;
  --sky-3: #8a3f4e;
  --sky-4: #e0763a;
  --sky-5: #f6b45a;

  --on-accent: #140904;

  --sans: "Plex", "Segoe UI", system-ui, -apple-system, sans-serif;
  --gothic: "Cinzel", "Trajan Pro", Georgia, serif;
  --cyrillic: "Ruslan", Georgia, serif;
  --mono: "VT323", "Consolas", ui-monospace, monospace;

  --glow-amber: 0 0 6px rgba(255, 176, 0, 0.55), 0 0 16px rgba(255, 122, 26, 0.3);

  --rivet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3H13V13H3Z' fill='%23c9a05a'/%3E%3Cpath d='M8 0.9 15.1 8 8 15.1 0.9 8Z' fill='%23c9a05a'/%3E%3Cpath d='M8 4 12 8 8 12 4 8Z' fill='%23237f8c'/%3E%3Ccircle cx='8' cy='8' r='1.5' fill='%23ffcf7a'/%3E%3C/svg%3E");
  --tilework: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56' fill='none' stroke='%23d4af6e' stroke-opacity='0.05' stroke-width='1'%3E%3Cpath d='M18 18H38V38H18Z'/%3E%3Cpath d='M28 13.9 42.1 28 28 42.1 13.9 28Z'/%3E%3Cpath d='M0 0 13.9 13.9M56 0 42.1 13.9M0 56 13.9 42.1M56 56 42.1 42.1'/%3E%3C/svg%3E");
  --corner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M4 4H37L32 10H10V32L4 37Z' fill='%23241b12' stroke='%23c79a4a' stroke-width='1.5'/%3E%3Cpath d='M0 0 14 5H5V14Z' fill='%23e0bb6c'/%3E%3Ccircle cx='8.5' cy='8.5' r='2.7' fill='%23ff8a2a'/%3E%3Ccircle cx='23' cy='7' r='1.3' fill='%23e0bb6c'/%3E%3Ccircle cx='7' cy='23' r='1.3' fill='%23e0bb6c'/%3E%3C/svg%3E");
  --rune: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke-width='2'%3E%3Cpath d='M16 1.5 30.5 16 16 30.5 1.5 16Z' stroke='%23ff9a3c'/%3E%3Ccircle cx='16' cy='16' r='6' stroke='%23ffb000'/%3E%3Ccircle cx='16' cy='16' r='2.4' fill='%23ffd27a' stroke='none'/%3E%3Cpath d='M16 5v4M16 23v4M5 16h4M23 16h4' stroke='%23ff9a3c'/%3E%3C/svg%3E");
  --grain-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .6 0 0 0 0 .45 0 0 0 0 .3 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .6 0 0 0 0 .45 0 0 0 0 .3 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --wrap: 72rem;
  --gutter: 16px;
  --topbar-h: 3.5rem;

  color-scheme: dark;
}

@media (min-width: 640px) {
  :root { --gutter: 28px; }
}

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

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

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

body {
  position: relative;
  margin: 0;
  background: var(--grain-bg), var(--tilework) center top / 56px, var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}


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

a, button { -webkit-tap-highlight-color: rgba(255, 140, 0, 0.22); }

@media (pointer: fine) {
  html { cursor: url("../assets/img/cursor.png") 2 1, auto; }
  a, button, summary, label { cursor: url("../assets/img/cursor-hover.png") 2 1, pointer; }
}

a {
  color: var(--orange);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--amber); }

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

::selection { background: var(--orange); color: var(--on-accent); }

h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0 0 1em; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  background: var(--amber);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; }

.cursor { animation: blink 1.06s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Top bar (terminal) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 6, 4, 0.95);
  border-bottom: 1px solid var(--iron);
  box-shadow: 0 1px 0 #000, 0 2px 0 rgba(199, 179, 119, 0.08);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: var(--topbar-h);
}

.mark {
  flex: none;
  font-family: var(--mono);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--amber);
  text-decoration: none;
  text-shadow: var(--glow-amber);
}
.mark:hover { color: var(--amber); }

.topbar nav {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
}
.topbar nav::-webkit-scrollbar { display: none; }

.topbar nav ul {
  display: flex;
  gap: 0.2rem;
  margin: 0;
  padding: 0 1.5rem 0 0;
  list-style: none;
  white-space: nowrap;
}

.topbar nav a {
  display: block;
  padding: 0.3rem 0.55rem;
  font-family: var(--mono);
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--amber-dim);
  text-decoration: none;
}
/* DOS menu highlight: inverted colours. */
.topbar nav a:hover { color: var(--on-accent); background: var(--amber); text-shadow: none; }
.topbar nav a[aria-current="true"] { color: var(--amber); text-shadow: var(--glow-amber); }
.topbar nav a[aria-current="true"]::before { content: "["; }
.topbar nav a[aria-current="true"]::after { content: "]"; }

.topbar nav .nav-cta {
  color: var(--amber);
  border: 1px solid rgba(255, 176, 0, 0.5);
}

@media (min-width: 860px) {
  .topbar nav { flex: none; margin-left: auto; -webkit-mask-image: none; mask-image: none; }
  .topbar nav ul { padding: 0; }
}

/* Language switcher: torn war banners that sway on their rods. */
.banner-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.langs {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 0.2rem;
  margin: 0;
  padding: 0 0 0 0.6rem;
  border-left: 1px solid var(--iron);
  list-style: none;
}
.langs a { display: block; padding: 0.15rem 0.1rem 0; line-height: 0; }
/* Hidden labels in a system font, so naming Български doesn't fetch the Cyrillic web font on every page. */
.langs .visually-hidden { font-family: system-ui, sans-serif; }
.banner {
  display: block;
  width: 1.45rem;
  height: 2.1rem;
  transform-origin: 50% 8%;
  filter: saturate(0.45) brightness(0.62) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8));
  transition: filter 0.2s;
  animation: sway 4.2s ease-in-out infinite;
}
.langs li:nth-child(2) .banner { animation-delay: -1.4s; }
.langs li:nth-child(3) .banner { animation-delay: -2.8s; }
.langs li:nth-child(4) .banner { animation-delay: -0.7s; }
@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
.langs a:hover .banner,
.langs a:focus-visible .banner { filter: saturate(1) brightness(1) drop-shadow(0 0 6px rgba(255, 140, 0, 0.7)); }
.langs a[aria-current="true"] .banner { filter: saturate(1) brightness(1.05) drop-shadow(0 0 5px rgba(255, 140, 0, 0.75)); }
.banner-edge { fill: none; stroke: #120b05; stroke-width: 1; stroke-linejoin: round; }
.banner-rod { fill: #8a6a38; }
.banner-knob { fill: #e0bb6c; }

/* Small phones: a tighter bar, so the section links keep some room beside the banners. */
@media (max-width: 480px) {
  .topbar-inner { gap: 0.6rem; }
  .mark { font-size: 1.35rem; padding-block: 0.2rem; }
  .langs { gap: 0.05rem; padding-left: 0.4rem; }
}

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

.hero {
  position: relative;
  overflow: hidden;
  padding-top: clamp(2.5rem, 7vw, 5rem);
  background: linear-gradient(to bottom, var(--sky-1) 0%, var(--sky-2) 34%, var(--sky-3) 62%, var(--sky-4) 86%, var(--sky-5) 100%);
}
/* A few early stars at the top of the sky. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 55% 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 34%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 9%, #ffe8c0 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 23%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 69% 12%, #d8fbff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 83% 27%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 6%, #fff 50%, transparent 51%);
  background-size: 700px 420px;
  opacity: 0.55;
}
/* Keep the hero text readable where the sky turns bright. */
.hero-text { text-shadow: 0 1px 12px rgba(20, 10, 30, 0.55); }

/* CRT: scanlines and a dark vignette. */
.crt {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 90% 80% at 50% 40%, transparent 60%, rgba(10, 5, 15, 0.35) 100%);
  /* Fade out at the bottom so the ground meets the next section without a seam. */
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 97%);
  mask-image: linear-gradient(to bottom, #000 70%, transparent 97%);
  animation: crt-flicker 6s steps(1) infinite;
}
@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 0.92; }
  48% { opacity: 1; }
}

.hero {
  /* Height of the skyline painting (2400 x 760 artwork). */
  --sky-h: min(31.67vw, 640px);
}
@media (max-width: 640px) {
  .hero { --sky-h: 202px; }
  .hero-inner { padding-bottom: calc(var(--sky-h) * 0.72); }
}

.hero-inner {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 2.5rem;
  align-items: center;
  /* Room for the buildings: they fill the lower 62% of the painting. */
  padding-bottom: calc(var(--sky-h) * 0.62);
}

@media (min-width: 860px) {
  .hero-inner { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 3rem; }
}

.prompt {
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--amber);
  text-shadow: var(--glow-amber);
}
.prompt-path { color: var(--amber-dim); }
.prompt .cursor { margin-left: 0.15em; }

h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.35em;
  font-family: var(--gothic);
  font-size: clamp(3.6rem, 11vw, 6.8rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* On the Bulgarian page the title is only Cyrillic, in the Slavonic display face. */
.metal-cyr { font-family: var(--cyrillic); font-weight: 400; letter-spacing: 0.04em; }

/* Gold metal lettering, lit from below by fire. */
.metal {
  background: linear-gradient(to bottom, #fff3d6 0%, #f4cc7e 40%, #d08c2c 62%, #a8581a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 #000) drop-shadow(0 0 14px rgba(255, 106, 20, 0.45));
}

.cyr {
  font-family: var(--cyrillic);
  font-size: 0.5em;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #ffb066;
  text-shadow:
    0 0 4px #ff7a1a,
    0 0 14px rgba(255, 90, 0, 0.85),
    0 0 36px rgba(255, 60, 0, 0.55);
}

.fullname {
  margin: 0.4rem 0 1.4rem;
  font-family: var(--gothic);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.class-line {
  margin-bottom: 0;
  font-family: var(--gothic);
  font-size: clamp(1.1rem, 2.3vw, 1.3rem);
  font-weight: 700;
  color: var(--text);
}
.class-line .level { color: var(--orange); margin-right: 0.2em; cursor: help; }
.nowrap { white-space: nowrap; }
.class-line .sep { color: var(--trim); margin: 0 0.3em; }

.lede {
  max-width: 34rem;
  margin-top: 1rem;
  color: #e3d6c2;
  font-size: 1.15rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.75rem;
}

/* Carved stone buttons with a gold edge. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--trim);
  border-radius: 2px;
  background: linear-gradient(to bottom, #2a2017, #140f0a);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.12), inset 0 0 0 1px #000, 0 0 0 1px #000;
  color: var(--unique);
  font-family: var(--gothic);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn:hover {
  color: #fff2d6;
  border-color: var(--orange);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.12), inset 0 0 0 1px #000, 0 0 0 1px #000, 0 0 20px rgba(255, 122, 26, 0.45);
}
.btn-primary {
  border-color: #ffb066;
  background: linear-gradient(to bottom, #ff9a3c, #e2560d);
  color: var(--on-accent);
}
.btn-primary:hover {
  color: var(--on-accent);
  border-color: #ffd29a;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3), 0 0 0 1px #000, 0 0 26px rgba(255, 122, 26, 0.7);
}
.btn-meta {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  padding: 0.05rem 0.3rem;
  background: rgba(20, 9, 4, 0.2);
}

/* ---------- Item tooltip ---------- */

.tooltip {
  padding: 0.9rem 1.2rem;
  border: 1px solid #3a3024;
  background: rgba(4, 3, 2, 0.92);
  box-shadow: 0 0 0 1px #000, 0 12px 30px rgba(0, 0, 0, 0.7);
  font-family: var(--gothic);
  font-weight: 600;
  text-align: center;
  line-height: 1.45;
}
.tooltip p { margin: 0; }
.t-unique { color: var(--unique); font-size: 1.1rem; font-weight: 700; }
.t-base { color: var(--unique); }
.t-magic { color: var(--magic); }

/* ---------- Hero portrait: a memory in firelight ---------- */

.memory {
  position: relative;
  width: min(100%, 26rem);
  margin: 0;
  justify-self: center;
}
/* Warm torchlight the photo dissolves into. */
.memory::before {
  content: "";
  position: absolute;
  inset: -4% -16% 8%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 106, 20, 0.26), rgba(255, 106, 20, 0.08) 60%, transparent);
  filter: blur(14px);
}

/* Feathered edges: the photo fades into the dark instead of sitting in a frame. */
.memory-art {
  position: relative;
  aspect-ratio: 1;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 46%, #000 30%, rgba(0, 0, 0, 0.88) 46%, rgba(0, 0, 0, 0.55) 64%, rgba(0, 0, 0, 0.2) 82%, transparent 98%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 46%, #000 30%, rgba(0, 0, 0, 0.88) 46%, rgba(0, 0, 0, 0.55) 64%, rgba(0, 0, 0, 0.2) 82%, transparent 98%);
}
.memory-art picture {
  position: absolute;
  inset: 0;
}
.memory-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Toned to the palette; the real colours come back on hover, like a memory focusing. */
.m-toned { transition: opacity 0.9s ease; }
.memory:hover .m-toned { opacity: 0; }
/* Firelight from below, and faint scanlines. */
.memory-art::before,
.memory-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.memory-art::before {
  background: radial-gradient(ellipse 80% 55% at 50% 105%, rgba(255, 110, 20, 0.45), transparent 70%);
  mix-blend-mode: soft-light;
}
.memory-art::after {
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.13) 0 1px, transparent 1px 3px);
}

.memory-embers {
  position: absolute;
  inset: 0;
  z-index: 2;
  height: auto;
}

/* D2-style item tooltip floating over the faded bottom edge. */
.memory-caption {
  position: relative;
  z-index: 3;
  width: 80%;
  margin: -3.4rem auto 0;
  background: rgba(4, 3, 2, 0.84);
  font-size: 0.95rem;
}
.memory-caption span { display: block; }

/* ---------- Skyline: an ink-and-wash painting of a Bulgarian village, with Scotland, Valencia and the Netherlands on the horizon ---------- */

/* Layers, back to front: the CSS sky (.hero), the sun, the painting (WebP, drawn by
   tools/draw_skyline.py), then live details: window glow, the windmill's sails, smoke, the saltire. */
.skyline {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sky-h);
  pointer-events: none;
}
@media (max-width: 640px) {
  /* Keep the scene readable on phones: wider than the screen, the Bulgarian village in view. */
  .skyline { right: auto; left: calc(50% - 240px); width: 640px; }
}
.skyline > svg,
.sk-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.sk-art { object-fit: cover; object-position: 50% 100%; }

/* Lit windows glow; the home of the current language glows brightest. */
.sk-glow ellipse { fill: #ffb24a; }
.sk-glow {
  opacity: 0.22;
  filter: blur(6px);
  mix-blend-mode: screen;
  transition: opacity 0.8s;
}
.sk-glow.sk-nl { opacity: 0.55; }  /* home now: lit in every language */
html[lang="en"] .sk-glow.sk-sc,
html[lang="bg"] .sk-glow.sk-bg,
html[lang="es"] .sk-glow.sk-es,
html[lang="nl"] .sk-glow.sk-nl { opacity: 0.75; }

/* The windmill's sails, in the hazy tones of the distance; they turn slowly (SMIL). */
.sk-sails { opacity: 0.85; }
.sk-sails .whip { stroke: #4a3e44; stroke-width: 4; stroke-linecap: round; }
.sk-sails .sail { fill: #c4b4bc; fill-opacity: 0.45; stroke: #4a3e44; stroke-width: 1.4; }
.sk-sails .lat { fill: none; stroke: #4a3e44; stroke-width: 1; }
.sk-sails .hub { fill: #3a3036; }

.sk-smoke circle {
  fill: #d8ccd4;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: smoke 7s linear infinite;
}
.sk-smoke circle:nth-child(2) { animation-delay: -2.3s; }
.sk-smoke circle:nth-child(3) { animation-delay: -4.6s; }
@keyframes smoke {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  12% { opacity: 0.55; }
  100% { transform: translate(34px, -70px) scale(2.6); opacity: 0; }
}

.sk-flag { fill: #1f4f9a; stroke: #12305c; stroke-width: 0.8; }
.sk-flag-x { fill: none; stroke: #f2efe6; stroke-width: 2.4; }

/* Each language leans the sky toward home: heather for Scotland, rose for Bulgaria, amber for Spain,
   the silver blue of a Dutch sky for the Netherlands. */
html[lang="en"] {
  --sky-1: #141c33; --sky-2: #2e2f55; --sky-3: #6a4a72; --sky-4: #c9784a; --sky-5: #ebb066;
}
html[lang="bg"] {
  --sky-1: #1a1830; --sky-2: #42284a; --sky-3: #a04a62; --sky-4: #e88a5a; --sky-5: #f4c27a;
}
html[lang="es"] {
  --sky-1: #181a34; --sky-2: #3c2446; --sky-3: #9a3e44; --sky-4: #ec7a32; --sky-5: #f9be58;
}
html[lang="nl"] {
  --sky-1: #121b31; --sky-2: #2a3c60; --sky-3: #66708f; --sky-4: #c99070; --sky-5: #f0cc92;
}

.embers {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 360px;
  pointer-events: none;
}
.embers i {
  position: absolute;
  bottom: 12%;
  left: var(--x);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffe2a0;
  box-shadow: 0 0 6px 2px rgba(255, 190, 90, 0.75);
  opacity: 0;
  animation: rise var(--t) linear var(--d) infinite;
}
@keyframes rise {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(16px, -170px) scale(0.8); }
  100% { transform: translate(-12px, -340px) scale(0.3); opacity: 0; }
}

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

/* Offscreen sections skip rendering until the page has loaded; main.js then lays them out while idle. */
.section > .wrap {
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
}

.section {
  padding-block: clamp(3.5rem, 8vw, 6rem);
  scroll-margin-top: var(--topbar-h);
}
/* Divider: a glowing ember diamond on a fading line. */
.section + .section { position: relative; }
.section + .section::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: min(var(--wrap), 100% - 2 * var(--gutter));
  height: 14px;
  transform: translateX(-50%);
  background:
    var(--rivet) center / 14px no-repeat,
    linear-gradient(90deg, transparent, rgba(255, 122, 26, 0.5) 25%, rgba(255, 122, 26, 0.5) 75%, transparent) center / 100% 1px no-repeat;
  filter: drop-shadow(0 0 5px rgba(255, 122, 26, 0.6));
}

.section-head { margin-bottom: 2.25rem; }

.kicker {
  margin: 0 0 0.45rem;
  font-family: var(--mono);
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--amber);
  text-shadow: var(--glow-amber);
}
.kicker .path { color: var(--amber-dim); text-shadow: none; }

h2 {
  font-family: var(--gothic);
  font-size: clamp(1.8rem, 4.2vw, 2.6rem);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 0 #000, 0 0 22px rgba(255, 106, 20, 0.35);
}
/* Ornamental rule: a gold diamond and a fading line. */
h2::after {
  content: "";
  display: block;
  width: min(14rem, 60%);
  height: 12px;
  margin-top: 0.75rem;
  background:
    var(--rivet) left center / 12px no-repeat,
    linear-gradient(90deg, var(--trim), transparent) 14px center / calc(100% - 14px) 1px no-repeat;
}

.section-sub { margin: 0.9rem 0 0; color: var(--muted); }
.motto { max-width: 36rem; font-style: italic; }

h3 { font-size: 1.15rem; font-weight: 600; color: #f5ecdc; }

.tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid rgba(255, 122, 26, 0.55);
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 0.15em;
  white-space: nowrap;
}

/* About */

.about-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 860px) {
  .about-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 3.5rem; }
}

.prose { max-width: 34rem; font-size: 1.15rem; }
.prose strong { color: #fff4e0; font-weight: 600; }

.diagram {
  margin: 0;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--iron);
  background:
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(255, 106, 20, 0.1), transparent 70%),
    linear-gradient(to bottom, #251910, #1d140c);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 0 4px #2c1e12, inset 0 0 0 5px rgba(122, 98, 64, 0.5);
}
.diagram svg { display: block; width: 100%; max-width: 44rem; height: auto; margin: 0 auto; overflow: visible; }
.diagram figcaption {
  max-width: 40rem;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}
.d-fill { fill: #2c1e12; }
.d-ln { fill: none; stroke: var(--trim); stroke-width: 2; stroke-linejoin: round; }
.d-lit { fill: #ffa040; filter: drop-shadow(0 0 3px #ff7a1a); }
.d-gold { fill: none; stroke: var(--unique); stroke-width: 2; }
.d-goldfill { fill: var(--unique); }
.d-links path { fill: none; stroke: rgba(255, 176, 0, 0.18); stroke-width: 6; stroke-linecap: round; }
.d-dot { fill: #ffcf6e; filter: drop-shadow(0 0 3px rgba(255, 140, 0, 0.9)); }
.fl-legend { display: block; margin: 0 0 0.35rem; color: var(--muted); }
.fl-legend svg { display: inline-block; width: 12px; height: 14px; margin-right: 0.4rem; vertical-align: -1px; }
.d-orb { fill: #ff7a1a; filter: drop-shadow(0 0 10px rgba(255, 110, 20, 0.9)); }
.d-ring {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.5;
  transform-origin: 280px 190px;
  animation: ring 2.8s ease-out infinite;
}
@keyframes ring {
  from { transform: scale(0.8); opacity: 0.9; }
  to { transform: scale(1.9); opacity: 0; }
}
.d-label { fill: var(--text); font-family: var(--gothic); font-weight: 700; font-size: 17px; text-anchor: middle; }
.d-center { fill: var(--gold); }
.d-plate { fill: #20160d; stroke: var(--iron); }
.d-note { fill: var(--amber); font-family: var(--mono); font-size: 19px; text-anchor: middle; }

@media (max-width: 520px) {
  .diagram { padding: 0.75rem 0.25rem; }
  .d-label { font-size: 23px; }
  .d-note { font-size: 24px; }
}

/* Skill tree */

.trees {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 900px) {
  .trees { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tree {
  --tree: var(--amber);
  --tree-glow: rgba(255, 140, 0, 0.55);
  position: relative;
  padding: 0 1.1rem 1.1rem;
  border: 1px solid var(--iron);
  background: linear-gradient(to bottom, #2b1d11, #1d140c);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 0 4px #251910, inset 0 0 0 5px rgba(122, 98, 64, 0.45);
}
.tree-engineering { --tree: var(--waypoint); --tree-glow: rgba(90, 168, 255, 0.55); }
.tree-bard { --tree: #4be07a; --tree-glow: rgba(60, 224, 110, 0.5); }

/* Tab on top, like the skill-tree tabs of an old RPG. */
.tree-tab {
  width: fit-content;
  margin: -1px auto 1.2rem;
  padding: 0.45rem 1.4rem 0.5rem;
  border: 1px solid var(--iron);
  border-top: 0;
  background: linear-gradient(to bottom, #241a10, #251910);
  box-shadow: 0 0 0 1px #000;
  font-family: var(--gothic);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--tree);
  text-shadow: 0 0 12px var(--tree-glow);
}

.nodes { margin: 0; padding: 0; list-style: none; }
.node {
  position: relative;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding-bottom: 1.05rem;
}
.node:last-child { padding-bottom: 0; }
/* The line joining each skill to the next. */
.node:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 1.5rem;
  top: 3rem;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(to bottom, var(--tree), rgba(122, 98, 64, 0.5));
  opacity: 0.6;
}
.node-gem {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--trim);
  background: radial-gradient(circle at 50% 40%, #241a10, #060403 78%);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000, inset 0 0 12px rgba(0, 0, 0, 0.9), 0 0 14px -4px var(--tree-glow);
  font-family: var(--mono);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--tree);
  text-shadow: 0 0 8px var(--tree-glow);
}
.node-body { display: grid; gap: 0.1rem; padding-top: 0.2rem; }
.node-name { font-family: var(--gothic); font-weight: 700; color: #f5ecdc; }
.node-desc { color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.node .tag { border-color: var(--tree); color: var(--tree); }

/* Music strip */

.tavern {
  display: grid;
  gap: 1.25rem 1.75rem;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--iron);
  background:
    radial-gradient(ellipse 40% 90% at 8% 50%, rgba(60, 224, 110, 0.08), transparent 70%),
    linear-gradient(to bottom, #2b1d11, #1d140c);
  box-shadow: inset 0 0 0 1px #000;
}
@media (min-width: 700px) {
  .tavern { grid-template-columns: 6rem minmax(0, 1fr) auto; }
}
.tavern p { margin: 0; }
.tavern-text { display: grid; gap: 0.15rem; }
.tavern .t-unique { font-family: var(--gothic); font-weight: 700; }
.tavern-text { max-width: 44rem; }
.tavern-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.sc-player { grid-column: 1 / -1; }
.sc-player iframe { display: block; width: 100%; height: 300px; border: 0; }

/* Equaliser bars that bounce like an old hi-fi display. */
.eq { width: 100%; max-width: 6rem; height: auto; }
.eq rect {
  fill: #4be07a;
  filter: drop-shadow(0 0 4px rgba(60, 224, 110, 0.7));
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: eq 1.1s ease-in-out infinite alternate;
}
.eq rect:nth-child(2) { animation-duration: 0.8s; animation-delay: -0.3s; }
.eq rect:nth-child(3) { animation-duration: 1.3s; animation-delay: -0.6s; fill: var(--amber); }
.eq rect:nth-child(4) { animation-duration: 0.7s; animation-delay: -0.2s; fill: var(--amber); }
.eq rect:nth-child(5) { animation-duration: 1.2s; animation-delay: -0.9s; fill: var(--orange); }
.eq rect:nth-child(6) { animation-duration: 0.9s; animation-delay: -0.4s; fill: var(--orange); }
.eq rect:nth-child(7) { animation-duration: 1s; animation-delay: -0.7s; fill: var(--blood); }
@keyframes eq {
  from { transform: scaleY(0.15); }
  to { transform: scaleY(1); }
}

/* Story */

.quote {
  max-width: 40rem;
  margin: 0 0 2.5rem;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--tile);
}
.quote p {
  margin: 0 0 0.35rem;
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  font-style: italic;
  line-height: 1.5;
}
.quote footer {
  font-family: var(--mono);
  font-size: 1.25rem;
  color: var(--muted);
}
.quote footer::before { content: "\2014\00a0"; }

.acts, .log, .pubs, .plain { margin: 0; padding: 0; list-style: none; }

.act {
  display: grid;
  gap: 0.6rem 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
@media (min-width: 640px) {
  .act { grid-template-columns: 12.5rem minmax(0, 1fr); }
}

.act-badge {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 0.45rem 0.9rem;
}
/* Framed like a skill icon. */
.act-icon {
  grid-row: span 2;
  display: block;
  width: 4.25rem;
  height: 4.25rem;
  padding: 0.35rem;
  border: 1px solid var(--trim);
  background: radial-gradient(circle at 50% 40%, #241a10, #080604 75%);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000, inset 0 0 14px rgba(0, 0, 0, 0.9);
}
.act-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--amber);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(255, 140, 0, 0.75));
}
.act-icon .f { fill: var(--amber); stroke: none; }
.act-icon .t { fill: var(--amber); stroke: none; font-family: var(--mono); font-size: 28px; text-anchor: middle; }
.act-icon .dash { stroke-dasharray: 3 4; }
.act-icon .caret { animation: blink 1.06s steps(1) infinite; }
.act-icon .ecg { stroke: var(--orange); stroke-dasharray: 80; animation: ecg 2.4s linear infinite; }
@keyframes ecg {
  from { stroke-dashoffset: 80; }
  60%, to { stroke-dashoffset: 0; }
}
.act-num { align-self: end; }
.act-num {
  font-family: var(--gothic);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  color: var(--orange);
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(255, 106, 20, 0.5);
}

/* Experience bar: gold rim, amber fill. */
.xp {
  display: block;
  width: 6.5rem;
  height: 0.55rem;
  padding: 1px;
  border: 1px solid var(--trim);
  background: #000;
}
.xp span {
  display: block;
  height: 100%;
  width: var(--xp, 0%);
  background: linear-gradient(to bottom, #ffd27a, #ff8a1a 60%, #c45a0a);
  box-shadow: 0 0 8px rgba(255, 140, 30, 0.7);
  animation: xp-fill 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes xp-fill { from { width: 0; } }

.act-body h3 {
  margin-bottom: 0.45rem;
  font-family: var(--gothic);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
}
.act-body p { max-width: 40rem; margin: 0; }

.when-inline {
  margin-left: 0.4rem;
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--amber);
  white-space: nowrap;
}

.sidequest {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: center;
  max-width: 40rem;
  margin-top: 1.25rem;
  padding: 0.75rem;
  border: 1px solid var(--iron);
  background: linear-gradient(to bottom, #2c1e12, #0b0806);
  box-shadow: inset 0 0 0 1px #000;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sidequest:hover {
  color: var(--text);
  border-color: var(--orange);
  box-shadow: inset 0 0 0 1px #000, 0 0 24px rgba(255, 122, 26, 0.35);
}
.sidequest picture { display: block; border: 1px solid #000; box-shadow: 0 0 0 1px var(--trim); }
.sidequest img { width: 100%; }
.sq-body { display: grid; gap: 0.2rem; }
.sq-kicker { color: var(--magic); font-family: var(--gothic); font-weight: 700; font-size: 0.85rem; }
.sq-title { color: var(--unique); font-family: var(--gothic); font-weight: 700; font-size: 1.2rem; }
.sq-text { font-size: 0.95rem; color: var(--muted); }
.sq-meta { font-family: var(--mono); font-size: 1.15rem; color: var(--amber); }
.sidequest:hover .sq-meta { text-shadow: var(--glow-amber); }
@media (max-width: 520px) {
  .sidequest { grid-template-columns: 1fr; }
}

.continue {
  display: inline-block;
  padding: 0.3rem 0;
  margin-left: 0.5rem;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--amber);
  text-shadow: var(--glow-amber);
  animation: blink 1.2s steps(1) infinite;
}

/* The road so far: map and stops */

.journey {
  margin-top: 3.5rem;
  display: grid;
  gap: 1.5rem 2.5rem;
  align-items: center;
}
@media (min-width: 900px) {
  .journey { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
}

/* The map fades into the page at its edges, like the portrait. */
.map {
  position: relative;
  margin: 0;
  aspect-ratio: 800 / 710;
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}
.map-base, .map-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-overlay { overflow: visible; }

.sea {
  fill: var(--unique);
  fill-opacity: 0.5;
  font-family: var(--gothic);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-anchor: middle;
}
.compass circle { fill: none; stroke: var(--trim); stroke-width: 1.2; }
.c-star { fill: #2a1f14; stroke: var(--unique); stroke-width: 1; }
.c-north { fill: var(--orange); }
.c-n { fill: var(--gold); font-family: var(--gothic); font-weight: 800; font-size: 13px; text-anchor: middle; }

.route-glow {
  fill: none;
  stroke: rgba(255, 122, 26, 0.25);
  stroke-width: 7;
  stroke-linecap: round;
  filter: blur(3px);
}
.route {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 8 7;
  filter: drop-shadow(0 0 3px rgba(255, 110, 20, 0.9));
}
.route-detour {
  stroke: var(--amber);
  stroke-width: 2.2;
  stroke-dasharray: 1 8;
}
.traveller { fill: #ffe0a0; filter: drop-shadow(0 0 6px #ff8a2a); }

.pin-halo { fill: rgba(255, 122, 26, 0.18); }
.pin-ring { fill: #251910; stroke: var(--amber); stroke-width: 2; filter: drop-shadow(0 0 4px rgba(255, 140, 0, 0.8)); }
.pin-num { fill: var(--amber); font-family: var(--mono); font-size: 16px; text-anchor: middle; }
.pin-label {
  fill: var(--text);
  font-family: var(--gothic);
  font-size: 17px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #0b0806;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.pin-amsterdam .pin-halo { animation: here 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes here {
  from { transform: scale(0.7); opacity: 1; }
  to { transform: scale(2.2); opacity: 0; }
}
.here {
  fill: var(--amber);
  font-family: var(--mono);
  font-size: 18px;
  paint-order: stroke;
  stroke: #0b0806;
  stroke-width: 4px;
}
@media (max-width: 520px) {
  .pin-label, .sea, .here, .compass { display: none; }
  .pin-body { transform: scale(1.9); }
}
.pin.is-lit .pin-ring { stroke: #fff2d6; fill: #2a1a0c; }
.pin.is-lit .pin-halo { fill: rgba(255, 150, 40, 0.45); }

.stops { margin: 0; padding: 0; list-style: none; }
.stops li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.9rem;
  position: relative;
  padding: 0 0 1.4rem;
}
.stops li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 1.2rem;
  top: 2.4rem;
  bottom: 0.2rem;
  border-left: 2px dashed rgba(255, 122, 26, 0.45);
  margin-left: -1px;
}
.stops .stop-detour::after { border-left-style: dotted; }
.stop-pin {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 2px solid var(--amber);
  border-radius: 50%;
  background: #251910;
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--amber);
}
.stop-here .stop-pin { border-color: #ffd29a; box-shadow: 0 0 16px rgba(255, 140, 0, 0.9); }
.stop-when { margin: 0.15rem 0 0.1rem; font-family: var(--mono); font-size: 1.2rem; line-height: 1.2; color: var(--amber); }
.stops h4 { margin: 0 0 0.25rem; font-family: var(--gothic); font-size: 1.2rem; font-weight: 700; color: var(--gold); }
.stops p:last-child { margin: 0; color: var(--muted); font-size: 0.95rem; }
.stops li.is-lit h4 { color: #fff2d6; text-shadow: 0 0 12px rgba(255, 140, 0, 0.6); }

/* Quest log and publications */

.log > li, .pubs > li {
  display: grid;
  gap: 0.25rem 2rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
@media (min-width: 640px) {
  .log > li, .pubs > li { grid-template-columns: 10rem minmax(0, 1fr); }
}

.when {
  font-family: var(--mono);
  font-size: 1.3rem;
  line-height: 1.3;
  color: var(--amber-dim);
  white-space: nowrap;
}
/* Active quests glow. */
.log .current .when { color: var(--amber); text-shadow: var(--glow-amber); }
.log .current .when::after {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.55rem;
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
  transform: rotate(45deg);
  vertical-align: 0.15em;
}

.log h3 { margin-bottom: 0.15rem; }
.where { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.98rem; }
.log li p:last-child { margin-bottom: 0; }
.log li > div > p:not(.where) { max-width: 44rem; }

.subhead {
  margin: 3rem 0 0.75rem;
  font-family: var(--gothic);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--orange);
}

.log-compact > li { padding: 1rem 0; }

.plain li {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.5rem;
  max-width: 44rem;
}
.plain li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.85em;
  width: 0.4rem;
  height: 0.4rem;
  background: var(--unique);
  transform: rotate(45deg);
}

.pub-title {
  display: inline-block;
  padding: 0.15rem 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
}
.pub-title:hover { color: var(--orange); text-decoration: underline; }
/* External links wear an arrow; screen readers hear "opens in a new tab" instead (aria-describedby). */
.pub-title::after { content: "\00a0\2197"; content: "\00a0\2197" / ""; color: var(--orange); }
.venue { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.98rem; }

.more { margin: 1.75rem 0 0; }
.more a { display: inline-block; padding: 0.3rem 0; }
.more a::after { content: " \2192"; }

/* Inventory: GitHub projects as items */

.inventory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.item {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  height: 100%;
  padding: 0.8rem;
  border: 1px solid var(--iron);
  background: linear-gradient(to bottom, #2b1d11, #1d140c);
  box-shadow: inset 0 0 0 1px #000;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.item-slot {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid #2a3a5a;
  background: radial-gradient(circle at 50% 40%, #121a2c, #05070c 80%);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 12px rgba(0, 0, 0, 0.9);
  font-family: var(--mono);
  font-size: 1.25rem;
  color: var(--unique);
}
.item-tool .item-slot { color: var(--magic); }
.item-body { display: grid; gap: 0.1rem; }
.item-name { font-family: var(--gothic); font-weight: 700; color: var(--unique); }
.item-tool .item-name { color: var(--magic); }
.item-desc { color: var(--muted); font-size: 0.93rem; line-height: 1.45; }
.item-meta { font-family: var(--mono); font-size: 1.1rem; color: #8f7a55; }
/* Hovering an item lights its slot, like picking it up in an old inventory. */
.item:hover { color: var(--text); border-color: var(--trim); box-shadow: inset 0 0 0 1px #000, 0 0 22px rgba(90, 120, 200, 0.18); }
.item:hover .item-slot { background: radial-gradient(circle at 50% 40%, #22345a, #0a1020 80%); border-color: #4f6fa8; }

/* Waypoints */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.85rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  padding: 1rem 1.15rem 1rem 3.7rem;
  border: 1px solid var(--iron);
  background: linear-gradient(to bottom, #2c1e12, #20160d);
  box-shadow: inset 0 0 0 1px #000, inset 0 1px 0 rgba(255, 220, 160, 0.06);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* A waypoint lights up blue when you touch it. */
.tile:hover {
  color: var(--text);
  border-color: var(--waypoint);
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px var(--waypoint), 0 0 24px rgba(90, 168, 255, 0.35), inset 0 0 22px rgba(90, 168, 255, 0.12);
}
.tile::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1.85rem;
  height: 1.85rem;
  transform: translateY(-50%);
  background: var(--rune) center / contain no-repeat;
  filter: drop-shadow(0 0 4px rgba(255, 122, 26, 0.6));
  transition: filter 0.2s;
}
.tile:hover::before { filter: hue-rotate(190deg) saturate(1.4) drop-shadow(0 0 6px rgba(90, 168, 255, 0.9)); }
.tile-label {
  font-family: var(--gothic);
  font-weight: 700;
  color: var(--unique);
}
.tile:hover .tile-label { color: #d6e9ff; }
.tile-label::after { content: "\00a0\2197"; content: "\00a0\2197" / ""; color: var(--orange); }
.tile-meta {
  font-family: var(--mono);
  font-size: 1.2rem;
  line-height: 1.2;
  color: var(--muted);
}

.contact { color: var(--muted); margin: 0; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--iron);
  background: var(--bg-deep);
  padding: 2rem 0 2.5rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.footer-inner p { margin: 0; }

.copyright { color: var(--muted); font-size: 0.95rem; }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.badge {
  display: inline-flex;
  align-items: stretch;
  min-width: 88px;
  height: 31px;
  border: 1px solid var(--trim);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  line-height: 1;
}
.badge b {
  display: flex;
  align-items: center;
  padding: 0 0.4rem;
  background: var(--orange);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 400;
}
.badge span {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 0 0.45rem;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
}
.badge:nth-child(2) b { background: var(--amber); }
.badge:nth-child(3) b { background: var(--blood); color: #fff; }

.hint {
  font-family: var(--mono);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: #9a8560;
  cursor: help;
}

/* ---------- Ambience toggle ---------- */

.music {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.8rem 0.3rem 0.35rem;
  border: 1px solid var(--trim);
  border-radius: 999px;
  background: rgba(8, 6, 4, 0.88);
  box-shadow: 0 0 0 1px #000, 0 8px 20px rgba(0, 0, 0, 0.6);
  color: var(--amber-dim);
  font-family: var(--mono);
  font-size: 1.2rem;
  line-height: 1;
}
.music:hover { color: var(--amber); border-color: var(--orange); }
/* Fixed in the corner only where the margin can hold it; elsewhere it would cover the start of
   text lines, so it sits in the hero's top corner instead. */
@media (max-width: 1419px), (max-height: 500px) {
  .music {
    position: absolute;
    top: calc(var(--topbar-h) + 0.75rem);
    right: max(12px, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: auto;
    z-index: 40;  /* scrolls away under the top bar */
  }
}
/* On phones, just the orb: the label stays for screen readers. */
@media (max-width: 520px) {
  .music { padding: 0.3rem; }
  .music-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
.music-orb {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #ffe6b0 0, #c98a3a 30%, #5a3a18 75%, #1a0f06 100%);
  box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #241b12;
}
.music[aria-pressed="true"] { color: var(--amber); text-shadow: var(--glow-amber); }
.music[aria-pressed="true"] .music-orb {
  background: radial-gradient(circle at 38% 34%, #fff0c8 0, #ffb050 22%, #ff7a1a 45%, #b83c00 80%, #4a1500 100%);
  animation: orb 2.2s ease-in-out infinite;
}
@keyframes orb {
  0%, 100% { box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #241b12, 0 0 8px rgba(255, 120, 20, 0.6); }
  50% { box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #241b12, 0 0 20px rgba(255, 140, 30, 1); }
}

/* ---------- Toast and cheat mode ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 95;
  max-width: calc(100% - 2 * var(--gutter));
  padding: 0.6rem 1rem;
  border: 1px solid var(--amber);
  background: #080502;
  box-shadow: 0 0 24px rgba(255, 140, 20, 0.35);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 1.3rem;
  line-height: 1.25;
  text-align: center;
  text-shadow: var(--glow-amber);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 1rem);
  transition: opacity 0.2s, transform 0.2s, visibility 0s 0.2s;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 0.2s, transform 0.2s;
}

/* Konami code: hell difficulty. */
.turbo .embers i { animation-duration: 2.6s; background: #ff6a4a; box-shadow: 0 0 8px 3px rgba(255, 40, 10, 0.9); }
.turbo .sk-glow ellipse { fill: #ff3b1f; }
.turbo .cyr { color: #ff6a5a; animation: none; text-shadow: 0 0 4px #ff2a1a, 0 0 16px rgba(255, 20, 0, 0.9), 0 0 40px rgba(200, 0, 0, 0.7); }
.turbo .hero { --sky-3: #6a1a1a; --sky-4: #b0301a; --sky-5: #e05a2a; }

/* ---------- 404 ---------- */

.lost {
  min-height: calc(100vh - var(--topbar-h));
  min-height: calc(100svh - var(--topbar-h));
  display: flex;
  flex-direction: column;
}
.lost .hero { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.lost .hero-inner { grid-template-columns: 1fr; padding-bottom: 3rem; }
.lost h1 { margin-bottom: 0.75rem; }
.lost .code {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: clamp(5rem, 22vw, 10rem);
  line-height: 0.9;
  color: var(--amber);
  text-shadow: 0 0 10px var(--orange), 0 0 40px rgba(255, 77, 0, 0.6);
}

/* ---------- Preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .embers { display: none; }
}
.lite *, .lite *::before, .lite *::after { animation: none !important; transition: none !important; }
/* Set by main.js on the hero and on each section while out of view. */
.is-resting *, .is-resting *::before, .is-resting *::after { animation-play-state: paused !important; }
.lite .embers { display: none; }

@media (forced-colors: active) {
  .metal {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
    filter: none;
  }
  .crt, .skyline { display: none; }
}

@media print {
  .topbar, .crt, .skyline, .site-footer, .toast, .music { display: none; }
  .section > .wrap { content-visibility: visible; }
  body { background: #fff; color: #000; }
  .metal { background: none; color: #000; -webkit-text-fill-color: #000; filter: none; }
  a, h2, h3, .t-mods, .t-unique, .t-base { color: #000; }
}
