/* Binding Blade script site.
   Crimson/red palette (the game's own box art and "Binding Blade" emblem lean red),
   kept close to Thracia's 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. (The support-conversation grid/accordion rules
   also live in base.css, var()-driven like everything else, even though
   only FE6 uses them today - harmless for the other games, and ready to
   reuse as-is if FE7 supports ever happen.) */
@import url("../../css/base.css");

:root {
  /* core palette */
  --bg: #241414;
  --bg-2: #3a1818;
  --column: #170c0c;       /* darker red-brown behind the script column */
  --ink: #2a1210;
  --paper: #f6e8dc;
  --paper-edge: #6a2020;
  --gold: #e36b6b;         /* accent - named --gold for drop-in parity with Thracia's CSS */
  --gold-rgb: 227, 107, 107;
  --text: #e8dcdc;
  --muted: #c29e9e;
  --line: #6a3b3b;

  /* character portraits */
  --portrait-w: 132px;
  --portrait-w-mobile: 76px;
  --portrait-ratio: 6 / 5;
  --portrait-bg: #3a1818;
  --portrait-filter: contrast(1.18) saturate(1.12) brightness(0.92);

  /* dialogue box accents */
  --box-inset: #fff3ec;
  --box-hover-border: #8a2b2b;
  --box-on-bg: #ffd4c8;
  --box-on-border: #b83030;
  --narration-bg: #1c1010;
  --narration-border: #7d3b3b;
  --narration-inset: #3b2020;
  --narration-hover-border: #a95252;
  --narration-on-bg: #3b1616;

  /* header + translation panel */
  --header-bg: rgba(48, 27, 27, 0.95);
  --knob-on: #6b2323;
  --note-cond: #e0a0a0;
  --backdrop: rgba(10, 4, 4, 0.72);
  --panel-bg: #261717;
  --panel-text-soft: #dcc8c8;
  --ref-text: #e8d6d6;
}

/* ---------- pixel borders + diamond fill after the game's battle windows ----------
   Same layout as Thracia's style.css (keep the two in step). frame.png is
   hand-drawn; the edge strips and texture.png come from tools/make_fe6_borders.py
   (2x game pixels). */
:root {
  --frame: 4px;            /* the frame's edge stripe: 2 game px at 2x */
  --tex: 32px;             /* one diamond tile: 16 game px at 2x */
  /* outside the centre column: near-black red-brown, so the diamond column
     stands out; a slight fade from --page-bg-top down to --page-bg */
  --page-bg: #0d0606;
  --page-bg-top: #2a1414;
}

header.site {
  border-bottom: 0; padding-bottom: var(--frame);
  background:
    url("../img/border/edge-bottom.png") repeat-x left bottom / 2px 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 diamond 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 + 2 */
    background:
      url("../img/border/edge-left.png") calc(50% - 406px) 0 / var(--frame) 2px repeat-y,
      url("../img/border/edge-right.png") calc(50% + 406px) 0 / var(--frame) 2px 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 diamond fill */
.gloss {
  border: 14px solid transparent; border-radius: 0;
  background: var(--column) url("../img/border/texture.png") 0 0 / var(--tex) repeat;
  /* frame.png is hand-drawn at 1x: 7px corners around a 1px edge strip,
     shown at 2x (14px corners) */
  border-image: url("../img/frame.png") 7 / 14px repeat;
  image-rendering: pixelated;
}
.gloss > * { image-rendering: auto; }
@media (min-width: 1300px) {
  .gloss { border-radius: 0; left: calc(50% + 408px + 20px); width: min(340px, calc(50vw - 408px - 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 / 2px 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 - 408px - 16px));   /* never overlap the centre column */
    object-fit: contain; object-position: left bottom;
    opacity: 0.55;                           /* let it blend into the background */
  }
}
