/* ------------------------------------------------------------------ *
   AURELO study resources
   Palette started from the printed deck: off-white stock and the purple
   band from the box. The stock has since been cooled toward white, and the
   sage of the divider tabs replaced by a pale tint of the same purple.
 * ------------------------------------------------------------------ */

:root {
  --paper:      #fffdf2;
  --paper-warm: #f7f3e5;
  /* Was a sage drawn from the deck's divider tabs. Now a pale tint of the
     brand purple. Full-strength --violet cannot be used as a panel background:
     it drops --ink-soft body text to 2.15:1, while this holds 5.60:1, matching
     what the sage gave. */
  --violet-pale: #dcdef0;
  --ink:        #17160f;
  --ink-soft:   #58554a;
  /* Labels, eyebrows, and meta lines are violet rather than grey. Contrast is
     unchanged by the swap: #8d8a7c and #7e85c6 both sit at 3.37:1 on paper.
     --ink-muted stays grey for genuinely inactive things, where violet would
     wrongly read as interactive. */
  --ink-faint:  var(--violet);
  --ink-muted:  #8d8a7c;
  --violet:     #7e85c6;
  --violet-ink: #444a7d;
  --moss:       #3f6d52;
  --clay:       #9a4a30;
  --rule:       rgba(23, 22, 15, 0.14);

  --display: 'Bodoni Moda', 'Times New Roman', serif;
  --body:    'Montserrat', system-ui, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, monospace;

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 68rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; margin: 0; }
p { margin: 0 0 1rem; }
a { color: inherit; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--violet-ink);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper);
  padding: .75rem 1rem; z-index: 10;
}
.skip:focus { left: var(--gutter); top: .5rem; }

/* ---------------------------------------------------------------- head */

.masthead {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding: 1.75rem var(--gutter);
  /* Opaque, or page content shows through as it scrolls underneath. Sits
     below .skip (z-index 10) so the skip link still lands on top. A modal
     is unaffected either way, since showModal renders in the top layer. */
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

/* Watched by the header script to detect scroll. Out of flow, so it costs
   no layout. */
.masthead__probe { position: absolute; top: 0; left: 0; width: 1px; height: 1px; pointer-events: none; }

/* The bar wraps to two rows on narrow screens, and at the full padding that
   eats an unreasonable share of a phone viewport once it is pinned. */
@media (max-width: 46rem) {
  .masthead { padding-top: 1rem; padding-bottom: 1rem; }
  .nav { gap: .9rem; }

  /* Once scrolled, drop the wordmark and shorten the CTA to just "Buy" so
     the pinned bar collapses to a single line. The link keeps its full
     accessible name through aria-label, so this is purely visual. */
  .masthead.is-stuck { padding-top: .55rem; padding-bottom: .55rem; }
  .masthead.is-stuck .wordmark { display: none; }
  .masthead.is-stuck .btn__rest { display: none; }
  .masthead.is-stuck .nav { width: 100%; justify-content: space-between; gap: .5rem; }
}

/* Anchor targets would otherwise land underneath the pinned bar. */
#main, .section[id] { scroll-margin-top: 7rem; }

.wordmark { display: inline-flex; align-items: center; text-decoration: none; }
.wordmark img { display: block; height: 2rem; width: auto; }

.nav { display: flex; gap: 1.75rem; flex-wrap: wrap; align-items: center; }
.nav a {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .04em;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.nav a:hover { border-bottom-color: var(--violet); }

/* The nav CTA is an <a> inside .nav, so `.nav a` above outranks `.btn` on
   specificity and would strip its border and padding. Restore them here. */
.nav .btn {
  font-size: .72rem;
  letter-spacing: .1em;
  padding: .55rem 1.1rem;
  border: 1px solid var(--ink);
}
.nav .btn:hover { border-color: var(--violet-ink); }

/* Buy CTA. Paper on the brand purple is 3.4:1, under the 4.5:1 AA floor at
   this text size. Kept as a deliberate brand decision. If that is ever
   revisited, darkening the background to --violet-ink holds the same paper
   text at 8.1:1 without changing the type colour.
   The .nav-scoped twin is needed because `.nav .btn` above outranks a bare
   `.btn--buy`. */
.btn--buy, .nav .btn--buy {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--paper);
}
.btn--buy:hover, .nav .btn--buy:hover {
  background: var(--violet-ink);
  border-color: var(--violet-ink);
  color: var(--paper);
}

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }

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

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.25rem;
}
.eyebrow a { text-decoration: none; border-bottom: 1px solid var(--rule); }

.lede {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 34em;
}

/* ---------------------------------------------------------------- hero */

.hero { padding: clamp(3.5rem, 11vw, 8rem) 0 clamp(2.5rem, 6vw, 4.5rem); }

.hero__title {
  font-size: clamp(2.75rem, 9.5vw, 6.5rem);
  letter-spacing: -.015em;
  margin-bottom: 1.75rem;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: .85rem 1.5rem;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.btn:hover { background: var(--violet-ink); border-color: var(--violet-ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--small { padding: .6rem 1.1rem; font-size: .72rem; }

/* ------------------------------------------------------------ sections */

.section { padding: clamp(3rem, 7vw, 5.5rem) 0; border-top: 1px solid var(--rule); }
.section--tint {
  background: var(--violet-pale);
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  border-top: none;
}
.section__head { max-width: 34em; margin-bottom: 2.5rem; }
.section__title { font-size: clamp(1.75rem, 4vw, 2.75rem); margin-bottom: .85rem; }
.section__note { color: var(--ink-soft); margin: 0; }

/* --------------------------------------------------- signature: tab rail
   The physical deck is divided by colour-coded index tabs. Each row is a
   tab: flush left, uniform height, with the coloured edge appearing on
   hover the way a tab catches the eye when you thumb through the box.
 * -------------------------------------------------------------------- */

.rail { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }

.tab {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  min-height: 4.25rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background .16s ease, padding-left .16s ease;
}
.tab:hover { padding-left: 1.6rem; }
.tab::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--violet);
  transform: scaleY(0); transform-origin: top;
  transition: transform .2s ease;
}
.tab:hover { background: var(--paper-warm); }
.tab:hover::before, .tab:focus-visible::before { transform: scaleY(1); }

.tab__name { font-family: var(--display); font-size: clamp(1.35rem, 3.5vw, 1.9rem); line-height: 1.1; }
.tab__meta {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint); white-space: nowrap;
}

/* Mixed is not one of the nine body systems, so a heavier rule sets it apart
   without reintroducing any stagger into the flat rail. */
.tab--mixed { border-top: 1px solid var(--ink); }

.tab--off { color: var(--ink-muted); cursor: default; }
.tab--off .tab__name { opacity: .55; }

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

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--rule); }
@media (min-width: 46rem) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card { background: var(--violet-pale); padding: 1.75rem 1.5rem; }
.card__kicker {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .75rem;
}
.card__title { font-size: 1.35rem; margin-bottom: .75rem; }
.card p { color: var(--ink-soft); font-size: .93rem; }

/* ------------------------------------------------------------- anatomy */

.anat { margin: 3rem 0 0; }
/* The artwork background is #dcddef, all but identical to --violet-pale
   behind it, so the images would otherwise have no visible edge. The violet
   rule is what defines them. */
.anat img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--violet);
}
.anat figcaption {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft); margin-top: .85rem;
}

/* --------------------------------------------------------------- split */

.split { display: grid; gap: 3rem; }
@media (min-width: 52rem) { .split { grid-template-columns: 1.2fr .8fr; gap: 4rem; } }
.split p { color: var(--ink-soft); }

.stats { margin: 0; display: grid; gap: 1px; background: var(--rule); align-content: start; }
.stats > div { background: var(--paper); padding: 1rem 1.25rem; }
.stats dt {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
}
.stats dd { font-family: var(--display); font-size: 1.9rem; margin: .2rem 0 0; }

/* ---------------------------------------------------------- quiz pages */

.quizhead { padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
.quizhead__title { font-size: clamp(2.25rem, 7vw, 4.25rem); margin-bottom: 1.25rem; letter-spacing: -.015em; }

.runner { padding-bottom: 5rem; }

.q {
  border: 1px solid var(--rule);
  background: var(--paper-warm);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.q__rail { display: flex; gap: 3px; margin-bottom: 1.75rem; }
.q__tick { flex: 1; height: 4px; background: var(--rule); }
.q__tick[data-on] { background: var(--violet); }

.q__meta {
  display: flex; flex-wrap: wrap; gap: 1rem;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 1.25rem;
}

.q__stem {
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
  line-height: 1.5;
  margin-bottom: 1.75rem;
  max-width: 40em;
}

.q__opts { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }

.opt {
  width: 100%; display: flex; gap: .9rem; align-items: flex-start; text-align: left;
  font: inherit; font-size: .96rem; line-height: 1.45; color: inherit;
  background: var(--paper); border: 1px solid var(--rule);
  padding: .9rem 1.1rem; cursor: pointer;
  transition: border-color .14s ease, background .14s ease, opacity .14s ease;
}
.opt:hover:not(:disabled) { border-color: var(--violet); }
.opt:disabled { cursor: default; }
.opt__key {
  flex: 0 0 1.45rem; height: 1.45rem; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%;
  font-family: var(--mono); font-size: .7rem; margin-top: .05rem;
}
.opt[data-state="right"] { border-color: var(--moss); background: rgba(63,109,82,.08); }
.opt[data-state="right"] .opt__key { border-color: var(--moss); color: var(--moss); }
.opt[data-state="wrong"] { border-color: var(--clay); background: rgba(154,74,48,.07); }
.opt[data-state="wrong"] .opt__key { border-color: var(--clay); color: var(--clay); }
.opt[data-state="dim"] { opacity: .48; }
.opt[data-state="chosen"] { border-color: var(--violet-ink); background: rgba(126,133,198,.14); }
.opt[data-state="chosen"] .opt__key { border-color: var(--violet-ink); color: var(--violet-ink); }

.why {
  border-left: 3px solid var(--violet);
  padding: 1rem 0 .25rem 1.25rem;
  margin-top: 1.75rem;
  animation: rise .22s ease both;
}
.why__verdict {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .16em;
  text-transform: uppercase; margin: 0 0 .5rem;
}
.why__verdict[data-v="right"] { color: var(--moss); }
.why__verdict[data-v="wrong"] { color: var(--clay); }
.why__verdict[data-v="part"] { color: var(--violet-ink); }
.why__ref {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  color: var(--ink-faint); margin-top: .75rem !important;
}
.why p { margin: 0; font-size: .95rem; line-height: 1.65; }

.q__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
}
.q__count {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.q__timer { font-family: var(--mono); font-size: .8rem; letter-spacing: .06em; }
.q__timer[data-low] { color: var(--clay); }
.q__acts { display: flex; gap: .5rem; flex-wrap: wrap; }

.score { font-family: var(--display); font-size: clamp(3.5rem, 14vw, 6rem); line-height: 1; margin: 0 0 .75rem; }
.score span { font-size: .34em; color: var(--ink-faint); }

.missed { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1px; background: var(--rule); }
.missed li { background: var(--paper); padding: 1rem 1.25rem; font-size: .92rem; }
.missed b { font-weight: 500; }

@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------- bank */

.filters { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 1.25rem 0; display: grid; gap: 1rem; }
.filters__row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.filters__row--end { justify-content: space-between; }
.filters__label {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); flex: 0 0 5.5rem;
}
/* The set picker on quiz pages and the length picker on the mixed page reuse
   .filters__row outside the .filters container, which is what normally
   supplies its spacing, so give the standalone rows their own rhythm. */
.page-quiz .filters__row { margin: 1.75rem 0; }
.mixed__go { margin: 1.5rem 0 0; }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: .82rem;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--rule); padding: .35rem .8rem; cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.chip:hover { border-color: var(--violet); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.search input {
  font: inherit; font-size: .9rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); padding: .5rem .75rem; min-width: 14rem;
}

.count {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); margin: 1.25rem 0;
}

.list { display: grid; gap: 1px; background: var(--rule); margin-bottom: 5rem; }

.row { background: var(--paper); }
.row__btn {
  width: 100%; display: flex; gap: 1.25rem; align-items: baseline; justify-content: space-between;
  font: inherit; text-align: left; color: inherit;
  background: transparent; border: 0; padding: 1.15rem 1.25rem; cursor: pointer;
}
.row__btn:hover { background: var(--paper-warm); }
.row__stem { font-size: .96rem; line-height: 1.5; }
.row__tag {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); white-space: nowrap;
}
.row__body { padding: 0 1.25rem 1.5rem; }
.row[hidden] { display: none; }

/* The tag is nowrap, and a flex item will not shrink below its content, so
   beside a long stem it pushed the row wider than a phone viewport and gave
   the whole page a horizontal scrollbar. Stacked, each gets the full width
   and the tag can stay on one line. */
@media (max-width: 46rem) {
  .row__btn { flex-direction: column; align-items: flex-start; gap: .45rem; }
  /* Stacking alone is not quite enough: the longest tag, "musculoskeletal,
     clinical, select 3", still measures wider than a 360px viewport once the
     row padding is taken off. Let it wrap rather than overflow. */
  .row__tag { white-space: normal; }
}

.empty { padding: 3rem 1.25rem; text-align: center; color: var(--ink-faint); background: var(--paper); }

/* --------------------------------------------------------------- modal */

.modal {
  width: min(52rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}
.modal::backdrop { background: rgba(23, 22, 15, .55); }

.modal__head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.modal__title {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0;
}
.modal__close {
  font: inherit; font-family: var(--mono); font-size: .72rem;
  letter-spacing: .1em; text-transform: uppercase;
  background: transparent; color: inherit;
  border: 1px solid var(--rule); padding: .4rem .85rem; cursor: pointer;
}
.modal__close:hover { border-color: var(--violet); }

/* .runner carries bottom padding for the standalone quiz pages, which is
   wasted space inside a dialog. */
.modal .runner { padding: 1.25rem; }
.modal .q { border: 0; background: transparent; padding: 0; }

/* --------------------------------------------------------------- prose */

.prose { max-width: 36em; padding-bottom: 5rem; }
.prose h2 { font-size: 1.5rem; margin: 2.5rem 0 .75rem; }
.prose p { color: var(--ink-soft); }

/* Signs off the personal note on the About page. */
.prose__sign {
  font-family: var(--display);
  font-size: 1.25rem;
  color: var(--ink) !important;
  margin: 1.75rem 0 2.25rem;
  padding-left: 1rem;
  border-left: 3px solid var(--violet);
}

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

.footer { border-top: 1px solid var(--rule); margin-top: 2rem; }
.footer__inner { max-width: var(--measure); margin: 0 auto; padding: 3rem var(--gutter); }
.footer__mark { font-family: var(--display); font-weight: 600; letter-spacing: .1em; margin: 0 0 .25rem; }
.footer__mark img {
  display: block;
  height: 1.5rem;
  width: auto;
}
.footer__line { font-family: var(--display); font-size: 1.15rem; margin: 0 0 1.5rem; }
.footer__fine { font-size: .8rem; color: var(--ink-faint); margin: 0; max-width: 40em; }

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