/* Dungeon Keeper 2: Abyssal site. All frames, panels, bars and the heading font are the game's own
   interface art (public/ui/, built by scripts/build-ui-assets.py). Body text stays a real text font. */
/* the screenshot stage and its controls set display, which beat their hidden attribute (owner 2026-10-07: the Terrain
   section's empty stage stayed visible); scoped, not global: the 3D main menu fades out WITH hidden set (menu3d.css) */
.stage[hidden], .stage-ctl[hidden] { display: none !important; }
:root {
  --ink: #e9e0c9;
  --muted: #b9ab8c;
  --gold: #e2bd62;
  --gold-hi: #f6e3a1;
  --blood: #c0392b;
  --link: #f0c96a;
  --stone: #121110;
  --panel-text: #efe6cf;
  --focus: #ffd96b;
  /* the game's own cursors (scripts/build-cursors.py): the open Keeper hand, the pointing hand over anything clickable */
  /* the idle hand is animated in the game: site.js steps --cur through cursor-idle-NN.png (frame 00 is the still) */
  --cur: url('/ui/cursor-idle-00.png') 1 12, auto;
  --cur-point: url('/ui/cursor-point.png') 0 2, pointer;
  /* owner 2026-10-06: every text on the site in the game's own font (scripts/build-webfont.py: FONT_FRONTEND28 traced) */
  --serif: 'DK2 Frontend', Georgia, 'Palatino Linotype', 'Book Antiqua', serif;
}
@font-face { font-family: 'DK2 Frontend'; src: url('/fonts/dk2-frontend.woff2') format('woff2'); font-display: swap; }
input, button, textarea, select { font-family: inherit; }
* { box-sizing: border-box; }
html { color-scheme: dark; }
/* 3D site (js/boot.js marks html.dk3d when WebGL works): the plain page is never drawn; the page stays black until the
   3D hall is ready (menu3d.js adds body.menu3d-on). Without WebGL (no dk3d) the plain page shows as a last resort. */
html.dk3d, html.dk3d body { background: #050404; }
html.dk3d body:not(.menu3d-on) > * { visibility: hidden; }
body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.6 var(--serif);
  background-color: var(--stone);
  background-image: url('/ui/body-tile.png');
  background-repeat: repeat;
  background-size: 128px 128px;
}
a { color: var(--link); }
a:hover { color: var(--gold-hi); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img { max-width: 100%; height: auto; }
.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: absolute; left: -999px; top: 8px; background: #000; color: var(--gold); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 16px; }

/* ---- frames (9-slice border-image from the game UI) ---- */
.panel {
  border-style: solid;
  border-width: 16px;
  border-image: url('/ui/panel-stone.png') 16 fill / 16px stretch;
  padding: 10px 14px;
  color: var(--panel-text);
}
.frame-gold { border-style: solid; border-width: 8px; border-image: url('/ui/panel-gold.png') 8 / 8px stretch; background: rgba(10, 8, 6, 0.82); }
.frame-silver { border-style: solid; border-width: 8px; border-image: url('/ui/panel-silver.png') 8 / 8px stretch; background: rgba(10, 8, 6, 0.82); }
/* every picture on the site sits in the creature portrait border */
.portrait { display: inline-block; border-style: solid; border-width: 8px; border-image: url('/ui/portrait.png') 8 / 8px stretch; background: #050404; line-height: 0; }
.portrait img, .portrait canvas { display: block; }

/* ---- bitmap headings (game font FONT_INGAME48 / FONT_FRONTEND28) ---- */
h1, h2, h3 { color: var(--gold); font-weight: normal; margin: 0.4em 0 0.3em; line-height: 1.2; }
.gf canvas { display: block; max-width: 100%; height: auto; }
.gf canvas + canvas { margin-top: 2px; }

/* ---- header, funding bar, nav ---- */
.site-head { padding: 14px 0 6px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > div { flex: 1; min-width: 0; }
.brand h1, .brand p { margin: 0; }
.brand .sub { color: var(--muted); font-size: 15px; }
.fund { margin: 10px 0; padding: 8px 12px; }
.fund-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 6px; font-size: 15px; }
.fund-row strong { color: var(--gold-hi); font-size: 18px; }
.bar {
  position: relative; height: 24px; overflow: hidden;
  background: url('/ui/progress-track.png') repeat-x 0 50% / 128px 40px;
  border: 1px solid #000; box-shadow: inset 0 0 6px #000;
}
.bar-fill {
  height: 100%; width: 0;
  background: url('/ui/progress-fill.png') repeat-x 0 50% / 128px 40px;
  filter: saturate(0.75) brightness(0.9);
  transition: width 1.2s ease-out;
}
.nav { margin: 10px 0 18px; padding: 0; }
.nav ul, .nav noscript ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; margin: 0; padding: 0; }
.nav noscript a { color: var(--gold); }

/* ---- DK buttons: the game's frame art + bitmap font ----
   unlit frame (silver) at rest, lit frame (gold) on hover / focus / selected, darker + pushed in when pressed.
   The label is two canvases (unlit and lit gold) drawn by site.js; the real text stays for screen readers. */
.dk-btn {
  display: inline-block; font: inherit; font-size: 16px; color: var(--panel-text); text-decoration: none; cursor: var(--cur-point);
  padding: 4px 12px; background: rgba(0, 0, 0, 0.62);
  border-style: solid; border-width: 8px; border-image: url('/ui/panel-silver.png') 8 / 8px stretch;
}
.dk-btn .dk-label { display: block; }
.dk-btn .dk-label:not(.gf) { padding: 6px 4px; color: var(--panel-text); }
.dk-btn .gf-lit { display: none; }
.dk-btn:hover, .dk-btn:focus-visible, .dk-btn[aria-current], .dk-btn[aria-pressed='true'] {
  border-image-source: url('/ui/panel-gold.png'); background: rgba(70, 46, 10, 0.55); color: var(--gold-hi);
}
.dk-btn:hover .gf-unlit, .dk-btn:focus-visible .gf-unlit, .dk-btn[aria-current] .gf-unlit, .dk-btn[aria-pressed='true'] .gf-unlit { display: none; }
.dk-btn:hover .gf-lit, .dk-btn:focus-visible .gf-lit, .dk-btn[aria-current] .gf-lit, .dk-btn[aria-pressed='true'] .gf-lit { display: block; }
.dk-btn[aria-current], .dk-btn[aria-pressed='true'] { background: rgba(120, 30, 160, 0.34); }
.dk-btn:active { background: rgba(0, 0, 0, 0.85); box-shadow: inset 0 0 8px #000; padding-top: 6px; padding-bottom: 2px; }
.dk-btn-inline { margin-top: 4px; }

main { padding-bottom: 32px; }
main > section { margin-bottom: 22px; }
.lede { font-size: 19px; color: var(--ink); }
.muted { color: var(--muted); }

/* ---- news ---- */
.post { margin-bottom: 18px; }
.post time { color: var(--muted); font-size: 15px; }
.post .body { white-space: pre-line; }
.post-pic { margin: 10px 0 0; max-width: 100%; }
.post-pic img { max-width: 100%; height: auto; }

/* ---- feature + milestone lists ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { padding: 12px 14px; }
.card h3 { font-size: 18px; color: var(--gold-hi); margin-top: 0; font-family: var(--serif); }
.card p { margin: 0; font-size: 16.5px; }
.milestones { list-style: none; padding: 0; margin: 0; }
.milestones li { padding: 6px 0 6px 28px; position: relative; border-bottom: 1px solid rgba(226, 189, 98, 0.15); }
.milestones li::before { content: ''; position: absolute; left: 4px; top: 13px; width: 12px; height: 12px; background: url('/ui/progress-fill.png') center / 64px 20px; border: 1px solid #000; transform: rotate(45deg); }

/* ---- gallery ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button, .btn {
  font: inherit; font-size: 16px; color: var(--panel-text); cursor: var(--cur-point);
  padding: 7px 18px; background: rgba(0, 0, 0, 0.55);
  border-style: solid; border-width: 8px; border-image: url('/ui/panel-silver.png') 8 / 8px stretch;
}
.tabs button[aria-selected='true'], .btn.primary { border-image-source: url('/ui/panel-gold.png'); color: var(--gold-hi); }
.tabs button:hover, .btn:hover { color: var(--gold-hi); background: rgba(40, 20, 50, 0.7); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; align-items: start; }
.stage { width: 100%; }
.stage canvas { width: 100%; height: auto; aspect-ratio: 4 / 3; background: radial-gradient(ellipse at 50% 70%, #2a2018 0%, #0b0908 70%); touch-action: pan-y; cursor: grab; }
.stage-ctl { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.stage-ctl .name { color: var(--gold-hi); font-size: 18px; }
.model-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.model-list li { display: block; }
/* W38b: the creature list is the game's portraits (64 x 128, the proportions kept), five to a row */
.model-list.portrait-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.portrait-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: var(--cur-point, pointer); line-height: 0; }
.portrait-btn img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 2; image-rendering: auto; }
.portrait-btn:hover img, .portrait-btn:focus-visible img { filter: brightness(1.25); }
/* owner 2026-10-07: the chosen creature's own riveted game frame turns gold (the hand-made silver -> gold mapping of
   panel-gold.png, scripts/build-portrait-gold.py), laid exactly over the portrait's frame; no outline */
.portrait-btn { position: relative; }
.portrait-btn[aria-pressed='true'] img { filter: brightness(1.15); }
.portrait-btn[aria-pressed='true']::after { content: ''; position: absolute; inset: 0; background: url('/ui/portrait-gold-frame.png') 0 0 / 100% 100% no-repeat; pointer-events: none; }
.dk-btn-list { width: 100%; text-align: left; padding: 3px 8px; }
.dk-btn-list small { display: block; color: var(--muted); font-size: 14.5px; padding: 0 2px 3px; }
.dk-btn-list:hover small, .dk-btn-list[aria-pressed='true'] small { color: var(--panel-text); }
.stage a { display: block; cursor: zoom-in; }
.stage img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: radial-gradient(ellipse at 50% 70%, #2a2018 0%, #0b0908 70%); }
.stage:focus-visible { outline-offset: 3px; }

/* ---- roadmap (W73): three plain lists, side by side on a wide screen, stacked on a phone ---- */
.road { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 26px; margin-top: 10px; }
.rm-group h3 { margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid rgba(226, 189, 98, 0.35); font-size: 21px; }
.rm-items { list-style: none; margin: 0; padding: 0; }
.rm-items li { position: relative; padding: 5px 0 5px 22px; line-height: 1.35; }
.rm-items li::before { content: ''; position: absolute; left: 3px; top: 11px; width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid #000; }
.rm-done li::before { background: var(--gold); }
.rm-next li::before { background: #d98b3a; }
.rm-maybe li::before { background: transparent; border-color: var(--muted); }
.rm-maybe li { color: var(--muted); }
@media (max-width: 720px) { .road { grid-template-columns: 1fr; } }
.status { display: inline-block; flex: none; font-size: 14px; letter-spacing: 0.3px; padding: 0 7px; border: 1px solid #5d5040; background: #0c0a09; color: var(--muted); white-space: nowrap; }
/* dark text on a light badge: the panel's black outline shadow (menu3d.css main) would smear it */
.status-done { color: var(--stone); background: var(--gold); border-color: #000; text-shadow: none; }
.status-testing { color: #fff; background: #5e2a86; border-color: #000; }
.status-progress { color: var(--stone); background: #d98b3a; border-color: #000; text-shadow: none; }
.status-reached { color: var(--gold-hi); border-color: var(--gold); }
.deliv .status { min-width: 84px; text-align: center; }

/* ---- participate ---- */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.tier { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.tier .amounts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.notice { padding: 10px 14px; margin-bottom: 14px; }
.small { font-size: 16px; }
/* W60 Download: two plain sentences, then the not-yet message in large type with a call-to-action button */
.dl-intro { font-size: 1.2em; line-height: 1.45; }
.dl-intro p { margin: 0 0 .6em; }
.dl-prank { font-size: 1.2em; line-height: 1.45; }
.dl-oops { color: var(--gold-hi); font-size: 1.3em; line-height: 1.25; margin: 0 0 .6em; outline: none; }
.dl-cta-row { margin: 18px 0 0; }
.dk-btn.dl-cta { border-image-source: url('/ui/panel-gold.png'); }
.dl-btn-row { margin: 14px 0 0; }
/* W71: the release-list form (Download message). The honeypot sits off-screen, not display:none, so bots still fill it. */
.dl-notify { margin: 0 0 .9em; padding: 10px 12px; border: 1px solid rgba(226, 189, 98, .3); border-radius: 10px; background: rgba(12, 10, 9, .6); font-size: 15px; line-height: 1.4; }
.notify-title { margin: 0 0 6px; color: var(--gold-hi); font-size: 1.05em; }
.notify-row { display: flex; gap: 8px; align-items: stretch; }
.notify-row input[type='email'] { flex: 1 1 auto; min-width: 0; width: auto; padding: 6px 8px; }
.notify-row .dk-btn { flex: 0 0 auto; }
.notify-msg { margin: 4px 0 0; min-height: 0; font-size: 14px; line-height: 1.3; }
.notify-msg:empty { display: none; }
.notify-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.plain-terms { margin-top: 16px; }
/* W60 About: what is already built, one plain list (owner: «specific additions shouldn't have their own titles») */
.built-list { margin: 0 0 8px; padding-left: 1.2em; }
.built-list li { margin: .3em 0; break-inside: avoid; }   /* W59: inside the tiers block (3D: its own grid cell under tier 3) */

/* ---- forms (admin) ---- */
label { display: block; margin: 8px 0 4px; }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='url'], textarea, select#news-image {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #0c0a09; border: 1px solid #5d5040; padding: 8px;
}
textarea { min-height: 140px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.adm-list { list-style: none; padding: 0; }
.adm-list li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(226, 189, 98, 0.15); flex-wrap: wrap; }
.adm-list input[type='text'] { width: auto; flex: 1 1 180px; }
.msg { min-height: 1.4em; color: var(--gold-hi); }
.msg.err { color: #ff8f7f; }

.demo-banner { background: #3b0f4a; color: #fff; text-align: center; padding: 6px; font-size: 14px; }
.site-foot { padding: 18px 0 30px; font-size: 14px; color: var(--muted); text-align: center; }
.site-foot a { color: var(--muted); }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .viewer { grid-template-columns: 1fr; }
  .dk-btn { padding: 3px 8px; }
  .model-list { display: grid; grid-template-columns: 1fr 1fr; }
  .milestone-bar { margin-left: 10px; margin-right: 10px; }
  .tick-amt { display: none; }
  .bar-wrap { padding-bottom: 30px; }
  .deliv li { flex-direction: column; gap: 3px; }
  .deliv .status { min-width: 0; }
  .panel { padding: 6px 8px; }
  .brand img { width: 40px; height: 40px; }
  .brand .sub { font-size: 14px; }
  .stage-ctl .name { order: -1; flex-basis: 100%; text-align: center; }
}
/* reduced motion (W46): no fades, slides or smooth scrolling anywhere on the site, plain or 3D (the 3D camera cuts and the candle
   flames hold still: menu3d.js, props.js) */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; transition-delay: 0s !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }

html { cursor: var(--cur); }
a, button, label, summary, select, [role='button'], [role='switch'], [role='tab'] { cursor: var(--cur-point); }

/* ---- legibility layer (owner 2026-10-11: «make sure the texts are well visible, maybe a little dark shadow behind») ----
   Measured with WCAG contrast against the rendered pixels around every glyph (the textured stone tiles and the 3D hall
   both varied from 1:1 to 4:1). A dark halo on every text (the 3D hall's backdrops are in menu3d/menu3d.css). The game-font canvases get their own halo in js/site.js drawLine. */
body { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.6); }
/* dark text on a light fill, form fields and the game's own buttons keep their own look: a dark halo would smear them */
input, textarea, select, option, .tick-n, .ms-num, .status-done, .status-progress, .status-testing, .demo-banner { text-shadow: none; }
.muted, .small, .post time, .ms-short-meta, .tick-amt, .site-foot { color: #cdbf9f; }
.brand .sub { color: #d2c4a4; }
.site-foot a { color: #d6c8a8; }
.status-reached { color: var(--gold-hi); }
/* the 3D hall's own legibility rules (backdrops behind the page text, the top and bottom bars, the music chip, the main menu, the
   pager) live in menu3d/menu3d.css, where the rest of the hall is styled */

/* ---- full-screen picture view (W71, DK.viewImage in js/site.js): the picture covers the whole screen; only the site's
   X stays, in its corner (the 3D hall's own .menu3d-back lifted above it, or the same art on the plain site) ---- */
.shot-full { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: #000; }
.shot-full img { display: block; width: 100%; height: 100%; object-fit: contain; }
body.shot-full-open { overflow: hidden; }
body.shot-full-open .menu3d-back { z-index: 31; }
.shot-full-x { position: fixed; z-index: 31; right: 22px; bottom: 54px; width: 48px; height: 48px; padding: 0; border: 0; cursor: var(--cur-point, pointer); background: url('/ui/cancel-normal.png') center / 48px 48px no-repeat; }
.shot-full-x:hover, .shot-full-x:focus-visible { background-image: url('/ui/cancel-hover.png'); }
.shot-full-x:active { background-image: url('/ui/cancel-pressed.png'); }
.shot-full-x:focus-visible { outline: 2px solid #ffe08a; outline-offset: 2px; }
@media (max-width:720px) { .shot-full-x { right: 10px; bottom: 44px; } }

/* W71 (owner 2026-10-20): New Terrain shows only the screenshot and the choice list (Muddy Water / Toxic Goo); the
   Prev / Next row and the status line under the picture are dropped (the list is the choice; arrow keys still step) */
#section-terrain .stage-ctl, #section-terrain #shot-status { display: none !important; }
/* W71 (owner 2026-10-20: the screenshots' black strips must be black everywhere): a screenshot's letterbox / pillarbox
   area is black, not the model viewer's brown radial backdrop */
#shots .stage img { background: #000; }
