/* aust.live themes. A page's own :root holds the AUST green; a theme is a
   set of the same variables under html[data-theme], which outranks :root
   wherever the stylesheets sit. themes.js sets the attribute from the
   visitor's choice before the page paints.

   Every theme names: the primary family (--green / -d / -l — the names are
   the site's, the colour is the theme's), its tints (--sage, --sage-2), the
   lines, the ground, the inks, an accent (--gold), and the extras the public
   pages draw with (--accent-rgb, --glow, --field, --row, --track, --nav-bg). */

:root {
  --accent-rgb: 31, 107, 82;
  --glow: #dcefe5;
  --field: #fbfdfc;
  --row: #fafcfb;
  --track: #e5ede9;
  --nav-bg: rgba(255, 255, 255, .94);
  --paper-2: #fbfdfc;
  --on-primary: #ffffff;
  --note-bg: #fff8e6;
  --note-line: #ecd9a6;
  --note-ink: #6b5216;
  --gold-ink: #7a5c12;
}

/* ---- Ocean Blue -------------------------------------------------------- */
html[data-theme="ocean"] {
  --green: #1e5aa8; --green-d: #174683; --green-l: #2f74c8;
  --sage: #dfeaf8; --sage-2: #eef4fc; --line: #d3dfee; --line-2: #e3eaf4;
  --ground: #f3f6fb; --ink: #12263f; --ink-2: #28405f; --muted: #5a6f88;
  --gold: #c48a1f; --gold-soft: #fcf3e1;
  --accent-rgb: 30, 90, 168; --glow: #dce8f8; --field: #fafcfe; --row: #f8fafd; --track: #e2e9f3; --paper-2: #fafcfe;
}
/* ---- Royal Indigo ------------------------------------------------------- */
html[data-theme="indigo"] {
  --green: #4338ca; --green-d: #3730a3; --green-l: #5b52e0;
  --sage: #e6e5fb; --sage-2: #f2f1fe; --line: #dcdbf2; --line-2: #e9e8f7;
  --ground: #f5f5fc; --ink: #1e1b4b; --ink-2: #312e81; --muted: #67658f;
  --gold: #c0841a; --gold-soft: #fcf2df;
  --accent-rgb: 67, 56, 202; --glow: #e3e1fb; --field: #fbfbff; --row: #f9f9fe; --track: #e5e4f5; --paper-2: #fbfbff;
}
/* ---- Teal Lagoon -------------------------------------------------------- */
html[data-theme="teal"] {
  --green: #0f766e; --green-d: #0b5c56; --green-l: #14958a;
  --sage: #d9f1ee; --sage-2: #ecf8f6; --line: #cfe5e2; --line-2: #e2efed;
  --ground: #f2f8f7; --ink: #0f2f2c; --ink-2: #23504b; --muted: #557572;
  --gold: #b8892b; --gold-soft: #fbf4e2;
  --accent-rgb: 15, 118, 110; --glow: #d3efeb; --field: #fafdfc; --row: #f8fcfb; --track: #e0eeec; --paper-2: #fafdfc;
}
/* ---- Violet Orchid ------------------------------------------------------ */
html[data-theme="violet"] {
  --green: #6d28d9; --green-d: #5b21b6; --green-l: #8b5cf6;
  --sage: #ede4fd; --sage-2: #f6f1fe; --line: #e2d8f5; --line-2: #eee8f9;
  --ground: #f8f6fd; --ink: #2e1065; --ink-2: #4c1d95; --muted: #6f6589;
  --gold: #c0841a; --gold-soft: #fcf2df;
  --accent-rgb: 109, 40, 217; --glow: #ebe0fc; --field: #fcfbff; --row: #faf8ff; --track: #ebe4f7; --paper-2: #fcfbff;
}
/* ---- Rose Crimson ------------------------------------------------------- */
html[data-theme="rose"] {
  --green: #be123c; --green-d: #9f1239; --green-l: #e11d48;
  --sage: #fde4e8; --sage-2: #fff1f3; --line: #f2d6dc; --line-2: #f7e6ea;
  --ground: #fdf7f8; --ink: #4c0519; --ink-2: #6f1a33; --muted: #8a6670;
  --gold: #b8892b; --gold-soft: #fbf4e2;
  --accent-rgb: 190, 18, 60; --glow: #fbdde3; --field: #fffbfc; --row: #fffafb; --track: #f3e3e7; --paper-2: #fffbfc;
}
/* ---- Sunset Amber ------------------------------------------------------- */
html[data-theme="amber"] {
  --green: #b45309; --green-d: #92400e; --green-l: #d97706;
  --sage: #fdecd6; --sage-2: #fff6ea; --line: #f0dfc8; --line-2: #f6eadb;
  --ground: #fdf9f3; --ink: #3b1d06; --ink-2: #5c3310; --muted: #85705c;
  --gold: #1f6b52; --gold-soft: #e4f3eb;
  --accent-rgb: 180, 83, 9; --glow: #fbe5c8; --field: #fffcf8; --row: #fffbf6; --track: #f1e6d7; --paper-2: #fffcf8;
}
/* ---- Graphite Slate ----------------------------------------------------- */
html[data-theme="slate"] {
  --green: #334155; --green-d: #1e293b; --green-l: #475569;
  --sage: #e2e8f0; --sage-2: #f1f5f9; --line: #d8dee8; --line-2: #e7ebf1;
  --ground: #f5f7fa; --ink: #0f172a; --ink-2: #1e293b; --muted: #64748b;
  --gold: #b8892b; --gold-soft: #fbf4e2;
  --accent-rgb: 51, 65, 85; --glow: #e2e8f0; --field: #fbfcfd; --row: #f9fafc; --track: #e5e9ef; --paper-2: #fbfcfd;
}
/* ---- Midnight (dark) — the student pages only (themes.js keeps the admin
   panel and the teacher portal light). ------------------------------------ */
html[data-theme="midnight"] {
  color-scheme: dark;
  --green: #3fb68b; --green-d: #8be0bd; --green-l: #5cc9a0;
  --sage: #1d3a30; --sage-2: #172a24; --line: #2a3c35; --line-2: #22322c;
  --ground: #0d1513; --paper: #142019; --paper-2: #17251f; --ink: #e4eee9; --ink-2: #c4d6ce; --muted: #8fa89f;
  --gold: #d9a441; --gold-soft: #2c2412; --gold-ink: #f0cd7d;
  --bad: #ff8a78; --bad-soft: #3a1d18; --bad-line: #5e2b23;
  --warn: #f2b84b; --warn-soft: #33270f;
  --ok-soft: #173a2b; --ok-line: #23573f;
  --accent-rgb: 63, 182, 139; --glow: #10372a; --field: #101b17; --row: #17241f; --track: #263832;
  --nav-bg: rgba(17, 27, 23, .92); --on-primary: #06140f;
  --note-bg: #2b2414; --note-line: #4d3f1d; --note-ink: #f0d58c;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/* ---- the picker -------------------------------------------------------- */
.aust-theme { position: relative; }
.aust-theme-btn {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 1px solid var(--line, #d6e3dd);
  border-radius: 50%;
  background: var(--paper, #fff);
  color: var(--green, #1f6b52);
  cursor: pointer;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.aust-theme-btn:hover { background: var(--sage-2, #eef6f2); transform: rotate(-12deg); }
.aust-theme-btn[aria-expanded="true"] { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .16); }
.aust-theme-btn svg { width: 19px; height: 19px; fill: currentColor; }
.aust-theme-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 200;
  width: 336px;
  padding: 12px;
  background: var(--paper, #fff);
  border: 1px solid var(--line, #d6e3dd);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(15, 30, 25, .18);
  font: 13px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink, #14312a);
  animation: austThemeIn .16s ease-out;
}
@keyframes austThemeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.aust-theme-panel[hidden] { display: none; }
.aust-theme-panel h2 { margin: 2px 4px 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #5d7970); }
.aust-theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.aust-theme-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.aust-theme-opt:hover { background: var(--sage-2, #eef6f2); }
.aust-theme-opt[aria-pressed="true"] { border-color: var(--green, #1f6b52); background: var(--sage-2, #eef6f2); }
.aust-theme-opt i {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55), 0 0 0 1px rgba(0, 0, 0, .08);
}
.aust-theme-opt[aria-pressed="true"]::after { content: "✓"; margin-left: auto; color: var(--green, #1f6b52); font-weight: 800; }
.aust-theme-note { margin: 10px 4px 2px; font-size: 11.5px; color: var(--muted, #5d7970); }
.aust-site-nav button.aust-theme-btn:focus-visible, .aust-theme-opt:focus-visible { outline: 3px solid #c69a3d; outline-offset: 2px; }
@media (max-width: 760px) {
  /* On a phone the panel spans the screen under the bar: anchored to the
     icon it would run off the left edge. (The bar's backdrop-filter makes it
     the box a fixed child is placed in — the bar is the screen's width.) */
  .aust-theme-panel { position: fixed; top: 58px; left: 12px; right: 12px; width: auto; }
}
@media print { .aust-theme { display: none !important; } }
