/* Scouncil — the shared stylesheet of the student site (design phase, 2026-09).
   Two visual languages, one family (design/mocks/deliverables/DIRECTION.md):
     html.lang-a  the sign-in shell: white, 32px grid, gold, doodle corners
                  (login, enroll, recover, lock)
     html.lang-b  the signed-in pages: paper, ink, five pastels, no gold
   Everything a page needs that is not page-specific lives here: tokens, type,
   buttons, cards, pills, notices, form fields, PIN cells, the loader, the top
   bar and account menu, the rail layout, the footer, keyframes, reduced motion.
   No inline styles anywhere (CSP): dynamic numbers are set through the CSSOM. */

@import url(/static/auth/assets/fonts/quicksand.css);

/* ---- tokens ---------------------------------------------------------------- */

:root {
  --ink: #1c1b18;
  --white: #fff;
  --error: #8a2b1d;
  --error-bg: #fbeeea;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.4, 0, .2, 1);
  --powder: #dfe6ee;
  --sage: #e3ebe3;
  --blush: #efe3df;
  --sand: #ede8dc;
  --lilac: #e4e0ee;
  --font: Quicksand, system-ui, -apple-system, "Segoe UI", sans-serif;
}

html.lang-a {
  --ground: #fff;
  --accent: #d4a94a;
  --accent-deep: #8a6d3b;
  --link-hover: #a67c22;
  --card: rgba(255, 255, 255, .86);
  --tint: #fdf8ec;
  --tint-2: #fdf8ec;
  --hair: #e6e1d6;
  --rule: #efebe2;
  --text-2: #4a4740;
  --hint: #6b665c;
  --underline: #d4a94a;
  --focus-ring: rgba(212, 169, 74, .22);
  --hover-fill: #d4a94a;
  --hover-text: #1c1b18;
  --notice-text: #6b5218;
  --card-radius: 24px;
}

html.lang-b {
  --ground: #f5f4f0;
  --accent: #1c1b18;
  --accent-deep: #82807a;
  --link-hover: #56544f;
  --card: #fff;
  --tint: #e9ece8;
  --tint-2: #f0efeb;
  --hair: #e3e1db;
  --rule: #ecebe6;
  --text-2: #56544f;
  --hint: #82807a;
  --underline: #b9b6ae;
  --focus-ring: rgba(28, 27, 24, .08);
  --hover-fill: #dfe6ee;
  --hover-text: #1c1b18;
  --notice-text: #1c1b18;
  --card-radius: 20px;
  scroll-behavior: smooth;
}

/* ---- base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

img { display: block; max-width: 100%; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color .3s var(--ease), text-underline-offset .3s var(--ease);
}

a:hover { color: var(--link-hover); text-underline-offset: 5px; }

p { margin: 0 0 .9rem; }

h1, h2, h3 { margin: 0; letter-spacing: -.01em; text-wrap: balance; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

html.lang-a :focus-visible { outline-color: var(--accent); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- type ------------------------------------------------------------------ */

.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.page-title {
  margin: 16px 0 0;
  font-weight: 500;
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.06;
  letter-spacing: -.02em;
}

.section-title {
  font-weight: 700;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: -.015em;
}

.lede {
  margin: 20px 0 0;
  max-width: 640px;
  font-size: clamp(15.5px, 1.4vw, 18px);
  line-height: 1.55;
  color: var(--text-2);
  text-wrap: pretty;
}

.hint {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--hint);
  text-wrap: pretty;
}

.hint.rule-top {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.muted { color: var(--hint); }

.card-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ---- buttons --------------------------------------------------------------- */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 26px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font: inherit;
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color .4s var(--ease),
    color .4s var(--ease),
    border-color .4s var(--ease),
    box-shadow .4s var(--ease),
    scale .4s var(--ease),
    opacity .4s var(--ease);
}

html.lang-a button,
html.lang-a .btn {
  min-height: 52px;
  font-size: 16px;
  box-shadow: 0 10px 24px -12px rgba(28, 27, 24, .45);
}

button:hover,
.btn:hover {
  background: var(--hover-fill);
  color: var(--hover-text);
  scale: 1.03;
}

html.lang-a button:hover,
html.lang-a .btn:hover { box-shadow: 0 14px 28px -12px rgba(212, 169, 74, .55); }

button:active,
.btn:active { scale: .99; }

button.secondary,
.btn.secondary {
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 15px;
  box-shadow: none;
}

button.secondary:hover,
.btn.secondary:hover {
  background: var(--ink);
  color: var(--white);
  scale: 1.02;
  box-shadow: none;
}

button.danger,
.btn.danger {
  border: 1.5px solid var(--error);
  background: var(--white);
  color: var(--error);
  box-shadow: none;
}

button.danger:hover,
.btn.danger:hover { background: var(--error); color: var(--white); }

button.small,
.btn.small { min-height: 40px; padding: 0 16px; font-size: 14px; }

button.text,
.btn.text {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  box-shadow: none;
}

button.text:hover,
.btn.text:hover { background: none; color: var(--link-hover); scale: 1; text-underline-offset: 6px; }

button[disabled],
.btn[disabled] { opacity: .55; cursor: not-allowed; scale: 1; }

/* A button that is waiting for the server: a small spinner before its label. */
button[aria-busy="true"]::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: currentColor;
  animation: sc-spin .8s linear infinite;
}

button.secondary[aria-busy="true"]::before,
button.danger[aria-busy="true"]::before { border-color: rgba(28, 27, 24, .2); border-top-color: currentColor; }

/* A primary action that is not ready yet: neutral until the form is valid. */
button.is-neutral { background: var(--tint); color: var(--hint); box-shadow: none; }

/* ---- pills, badges, notices -------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pill::before,
.pill-dot {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.pill.plain::before { display: none; }

.pill.sage { background: var(--sage); }
.pill.lilac { background: var(--lilac); }
.pill.sand { background: var(--sand); }
.pill.powder { background: var(--powder); }
.pill.blush { background: var(--blush); }
.pill.urgent { background: var(--error-bg); color: var(--error); }
.pill.urgent::before { background: var(--error); }

.pill.live::before { animation: sc-pulse 1.8s var(--ease) 2s 3; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--sage);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ink { background: var(--ink); color: var(--white); }

.badge.ink::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--white);
}

/* say() from api.js puts one of these class names on #message. */
.error,
.ok,
.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0 0;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
  animation: sc-in .5s var(--ease) both;
}

.error::before,
.ok::before,
.notice::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: currentColor;
}

.error { background: var(--error-bg); color: var(--error); }
.ok, .notice { background: var(--tint); color: var(--notice-text); }
html.lang-b .ok { background: var(--sage); }

/* ---- cards ----------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--card-radius);
  padding: clamp(24px, 4vw, 36px);
}

html.lang-b .card { transition: background-color .4s var(--ease), scale .4s var(--ease); }

.card-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.card-head h2 {
  font-size: clamp(20px, 2.2vw, 24px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.015em;
}

.card-head p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-2); text-wrap: pretty; }

.tile {
  padding: 20px;
  border-radius: 16px;
  background: var(--tint-2);
}

.tile.powder { background: var(--powder); }
.tile.sage { background: var(--sage); }
.tile.blush { background: var(--blush); }
.tile.sand { background: var(--sand); }
.tile.lilac { background: var(--lilac); }

/* ---- form fields ----------------------------------------------------------- */

label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-2);
}

.stack { display: flex; flex-direction: column; gap: 10px; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: var(--white);
  font: inherit;
  font-size: 15.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}

textarea { min-height: 8rem; padding: 14px 16px; line-height: 1.55; resize: vertical; }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

input.code {
  min-height: 56px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: .32em;
  text-align: center;
}

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

legend.legend-heading { padding: 0; font-size: 18px; font-weight: 700; margin-bottom: 6px; }

/* A tinted block holding a label and its input row. */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: 16px;
  background: var(--tint-2);
}

.field-row { display: flex; flex-wrap: wrap; gap: 10px; }
.field-row > input { flex: 1 1 220px; width: auto; }

/* ---- PIN cells --------------------------------------------------------------
   One real <input> (the hook) sits invisibly over six drawn cells. The script
   toggles is-filled / is-active on the cells and is-focused / is-shaking on
   the wrapper; nothing about the value is ever written into the DOM. */

.pin-wrap { position: relative; max-width: 360px; }

.pin-wrap.is-shaking { animation: sc-shake .5s cubic-bezier(.36, .07, .19, .97) both; }

.pin-cells {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.pin-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 6;
  min-height: 52px;
  border: 1.5px solid var(--hair);
  border-radius: 14px;
  background: var(--white);
  transition: border-color .25s var(--ease), background-color .25s var(--ease), box-shadow .25s var(--ease);
}

html.lang-a .pin-cell { min-height: 64px; aspect-ratio: auto; }

.pin-cell.is-filled { border-color: var(--ink); background: var(--tint-2); }

.pin-wrap.is-focused .pin-cell.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
  transform: scale(0);
  transition: transform .3s var(--ease), opacity .25s var(--ease);
}

.pin-cell.is-filled .pin-dot { opacity: 1; transform: scale(1); }

.pin-wrap input.pin-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 2em;
  box-shadow: none;
  cursor: text;
}

.pin-wrap input.pin-input:focus { box-shadow: none; }

/* ---- steps and swaps ---------------------------------------------------------
   A .step animates in whenever it is shown (display none → shown restarts the
   animation); a script adds .is-leaving ~320 ms before hiding the old one. */

.step { animation: sc-in .5s var(--ease) both; }

.is-leaving {
  opacity: 0 !important;
  transform: translateY(-6px);
  transition: opacity .32s var(--ease), transform .32s var(--ease);
  pointer-events: none;
}

.collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .6s var(--ease);
}

.collapse.is-open { grid-template-rows: 1fr; }

.collapse > .collapse-inner { min-height: 0; overflow: hidden; }

/* ---- page entry -------------------------------------------------------------
   .enter rises in with a staggered delay (.d1 … .d6). While the loader is up
   (html.sc-loading) nothing moves; the animation starts when it leaves. With
   no script at all the page simply animates on load. */

.enter { animation: sc-rise 1.2s var(--ease) both; }
.enter.d1 { animation-delay: .2s; }
.enter.d2 { animation-delay: .4s; }
.enter.d3 { animation-delay: .6s; }
.enter.d4 { animation-delay: .8s; }
.enter.d5 { animation-delay: 1s; }
.enter.d6 { animation-delay: 1.2s; }
.enter.fade { animation-name: sc-fade; animation-timing-function: ease-out; }
.enter.crest { animation-name: sc-crest; animation-duration: 1.4s; }

html.sc-loading .enter,
html.sc-loading .backdrop { animation: none; opacity: 0; }

.backdrop { animation: sc-fade 2s ease-out both; }

/* Sections that rise once when scrolled into view (shell.js adds .is-in). */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---- the loader ---------------------------------------------------------------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}

html.sc-loader-out .loader { opacity: 0; transform: scale(1.06); pointer-events: none; }

.loader-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(28, 27, 24, .075) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(28, 27, 24, .075) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, #000 10%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, #000 10%, transparent 100%);
  animation: sc-fade 1.6s ease-out both;
}

.loader-b .loader-grid { display: none; }

.loader-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(80vmin, 620px);
  height: min(80vmin, 620px);
  margin: calc(min(80vmin, 620px) / -2) 0 0 calc(min(80vmin, 620px) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 169, 74, .22) 0%, rgba(212, 169, 74, .07) 38%, rgba(212, 169, 74, 0) 70%);
  animation: sc-glow 1.8s var(--ease) both;
}

.loader-b .loader-glow { display: none; }

.loader-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vh, 40px);
  padding: 24px;
  text-align: center;
}

.loader-medal {
  position: relative;
  width: min(62vmin, 300px);
  height: min(62vmin, 300px);
  display: grid;
  place-items: center;
}

.loader-medal svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.loader-track { fill: none; stroke: rgba(28, 27, 24, .12); stroke-width: 1; }

.loader-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 754;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  animation: sc-ring 5.3s cubic-bezier(.65, 0, .35, 1) .3s both;
}

.loader-b .loader-ring { stroke-width: 2; }

.loader-orbit { transform-origin: 50% 50%; animation: sc-spin 6s cubic-bezier(.4, 0, .2, 1) both; }
.loader-orbit-ring { fill: none; stroke: rgba(28, 27, 24, .35); stroke-width: 1.2; stroke-dasharray: 2 9; }
.loader-orbit-dot { fill: var(--accent); }

.loader-medal img {
  width: 66%;
  height: 66%;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 30px 70px -24px rgba(28, 27, 24, .35), 0 0 0 6px rgba(212, 169, 74, .12);
  animation: sc-medal 1.3s var(--ease) .15s both;
}

.loader-b .loader-medal img { box-shadow: 0 30px 70px -24px rgba(28, 27, 24, .3); }

.loader-words { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.loader-eyebrow {
  font-size: clamp(11px, 1.4vw, 13px);
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  animation: sc-word 1.2s var(--ease) .9s both;
}

.loader-title {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 500;
  letter-spacing: -.01em;
  animation: sc-rise 1.2s var(--ease) 1.1s both;
}

.loader-bar {
  width: min(60vw, 220px);
  height: 2px;
  border-radius: 2px;
  background: var(--rule);
  overflow: hidden;
  animation: sc-fade .6s ease-out .6s both;
}

.loader-bar-fill {
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: sc-bar 5.5s cubic-bezier(.65, 0, .35, 1) .4s both;
}

.loader-note {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  text-wrap: balance;
  animation: sc-rise 1s var(--ease) 1.8s both;
}

.loader-note svg { flex: none; color: var(--accent-deep); }

/* ---- backdrops ------------------------------------------------------------------ */

.backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* A: the 32px grid masked to a centre ellipse, the gold glow, the corner figures. */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(28, 27, 24, .075) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(28, 27, 24, .075) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, #000 20%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, #000 20%, transparent 100%);
}

.bg-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 46% 40% at 50% 46%, rgba(212, 169, 74, .16), rgba(212, 169, 74, 0) 100%);
  animation: sc-fade 2.6s ease-out both;
}

.bg-figures {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse clamp(240px, 32vw, 380px) clamp(300px, 40vh, 430px) at 50% 50%, transparent 0%, transparent 45%, #000 100%);
  mask-image: radial-gradient(ellipse clamp(240px, 32vw, 380px) clamp(300px, 40vh, 430px) at 50% 50%, transparent 0%, transparent 45%, #000 100%);
}

.bg-figures .figure {
  position: absolute;
  width: max(min(38vw, 500px), 44vmin);
  filter: sepia(1) saturate(.55) hue-rotate(-8deg) brightness(1.05) opacity(.16);
  animation: sc-drift 2.4s var(--ease) both;
}

.bg-figures .figure.far { filter: sepia(1) saturate(.55) hue-rotate(-8deg) brightness(1.05) blur(2.5px) opacity(.1); }
.bg-figures .figure.tl { left: -1%; top: 8%; animation-delay: .2s; }
.bg-figures .figure.tr { right: -2%; top: 4%; animation-delay: .5s; }
.bg-figures .figure.bl { left: -2%; bottom: -3%; animation-delay: .8s; }
.bg-figures .figure.br { right: -3%; bottom: -2%; animation-delay: 1.1s; }

/* B: the dot grid, the pastel washes, one oversized grayscale figure. */
.bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(28, 27, 24, .16) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .7), rgba(0, 0, 0, .15) 30%, rgba(0, 0, 0, .15) 70%, rgba(0, 0, 0, .7));
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .7), rgba(0, 0, 0, .15) 30%, rgba(0, 0, 0, .15) 70%, rgba(0, 0, 0, .7));
}

.wash {
  position: absolute;
  border-radius: 50%;
  animation: sc-fade 2.6s ease-out .2s both;
}

.wash.powder { background: radial-gradient(circle, var(--powder), rgba(245, 244, 240, 0) 70%); }
.wash.sage { background: radial-gradient(circle, var(--sage), rgba(245, 244, 240, 0) 70%); }
.wash.blush { background: radial-gradient(circle, var(--blush), rgba(245, 244, 240, 0) 70%); }
.wash.sand { background: radial-gradient(circle, var(--sand), rgba(245, 244, 240, 0) 70%); }
.wash.lilac { background: radial-gradient(circle, var(--lilac), rgba(245, 244, 240, 0) 70%); }
.wash.top-left { left: -10vw; top: -10vw; width: 60vw; height: 60vw; }
.wash.right { right: -15vw; top: 40%; width: 55vw; height: 55vw; animation-delay: .4s; }
.wash.bottom-left { left: -12vw; bottom: -10vw; width: 50vw; height: 50vw; animation-delay: .6s; }

.bg-figure {
  position: absolute;
  filter: grayscale(1) opacity(.12);
}

.bg-figure.top-right { right: -4vw; top: 60px; width: min(26vw, 460px); }

/* ---- language A layout: one card on the page ---------------------------------- */

main.auth {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(88px, 10vh, 112px) 16px 88px;
}

.auth-column {
  position: relative;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

img.crest {
  width: 104px;
  height: 104px;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(28, 27, 24, .12));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  margin-top: 28px;
  padding: clamp(22px, 5.5vw, 32px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 30px 60px -30px rgba(28, 27, 24, .25);
  overflow: hidden;
  text-align: center;
  transition: height .5s var(--ease);
}

.auth-card .eyebrow { margin-bottom: 10px; }

.auth-card h1,
.auth-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
}

.auth-card form { margin-top: 20px; text-align: left; }

.auth-card form label { font-size: 14px; font-weight: 600; }

.auth-card form button[type="submit"] { width: 100%; margin-top: 4px; }

.auth-card .pin-wrap { max-width: none; }

.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 12px 0 6px;
}

.done h2 { margin: 6px 0 0; }

.done-medal { display: block; }
.done-medal .halo { fill: var(--accent); opacity: .18; }
.done-medal .disc { fill: var(--accent); }
.done-medal .tick {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  animation: sc-check .7s var(--ease) .3s both;
}

html.lang-b .done-medal .halo { fill: var(--ink); opacity: .1; }
html.lang-b .done-medal .disc { fill: var(--ink); }
html.lang-b .done-medal .tick { stroke: var(--white); }

/* ---- language B layout: the top bar, the page column, the rail ----------------- */

main.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: clip;
}

.container {
  position: relative;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 32px);
}

.container.wide { max-width: 1320px; }

.page-head { padding-top: clamp(120px, 16vh, 160px); }

header.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 18px clamp(20px, 4vw, 32px);
  background: rgba(245, 244, 240, 0);
  border-bottom: 1px solid transparent;
  transition: padding .5s var(--ease), background-color .5s var(--ease), border-color .5s var(--ease);
  animation: sc-fade 1.2s ease-out .4s both;
}

html.sc-loading header.topbar { animation: none; opacity: 0; }

header.topbar.is-scrolled {
  padding-top: 10px;
  padding-bottom: 10px;
  background: rgba(245, 244, 240, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--hair);
}

.topbar-inner {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

a.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-link img { width: 38px; height: 38px; object-fit: contain; }

.brand-words { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 15px; font-weight: 700; }
.brand-sub { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--hint); }

nav.nav-pills { display: flex; align-items: center; gap: 4px; }

.nav-pill {
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
  background: var(--tint);
  transition: background-color .3s var(--ease), color .3s var(--ease), scale .3s var(--ease);
}

.nav-pill.sage { background: var(--sage); }
.nav-pill.lilac { background: var(--lilac); }
.nav-pill.sand { background: var(--sand); }
.nav-pill.powder { background: var(--powder); }

.nav-pill:hover,
.nav-pill[aria-current="page"] { background: var(--ink); color: var(--white); scale: 1.03; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.account { position: relative; }

button.account-button {
  min-height: 44px;
  padding: 0 6px 0 16px;
  border: 1.5px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 15px;
  box-shadow: none;
}

button.account-button:hover { background: var(--ink); color: var(--white); }

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--powder);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(340px, calc(100vw - 40px));
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: 20px;
  box-shadow: 0 30px 60px -24px rgba(28, 27, 24, .3);
  text-align: left;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(.97);
  pointer-events: none;
  transition: opacity .35s var(--ease), transform .4s var(--ease);
}

.account-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }

.menu-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--tint-2);
}

.menu-head p { margin: 0; font-size: 15px; font-weight: 700; }
.menu-head p.muted { margin-top: 4px; font-size: 13.5px; font-weight: 400; }

.menu-links { display: flex; flex-direction: column; padding: 8px; }

.menu-links.nav { display: none; border-top: 1px solid var(--rule); }

.menu-link {
  display: block;
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  transition: background-color .3s var(--ease);
}

.menu-link:hover { background: var(--powder); color: var(--ink); }
.menu-link.sage:hover { background: var(--sage); }
.menu-link.lilac:hover { background: var(--lilac); }
.menu-link.sand:hover { background: var(--sand); }

.menu-actions { display: flex; gap: 8px; padding: 8px 16px 16px; }

.menu-actions button {
  flex: 1;
  min-height: 44px;
  padding: 0 12px;
  font-size: 14.5px;
}

@media (max-width: 1099px) {
  nav.nav-pills { display: none; }
  .menu-links.nav { display: flex; }
}

@media (max-width: 640px) {
  button.account-button .greeting { display: none; }
  button.account-button { padding-left: 6px; }
  .brand-words { display: none; }
}

/* The console origin serves /settings too; it has no student pages to link. */
body[data-realm="admin"] .student-only { display: none !important; }

/* The rail layout: a sticky pastel contents rail beside the cards. */
.rail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: clamp(28px, 4vh, 40px);
}

@media (min-width: 900px) {
  .rail-layout { grid-template-columns: minmax(0, 240px) minmax(0, 1fr); }
}

nav.rail {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: 16px;
  background: var(--powder);
}

nav.rail.lilac { background: var(--lilac); }
nav.rail.sand { background: var(--sand); }
nav.rail.sage { background: var(--sage); }

.rail-label { padding: 6px 12px 8px; }

nav.rail a.rail-link {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

nav.rail a.rail-link:hover { background: rgba(255, 255, 255, .75); }

nav.rail a.rail-link[aria-current="true"],
nav.rail a.rail-link[aria-current="location"] { background: var(--ink); color: var(--white); }

.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(28, 27, 24, .1);
}

.rail-foot .btn { min-height: 44px; font-size: 14.5px; }

.rail-foot a:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  font-size: 14px;
  font-weight: 600;
}

.card-column { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.card[id] { scroll-margin-top: 110px; }

/* A structured list row: icon disc, two lines, actions on the right. */
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--white);
  transition: opacity .4s var(--ease), transform .4s var(--ease), background-color .4s var(--ease);
  animation: sc-row .8s var(--ease) both;
}

.row.is-leaving { transform: translateX(12px); animation: none; }

.row-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--powder);
  color: var(--ink);
}

.row-icon.sage { background: var(--sage); }
.row-icon.neutral { background: var(--tint-2); }

.row-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-body strong { font-size: 15.5px; font-weight: 700; }
.row-body .muted { font-size: 13.5px; }

.row-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.row.empty {
  display: block;
  padding: 18px 20px;
  border: 1.5px dashed var(--underline);
  background: transparent;
  font-size: 14.5px;
  color: var(--hint);
}

/* ---- dialogs -------------------------------------------------------------------- */

dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: clamp(24px, 4vw, 32px);
  border: 1px solid var(--hair);
  border-radius: 24px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(28, 27, 24, .4);
}

dialog[open] { animation: sc-dialog .5s var(--ease) both; }

dialog::backdrop {
  background: rgba(245, 244, 240, .7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html.lang-a dialog::backdrop { background: rgba(255, 255, 255, .6); }

.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---- footer ---------------------------------------------------------------------- */

footer.page {
  position: relative;
  margin-top: auto;
  padding: 80px 16px 26px;
  display: flex;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--hint);
  animation: sc-fade 1.6s ease-out 1.6s both;
}

main.auth footer.page {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  margin: 0;
  padding: 0 16px;
}

.footer-text { margin: 0; display: inline-block; }

.footer-text span {
  display: inline-block;
  white-space: pre;
  opacity: 1;
  transform: none;
  filter: blur(0);
  transition:
    opacity .9s cubic-bezier(.4, 0, .6, 1) var(--delay, 0s),
    transform 1.1s cubic-bezier(.2, .6, .3, 1) var(--delay, 0s),
    filter .9s ease var(--delay, 0s);
}

.footer-text span.is-scattered {
  opacity: 0;
  transform: translate(var(--dx, 0), var(--dy, -20px)) rotate(var(--rot, 0)) scale(.6);
  filter: blur(4px);
}

.colophon {
  margin: 0;
  font-size: 13.5px;
  color: var(--hint);
  text-align: center;
}

/* ---- keyframes ------------------------------------------------------------------- */

@keyframes sc-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sc-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sc-crest { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes sc-drift { from { opacity: 0; transform: translate3d(0, 28px, 0) scale(1.02); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }
@keyframes sc-glow { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes sc-check { from { stroke-dashoffset: 48; } to { stroke-dashoffset: 0; } }
@keyframes sc-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes sc-ring { from { stroke-dashoffset: 754; } to { stroke-dashoffset: 0; } }
@keyframes sc-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes sc-medal { from { opacity: 0; transform: scale(.82); filter: blur(6px); } to { opacity: 1; transform: scale(1); filter: blur(0); } }
@keyframes sc-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sc-word { from { opacity: 0; transform: translateY(12px); letter-spacing: .3em; } to { opacity: 1; transform: translateY(0); letter-spacing: .18em; } }
@keyframes sc-pulse { 0% { box-shadow: 0 0 0 0 rgba(28, 27, 24, .28); } 100% { box-shadow: 0 0 0 16px rgba(28, 27, 24, 0); } }
@keyframes sc-pulse-red { 0% { box-shadow: 0 0 0 0 rgba(138, 43, 29, .35); } 100% { box-shadow: 0 0 0 16px rgba(138, 43, 29, 0); } }
@keyframes sc-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes sc-tick { from { opacity: 0; transform: translateY(.28em); filter: blur(3px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }
@keyframes sc-row { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes sc-dialog { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
@keyframes sc-blob { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-14%, 10%) scale(1.18); } 100% { transform: translate(0, 0) scale(1); } }
@keyframes sc-flash { 0% { background-color: var(--powder); } 100% { background-color: var(--white); } }

/* ---- reduced motion: staging, never function ------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  html.lang-b { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
