/* ───────────────────────── EDITORIAL CHESS — palettes ─────────────────────────
   Two committed moods.
   • Dark "Inkwell": late-night reading room. Ink-deep walls, candle-warm accents.
   • Light "Folio":  old paper, espresso letterpress, oxblood seal.            */

:root,
:root[data-theme="dark"] {
  --bg:           #0c0a08;
  --bg-tint:      #100d0a;
  --surface:      #16120e;
  --surface-2:    #1e1813;
  --surface-3:    #2a2218;
  --rule:         rgba(244, 234, 210, .08);
  --rule-strong:  rgba(244, 234, 210, .22);

  --ink:          #f1e5c7;     /* old paper warmth */
  --ink-soft:     #d6c399;
  --ink-dim:      #948060;
  --ink-faint:    #5a4d3a;

  --accent:       #d96a2f;     /* burnt orange — the "seal" */
  --accent-deep:  #a64a18;
  --accent-soft:  rgba(217, 106, 47, .12);
  --accent-glow:  rgba(217, 106, 47, .35);
  --gilt:         #b18a3d;     /* aged gilt — secondary */

  --win:          #8db576;
  --lose:         #c46757;
  --draw:         #c19a55;

  --piece-light-fill:   #ece1c2;
  --piece-light-stroke: #0c0a08;
  --piece-dark-fill:    #1a130d;
  --piece-dark-stroke:  #ece1c2;

  --board-light:  #d9c08a;
  --board-dark:   #6b4824;
  --board-frame:  #1e1813;
  --board-last:   rgba(217, 106, 47, .26);
  --board-highlight: rgba(217, 106, 47, .42);
  --board-check:  rgba(196, 103, 87, .65);
  --board-legal:  rgba(217, 106, 47, .55);

  --shadow-card:  0 18px 50px -22px rgba(0, 0, 0, .9), 0 2px 0 rgba(244, 234, 210, .04) inset;

  /* SVG noise used as backdrop grain (data URI; ≈700b) */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.32 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

:root[data-theme="light"] {
  --bg:           #ece1c2;     /* parchment */
  --bg-tint:      #e5d8b3;
  --surface:      #f6ecd1;
  --surface-2:    #e5d6ad;
  --surface-3:    #d8c590;
  --rule:         rgba(50, 32, 18, .14);
  --rule-strong:  rgba(50, 32, 18, .28);

  --ink:          #1a120a;
  --ink-soft:     #3d2c18;
  --ink-dim:      #6d5634;
  --ink-faint:    #a99066;

  --accent:       #8c2114;     /* oxblood seal */
  --accent-deep:  #5d1208;
  --accent-soft:  rgba(140, 33, 20, .10);
  --accent-glow:  rgba(140, 33, 20, .25);
  --gilt:         #875e26;

  --win:          #2f6033;
  --lose:         #8c2114;
  --draw:         #6f521b;

  --piece-light-fill:   #f6ecd1;
  --piece-light-stroke: #1a120a;
  --piece-dark-fill:    #1a120a;
  --piece-dark-stroke:  #f6ecd1;

  --board-light:  #e9d6a4;
  --board-dark:   #8c6a3c;
  --board-frame:  #1a120a;
  --board-last:   rgba(140, 33, 20, .22);
  --board-highlight: rgba(140, 33, 20, .38);
  --board-check:  rgba(140, 33, 20, .55);
  --board-legal:  rgba(140, 33, 20, .50);

  --shadow-card:  0 14px 32px -22px rgba(50, 32, 18, .55);

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.05' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.20 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* board presets */
:root[data-board="ocean"] {
  --board-light: #d4dbe4;
  --board-dark:  #5b6f8c;
}
:root[data-board="mint"] {
  --board-light: #d6dbb4;
  --board-dark:  #5a7344;
}
:root[data-board="violet"] {
  --board-light: #d8c8e0;
  --board-dark:  #5e4877;
}
:root[data-board="graphite"] {
  --board-light: #c4bfb6;
  --board-dark:  #36322c;
}

/* piece color hooks (used by SVG <use> color) */
.square.dark .piece-w, .square.light .piece-w, .piece-mini.piece-w svg {
  color: var(--piece-light-fill);
  --piece-stroke: var(--piece-light-stroke);
}
.square.dark .piece-b, .square.light .piece-b, .piece-mini.piece-b svg {
  color: var(--piece-dark-fill);
  --piece-stroke: var(--piece-dark-stroke);
}
