/* Palantiri themes: the one place where colours live. Loaded by every page.
   A theme is selected with <html data-theme="...">, set by theme.js. The same
   attribute on a menu swatch gives that swatch its own theme's colours. */
/* Orthanc: black stone and the violet glow of its seeing-stone. Also the base
   that every other theme overrides. (The variable names --pink... are historical.) */
:root,[data-theme="dark"]{
  --bg:#0d0c12;--grid:#1a1822;--ink:#f1eff7;--dim:#aaa6b8;--faint:#8f8a9f;
  --pink:#ab8ff2;--pink-deep:#c6b1fa;--pink-soft:#191426;--pink-line:#30284a;--panel:#15131c;
  --glow:0 0 0 4px rgba(171,143,242,.24);--glow-top:rgba(151,117,240,.15);--glow-low:transparent;
  --on-pink:#0d0a16;--btn-fg:#0d0a16;
  /* badges and section bars: 1 main, 2 deeper, 3 neutral */
  --tone-1:#ab8ff2;--tone-1-fg:#0d0a16;--tone-2:#5f4a96;--tone-2-fg:#ffffff;--tone-3:#34313f;--tone-3-fg:#ffffff;
  --tint-a:rgba(171,143,242,.06);--tint-b:rgba(171,143,242,.13);
  --good:#4fce80;--warn:#edb53a;--bad:#ff6a6c;
  --ok2:#4fce80;--warn2:#f09a4a;--bad2:#ff6a6c;--both-bg:#4fce80;--both-fg:#0d0a16;
  --changed:#9fa6c8;
  --orb-1:#efe7ff;--orb-2:#9b78f0;--orb-3:#4a2f96;--orb-4:#120a2a;--orb-glow:rgba(155,120,240,.55);
  --radius:0px;
  --pattern:linear-gradient(var(--grid) 1px,transparent 1px),linear-gradient(90deg,var(--grid) 1px,transparent 1px);
  --pattern-size:46px 46px;
}
/* Minas Tirith: white stone, black and grey; the default. Only status words have colour. */
[data-theme="light"]{
  --bg:#ffffff;--grid:#f1f1f1;--ink:#0a0a0a;--dim:#3d3d3d;--faint:#575757;
  --pink:#111111;--pink-deep:#2e2e2e;--pink-soft:#f2f2f2;--pink-line:#c6c6c6;--panel:#fbfbfb;
  --glow:0 0 0 4px rgba(0,0,0,.14);--glow-top:rgba(0,0,0,.04);
  --on-pink:#ffffff;--btn-fg:#ffffff;
  --tone-1:#111111;--tone-1-fg:#ffffff;--tone-2:#4a4a4a;--tone-2-fg:#ffffff;--tone-3:#6b6b6b;--tone-3-fg:#ffffff;
  --tint-a:rgba(0,0,0,.04);--tint-b:rgba(0,0,0,.08);
  --both-bg:#0a7535;--both-fg:#ffffff;
  --good:#0a7535;--warn:#a04000;--bad:#b8122e;--changed:#4f4f4f;
  --ok2:#0a7535;--warn2:#a04000;--bad2:#b8122e;
  --orb-1:#f4f4f4;--orb-2:#a8a8a8;--orb-3:#4a4a4a;--orb-4:#0a0a0a;--orb-glow:rgba(0,0,0,.35);
}
/* without colour, links are recognised by a clear underline */
:root[data-theme="light"] :is(.link,.dlink,.back,footer a,.archive-link a,li a){border-bottom-color:#6f6f6f}
:root[data-theme="light"] .bulk .link.ip{text-decoration-color:#6f6f6f}
:root[data-theme="light"] .toc a{text-decoration:underline;text-decoration-color:#6f6f6f;text-underline-offset:3px}

/* Rohan: saddle brown, the green of the banner and wheat */
[data-theme="grey"]{
  --bg:#191108;--grid:#2a1f0d;--ink:#f0e0c0;--dim:#bb9b79;--faint:#a78a6a;
  --pink:#9cbf5e;--pink-deep:#bcd884;--pink-soft:#222208;--pink-line:#443a18;--panel:#231908;
  --glow:0 0 0 4px rgba(156,191,94,.24);--glow-top:rgba(206,168,84,.13);
  --on-pink:#141a06;--btn-fg:#141a06;
  --tone-1:#9cbf5e;--tone-1-fg:#141a06;--tone-2:#d0a850;--tone-2-fg:#1c1204;--tone-3:#55421f;--tone-3-fg:#f6e9cf;
  --tint-a:rgba(156,191,94,.07);--tint-b:rgba(156,191,94,.14);
  --good:#58d6a0;--warn:#f5b942;--bad:#ff7466;--ok2:#58d6a0;--warn2:#f5b942;--bad2:#ff7466;--both-bg:#58d6a0;--both-fg:#0c1a10;
  --changed:#b3aacb;
  --orb-1:#f6f8d8;--orb-2:#9cbf5e;--orb-3:#4f7026;--orb-4:#1a2208;--orb-glow:rgba(156,191,94,.5);
}

/* Mithril: silver-white and steel blue, on fine interlinked rings */
[data-theme="mithril"]{
  color-scheme:light;
  --bg:#eef1f5;--grid:#dbe2ea;--ink:#141a22;--dim:#465364;--faint:#566374;
  --pink:#2f5d8a;--pink-deep:#234a70;--pink-soft:#e1eaf4;--pink-line:#b9c8d9;--panel:#fbfcfe;
  --glow:0 0 0 4px rgba(47,93,138,.2);--glow-top:rgba(255,255,255,.95);
  --on-pink:#ffffff;--btn-fg:#ffffff;
  --tone-1:#2f5d8a;--tone-1-fg:#ffffff;--tone-2:#5a6f86;--tone-2-fg:#ffffff;--tone-3:#333d49;--tone-3-fg:#ffffff;
  --tint-a:rgba(47,93,138,.06);--tint-b:rgba(47,93,138,.12);
  --good:#0a7535;--warn:#855900;--bad:#c01818;--ok2:#0a7535;--warn2:#a04d00;--bad2:#c01818;--both-bg:#0a7535;--both-fg:#ffffff;
  --changed:#54547c;
  --orb-1:#f2f8ff;--orb-2:#9fb8d0;--orb-3:#4f7296;--orb-4:#16283b;--orb-glow:rgba(47,93,138,.4);
  --radius:2px;
  --pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' fill='none' stroke='%23dde4ec'%3E%3Ccircle cx='18' cy='18' r='14'/%3E%3Ccircle cx='0' cy='0' r='14'/%3E%3Ccircle cx='36' cy='0' r='14'/%3E%3Ccircle cx='0' cy='36' r='14'/%3E%3Ccircle cx='36' cy='36' r='14'/%3E%3C/svg%3E");
  --pattern-size:36px 36px;
}
/* Shire: parchment and leaf green */
[data-theme="shire"]{
  color-scheme:light;
  --bg:#f3ead3;--grid:#e6dab9;--ink:#2b2416;--dim:#5c4f36;--faint:#695b40;
  --pink:#3f6b22;--pink-deep:#325719;--pink-soft:#e6ebc9;--pink-line:#cdc39a;--panel:#fcf6e6;
  --glow:0 0 0 4px rgba(63,107,34,.2);--glow-top:rgba(255,236,170,.75);
  --on-pink:#ffffff;--btn-fg:#ffffff;
  --tone-1:#3f6b22;--tone-1-fg:#ffffff;--tone-2:#8a5a1e;--tone-2-fg:#ffffff;--tone-3:#54472f;--tone-3-fg:#ffffff;
  --tint-a:rgba(63,107,34,.07);--tint-b:rgba(63,107,34,.14);
  --good:#0f6e33;--warn:#855300;--bad:#b51a1a;--ok2:#0f6e33;--warn2:#934600;--bad2:#b51a1a;--both-bg:#0f6e33;--both-fg:#ffffff;
  --changed:#565178;
  --orb-1:#eef7cf;--orb-2:#86b04c;--orb-3:#3f6b22;--orb-4:#182b0b;--orb-glow:rgba(63,107,34,.4);
  --radius:8px;
  --pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.035 .6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .33 0 0 0 0 .12 0 0 0 .3 -.06'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  --pattern-size:240px 240px;
}
/* Lothlorien: deep forest and gold, with drifting mallorn leaves */
[data-theme="lothlorien"]{
  color-scheme:dark;
  --bg:#0c1a14;--grid:#14271d;--ink:#f3efdc;--dim:#a9b8a3;--faint:#8fa28c;
  --pink:#d9b24a;--pink-deep:#ecca70;--pink-soft:#1c2a17;--pink-line:#36472a;--panel:#12241b;
  --glow:0 0 0 4px rgba(217,178,74,.24);--glow-top:rgba(236,202,112,.2);
  --on-pink:#14130a;--btn-fg:#14130a;
  --tone-1:#d9b24a;--tone-1-fg:#14130a;--tone-2:#4f7d5c;--tone-2-fg:#ffffff;--tone-3:#2c4034;--tone-3-fg:#f3efdc;
  --tint-a:rgba(217,178,74,.06);--tint-b:rgba(217,178,74,.13);
  --good:#5fd08a;--warn:#ff9f45;--bad:#ff6b6b;--ok2:#5fd08a;--warn2:#ff9f45;--bad2:#ff6b6b;--both-bg:#5fd08a;--both-fg:#0c1a14;
  --changed:#a3a3cc;
  --orb-1:#fff3c4;--orb-2:#e2bb4e;--orb-3:#8f6d1c;--orb-4:#1d2a12;--orb-glow:rgba(236,202,112,.5);
  --radius:5px;
  --pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' fill='none' stroke='%231d3427'%3E%3Cg id='l'%3E%3Cpath d='M40 62q-16-20 0-44q16 24 0 44zM40 18v54'/%3E%3C/g%3E%3Cg transform='translate(150 52) rotate(62)'%3E%3Cpath d='M0 22q-14-18 0-40q14 22 0 40zM0-18v50'/%3E%3C/g%3E%3Cg transform='translate(92 136) rotate(-38)'%3E%3Cpath d='M0 22q-14-18 0-40q14 22 0 40zM0-18v50'/%3E%3C/g%3E%3C/svg%3E");
  --pattern-size:180px 180px;
}
/* Moria: cold stone with carved angular lines */
[data-theme="moria"]{
  color-scheme:dark;
  --bg:#12161c;--grid:#1c232c;--ink:#e4ebf2;--dim:#9dabb9;--faint:#8291a1;
  --pink:#8fc1e8;--pink-deep:#b1d7f3;--pink-soft:#1a2632;--pink-line:#2c3c4b;--panel:#1a2028;
  --glow:0 0 0 4px rgba(143,193,232,.24);--glow-top:rgba(143,193,232,.14);
  --on-pink:#0b1219;--btn-fg:#0b1219;
  --tone-1:#8fc1e8;--tone-1-fg:#0b1219;--tone-2:#4a6c8a;--tone-2-fg:#ffffff;--tone-3:#333f4c;--tone-3-fg:#ffffff;
  --tint-a:rgba(143,193,232,.06);--tint-b:rgba(143,193,232,.12);
  --good:#58cc84;--warn:#edb53a;--bad:#ff6a6c;--ok2:#58cc84;--warn2:#f09a4a;--bad2:#ff6a6c;--both-bg:#58cc84;--both-fg:#0b1219;
  --changed:#a5a5cf;
  --orb-1:#eef8ff;--orb-2:#8fc1e8;--orb-3:#3f6b91;--orb-4:#0d1924;--orb-glow:rgba(143,193,232,.5);
  --radius:0px;
  --pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='none' stroke='%231e2731' stroke-width='1.5'%3E%3Cpath d='M0 0h120M0 60h120M30 0v60M90 60v60M52 12v34M52 16l10 8M52 26l10 8M74 12v34l10-12M74 22l10 12M12 72v36M12 78l9 8l-9 8M36 72v36l14-36v36M66 108V72l10 10l-10 10'/%3E%3C/svg%3E");
  --pattern-size:120px 120px;
}
/* Barad-dur: near-black, lit by embers from below. Errors are a cool crimson and
   warnings yellow, so neither can be mistaken for the orange accent. */
[data-theme="baraddur"]{
  color-scheme:dark;
  --bg:#0b0808;--grid:#191010;--ink:#f6e9df;--dim:#b59f92;--faint:#a8938a;
  --pink:#ff7a1a;--pink-deep:#ff9d52;--pink-soft:#24110a;--pink-line:#43210f;--panel:#161010;
  --glow:0 0 0 4px rgba(255,122,26,.26);--glow-top:rgba(255,80,10,.1);--glow-low:rgba(255,80,10,.22);
  --on-pink:#120702;--btn-fg:#120702;
  --tone-1:#ff7a1a;--tone-1-fg:#120702;--tone-2:#9c3a0c;--tone-2-fg:#ffffff;--tone-3:#3d2c27;--tone-3-fg:#ffffff;
  --tint-a:rgba(255,122,26,.06);--tint-b:rgba(255,122,26,.13);
  --good:#4fce80;--warn:#ffd84a;--bad:#ff5f85;--ok2:#4fce80;--warn2:#ffd84a;--bad2:#ff5f85;--both-bg:#4fce80;--both-fg:#0b0808;
  --changed:#a9a0c8;
  --orb-1:#ffe2a8;--orb-2:#ff7a1a;--orb-3:#a52c00;--orb-4:#1a0500;--orb-glow:rgba(255,100,20,.65);
  --radius:0px;
  --pattern:repeating-linear-gradient(90deg,var(--grid) 0 1px,transparent 1px 23px);
  --pattern-size:auto;
}

/* ember light along the bottom edge (only Barad-dur gives it a colour) */
body::after{content:"";position:fixed;inset:auto 0 0 0;height:55vh;pointer-events:none;z-index:-1;
  background:radial-gradient(ellipse 75% 100% at 50% 108%,var(--glow-low),transparent 70%)}

/* ---- theme menu ---- */
.theme-slot{position:relative;min-height:27px;font-size:10px}
.head-tools{display:flex;align-items:center;gap:16px}
.theme-btn{font-family:"JetBrains Mono",monospace;font-size:10px;font-weight:700;letter-spacing:.22em;
  text-transform:uppercase;background:transparent;border:1.5px solid var(--pink-line);border-radius:var(--radius);
  color:var(--dim);padding:5px 12px;cursor:pointer;transition:border-color .15s,color .15s,background .15s;white-space:nowrap}
.theme-btn:hover,.theme-btn[aria-expanded="true"]{border-color:var(--pink);color:var(--pink);background:var(--pink-soft)}
.theme-btn:focus-visible,.theme-opt:focus-visible{outline:2px solid var(--pink);outline-offset:2px}
.theme-menu{position:absolute;top:calc(100% + 6px);right:0;z-index:60;width:216px;background:var(--panel);
  border:1.5px solid var(--pink-line);border-radius:var(--radius);padding:5px;box-shadow:0 12px 32px rgba(0,0,0,.3)}
.theme-menu[hidden]{display:none}
.theme-opt{display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;color:var(--ink);
  font:500 12px "JetBrains Mono",monospace;text-align:left;padding:8px;cursor:pointer;border-radius:var(--radius)}
.theme-opt:hover,.theme-opt:focus{background:var(--pink-soft)}
.theme-opt[aria-checked="true"]{font-weight:700}
.theme-opt[aria-checked="true"]::after{content:"\2713";margin-left:auto;color:var(--pink-deep)}
.sw{display:flex;flex:none;width:34px;height:18px;border:1px solid var(--pink-line);background:var(--bg);
  align-items:center;justify-content:center;gap:4px}
.sw i{width:8px;height:8px;border-radius:50%;background:var(--pink)}
.sw i+i{background:var(--ink)}
