
/* VISION ECLIPSE
   The original cream palette remains the default. Night is a separate set of
   semantic surfaces, not an inversion or a filter over the artwork. */
:root {
  --theme-track:#e8d9d8;
  --theme-thumb:#fff8f3;
  --theme-icon:#654568;
  --theme-edge:#cdb4be;
  --theme-wave:#342038;
}
:root[data-theme="dark"] {
  color-scheme:dark;
  --paper:#211426;
  --surface:#302035;
  --rose:#432f48;
  --ink:#f4ebe6;
  --muted:#cbb7c9;
  --line:#5c4361;
  --line-dark:#75566e;
  --plum:#f0e3eb;
  --plum-deep:#1b0c21;
  --plum-mid:#462b49;
  --mauve:#ad89ad;
  --mauve-deep:#d2afce;
  --champagne:#d0ab90;
  --light-surface:linear-gradient(145deg,#3a283e 0%,#2b1c30 100%);
  --metal:linear-gradient(125deg,#775277 0%,#513452 50%,#664269 100%);
  --shadow-soft:0 12px 36px -22px #09050ce0,0 2px 8px #11081555;
  --shadow-lift:0 22px 52px -20px #09050ce0,0 4px 12px #11081555;
  --shadow-dark:0 26px 65px -24px #0a050ce6;
  --theme-track:#39273e;
  --theme-thumb:#614264;
  --theme-icon:#e4c8df;
  --theme-edge:#76577a;
  --theme-wave:#f4ebe6;
}
html { background:var(--paper); }
.theme-toggle {
  display:inline-flex; align-items:center; justify-content:center; flex:none;
  width:64px; min-width:64px; height:44px; padding:0; border:0;
  border-radius:24px; background:transparent; color:var(--theme-icon);
  -webkit-tap-highlight-color:transparent; transition:transform .23s var(--ease);
}
.theme-toggle:focus-visible { outline:2px solid var(--mauve-deep); outline-offset:3px; }
.theme-track {
  display:grid; grid-template-columns:1fr 1fr; align-items:center; justify-items:center;
  position:relative; width:62px; height:32px; padding:2px;
  background:var(--theme-track); border:1px solid var(--theme-edge); border-radius:20px;
  box-shadow:inset 0 1px 5px #25122e17; isolation:isolate;
}
.theme-track svg { position:relative; z-index:1; width:16px; height:16px; transition:opacity .28s,transform .4s var(--ease); pointer-events:none; }
.theme-sun { opacity:1; }
.theme-moon { opacity:.52; }
.theme-thumb {
  position:absolute; z-index:0; width:26px; height:26px; top:2px; left:2px;
  background:var(--theme-thumb); border:1px solid #d0ab9080; border-radius:50%;
  box-shadow:0 2px 7px #25122e30,inset 0 1px 0 #f4ebe64d;
  transition:transform .55s cubic-bezier(.2,.8,.2,1),background .3s;
}
[data-theme="dark"] .theme-thumb { transform:translateX(30px); }
[data-theme="dark"] .theme-sun { opacity:.5; transform:rotate(-35deg); }
[data-theme="dark"] .theme-moon { opacity:1; }
@media(hover:hover) and (pointer:fine) {
  .theme-toggle:hover { transform:translateY(-2px); }
  .theme-toggle:hover .theme-track { border-color:var(--mauve); box-shadow:0 4px 14px #7c587e33; }
}
.theme-toggle:active { transform:scale(.96); }
.access-tools { display:flex; align-items:center; gap:16px; flex:none; }

/* Night surfaces; the original emblem artwork is deliberately not recolored. */
[data-theme="dark"] body,
[data-theme="dark"] .access-page { background:radial-gradient(ellipse at 90% 0%,#65456837,transparent 35rem),var(--paper); color:var(--ink); }
[data-theme="dark"] .portal-nav,
[data-theme="dark"] .masthead { background:#28192d; border-color:var(--line); box-shadow:0 8px 30px -20px #0b060ef0; }
[data-theme="dark"] .portal .wordmark { color:var(--ink); }
[data-theme="dark"] .portal footer { background:#291b2e; }
[data-theme="dark"] .portal select,
[data-theme="dark"] #account-form input,
[data-theme="dark"] #account-form select { color:var(--ink); background:#26182b; border-color:var(--line); }
[data-theme="dark"] #account-form input:focus,
[data-theme="dark"] #account-form select:focus { background:var(--surface); border-color:var(--mauve-deep); box-shadow:0 0 0 4px #ad89ad26; }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color:var(--muted); }
[data-theme="dark"] #account-form input:-webkit-autofill { -webkit-text-fill-color:var(--ink); box-shadow:0 0 0 1000px #26182b inset; }
[data-theme="dark"] .profile-link { color:var(--ink); border-color:var(--line); background:#3a283e; }
[data-theme="dark"] .profile-link:hover { background:#543959; color:#fff8f3; border-color:var(--mauve); }
[data-theme="dark"] .nav-toggle { color:var(--ink); }
[data-theme="dark"] .nav-toggle[aria-expanded=true] { background:#513654; }
[data-theme="dark"] .portal nav a[aria-current=page] { color:var(--ink); }
[data-theme="dark"] .portal nav a::after { background:linear-gradient(90deg,var(--mauve-deep),var(--champagne)); }
[data-theme="dark"] .primary,
[data-theme="dark"] .portal .action { color:#fff8f3!important; border-color:#98749a; background:var(--metal); box-shadow:0 8px 24px -12px #100815cc,inset 0 1px 0 #f4ebe633; }
[data-theme="dark"] .primary:hover:not(:disabled),
[data-theme="dark"] .portal .action:hover { background:var(--metal); border-color:#d0ab90; }
[data-theme="dark"] .brand-showcase,
[data-theme="dark"] .institution { background:#25122e; color:#f4ebe6; border-color:#76577a; }
[data-theme="dark"] .brand-caption,
[data-theme="dark"] .institute-title h2 { color:#f4ebe6; }
[data-theme="dark"] .institute-name { color:#decbc5; }
[data-theme="dark"] .manifesto { background:linear-gradient(125deg,#211025,#38223f 58%,#513654); color:#f4ebe6; border:1px solid var(--line); }
[data-theme="dark"] .manifesto h2,
[data-theme="dark"] .manifesto .text-link { color:#f4ebe6; }
[data-theme="dark"] .manifesto p:not(.eyebrow) { color:#decbc5; }
[data-theme="dark"] .feature-grid > a:hover { background:var(--light-surface); }
[data-theme="dark"] .feature-grid > a::before,
[data-theme="dark"] .suggest::before { background:radial-gradient(ellipse at var(--px,50%) var(--py,50%),#ad89ad30,transparent 72%); }
[data-theme="dark"] .feature-grid a:hover > span { color:#f4ebe6; background:#654568; border-color:#ad89ad; }
[data-theme="dark"] .club-crest { background:radial-gradient(ellipse at 35% 28%,#4b354f,#2d1e32); }
[data-theme="dark"] .vision-crest { background:linear-gradient(135deg,#25122e,#462b49); }
[data-theme="dark"] .club-crest > span { color:#e8d4e2; }
[data-theme="dark"] .tags span { background:#432f48; color:var(--mauve-deep); }
[data-theme="dark"] .assignment b { background:#432f48; color:#dfbfdb; }
[data-theme="dark"] .profile-card #avatar { color:#f4ebe6; }
[data-theme="dark"] .mode-switch { background:#26182b; }
[data-theme="dark"] .mode-switch button[aria-pressed=true] { background:#513654; color:#fff8f3; }
[data-theme="dark"] .error { background:#432f48; color:#f4ebe6; }
[data-theme="dark"] #composer:focus-within { box-shadow:0 0 0 4px #ad89ad26,var(--shadow-lift); }
[data-theme="dark"] .message.user { color:#fff8f3; background:var(--metal); }
[data-theme="dark"] .response pre { background:#1b0c21; color:#f4ebe6; border:1px solid var(--line); }
[data-theme="dark"] .response code { background:#432f48; color:#f4ebe6; }
[data-theme="dark"] .response th { background:#432f48; color:#f4ebe6; }
[data-theme="dark"] .in-dialog .composer-wrap { background:#211426b3; }
[data-theme="dark"] ::selection { background:#775277; color:#fff8f3; }
[data-theme="dark"] :focus-visible { outline-color:#d2afce; }

/* One circular reveal of the real new page. Native View Transitions supplies
   a snapshot of the old theme without duplicating the DOM or reading its data. */
html.theme-transition::view-transition-old(root),
html.theme-transition::view-transition-new(root) { animation:none; mix-blend-mode:normal; }
html.theme-transition::view-transition-old(root) { z-index:1; }
html.theme-transition::view-transition-new(root) { z-index:2; }
html.theme-transition::view-transition-group(root) { animation:none; }
html.theme-transition::view-transition { pointer-events:none; }
.theme-wash {
  position:fixed; inset:0; z-index:10000; pointer-events:none;
  background:var(--wash-color); clip-path:circle(0px at var(--wave-x) var(--wave-y));
  will-change:clip-path,opacity;
}
.theme-edge-wave {
  position:fixed; inset:0; z-index:10001; pointer-events:none;
  background:radial-gradient(circle at var(--wave-x) var(--wave-y),transparent calc(var(--edge-radius) - 14px),#d0ab9050 calc(var(--edge-radius) - 3px),#d0ab90a0 var(--edge-radius),transparent calc(var(--edge-radius) + 3px));
  opacity:0;
}
@media(max-width:600px) {
  .portal-nav .tools { gap:4px; }
  .portal-nav .theme-toggle { width:44px; min-width:44px; height:44px; }
  .portal-nav .theme-track { width:38px; height:32px; display:grid; grid-template-columns:1fr; }
  .portal-nav .theme-thumb { width:26px; height:26px; left:5px; transform:none; }
  .portal-nav .theme-track svg { grid-area:1/1; }
  .portal-nav .theme-moon { opacity:0; transform:scale(.5) rotate(-30deg); }
  [data-theme="dark"] .portal-nav .theme-thumb { transform:none; }
  [data-theme="dark"] .portal-nav .theme-sun { opacity:0; transform:scale(.5) rotate(35deg); }
  [data-theme="dark"] .portal-nav .theme-moon { opacity:1; transform:scale(1); }
  .access-tools { gap:8px; }
  [data-theme="dark"] .portal-nav nav a { background:#39273e; }
  [data-theme="dark"] .portal-nav nav a[aria-current=page] { background:#513654; }
}
@media(max-width:400px) {
  .portal-nav .nav-toggle { width:44px; padding:0; }
  .portal-nav .nav-toggle-label { display:none; }
  .access-tools .clock > span { display:none; }
  .access-tools .theme-toggle { width:58px; min-width:58px; }
  .access-tools .theme-track { transform:scale(.9); }
}
@media(prefers-reduced-motion:reduce) {
  .theme-toggle,.theme-thumb,.theme-track svg { transition:none!important; transform:none; }
  [data-theme="dark"] .theme-thumb { transform:translateX(30px); }
  [data-theme="dark"] .portal-nav .theme-thumb { transform:none; }
  .theme-wash,.theme-edge-wave { display:none!important; }
}
