/* Genealogy of the Holy War script site.
   Light-blue palette (a cooler, calmer counterpoint to Thracia's brown and
   FE6's crimson), kept to the same dark, bordered-parchment look otherwise.

   Everything structural lives in ../../css/base.css (shared by every game) -
   this file is just the knobs: retune the look by changing values below,
   not by editing base.css. */
@import url("../../css/base.css");

:root {
  /* core palette */
  --bg: #0f1f2e;
  --bg-2: #16304a;
  --column: #284c76;       /* blue behind the script column (texture.png sits on top) */
  --ink: #102230;
  --paper: #eaf6fb;
  --paper-edge: #1f6fa0;
  --gold: #7ec8e3;          /* accent - named --gold for drop-in parity with Thracia/FE6's CSS */
  --gold-rgb: 126, 200, 227;
  --text: #dceaf0;
  --muted: #8fb4c8;
  --line: #2c5770;

  /* character portraits */
  --portrait-w: 96px;         /* same box as Thracia: the portraits are 48x64 */
  --portrait-w-mobile: 60px;
  --portrait-ratio: 3 / 4;
  --portrait-bg: #16304a;
  --portrait-filter: contrast(1.12) saturate(1.05) brightness(0.96);

  /* dialogue box accents */
  --box-inset: #ffffff;
  --box-hover-border: #15567a;
  --box-on-bg: #cdeefc;
  --box-on-border: #1f6fa0;
  --narration-bg: #0d1b26;
  --narration-border: #3a6a85;
  --narration-inset: #17303f;
  --narration-hover-border: #52a0c2;
  --narration-on-bg: #16384a;

  /* header + translation panel */
  --header-bg: rgba(16, 30, 42, 0.95);
  --knob-on: #1f4a63;
  --note-cond: #4fb3e0;
  --backdrop: rgba(4, 9, 14, 0.72);
  --panel-bg: #102233;
  --panel-text-soft: #c3dce8;
  --ref-text: #ccdfe8;
}

/* ---------- pixel borders + splotchy fill ----------
   Same layout as Thracia's and FE6's style.css (keep them in step). frame.png
   is hand-drawn; the edge strips (cut from it) and texture.png (Thracia's
   splotches in light blue) come from tools/make_fe4_borders.py (2x game pixels). */
:root {
  --frame: 14px;           /* the frame's edge strip: 7 game px at 2x */
  --tex: 192px;            /* one splotch tile: 96 game px at 2x */
  /* outside the centre column: dark navy, so the blue column stands
     out; a slight fade from --page-bg-top down to --page-bg */
  --page-bg: #0c1a2e;
  --page-bg-top: #21426b;
}

header.site {
  border-bottom: 0; padding-bottom: var(--frame);
  background:
    url("../img/border/edge-bottom.png") repeat-x left bottom / 4px var(--frame),
    var(--column) url("../img/border/texture.png") 0 0 / var(--tex) repeat;
  image-rendering: pixelated;
}
header.site > * { image-rendering: auto; }

/* centre column: a band of the splotchy fill, with a frame stripe either side
   whose inner edge sits on the band's edge, 404px from centre. The band is a
   pseudo-element so the texture can be clipped to it; below 840px it simply
   fills the width. */
body {
  position: relative;
  /* fixed: the fade spans the window, not the whole (very long) page */
  background: var(--page-bg) linear-gradient(180deg, var(--page-bg-top), var(--page-bg)) fixed;
}
body::before {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: 0;
  left: max(0px, calc(50% - 404px)); right: max(0px, calc(50% - 404px));
  background: var(--column) url("../img/border/texture.png") 0 0 / var(--tex) repeat;
  image-rendering: pixelated;
}
@media (min-width: 840px) {
  body {
    /* background-position % aligns the image's own midpoint, hence 404 + 7 */
    background:
      url("../img/border/edge-left.png") calc(50% - 411px) 0 / var(--frame) 4px repeat-y,
      url("../img/border/edge-right.png") calc(50% + 411px) 0 / var(--frame) 4px repeat-y,
      var(--page-bg) linear-gradient(180deg, var(--page-bg-top), var(--page-bg)) fixed;
    image-rendering: pixelated;
  }
  body > * { image-rendering: auto; }
}

/* translation panel: the hand-drawn frame, same splotchy fill darkened a
   little so the text is easier on the eyes */
.gloss {
  border: 14px solid transparent; border-radius: 0;
  background:
    linear-gradient(rgba(8, 16, 34, 0.35), rgba(8, 16, 34, 0.35)),
    var(--column) url("../img/border/texture.png") 0 0 / var(--tex) repeat;
  /* frame.png is hand-drawn at 3 image px per game pixel: 21px (7 game px)
     corners around a 6px (2 game px) edge strip, shown at 2x (14px corners) */
  border-image: url("../img/frame.png") 21 / 14px repeat;
  image-rendering: pixelated;
}
.gloss > * { image-rendering: auto; }
@media (min-width: 1300px) {
  .gloss { border-radius: 0; left: calc(50% + 418px + 20px); width: min(340px, calc(50vw - 418px - 44px)); }
}

/* chapter sidebar: hidden for now. The markup is still generated
   (tools/sidebar.py) and styled in base.css - delete this rule to bring it back. */
.side-nav { display: none; }

/* footer: full width, styled like the header (texture + frame stripe on top) */
footer.site {
  width: auto; margin: 64px 0 0; padding: calc(var(--frame) + 14px) 24px 24px;
  border-top: 0; text-align: center;
  position: relative; z-index: 2;   /* above the corner art (z-index 1) */
  background:
    url("../img/border/edge-top.png") repeat-x left top / 4px var(--frame),
    var(--column) url("../img/border/texture.png") 0 0 / var(--tex) repeat;
  image-rendering: pixelated;
}
footer.site > * { image-rendering: auto; }
footer.site p { max-width: 760px; margin: 0.3em auto; text-align: center; }

/* header: the game logo (img/logo.png) in place of the text title */
.title-group.logo { display: block; line-height: 0; padding: 14px 0 10px; }
.title-group.logo img { display: block; height: 110px; width: auto; }
/* back link + toggles sit in the top corners rather than level with the logo */
header.site .bar { align-items: start; }
.all-games, nav.tools { margin-top: 16px; }
@media (max-width: 640px) {
  /* phones: same three columns, smaller links, toggles stacked */
  header.site .bar { gap: 8px; padding-inline: 12px; }
  .title-group.logo { padding: 10px 0 8px; }
  .title-group.logo img { height: 80px; }
  .all-games, nav.tools { margin-top: 10px; }
  .all-games { font-size: 0.75rem; letter-spacing: 0.02em; }
  nav.tools { flex-direction: column; align-items: flex-end; gap: 6px; }
  .furi-toggle, .en-toggle { font-size: 0.68rem; padding: 3px 9px 3px 5px; gap: 6px; }
  .furi-toggle .knob, .en-toggle .knob { width: 22px; height: 12px; }
  .furi-toggle .knob::after, .en-toggle .knob::after { width: 8px; height: 8px; }
  .furi .furi-toggle .knob::after, .eng .en-toggle .knob::after { transform: translateX(10px); }
}

/* random character art in the bottom-left corner (js/art.js, images from
   img/art/). Desktop only: it sits in the empty left margin beside the column. */
.art-track { display: none; }
@media (min-width: 1300px) {
  /* runs from the page top down to the footer's top edge (js/art.js sets
     its bottom to the footer height); the art sticks to the window bottom
     inside it, so it rides along while scrolling and stops at the footer */
  .art-track {
    display: flex; flex-direction: column; justify-content: flex-end;
    position: absolute; z-index: 1; top: 0; left: 0; bottom: 0; pointer-events: none;
  }
  .corner-art {
    display: block; position: sticky; bottom: 0;
    width: auto; height: auto; max-height: min(55vh, 460px);
    max-width: min(300px, calc(50vw - 418px - 16px));   /* never overlap the centre column */
    object-fit: contain; object-position: left bottom;
    opacity: 0.55;                           /* let it blend into the background */
  }
}
