/* ==========================================================================
   Brand borders (Nov 2026): every card, table and field edge is a light tint of the one brand purple, never a
   stray grey. Loaded last on the student site, after academic.css. Plain hex first for phones whose browser cannot
   mix colours (color-mix needs Chrome 111+ / Safari 16.2+), then the mixed values where it can.
   ========================================================================== */
:root, :root[data-theme="light"] {
  --brand-primary: #532CEB;
  --border-brand-subtle: #C8C6EF;  /* resting cards, metadata strips, table lines */
  --border-brand-input: #A19AE4;   /* inputs, search bars, filter dropdowns */
  --border-brand-strong: var(--brand-primary); /* hover, active tabs, selected options, focus */
  --surface-brand-tint: #F8F7FE;   /* page background and table headers, so white cards stand out */
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root, :root[data-theme="light"] {
    --border-brand-subtle: color-mix(in srgb, var(--brand-primary) 18%, #E2E8F0);
    --border-brand-input: color-mix(in srgb, var(--brand-primary) 35%, #CBD5E1);
    --surface-brand-tint: color-mix(in srgb, var(--brand-primary) 4%, #FFFFFF);
  }
}
/* Dark theme: the purple mixed into the dark surfaces, so edges stay quiet instead of glowing. */
:root[data-theme="dark"] {
  --border-brand-subtle: #2E286E;
  --border-brand-input: #453A9F;
  --border-brand-strong: #B9A6FF;
  --surface-brand-tint: #120D2B;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root[data-theme="dark"] {
    --border-brand-subtle: color-mix(in srgb, var(--brand-primary) 30%, #1E2638);
    --border-brand-input: color-mix(in srgb, var(--brand-primary) 45%, #3A4660);
    --surface-brand-tint: color-mix(in srgb, var(--brand-primary) 6%, #0E0B1F);
  }
}

/* The design system's own line and page colours now come from the brand tokens (academic.css reads these). */
:root, :root[data-theme="light"], :root[data-theme="dark"] {
  --bb-line: var(--border-brand-subtle);
  --bb-page: var(--surface-brand-tint);
  --g-line: var(--border-brand-subtle);
  --g-tile-line: var(--border-brand-subtle);
  --g-panel-line: var(--border-brand-subtle);
  --g-bg: var(--surface-brand-tint);
  --line: var(--border-brand-subtle);
}

/* Cards and boxes: one 1px brand-tint edge, 8px corners. */
.cc, .sb-card, .hm-tool, .tl-tool, .g-tile, .hx-card, .hm-fr__tile, .hm-lang__card, .g-panel, .card, .box, .panel, .person, .sp-item {
  border: 1px solid var(--border-brand-subtle) !important;
  border-radius: 8px !important;
  transition: border-color .15s ease, outline-color .15s ease;
}
/* Hover (mouse) and tap (touch): the edge turns full brand purple, 1.5px. Drawn as 1px border + 0.5px outline so the
   card never jumps by half a pixel. A solid line, not a shadow. */
@media (hover: hover) {
  .cc:hover, .sb-card:hover, .hm-tool:hover, .tl-tool:hover, a.g-tile:hover, .g-tile:has(> a):hover, .hm-fr__tile:hover, .hm-lang__card:hover, .sp-item:hover {
    border-color: var(--border-brand-strong) !important; outline: .5px solid var(--border-brand-strong); outline-offset: 0;
  }
}
.cc:active, .sb-card:active, .hm-tool:active, .tl-tool:active, a.g-tile:active, .hm-fr__tile:active, .hm-lang__card:active,
.cc:focus-within, .sb-card:focus-within, .hm-tool:focus-visible, .tl-tool:focus-visible, a.g-tile:focus-visible {
  border-color: var(--border-brand-strong) !important; outline: .5px solid var(--border-brand-strong); outline-offset: 0;
}
/* Course card's stats strip and other inner dividers. */
.cc-stats { border-color: var(--border-brand-subtle) !important; }

/* Student fields: search bars, filters, forms. Components that draw their own borderless search keep theirs. */
body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=submit]):not([type=button]),
body select, body textarea {
  border: 1px solid var(--border-brand-input);
  border-radius: 6px;
}
body form textarea, body form select { border-color: var(--border-brand-input) !important; }
body input:not([type=checkbox]):not([type=radio]):not([type=range]):focus-visible, body select:focus-visible, body textarea:focus-visible {
  border-color: var(--border-brand-strong); outline: 2px solid var(--border-brand-strong); outline-offset: 1px;
}

/* Tables on student pages (results, routines): tinted header, brand-tint lines. */
table th { background: var(--surface-brand-tint); border-color: var(--border-brand-subtle); }
table td { border-color: var(--border-brand-subtle); }

/* Selected answer options and active tabs read as the strong brand edge. */
.opt.on, .opt.sel, .opt[aria-checked="true"], [role="tab"][aria-selected="true"] { border-color: var(--border-brand-strong) !important; }
