/* Dark Age website (tools/site_build.py). Colours follow the game's UITokens.gd. */
@font-face { font-family: "Forum"; src: url("fonts/Forum-Regular.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Variable.woff") format("woff"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0a0b0f;
  --surface: #14161c;
  --surface-2: #1b1e26;
  --text: #f5eddb;
  --text-2: #c7bdad;
  --muted: #948c80;
  --gold: #dbb352;
  --gold-hover: #f5d67a;
  --rim: rgba(240, 214, 140, .28);
  --rim-strong: rgba(209, 173, 92, .65);
  --atk: #e0a24a;
  --hp: #d0524a;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); }
h1, h2, h3 { font-family: "Forum", Georgia, serif; font-weight: 400; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); color: var(--gold); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--gold-hover); outline-offset: 2px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 10px var(--gutter); background: rgba(10, 11, 15, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rim);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: "Forum", Georgia, serif; font-size: 1.35rem; white-space: nowrap; }
.brand img { border-radius: 7px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--text-2); padding: 6px 12px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--gold); }
.lang { border: 1px solid var(--rim); border-radius: 6px; padding: 4px 10px; font-size: .85rem; color: var(--text-2); }
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 6px 12px; padding-bottom: 6px; }
  .brand span { font-size: 1.2rem; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -8px; }
  .lang { margin-left: auto; }
}

/* Sections */
main { min-height: 70vh; }
.band { padding: clamp(36px, 6vw, 72px) var(--gutter); max-width: 1240px; margin: 0 auto; }
.band.narrow { max-width: 860px; }
.band.head { padding-bottom: 12px; }
.band > h2 { text-align: center; margin-bottom: 1.2em; }
.band.head > h1, .band.head > .lead { text-align: center; }
.lead { font-size: 1.15rem; color: var(--text-2); max-width: 760px; margin-left: auto; margin-right: auto; }
.center { justify-content: center; }

/* Hero */
.hero { position: relative; min-height: min(92vh, 860px); display: flex; align-items: flex-end; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 11, 15, .25) 0%, rgba(10, 11, 15, .55) 55%, var(--bg) 100%),
              url("img/keyart.webp") center 30% / cover no-repeat;
}
@media (max-width: 700px) {
  .hero-bg { background-image: linear-gradient(180deg, rgba(10, 11, 15, .2) 0%, rgba(10, 11, 15, .7) 55%, var(--bg) 100%), url("img/keyart_tall.webp"); }
}
.hero-inner { position: relative; padding: 120px var(--gutter) 56px; max-width: 900px; margin: 0 auto; text-align: center; }
.kicker {
  display: inline-block; text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; color: var(--gold-hover); margin-bottom: 14px;
  padding: 4px 12px; border-radius: 999px; background: rgba(10, 11, 15, .72); border: 1px solid var(--rim);
}
.hero h1 { display: flex; flex-direction: column; gap: 4px; text-shadow: 0 2px 24px rgba(0, 0, 0, .8); }
.title-main { font-size: clamp(3rem, 9vw, 5.6rem); }
.title-sub { font-size: clamp(1.1rem, 2.6vw, 1.6rem); color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
.hero .lead { font-size: clamp(1.15rem, 2.4vw, 1.45rem); color: var(--text); text-shadow: 0 2px 12px rgba(0, 0, 0, .9); }
.hero-text { color: var(--text-2); max-width: 640px; margin: 0 auto 28px; text-shadow: 0 1px 8px rgba(0, 0, 0, .9); }

/* Downloads */
.dl-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.dl {
  display: flex; flex-direction: column; align-items: flex-start; min-width: 200px; padding: 12px 22px;
  border-radius: var(--radius); border: 1px solid var(--rim-strong); background: rgba(20, 22, 28, .82); color: var(--text);
  text-align: left; transition: transform .15s, border-color .15s, background .15s;
}
a.dl:hover { transform: translateY(-2px); border-color: var(--gold-hover); color: var(--text); background: rgba(40, 34, 20, .9); }
.dl-windows, .dl-android { background: linear-gradient(180deg, #e2bd5e, #b88e33); border-color: #f0d27c; color: #1a1408; }
a.dl-windows:hover, a.dl-android:hover { background: linear-gradient(180deg, #f2d27a, #c99c3c); color: #1a1408; }
.dl-name { font-family: "Forum", Georgia, serif; font-size: 1.45rem; line-height: 1.2; }
.dl-note { font-size: .82rem; opacity: .8; }
.dl-soon { opacity: .6; border-style: dashed; }
.dl-hint { margin: 14px auto 0; font-size: .86rem; color: var(--muted); max-width: 620px; text-align: center; }
.cta { text-align: center; }

/* Features */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--rim); border-radius: var(--radius); padding: 22px; }
.feature h3 { color: var(--gold); }
.feature p { color: var(--text-2); margin: 0; }
.modes { padding-left: 1.2em; color: var(--text-2); }
.modes li { margin-bottom: .5em; }
.modes li::marker { color: var(--gold); }

.screens { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.screens figure { margin: 0; }
.screens img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--rim); }
.screens figcaption { color: var(--muted); font-size: .88rem; padding-top: 6px; text-align: center; }

/* Chips & tabs */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 18px; }
.chip {
  --accent: var(--gold);
  font: inherit; font-size: .9rem; cursor: pointer; padding: 5px 14px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: transparent; color: var(--text-2);
}
.chip:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); border-color: var(--accent); }
.tabs { display: flex; justify-content: center; gap: 6px; margin: 18px 0 14px; }
.tabs button {
  font: inherit; font-family: "Forum", Georgia, serif; font-size: 1.25rem; cursor: pointer; padding: 6px 20px;
  background: transparent; color: var(--text-2); border: 0; border-bottom: 2px solid transparent;
}
.tabs button small { font-family: "Inter", sans-serif; font-size: .75rem; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--gold); border-bottom-color: var(--gold); }
.search {
  display: block; width: min(460px, 100%); margin: 0 auto; padding: 10px 14px; font: inherit;
  background: var(--surface); color: var(--text); border: 1px solid var(--rim); border-radius: var(--radius);
}
.search::placeholder { color: var(--muted); }

/* Bestiary grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.page-bestiary .band { max-width: 1560px; }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .grid-heroes { grid-template-columns: repeat(2, 1fr); } }
.grid-heroes { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 22px; }
.tile {
  --accent: var(--gold);
  position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; cursor: pointer; text-align: left;
  font: inherit; color: var(--text); background: var(--surface); border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); transition: transform .15s, border-color .15s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.tile img, .tile .no-art { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; background: var(--surface-2); }
.tile-hero img, .tile-hero .no-art { aspect-ratio: 1; }
.detail-text .summons { color: var(--gold); }
.tile-tier {
  position: absolute; top: 8px; left: 8px; min-width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; font-size: .82rem; font-weight: 600; background: rgba(10, 11, 15, .85); color: var(--accent); border: 1px solid var(--accent);
}
.tile-body { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; flex: 1; }
.tile-name { font-family: "Forum", Georgia, serif; font-size: 1.08rem; line-height: 1.2; }
.tile-meta { font-size: .78rem; color: var(--muted); }
.tile-stats { display: flex; gap: 10px; margin-top: auto; padding-top: 4px; font-size: .9rem; }
.tile-stats b { font-weight: 600; }
.atk { color: var(--atk); } .atk::before { content: "⚔ "; font-weight: 400; }
.hp { color: var(--hp); } .hp::before { content: "♥ "; font-weight: 400; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Details dialog */
.detail {
  width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--rim-strong); border-radius: 14px;
}
.detail::backdrop { background: rgba(0, 0, 0, .72); }
.detail > form { display: contents; }
.detail[open] { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; }
.detail-art img { width: 100%; height: 100%; object-fit: cover; min-height: 100%; }
.detail-body { padding: 26px 28px; }
.detail-meta { color: var(--muted); font-size: .92rem; }
.detail-text p { color: var(--text-2); }
.detail-text h3 { font-size: 1.15rem; color: var(--gold); margin-top: 1.1em; }
.detail-text dl { margin: 0; }
.detail-text dt { color: var(--gold); font-weight: 600; }
.detail-text dd { margin: 0 0 .6em; color: var(--text-2); }
.detail-text .ability { white-space: pre-line; color: var(--text); }
.detail-text .skill { margin: 0 0 .5em; color: var(--text-2); }
.detail-text .skill-tier { margin: 1em 0 .4em; font: 600 .78rem/1 "Inter", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.detail-text .skill em { font-style: normal; color: var(--muted); font-size: .85rem; }
.close {
  position: absolute; top: 8px; right: 10px; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--rim); background: rgba(10, 11, 15, .8); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
@media (max-width: 680px) {
  .detail[open] { grid-template-columns: 1fr; }
  .detail-art img { max-height: 44vh; object-position: center 20%; }
  .detail-body { padding: 20px; }
}

/* Guide */
.rules .rule { border-left: 2px solid var(--rim-strong); padding: 2px 0 2px 20px; margin-bottom: 26px; }
.rules .rule h2 { font-size: 1.6rem; }
.rules p { color: var(--text-2); }
.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 0; }
.kw { background: var(--surface); border: 1px solid var(--rim); border-radius: var(--radius); padding: 14px 16px; }
.kw dt { font-family: "Forum", Georgia, serif; font-size: 1.2rem; color: var(--gold); }
.kw dd { margin: 4px 0 0; color: var(--text-2); font-size: .95rem; }

/* World */
.factions { display: grid; gap: 18px; }
.faction {
  --accent: var(--gold);
  display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: center; padding: 18px;
  background: var(--surface); border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.faction h3 { color: var(--accent); font-size: 1.7rem; }
.faction p { color: var(--text-2); }
.faction-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.faction-art img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; }
@media (max-width: 680px) {
  .faction { grid-template-columns: 1fr; }
  .faction-art img { aspect-ratio: 3 / 4; max-height: 170px; object-position: center 20%; }
  .dl { width: min(320px, 100%); }
}
.hero-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.hero-card { background: var(--surface); border: 1px solid var(--rim); border-radius: var(--radius); overflow: hidden; }
.hero-card img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.hero-card h3, .hero-card p { padding: 0 16px; }
.hero-card h3 { margin-top: 14px; color: var(--gold); }
.hero-card p { color: var(--text-2); font-size: .94rem; }
.book p { color: var(--text-2); text-align: center; }

/* Footer */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 26px var(--gutter);
  border-top: 1px solid var(--rim); color: var(--muted); font-size: .88rem;
}
.foot-links { display: flex; gap: 18px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile, .dl { transition: none; }
}
