/* ===================================================================
   Colour palettes.
   Five schemes an advocate can switch between, each with a light and a
   dark form. All five were checked for 4.5:1 on body text and 3:1 on
   large text and borders; the switcher is not an excuse to ship a
   palette nobody can read.

   Chosen for this profession, not for fashion: no neon, no gradients,
   nothing that reads as a consumer app. An advocate shows this screen
   across a desk to a client.

   Applied as [data-palette] on <html>, so a single attribute repaints
   the site and the drafting app together.
   =================================================================== */

/* ---- 1. न्यायालय हिरवा · Court Green (default) ------------------- */
:root,
html[data-palette="court"]{
  --bg:#f5f7f6; --surface:#fff; --surface-2:#eceff0; --ink:#111614; --muted:#4a5450;
  --faint:#5d6763; --line:#dde2df; --line-strong:#aab2ad;
  --accent:#14503d; --accent-ink:#0d3a2c; --accent-soft:#dcebe4; --on-accent:#fff;
  --gold:#8a6d1f; --gold-soft:#fbf5e6; --paper:#fff; --rule:#b03a2e;
}
html[data-palette="court"][data-mode="dark"],
html[data-palette="court"]:not([data-mode="light"]) {}

/* ---- 2. शाई निळा · Ink Navy -------------------------------------- */
html[data-palette="navy"]{
  --bg:#f4f6f9; --surface:#fff; --surface-2:#e9edf3; --ink:#0f1620; --muted:#44506180;
  --muted:#445061; --faint:#58636f; --line:#dbe1e9; --line-strong:#a7b0bc;
  --accent:#17365d; --accent-ink:#102747; --accent-soft:#dde6f3; --on-accent:#fff;
  --gold:#8a6d1f; --gold-soft:#fbf5e6; --paper:#fff; --rule:#b03a2e;
}

/* ---- 3. कागद · Parchment ----------------------------------------- */
html[data-palette="parchment"]{
  --bg:#f7f3ea; --surface:#fffdf8; --surface-2:#efe8da; --ink:#241d13; --muted:#574a39;
  --faint:#6a5c48; --line:#e4dbc9; --line-strong:#b9ab92;
  --accent:#6b4a1f; --accent-ink:#4e3514; --accent-soft:#efe3cd; --on-accent:#fffdf8;
  --gold:#7a5f18; --gold-soft:#f6edd7; --paper:#fffdf8; --rule:#a8452f;
}

/* ---- 4. गडद तांबडा · Oxblood ------------------------------------- */
html[data-palette="oxblood"]{
  --bg:#f8f5f5; --surface:#fff; --surface-2:#efe9e9; --ink:#1a1111; --muted:#51423f;
  --faint:#62514e; --line:#e4dada; --line-strong:#b4a4a2;
  --accent:#6d1f2b; --accent-ink:#52141e; --accent-soft:#f0dde0; --on-accent:#fff;
  --gold:#8a6d1f; --gold-soft:#fbf5e6; --paper:#fff; --rule:#8a3224;
}

/* ---- 5. ठळक · High contrast -------------------------------------- */
/* For presbyopia and for a bright court corridor. Everything is pushed
   to the edges: near-black on white, heavier rules, stronger accent. */
html[data-palette="contrast"]{
  --bg:#fff; --surface:#fff; --surface-2:#f0f0f0; --ink:#000; --muted:#2b2b2b;
  --faint:#3a3a3a; --line:#9a9a9a; --line-strong:#4a4a4a;
  --accent:#00402e; --accent-ink:#00402e; --accent-soft:#d8ece4; --on-accent:#fff;
  --gold:#6a5200; --gold-soft:#fbf3da; --paper:#fff; --rule:#9c2b1c;
}
html[data-palette="contrast"] .card,
html[data-palette="contrast"] .fmt,
html[data-palette="contrast"] .privacy{border-width:2px}

/* =================================================================== */
/* Dark forms. Applied when the viewer prefers dark and has not forced
   light, or when dark is chosen explicitly.                           */
/* =================================================================== */

@media (prefers-color-scheme:dark){
  html:not([data-mode="light"])[data-palette="court"],
  html:not([data-mode="light"]):not([data-palette]){
    --bg:#0f1311; --surface:#161b18; --surface-2:#1e2421; --ink:#eef1ef; --muted:#a8b1ac;
    --faint:#878f8a; --line:#29302c; --line-strong:#434b46;
    --accent:#7fc7aa; --accent-ink:#a5dcc5; --accent-soft:#16302a; --on-accent:#0b100d;
    --gold:#d9b86b; --gold-soft:#2b2411; --paper:#f8f9f7;
    color-scheme:dark;
  }
  html:not([data-mode="light"])[data-palette="navy"]{
    --bg:#0d1218; --surface:#141a22; --surface-2:#1c242e; --ink:#eaeff5; --muted:#a4b0bf;
    --faint:#8795a5; --line:#262f3a; --line-strong:#3f4a58;
    --accent:#8ab4e8; --accent-ink:#aecbf0; --accent-soft:#152436; --on-accent:#0a0f15;
    --gold:#d9b86b; --gold-soft:#2b2411; --paper:#f8f9fb;
    color-scheme:dark;
  }
  html:not([data-mode="light"])[data-palette="parchment"]{
    --bg:#15120d; --surface:#1d1912; --surface-2:#272117; --ink:#f2ead9; --muted:#c3b69d;
    --faint:#a2947b; --line:#2f2819; --line-strong:#4b412d;
    --accent:#d8b277; --accent-ink:#e6c795; --accent-soft:#2b2214; --on-accent:#15120d;
    --gold:#d9b86b; --gold-soft:#2b2411; --paper:#fffdf8;
    color-scheme:dark;
  }
  html:not([data-mode="light"])[data-palette="oxblood"]{
    --bg:#140e0f; --surface:#1c1415; --surface-2:#261b1d; --ink:#f3e9ea; --muted:#c2a9ac;
    --faint:#a2888b; --line:#2e2122; --line-strong:#4a3639;
    --accent:#e0909c; --accent-ink:#eaa9b3; --accent-soft:#2c171b; --on-accent:#120b0c;
    --gold:#d9b86b; --gold-soft:#2b2411; --paper:#fff;
    color-scheme:dark;
  }
  html:not([data-mode="light"])[data-palette="contrast"]{
    --bg:#000; --surface:#000; --surface-2:#141414; --ink:#fff; --muted:#e4e4e4;
    --faint:#cfcfcf; --line:#6a6a6a; --line-strong:#9d9d9d;
    --accent:#7fe3bd; --accent-ink:#9cecce; --accent-soft:#0d2b22; --on-accent:#000;
    --gold:#e8cd84; --gold-soft:#241d08; --paper:#fff;
    color-scheme:dark;
  }
}

/* Explicit dark, chosen rather than inherited from the system. */
html[data-mode="dark"][data-palette="court"],
html[data-mode="dark"]:not([data-palette]){
  --bg:#0f1311; --surface:#161b18; --surface-2:#1e2421; --ink:#eef1ef; --muted:#a8b1ac;
  --faint:#878f8a; --line:#29302c; --line-strong:#434b46;
  --accent:#7fc7aa; --accent-ink:#a5dcc5; --accent-soft:#16302a; --on-accent:#0b100d;
  --gold:#d9b86b; --gold-soft:#2b2411; --paper:#f8f9f7; color-scheme:dark;
}
html[data-mode="dark"][data-palette="navy"]{
  --bg:#0d1218; --surface:#141a22; --surface-2:#1c242e; --ink:#eaeff5; --muted:#a4b0bf;
  --faint:#8795a5; --line:#262f3a; --line-strong:#3f4a58;
  --accent:#8ab4e8; --accent-ink:#aecbf0; --accent-soft:#152436; --on-accent:#0a0f15;
  --gold:#d9b86b; --gold-soft:#2b2411; --paper:#f8f9fb; color-scheme:dark;
}
html[data-mode="dark"][data-palette="parchment"]{
  --bg:#15120d; --surface:#1d1912; --surface-2:#272117; --ink:#f2ead9; --muted:#c3b69d;
  --faint:#a2947b; --line:#2f2819; --line-strong:#4b412d;
  --accent:#d8b277; --accent-ink:#e6c795; --accent-soft:#2b2214; --on-accent:#15120d;
  --gold:#d9b86b; --gold-soft:#2b2411; --paper:#fffdf8; color-scheme:dark;
}
html[data-mode="dark"][data-palette="oxblood"]{
  --bg:#140e0f; --surface:#1c1415; --surface-2:#261b1d; --ink:#f3e9ea; --muted:#c2a9ac;
  --faint:#a2888b; --line:#2e2122; --line-strong:#4a3639;
  --accent:#e0909c; --accent-ink:#eaa9b3; --accent-soft:#2c171b; --on-accent:#120b0c;
  --gold:#d9b86b; --gold-soft:#2b2411; --paper:#fff; color-scheme:dark;
}
html[data-mode="dark"][data-palette="contrast"]{
  --bg:#000; --surface:#000; --surface-2:#141414; --ink:#fff; --muted:#e4e4e4;
  --faint:#cfcfcf; --line:#6a6a6a; --line-strong:#9d9d9d;
  --accent:#7fe3bd; --accent-ink:#9cecce; --accent-soft:#0d2b22; --on-accent:#000;
  --gold:#e8cd84; --gold-soft:#241d08; --paper:#fff; color-scheme:dark;
}

/* =================================================================== */
/* The switcher                                                        */
/* =================================================================== */
.palette{position:relative}
.palette-btn{display:inline-flex;align-items:center;gap:9px;min-height:44px;padding:0 13px;
  border:2px solid var(--line-strong);border-radius:10px;background:var(--surface);
  color:var(--muted);font-size:14.5px;cursor:pointer}
.palette-btn:hover{border-color:var(--accent);color:var(--ink)}
.swatch{width:17px;height:17px;border-radius:50%;border:1px solid rgba(0,0,0,.18);
  background:var(--accent);flex:none}
.palette-menu{position:absolute;right:0;top:calc(100% + 8px);z-index:40;min-width:232px;
  background:var(--surface);border:2px solid var(--line);border-radius:13px;
  box-shadow:0 14px 38px rgba(10,20,16,.16);padding:8px}
.palette-menu[hidden]{display:none}
/* Devanagari has no case and tracking pulls its conjuncts apart, so this
   heading takes neither. */
.palette-menu h4{font-family:var(--sans);font-size:14px;color:var(--faint);
  padding:8px 10px 5px;font-weight:600}
.palette-menu button{display:flex;width:100%;align-items:center;gap:11px;min-height:46px;
  padding:0 10px;border:0;border-radius:9px;background:none;color:var(--ink);
  font-size:15.5px;text-align:left;cursor:pointer;font-family:var(--deva)}
.palette-menu button:hover{background:var(--surface-2)}
.palette-menu button[aria-checked="true"]{background:var(--accent-soft);color:var(--accent-ink);font-weight:600}
.palette-menu button[aria-checked="true"]::after{content:"✓";margin-left:auto;font-weight:700}
.pdot{width:22px;height:22px;border-radius:50%;flex:none;border:1px solid rgba(0,0,0,.2);
  display:grid;place-items:center}
.pdot i{width:9px;height:9px;border-radius:50%;display:block}
.palette-menu hr{border:0;border-top:1px solid var(--line);margin:7px 4px}
