/* New Mystery of the Emblem script site.
   Deep midnight-blue palette (darker and more saturated than FE4's pale icy
   blue, per request), 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: #060d15;
  --bg-2: #0b1726;
  --column: #050a11;       /* near-black navy behind the script column */
  --ink: #0b1724;
  --paper: #e4ecf5;
  --paper-edge: #2a4566;
  --gold: #4a8fd1;          /* accent - a deeper, more saturated blue than FE4's pale #7ec8e3 */
  --gold-rgb: 74, 143, 209;
  --text: #cfdcea;
  --muted: #5d7693;
  --line: #1c2e42;

  /* character portraits */
  --portrait-w: 96px;
  --portrait-w-mobile: 60px;
  --portrait-ratio: 3 / 4;
  --portrait-bg: #0b1726;
  --portrait-filter: contrast(1.1) saturate(1.05) brightness(0.95);

  /* dialogue box accents */
  --box-inset: #f2f6fb;
  --box-hover-border: #1d3d5c;
  --box-on-bg: #c7ddf4;
  --box-on-border: #2a5c8c;
  --narration-bg: #080f18;
  --narration-border: #2a4566;
  --narration-inset: #11202f;
  --narration-hover-border: #3a6690;
  --narration-on-bg: #0f2234;

  /* header + translation panel */
  --header-bg: rgba(6, 13, 21, 0.95);
  --knob-on: #1a3350;
  --note-cond: #6fa8dd;
  --backdrop: rgba(2, 5, 9, 0.75);
  --panel-bg: #0a1420;
  --panel-text-soft: #b9cbdd;
  --ref-text: #c7d6e4;
}

/* ---------- pixel borders + splotchy fill after the DS battle windows ----------
   The translation panel uses the hand-drawn img/new-border.png; the header,
   footer and column-side strips are cut from it by tools/make_fe12_borders.py
   (2x game pixels), so they all match. Same layout as the other games'
   style.css (keep them in step). */
:root {
  --frame: 6px;            /* header/footer edge: the frame's 3-px top/bottom band at 2x */
  --side: 4px;             /* column sides: the frame's 2-px side line at 2x */
  --tex: 192px;
  --page-bg: #020408;
  --page-bg-top: #0c1826;
}

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; }

body {
  position: relative;
  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:
      url("../img/border/edge-left.png") calc(50% - 406px) 0 / var(--side) 2px repeat-y,
      url("../img/border/edge-right.png") calc(50% + 406px) 0 / var(--side) 2px repeat-y,
      var(--page-bg) linear-gradient(180deg, var(--page-bg-top), var(--page-bg)) fixed;
    image-rendering: pixelated;
  }
  body > * { image-rendering: auto; }
}

.gloss {
  /* new-border.png is hand-drawn at 1px per game pixel (29x29), shown at 2x.
     Slices (top right bottom left): 17 13 11 11 - the top ornaments are
     taller than the bottom ones, and the strip that repeats is row 17
     (down the sides) and columns 11-15 (along the top and bottom). */
  border-style: solid; border-color: transparent; border-width: 34px 26px 22px 22px; border-radius: 0;
  background: var(--column) url("../img/border/texture.png") 0 0 / var(--tex) repeat;
  border-image: url("../img/new-border.png") 17 13 11 11 / 34px 26px 22px 22px repeat;
  image-rendering: pixelated;
}
.gloss > * { image-rendering: auto; }
@media (min-width: 1300px) {
  .gloss { border-radius: 0; left: calc(50% + 410px + 20px); width: min(360px, calc(50vw - 410px - 44px)); }
}

/* chapter sidebar: hidden for now, matching the other games - the markup is
   still generated (tools/sidebar.py) and styled in base.css. */
.side-nav { display: none; }

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;
  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, .kris-toggle { font-size: 0.68rem; padding: 3px 9px 3px 5px; gap: 6px; }
  .furi-toggle .knob, .en-toggle .knob, .kris-toggle .knob { width: 22px; height: 12px; }
  .furi-toggle .knob::after, .en-toggle .knob::after, .kris-toggle .knob::after { width: 8px; height: 8px; }
  .furi .furi-toggle .knob::after, .eng .en-toggle .knob::after, .kris-f .kris-toggle .knob::after { transform: translateX(10px); }
}

/* Player-named protagonist (Kris): the script often carries both of his
   voicings for a line back to back (see render_scene() in
   tools/build_fe12.py, and the .kris-toggle wiring in js/site.js) - default
   to the male line, flip to the female one when the toggle is on. Scoped
   to this game only; Thracia/FE4/FE6's protagonists aren't player-gendered. */
.turn.branch-f { display: none; }
html.kris-f .turn.branch-f { display: flex; }
html.kris-f .turn.branch-m { display: none; }
/* same knob/pressed-state look as .furi-toggle/.en-toggle (defined in base.css) */
.kris-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 7px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font-size: 0.78rem; cursor: pointer; }
.kris-toggle:hover, .kris-toggle:focus-visible { border-color: var(--gold); }
.kris-f .kris-toggle { color: var(--gold); border-color: var(--gold); }
.kris-toggle .knob { width: 26px; height: 14px; border-radius: 7px; background: var(--line); position: relative; transition: background 0.15s; }
.kris-toggle .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.kris-f .kris-toggle .knob { background: var(--knob-on); }
.kris-f .kris-toggle .knob::after { transform: translateX(12px); background: var(--gold); }

/* random character art in the bottom-left corner (js/art.js, images from
   img/art/) - same as the other games, empty img/art/ for now so it just
   shows nothing until art is dropped in. */
.art-track { display: none; }
@media (min-width: 1300px) {
  .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 - 410px - 16px));
    object-fit: contain; object-position: left bottom;
    opacity: 0.55;
  }
}

/* portraits: gold frame to match the panel/column edges (new-border.png's
   gold and dark brown); dialogue boxes keep the blue --paper-edge */
.who img, .gloss-who img { border-color: #b88858; }
.who img { outline-color: #402818; }
