/* site.css - Cold Light's web pages (2026-10-08): the game's own look (its palette, pixel fonts and Dragon Quest window
   frame) on top of Bootstrap 5.3. Colours are from tools/coldlight/assetgen/palette.py; the window frame is the game's
   9-slice ui/window-dq.png, used with border-image the way game/css/game.css does. */

@font-face { font-family: "Press Start 2P"; src: url("../../assets/fonts/pressstart2p/PressStart2P-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("../../assets/fonts/pixelifysans/PixelifySans[wght].ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  --cl-ground: #0c0c14;      /* the game's black */
  --cl-outline: #1a1424;
  --cl-line: #c4c4d4;        /* stone highlight: body text */
  --cl-white: #ffffff;
  --cl-gold: #e6b32e;
  --cl-gold-light: #f8dc6a;
  --cl-dusk: #08145a;        /* uiblue shadow, the sky at dusk */
  --cl-pixel-font: "Press Start 2P", monospace;
  --cl-text-font: "Pixelify Sans", system-ui, sans-serif;
  --cl-window: url("/uploads/game/ui/window-dq.png");
  --cl-sprite-scale: 1;      /* walking sprites are 64x96; whole multiples keep the pixels square */
}

body.cl-page { margin: 0; background: var(--cl-ground); color: var(--cl-line); font-family: var(--cl-text-font); font-size: 1.125rem; }

/* a game window: black fill, white frame, drawn from the game's own 48x48 frame image */
.cl-win {
  border: 16px solid transparent; border-image: var(--cl-window) 16 fill / 16px stretch;
  image-rendering: pixelated; color: var(--cl-white); text-shadow: 2px 2px 0 #000;
}

/* ---- the banner: the plains at dusk, the logo, Play now, the party walking along the bottom */
.cl-banner { position: relative; overflow: hidden; min-height: min(100svh, 760px); display: flex; flex-direction: column; isolation: isolate; }
.cl-banner::before {   /* the battle background, dimmed to dusk */
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: var(--cl-sky) center bottom / cover no-repeat; image-rendering: pixelated;
  filter: brightness(0.42) saturate(0.75) hue-rotate(-12deg);
}
.cl-banner::after {    /* night coming down from the top, and the ground fading into the page below */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(8, 20, 90, 0.65) 0%, rgba(8, 20, 90, 0.15) 45%, rgba(12, 12, 20, 0) 70%, var(--cl-ground) 100%);
}
.cl-banner-inner { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: clamp(24px, 6vh, 64px); padding-bottom: 24px; }

.cl-glow {             /* the cold light, low on the horizon at the right */
  position: absolute; right: 14%; top: 38%; width: calc(64px * 2); height: auto; z-index: -1;
  image-rendering: pixelated; filter: drop-shadow(0 0 18px rgba(170, 220, 255, 0.7));
}

.cl-logo { width: min(100%, 720px); margin: 0 0 12px; }
.cl-logo img { display: block; width: 100%; height: auto; image-rendering: pixelated; }

.cl-hook { max-width: 36rem; margin: 0 auto 24px; font-size: 1.25rem; line-height: 1.5; color: var(--cl-white); text-shadow: 2px 2px 0 #000; }

/* Play now: a game window with the hand cursor pointing at it on hover and keyboard focus */
.cl-play {
  position: relative; display: inline-block; padding: 10px 28px 10px 44px; margin-bottom: 18px;
  font-family: var(--cl-pixel-font); font-size: clamp(1rem, 3.5vw, 1.375rem); line-height: 1.6; text-decoration: none;
}
.cl-play:hover, .cl-play:focus-visible { color: var(--cl-gold-light); }
.cl-play:focus-visible { outline: 3px solid var(--cl-gold); outline-offset: 4px; }
.cl-cursor { position: absolute; left: 4px; top: 50%; width: 32px; height: 32px; margin-top: -16px; image-rendering: pixelated; visibility: hidden; }
.cl-play:hover .cl-cursor, .cl-play:focus-visible .cl-cursor { visibility: visible; }
/* Play now with the manual beside it (Robin, 2026-10-16, after Xing's pair of buttons): a row that wraps on a phone, and
   the quieter twin a step smaller, in the body text's colour until the hover turns it gold like Play now */
.cl-play-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 18px; margin-bottom: 18px; }
.cl-play-row .cl-play { margin-bottom: 0; }
.cl-play-quiet { color: var(--cl-line); font-size: clamp(0.8rem, 2.8vw, 1.05rem); padding: 9px 22px 9px 40px; }

.cl-controls, .cl-saves { margin: 0 0 6px; text-shadow: 2px 2px 0 #000; }
.cl-keys { white-space: nowrap; }
.cl-saves { margin-bottom: 18px; }

/* a returning player's newest save */
.cl-continue { display: flex; align-items: center; gap: 16px; max-width: 30rem; padding: 6px 14px; text-align: left; font-size: 1rem; }
.cl-continue[hidden] { display: none; }
.cl-continue-sprite { flex: none; width: 64px; height: 96px; image-rendering: pixelated; }
.cl-continue-how { color: var(--cl-line); }

/* phones and tablets without a keyboard or controller */
.cl-touch { max-width: 30rem; margin-bottom: 18px; padding: 6px 14px; font-size: 1rem; }
.cl-link-button { background: none; border: 0; padding: 0; color: var(--cl-gold-light); text-decoration: underline; font: inherit; }

/* the hero and the six from the Wandering Boar, walking in place on the grass */
.cl-party { display: flex; justify-content: center; gap: calc(12px * var(--cl-sprite-scale)); padding: 0 16px clamp(16px, 4vh, 40px); }
.cl-party img { width: calc(64px * var(--cl-sprite-scale)); height: calc(96px * var(--cl-sprite-scale)); image-rendering: pixelated; }

@media (max-width: 575.98px) {
  .cl-party img:nth-child(n+5) { display: none; }   /* the hero and three companions fit a phone at 1x */
  .cl-glow { right: 4px; top: 4px; width: 64px; }   /* the text fills a phone's banner: the light goes up in the corner of the sky */
}
@media (min-width: 1200px) {
  :root { --cl-sprite-scale: 2; }
}

/* ---- the sections below the banner (step 2, 2026-10-08) */
.cl-main { padding-bottom: 64px; }
.cl-section { padding-top: 56px; }
.cl-heading {
  margin: 0 0 28px; text-align: center; font-family: var(--cl-pixel-font); font-size: clamp(1rem, 3.2vw, 1.5rem); line-height: 1.6;
  color: var(--cl-gold-light); text-shadow: 3px 3px 0 var(--cl-outline);
}
.cl-lead { font-size: 1.25rem; color: var(--cl-white); }

/* "The story so far": the opening pages in one window, then people of Willowbrook in dialog windows with the name above */
.cl-story { max-width: 46rem; margin: 0 auto; padding: 10px 18px; font-size: 1.2rem; line-height: 1.6; }
.cl-story p:last-child { margin-bottom: 0; }
.cl-quote { position: relative; display: flex; gap: 20px; align-items: center; max-width: 46rem; margin: 52px auto 0; padding: 8px 14px; font-size: 1.125rem; line-height: 1.5; }
.cl-quote-portrait { flex: none; width: 112px; height: 112px; border: 2px solid var(--cl-line); }   /* inked portraits, not pixel art: smooth scaling */
.cl-speaker { position: absolute; left: 12px; top: -38px; padding: 0 10px; background: var(--cl-ground); color: var(--cl-white); font-size: 1.125rem; }
.cl-signature { margin: 10px 0 0; text-align: right; color: var(--cl-line); }   /* the name a note is signed with */

/* "Choose your hero": the big portrait and the looks as buttons; the picked one walks towards you. On a phone the portrait
   sits between the text and the looks, so it stays in view while a look is picked; wider, it stands at the left. */
.cl-hero-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px 32px; justify-items: center; grid-template-areas: "lead" "portrait" "looks"; }
.cl-hero-lead { grid-area: lead; margin: 0; }
.cl-hero-portrait { grid-area: portrait; width: 192px; height: auto; }
.cl-looks { grid-area: looks; display: grid; grid-template-columns: repeat(auto-fill, 72px); gap: 4px; width: 100%; max-width: calc(7 * 72px + 6 * 4px); }   /* at most 7 in a row: 7 + 7 */
@media (min-width: 768px) {
  .cl-hero-layout { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "portrait lead" "portrait looks"; align-items: center; justify-items: start; }
  .cl-hero-portrait { width: 256px; }
}
.cl-look { padding: 2px; line-height: 0; background: none; border: 2px solid transparent; border-radius: 0; }
.cl-look img { width: 64px; height: 96px; image-rendering: pixelated; }
.cl-look:hover { border-color: var(--cl-line); }
.cl-look[aria-pressed="true"] { border-color: var(--cl-gold); background: rgba(230, 179, 46, 0.12); }
.cl-look:focus-visible { outline: 3px solid var(--cl-gold); outline-offset: 2px; }

@media (max-width: 575.98px) {
  .cl-quote { gap: 14px; }
  .cl-quote-portrait { width: 72px; height: 72px; }
  .cl-class-card h3 { font-size: 0.625rem; }   /* "Lamplighter" fits a half-width card */
}
@media (max-width: 767.98px) {
  .cl-looks { justify-content: center; }   /* one column: the looks centred under the portrait */
}

/* ---- step 3 (2026-10-08): the six at the Wandering Boar, then the other classes */
.cl-companion { flex: 1; max-width: none; margin: 52px 0 0; align-items: flex-start; }
#companions .col { display: flex; }   /* the two windows in a row are the same height */
.cl-companion blockquote p { margin-bottom: 0.4em; }
.cl-companion blockquote p:last-child { margin-bottom: 0; }
.cl-class { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--cl-gold-light); }
.cl-class img, .cl-class-card h3 img { width: 32px; height: 32px; image-rendering: pixelated; }
.cl-note { max-width: 46rem; margin: 32px auto 0; text-align: center; }

.cl-class-card { height: 100%; padding: 6px 8px; text-align: center; }
/* a class's portrait: the pictures are stacked, and a new one fades in on top of the last (site/js/site.js) */
.cl-card-portrait { position: relative; width: 100%; max-width: 192px; aspect-ratio: 1 / 1; margin: 4px auto 10px; border: 2px solid var(--cl-line); overflow: hidden; }
.cl-card-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 1.5s ease-in-out; }
.cl-class-card h3 {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; margin: 0 0 8px;
  font-family: var(--cl-pixel-font); font-size: 0.75rem; line-height: 1.6; color: var(--cl-gold-light);
}
.cl-class-card p { margin: 0; font-size: 1rem; line-height: 1.4; }

/* ---- step 4 (2026-10-08): one turn of a battle, laid out in the game's own 1024 x 576 screen pixels. --u is one screen
   pixel at the frame's width (container units, so it scales without a script); positions follow scenes/battle.js: the
   floor line at y 400, the message window at 64,16 (896 wide), the party panel at the bottom left (640 wide) and the
   command menu at x 660 (240 wide). The turn plays on a 6 s loop: the menu asks, then the skill lands. */
.cl-battle { max-width: 1024px; margin: 0 auto; }
.cl-battle-stage {
  position: relative; container-type: inline-size; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--cl-ground); outline: 2px solid var(--cl-outline); --u: calc(100cqw / 1024);
}
.cl-battle-stage img { image-rendering: pixelated; }
.cl-battle-bg { position: absolute; left: 0; top: 0; width: 100%; height: calc(var(--bg-h, 448) * var(--u)); }   /* --bg-h and --floor: the background's own, from the bundle */
.cl-battle-monster {
  position: absolute; left: calc((var(--x) - var(--w) / 2) * var(--u)); top: calc((var(--floor, 400) - var(--h)) * var(--u));
  width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u));
}
.cl-battle-stage .cl-win {
  position: absolute; box-sizing: border-box; border-width: calc(16 * var(--u)); border-image-width: calc(16 * var(--u));
  padding: calc(4 * var(--u)) calc(10 * var(--u)); line-height: 1.25; text-shadow: calc(2 * var(--u)) calc(2 * var(--u)) 0 #000;
}
.cl-battle-msg { left: calc(64 * var(--u)); top: calc(16 * var(--u)); width: calc(896 * var(--u)); height: calc(137.5 * var(--u)); font-size: calc(26 * var(--u)); }
.cl-battle-msg span { position: absolute; left: calc(10 * var(--u)); right: calc(10 * var(--u)); top: calc(4 * var(--u)); }

.cl-battle-party {
  left: 0; bottom: 0; width: calc(640 * var(--u)); min-height: calc(160 * var(--u)); font-size: calc(18 * var(--u));
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: calc(12 * var(--u));
}
.cl-battle-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: calc(6 * var(--u)); row-gap: calc(3 * var(--u)); align-content: start; }
.cl-battle-head { grid-column: 1 / -1; display: flex; align-items: center; gap: calc(6 * var(--u)); min-width: 0; }
.cl-battle-stage .cl-battle-portrait { flex: none; width: calc(40 * var(--u)); height: calc(40 * var(--u)); image-rendering: auto; }
.cl-battle-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(16 * var(--u)); }
.cl-battle-emblem { flex: none; width: calc(24 * var(--u)); height: calc(24 * var(--u)); }
.cl-battle-label, .cl-battle-num { font-size: calc(16 * var(--u)); }
.cl-bar { position: relative; height: calc(18 * var(--u)); background: url("/uploads/game/ui/bar-empty.png") 0 0 / 100% 100%; image-rendering: pixelated; }
.cl-bar span { position: absolute; inset: 0; background: url("/uploads/game/ui/bar-hp.png") 0 0 / 100% 100%; clip-path: inset(0 calc(100% - var(--pct) * 1%) 0 0); }
.cl-bar-mp span { background-image: url("/uploads/game/ui/bar-mp.png"); }

.cl-battle-menu {   /* a little smaller than the game's 26 px, so the monster on the right is not hidden behind it */
  left: calc(660 * var(--u)); bottom: 0; width: calc(240 * var(--u)); font-size: calc(21 * var(--u)); line-height: 1.2 !important;
  padding-left: calc(48 * var(--u)) !important;
}
.cl-battle-cmd { position: relative; }
.cl-battle-cursor { position: absolute; left: calc(-40 * var(--u)); top: 50%; width: calc(32 * var(--u)); height: calc(32 * var(--u)); margin-top: calc(-16 * var(--u)); }

.cl-battle-floats {   /* the hit's word and number over the target's head, in the game's float colours */
  position: absolute; left: calc(var(--x) * var(--u)); top: calc((var(--floor, 400) - var(--h) - 64) * var(--u)); translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; font-size: calc(28 * var(--u)); font-weight: bold; line-height: 1.1;
  text-shadow: calc(2 * var(--u)) calc(2 * var(--u)) 0 #000; opacity: 0;
}
.cl-flt { color: #ffe066; }
.cl-flt-weak { color: #ffb347; }
.cl-flt-resist { color: #c8d8ff; }

.cl-battle-ask, .cl-battle-menu { animation: cl-turn-ask 6s infinite; }
.cl-battle-act { opacity: 0; animation: cl-turn-act 6s infinite; }
.cl-battle-target { animation: cl-turn-hit 6s infinite; }
.cl-battle-floats { animation: cl-turn-float 6s infinite; }
@keyframes cl-turn-ask { 0%, 48% { opacity: 1; } 50%, 98% { opacity: 0; } 100% { opacity: 1; } }
@keyframes cl-turn-act { 0%, 48% { opacity: 0; } 50%, 96% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes cl-turn-hit {
  0%, 54%, 64%, 100% { translate: 0 0; filter: none; }
  56% { translate: calc(-6 * var(--u)) 0; filter: brightness(1.5) sepia(1) saturate(6) hue-rotate(-25deg); }
  58% { translate: calc(6 * var(--u)) 0; filter: brightness(1.5) sepia(1) saturate(6) hue-rotate(-25deg); }
  60% { translate: calc(-4 * var(--u)) 0; }
  62% { translate: calc(3 * var(--u)) 0; }
}
@keyframes cl-turn-float {
  0%, 56% { opacity: 0; translate: -50% 0; }
  58% { opacity: 1; translate: -50% 0; }
  80% { opacity: 1; translate: -50% calc(-18 * var(--u)); }
  92%, 100% { opacity: 0; translate: -50% calc(-34 * var(--u)); }
}
@media (prefers-reduced-motion: reduce) {
  .cl-battle-stage * { animation: none !important; }   /* the menu asking, standing still */
}

/* the battle's points, with the game's hand cursor for bullets */
.cl-points { max-width: 46rem; margin: 28px auto 0; padding: 0; list-style: none; }
.cl-points li { margin-bottom: 10px; padding-left: 40px; background: url("/uploads/game/ui/cursor-0.png") 0 2px / 24px 24px no-repeat; image-rendering: pixelated; }

/* the bestiary strip: each monster standing on a faint pool of light, idling as in battle */
.cl-monster-card { height: 100%; padding: 6px 10px; text-align: center; }
.cl-monster-art {
  display: flex; align-items: flex-end; justify-content: center; height: 136px; margin-bottom: 8px;
  background: radial-gradient(ellipse at 50% 92%, rgba(196, 196, 212, 0.14), transparent 60%);
}
.cl-monster-art img { max-width: 100%; height: auto; image-rendering: pixelated; }
.cl-monster-card h3 { margin: 0 0 2px; font-family: var(--cl-pixel-font); font-size: 0.75rem; line-height: 1.6; color: var(--cl-gold-light); }
.cl-monster-card p { margin: 0; font-size: 1rem; line-height: 1.4; }
.cl-monster-card .cl-monster-family { margin-bottom: 6px; font-size: 0.875rem; opacity: 0.75; }

/* ---- step 5 (2026-10-08): the feature cards, each with game art at twice its size, and the teasers from across the sea */
.cl-feature { height: 100%; padding: 8px 12px; }
.cl-feature-art { display: flex; align-items: flex-end; justify-content: center; gap: 16px; height: 136px; margin-bottom: 8px; }
.cl-feature-art img { image-rendering: pixelated; }
.cl-feature h3, .cl-teasers h3 {
  margin: 0 0 8px; text-align: center; font-family: var(--cl-pixel-font); font-size: 0.8rem; line-height: 1.6; color: var(--cl-gold-light);
}
.cl-feature p { margin: 0; line-height: 1.5; }
.cl-teasers { max-width: 46rem; margin: 40px auto 0; padding: 10px 18px; }
.cl-teasers .cl-points { margin-top: 12px; }
.cl-teasers .cl-points li:last-child { margin-bottom: 0; }

/* ---- step 6 (2026-10-08): how to play, the controls in two game windows and the notes under them */
.cl-controls-card { height: 100%; padding: 8px 14px; }
.cl-controls-card h3 { margin: 0 0 10px; text-align: center; font-family: var(--cl-pixel-font); font-size: 0.8rem; line-height: 1.6; color: var(--cl-gold-light); }
.cl-controls-card dl { margin: 0; }
.cl-controls-card dt { font-weight: normal; color: var(--cl-white); }
.cl-controls-card dt small { color: var(--cl-line); font-size: 0.875rem; }
.cl-controls-card dd { margin: 0 0 10px; color: var(--cl-line); }
.cl-controls-card dd:last-of-type { margin-bottom: 0; }
.cl-controls-note { margin: 12px 0 0; font-size: 0.95rem; color: var(--cl-line); }
.cl-page kbd {   /* a key: a small dark cap in the game's colours; a plain monospace face, as the pixel font's Z reads as a 2 */
  display: inline-block; min-width: 1.6em; padding: 0 6px; text-align: center; font-family: ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: 0.85em;
  color: var(--cl-white); background: var(--cl-outline); border: 1px solid #6b6b80; border-bottom-width: 3px; border-radius: 3px; box-shadow: none;
}
.cl-play-notes { margin-bottom: 32px; }
.cl-link { color: var(--cl-gold-light); }   /* a plain link in the page's text */
