/* AXORA — an anatomical atlas plate. Vein blue for actions, artery red for
   what needs you, nerve yellow for the streak and readiness, on a cool
   lab-bench ground. Tailwind (CDN) handles layout; this file holds the
   shared pieces. */

:root {
  --plate: #EFF2EE;
  --sheet: #FFFFFF;
  --ink: #171A2B;
  --ink-soft: #535868;
  --ink-faint: #8A8F9C;
  --rule: #D5DAD3;
  --rule-strong: #B4BBB2;
  --vein: #2747A8;
  --vein-dark: #1C3580;
  --vein-wash: #E6EBF8;
  --artery: #C9302C;
  --artery-dark: #9E2420;
  --artery-wash: #FBE9E7;
  --nerve: #E9B826;
  --nerve-dark: #8A6800;
  --nerve-wash: #FCF3D6;
  --mark: #FBE7A6;
  --correct: #2F7D57;
  --correct-wash: #E3F2EA;
  --wrong: #B3261E;
  --wrong-wash: #FBEAE8;
  --frost: repeating-linear-gradient(90deg, #E6EAE4 0 1px, transparent 1px 6px), #F3F5F1;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--plate);
  color: var(--ink);
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
.tabular { font-variant-numeric: tabular-nums; }

/* Headlines and big numbers: Instrument Serif, the plate titles of an atlas.
   It has one weight, so "bold" utilities on it are ignored. */
.font-display { font-family: "Instrument Serif", Georgia, serif; font-weight: 400 !important; letter-spacing: -0.005em; font-feature-settings: "lnum" 1; }
h1.font-display { line-height: 1.02; }
/* Question stems, options and explanations: Atkinson Hyperlegible keeps
   l, I and 1 or O and 0 apart in drug names and doses. */
.font-reading { font-family: "Atkinson Hyperlegible", system-ui, sans-serif; letter-spacing: 0; }

a { color: var(--vein); text-underline-offset: 3px; }
a:hover { color: var(--vein-dark); }

:focus-visible {
  outline: 2px solid var(--vein);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Form controls ---------- */
:where(.input, .textarea, .select) { width: 100%; }
.input, .textarea, .select {
  display: block;
  background: var(--sheet);
  border: 1.5px solid var(--rule-strong);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 16px; /* stops iOS zooming into fields */
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 6rem; resize: vertical; }
.input:hover, .textarea:hover, .select:hover { border-color: #9BA2B3; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--vein);
  box-shadow: 0 0 0 3px rgba(39, 71, 168, .16);
}
.input-error, .input-error:hover { border-color: var(--wrong); }

.check {
  width: 1.15rem; height: 1.15rem;
  accent-color: var(--vein);
  flex: none;
}

/* ---------- Buttons: specimen tags, squared with soft corners ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: 11px;
  padding: 0.68rem 1.25rem;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--vein); color: #fff; }
.btn-primary:hover { background: var(--vein-dark); color: #fff; }
.btn-quiet { background: var(--sheet); color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { border-color: var(--rule-strong); color: var(--ink); }
.btn-danger { background: var(--sheet); color: var(--wrong); border-color: #EBC7C3; }
.btn-danger:hover { background: var(--wrong-wash); color: var(--wrong); }
.btn-small { padding: .42rem .85rem; font-size: 14px; border-radius: 9px; }
.btn-icon { padding: .35rem; border-radius: 999px; color: var(--ink-soft); background: transparent; border: 1.5px solid transparent; }
.btn-icon:hover:not(:disabled) { border-color: var(--rule); background: var(--sheet); color: var(--ink); }
.btn-icon:disabled { opacity: .3; cursor: default; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Option nodes (the letter beside each option) ----------
   Round, like the labelled pins on an atlas plate. Picking one fills it. */
.bubble {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  font-size: 13px; font-weight: 700;
  color: var(--ink);
  background: var(--sheet);
  flex: none;
  overflow: hidden;
  isolation: isolate;
}
.bubble::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  background: var(--vein);
  transform: scale(0);
  transition: transform .26s cubic-bezier(.3, .7, .2, 1);
  z-index: -1;
}
.option[aria-pressed="true"] .bubble { color: #fff; border-color: var(--vein); }
.option[aria-pressed="true"] .bubble::before { transform: scale(1); }
.option.is-correct .bubble { border-color: var(--correct); color: #fff; }
.option.is-correct .bubble::before { background: var(--correct); transform: scale(1); }
.option.is-wrong .bubble { border-color: var(--wrong); }
.option.is-wrong .bubble::before { background: var(--wrong); }

.option {
  display: flex; align-items: center; gap: .85rem;
  width: 100%;
  text-align: left;
  padding: .55rem .6rem;
  margin: 0 -.6rem;
  border-radius: 12px;
  background: transparent;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.option:hover:not(:disabled) { background: rgba(39, 71, 168, .05); }
.option:disabled { cursor: default; }

/* The card that holds a sample question. */
.exam-sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 14px;
}

/* ---------- Highlighter (nerve yellow) ---------- */
.marked {
  background: linear-gradient(transparent 14%, var(--mark) 14%, var(--mark) 88%, transparent 88%);
  padding: 0 .2em;
  margin: 0 -.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- Disclosure ---------- */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.chevron { transition: transform .2s ease; }
details[open] > summary .chevron { transform: rotate(90deg); }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table th {
  text-align: left; font-weight: 600; font-size: 14px; color: var(--ink-soft);
  padding: .6rem .75rem; border-bottom: 1.5px solid var(--rule);
}
.data-table td { padding: .7rem .75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Question review form ---------- */
[data-question-form][data-type="sba"] [data-for-type="tf"],
[data-question-form][data-type="tf"] [data-for-type="sba"],
[data-question-form][data-type="sba"] [data-type-hint="tf"],
[data-question-form][data-type="tf"] [data-type-hint="sba"] { display: none; }

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.textarea.auto-grow { resize: none; field-sizing: content; min-height: 0; }
.textarea.compact { min-height: 0; }

/* ---------- Installer checklist ---------- */
.status-bubble {
  display: inline-block;
  width: 1.05rem; height: 1.05rem;
  border-radius: 5px;
  border: 1.5px solid var(--ink);
  flex: none;
  margin-top: .2rem;
}
.status-bubble.is-ok { background: var(--correct); border-color: var(--correct); }
.status-bubble.is-bad { background: var(--wrong); border-color: var(--wrong); }
.status-bubble.is-optional { border-color: var(--rule-strong); }
.status-bubble.is-now { background: var(--mark); border-color: var(--artery); }

/* ---------- Answering (practice sessions) ---------- */
.choice {
  position: relative;
  display: flex; align-items: flex-start; gap: .85rem;
  padding: .55rem .6rem;
  margin: 0 -.6rem;
  border-radius: 12px;
  cursor: pointer;
}
.choice:hover { background: rgba(39, 71, 168, .05); }
.choice.cursor-default:hover { background: transparent; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.choice input:checked + .bubble { color: #fff; border-color: var(--vein); }
.choice input:checked + .bubble::before { transform: scale(1); }
.choice input:focus-visible + .bubble { outline: 2px solid var(--vein); outline-offset: 3px; }
.choice input:disabled + .bubble { cursor: default; }

.bubble-sm { width: 2.2rem; height: 2.2rem; font-size: 14px; }
.bubble-blank { border-style: dashed; border-color: var(--rule-strong); color: var(--ink-soft); }
.choice input:checked + .bubble-blank { color: var(--ink); border-color: var(--ink-soft); }
.choice input:checked + .bubble-blank::before { background: #E2E6E0; }

/* After the answer is revealed */
.bubble.is-key { border-color: var(--correct); color: #fff; }
.bubble.is-key::before { background: var(--correct); transform: scale(1); }
.bubble.is-missed { border-color: var(--correct); border-width: 2.5px; color: var(--correct); }
.bubble.is-missed::before { transform: scale(0); }
.bubble.is-wrong-pick { border-color: var(--wrong); color: #fff; }
.bubble.is-wrong-pick::before { background: var(--wrong); transform: scale(1); }
.choice input:checked + .bubble.is-missed { color: var(--correct); }

/* Question grid: numbered wells */
.pal {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.15rem; height: 2.15rem; padding: 0 .3rem;
  border-radius: 9px;
  border: 1.5px solid var(--rule-strong);
  background: var(--sheet);
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
button.pal { cursor: pointer; }
button.pal:hover { border-color: var(--ink); color: var(--ink); }
.pal.is-done { background: var(--vein); border-color: var(--vein); color: #fff; }
.pal.is-current { box-shadow: 0 0 0 2px var(--plate), 0 0 0 4px var(--artery); color: var(--ink); border-color: var(--ink); }
.pal.is-current.is-done { color: #fff; }
.pal.is-partial { border-style: dashed; border-color: var(--ink); color: var(--ink); }

/* Timer when time is nearly up */
[data-timer].is-low { background: var(--mark); }

/* Score meters */
.meter { height: 10px; border-radius: 999px; background: #E2E6E0; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--vein); }

/* ---------- Flashcards: an index card with a ruled label strip ---------- */
.index-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(23, 26, 43, .04), 0 18px 36px -26px rgba(23, 26, 43, .45);
  overflow: hidden;
}
.index-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem 1.25rem .6rem;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--frost);
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 640px) { .index-card-head { padding-left: 1.75rem; padding-right: 1.75rem; } }
.card-fold { padding: 0 1.25rem 1.5rem; }
@media (min-width: 640px) { .card-fold { padding: 0 1.75rem 1.75rem; } }
.card-back[open] > .card-fold { display: none; }
.card-back[open] > [data-card-answer] { animation: card-in .22s ease-out; }
@keyframes card-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
[data-card-answer]:focus { outline: none; }

.kbd {
  display: inline-block;
  font: 600 12px/1.4 "Hanken Grotesk", system-ui, sans-serif;
  padding: 0 .4rem;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--sheet);
  color: var(--ink);
}

/* ---------- The node (streak marker): a node of Ranvier on a nerve fibre ---------- */
.capsule {
  position: relative;
  display: inline-block;
  width: 1.6rem; height: .9rem;
  flex: none;
  background: linear-gradient(var(--ink), var(--ink)) center / 100% 1.5px no-repeat;
}
.capsule::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: .62rem; height: .62rem; margin-top: -.31rem;
  border-radius: 999px; border: 1.5px solid var(--ink); background: var(--sheet);
}
.capsule::after {
  content: ""; position: absolute; right: 0; top: 50%;
  width: .78rem; height: .5rem; margin-top: -.25rem;
  border-radius: 999px; border: 1.5px solid var(--ink); background: var(--sheet);
}
.capsule.is-safe::before { background: var(--nerve); }
.capsule.is-safe::after { background: var(--nerve); }
.capsule.is-due::before { background: var(--artery); border-color: var(--artery-dark); }
/* kept for older markup */
.streak-dot { display: none; }

/* ---------- The streak: a myelinated nerve fibre ----------
   Each study day is a node of Ranvier; the myelin between two counted days
   fills yellow, so an unbroken streak reads as one conducting fibre. */
.dose { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; padding-top: .2rem; }
.dose::before {
  content: ""; position: absolute; left: 7%; right: 7%; top: 1.05rem; height: 2px;
  background: var(--rule-strong);
}
.dose-day {
  position: relative;
  display: flex; flex-direction: column-reverse; align-items: center; gap: .45rem;
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
}
.dose-day .pill {
  position: relative; z-index: 1;
  width: 1.15rem; height: 1.15rem;
  border-radius: 999px;
  border: 2px solid var(--rule-strong);
  background: var(--sheet);
  margin-top: .45rem;
}
/* myelin sheath to the left of each node (between it and the day before) */
.dose-day + .dose-day::before {
  content: ""; position: absolute; z-index: 0;
  top: .8rem; height: .7rem;
  right: calc(50% + .75rem); left: calc(-50% + .75rem);
  border-radius: 999px;
  border: 1.5px solid var(--rule-strong);
  background: var(--sheet);
}
.dose-day.is-taken .pill { background: var(--nerve); border-color: var(--nerve-dark); }
.dose-day.is-taken + .dose-day.is-taken::before { background: var(--nerve); border-color: var(--nerve-dark); }
.dose-day.is-some .pill { background: linear-gradient(90deg, var(--nerve) 50%, var(--sheet) 50%); border-color: var(--nerve-dark); }
.dose-day.is-today { color: var(--ink); }
.dose-day.is-today .pill { box-shadow: 0 0 0 3px var(--plate), 0 0 0 5px var(--artery); }
.dose-day.is-today.is-taken .pill { box-shadow: 0 0 0 3px var(--plate), 0 0 0 5px var(--nerve-dark); }
.dose-day.is-future { opacity: .5; }
@keyframes fire { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.dose-day.is-today:not(.is-taken) .pill { animation: fire 1.8s ease-in-out infinite; }

/* ---------- Module plates (course map) ----------
   Each module is an atlas plate: the code sits in a ruled label column. */
.slide {
  display: grid;
  grid-template-columns: 4.9rem minmax(0, 1fr);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
a.slide:hover { border-color: var(--rule-strong); box-shadow: 0 10px 24px -20px rgba(23, 26, 43, .5); color: inherit; }
.slide-label {
  background: var(--frost);
  border-right: 1px solid var(--rule);
  padding: .8rem .7rem;
  display: flex; flex-direction: column; justify-content: space-between; gap: .5rem;
  font-weight: 700; letter-spacing: -0.01em;
  line-height: 1.1;
}
.slide-body { padding: .8rem 1rem .9rem; min-width: 0; }
@media (min-width: 640px) { .slide { grid-template-columns: 5.6rem minmax(0, 1fr); } }
/* The stain strip: one band per discipline, as wide as its share of topics. */
.stain { display: flex; height: 7px; border-radius: 999px; overflow: hidden; background: #E2E6E0; }
.stain > span { display: block; height: 100%; }

.disc-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 999px; flex: none; }
.disc-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--sheet);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- Choiceboxes (ported from 21st.dev's Choicebox) ---------- */
.choicebox {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .75rem .9rem;
  border-radius: 12px;
  background: var(--sheet);
  border: 1.5px solid var(--rule);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.choicebox:hover { border-color: var(--rule-strong); }
.choicebox:has(input:checked) { border-color: var(--vein); background: var(--vein-wash); }
.choicebox:has(input:focus-visible) { outline: 2px solid var(--vein); outline-offset: 2px; }
.choicebox input { margin-top: .15rem; }
.choicebox .cb-meta { margin-left: auto; padding-left: .5rem; font-size: 13px; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Rank bars (ported from 21st.dev's Rank Bars) ---------- */
.rank-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 9rem) minmax(0, 1fr) 4.2rem;
  align-items: center; gap: .75rem;
}
@media (min-width: 640px) { .rank-row { grid-template-columns: 2rem minmax(0, 13rem) minmax(0, 1fr) 4.6rem; } }
.rank-track { height: 14px; background: #E2E6E0; border-radius: 0 999px 999px 0; overflow: hidden; }
.rank-bar { height: 100%; background: #B4BBB2; border-radius: 0 999px 999px 0; transform-origin: left; }
.rank-row.is-you .rank-bar { background: var(--vein); }
.rank-row.is-top .rank-bar { background: var(--nerve); }
.rank-in .rank-bar { animation: rank-grow .7s cubic-bezier(.2, .7, .3, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes rank-grow { from { transform: scaleX(0); } }

/* Inside the installed app there's nothing to install. */
@media (display-mode: standalone) { .hide-installed { display: none !important; } }

/* A grid with no column template gets one column that can shrink, so a long
   unbroken line (a truncated topic name, a link) never widens the page on a
   phone. :where() keeps this weaker than any grid-cols-* utility. */
:where(.grid) { grid-template-columns: minmax(0, 1fr); }
/* Screen-reader-only text inside a sideways-scrolling table must be clipped by
   the table's box, not placed against the page (which would widen it). */
.overflow-x-auto { position: relative; }
/* The hidden attribute always wins, even over .btn's display. */
[hidden] { display: none !important; }

/* ---------- Readiness ---------- */
/* A checklist mark: not yet (empty box), partly (half nerve-yellow), done (green tick). */
.mark-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 2.6rem;
  padding: .35rem .75rem .35rem .45rem;
  border-radius: 10px;
  border: 1.5px solid var(--rule);
  background: var(--sheet);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  text-align: left; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.mark-btn:hover { border-color: var(--rule-strong); }
.mark-btn .box {
  position: relative; flex: none;
  width: 1.3rem; height: 1.3rem; border-radius: 6px;
  border: 2px solid var(--rule-strong); background: var(--sheet);
}
.mark-btn .state { font-weight: 500; color: var(--ink-soft); }
.mark-btn[data-level="1"] { border-color: #E5CF85; background: var(--nerve-wash); }
.mark-btn[data-level="1"] .box { border-color: var(--nerve-dark); background: linear-gradient(135deg, var(--nerve) 50%, var(--sheet) 50%); }
.mark-btn[data-level="2"] { border-color: #A9D2BB; background: var(--correct-wash); }
.mark-btn[data-level="2"] .box { border-color: var(--correct); background: var(--correct); }
.mark-btn[data-level="2"] .box::after {
  content: ""; position: absolute; left: .32rem; top: .08rem;
  width: .38rem; height: .7rem; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.mark-btn.is-saving { opacity: .6; }
.mark-auto {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 2.6rem; padding: .35rem .75rem;
  border-radius: 10px; border: 1.5px dashed var(--rule-strong);
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.mark-auto .meter { width: 3.5rem; height: 7px; }
.mark-auto .meter > span { background: var(--nerve); }

.band { display: inline-flex; align-items: center; padding: .1rem .55rem; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.band-none { background: #E2E6E0; color: var(--ink-soft); }
.band-started { background: var(--artery-wash); color: var(--artery-dark); }
.band-building { background: var(--nerve-wash); color: var(--nerve-dark); }
.band-solid { background: var(--vein-wash); color: var(--vein-dark); }
.band-top { background: var(--correct-wash); color: var(--correct); }

/* Readiness bars: a fibre that fills nerve-yellow, with a tick at the distinction mark. */
.ready-bar { position: relative; height: 10px; border-radius: 999px; background: #E2E6E0; }
.ready-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--nerve); transition: width .35s ease; }
.ready-bar.is-top > span { background: var(--correct); }
.ready-bar::after {
  content: ""; position: absolute; top: -3px; bottom: -3px; left: 85%;
  width: 2px; border-radius: 2px; background: var(--ink); opacity: .35;
}

/* Leader line: label ............ value, as on a labelled plate */
.leader { display: flex; align-items: baseline; gap: .5rem; }
.leader > .dots { flex: 1; min-width: 1rem; border-bottom: 1.5px dotted var(--rule-strong); transform: translateY(-4px); }
