:root {
  --paper: #f8f3e6;
  --card: #fffbf1;
  --ink: #1e2240;
  --ink-2: #4a4d62;
  --rule: #cfc6ad;
  --ox: #8a2b2b;
  --ox-d: #74201f;
  --teal: #245f5a;
  --mustard: #c4922f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --g: 16px;
  --max: 1160px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--ox); text-underline-offset: .18em; }
a:hover { color: var(--ox-d); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .6rem; font-weight: 600; }
h2 { font-size: clamp(1.6rem, 5vw, 2.5rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
.fine { font: .9rem/1.5 var(--sans); color: var(--ink-2); }

.skip { position: absolute; left: var(--g); top: -80px; z-index: 50; background: var(--ink); color: var(--paper); padding: .7rem 1rem; }
.skip:focus { top: 8px; }

/* Top bar */
.top {
  max-width: var(--max); margin: 0 auto; padding: 12px var(--g);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1.4rem;
  border-bottom: 3px double var(--ink);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 600; min-height: 44px; }
.crest { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ox); color: var(--ox); font: 700 .8rem var(--sans); letter-spacing: .05em; }
.top ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1rem; font-family: var(--sans); font-size: .93rem; }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); text-decoration: none; }
.top nav a:hover { color: var(--ox); text-decoration: underline; }
.top nav a.universe { color: var(--ox); font-weight: 600; }

main > section, .electives { max-width: var(--max); margin: 0 auto; padding: 48px var(--g); }

/* Hero */
.hero { padding-top: 56px; text-align: center; }
.motto { font: 600 .78rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--ox); margin: 0 0 .8rem; }
h1 { font-size: clamp(2.6rem, 12vw, 6.4rem); line-height: .95; letter-spacing: -.025em; margin-bottom: 1.2rem; }
h1 span { display: inline-block; }
h1 span:nth-child(2) { font-style: italic; color: var(--ox); }
.lede { font-size: clamp(1.15rem, 3vw, 1.45rem); max-width: 34ch; margin: 0 auto 1rem; }
.hero .fine { max-width: 54ch; margin: 0 auto 1.6rem; }
.hero-actions, .write-actions, .row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.row { justify-content: flex-start; margin: .6rem 0; }
@media (prefers-reduced-motion: no-preference) {
  .kinetic span { animation: settle .9s cubic-bezier(.2, .7, .2, 1) both; }
  .kinetic span:nth-child(2) { animation-delay: .12s; }
  .kinetic span:nth-child(3) { animation-delay: .24s; }
  @keyframes settle { from { opacity: 0; transform: translateY(.4em) rotate(-4deg); } to { opacity: 1; transform: none; } }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
  padding: .6rem 1.2rem; font: 600 1rem var(--sans); text-decoration: none; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 999px;
  transition: background-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--ox); border-color: var(--ox); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.small { font-size: .92rem; padding: .45rem 1rem; }
.btn.big { font-size: 1.1rem; padding: .85rem 1.6rem; min-height: 52px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.linkish { background: none; border: 0; padding: .3rem 0; min-height: 44px; font: inherit; color: var(--ox); text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } html { scroll-behavior: auto; } }

/* Syllabus postcards */
.postcards { display: grid; gap: 20px; }
@media (min-width: 768px) { .postcards { grid-template-columns: 1fr 1fr; } }
.pc {
  background: var(--card); border: 1px solid var(--rule); padding: 1.3rem 1.4rem;
  box-shadow: 0 1px 0 var(--rule), 4px 5px 0 rgba(30, 34, 64, .08);
  position: relative;
}
.pc::after { content: ""; position: absolute; top: 12px; right: 12px; width: 34px; height: 40px; border: 2px dashed var(--mustard); border-radius: 3px; }
.pc h3 { padding-right: 46px; }
.pc ol { margin: 0; padding-left: 1.2rem; }
.lab { display: inline-block; font: 700 .68rem/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; padding: .28rem .45rem; border-radius: 3px; vertical-align: .12em; margin-right: .2rem; }
.lab-f { background: var(--ink); color: var(--paper); }
.lab-i { background: #e2ecea; color: var(--teal); border: 1px solid var(--teal); }
.lab-q { background: #f6e3e1; color: var(--ox-d); border: 1px solid var(--ox); }

/* Catalogue */
.cat-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; }
.progress-line { font: .95rem var(--sans); color: var(--ink-2); margin: 0; }
.cards { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.card { container-type: inline-size; }
.card a {
  display: grid; gap: .5rem; height: 100%; padding: 1.1rem 1.1rem 1rem; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); position: relative;
  box-shadow: 4px 5px 0 rgba(30, 34, 64, .08);
  transition: transform .2s, box-shadow .2s;
}
.card:nth-child(odd) a { transform: rotate(-.6deg); }
.card:nth-child(even) a { transform: rotate(.5deg); }
.card a:hover, .card a:focus-visible { transform: rotate(0) translateY(-3px); box-shadow: 6px 9px 0 rgba(138, 43, 43, .18); }
@media (prefers-reduced-motion: reduce) { .card a, .card:nth-child(n) a { transition: none; transform: none; } }
.card .seal { width: 92px; height: 92px; }
.card-n { font: 700 .74rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ox); }
.card h3 { font-size: 1.3rem; margin: 0; }
.card p { margin: 0; font-size: .97rem; color: var(--ink-2); }
.card .stamps { border-top: 1px dashed var(--rule); padding-top: .5rem; }
@container (min-width: 330px) {
  .card a { grid-template-columns: 92px 1fr; column-gap: 1rem; align-items: start; }
  .card .seal { grid-row: span 3; }
  .card .stamps { grid-column: 1 / -1; }
}
.stamps { display: flex; flex-wrap: wrap; gap: .4rem; font: 600 .74rem var(--sans); }
.stamp { padding: .18rem .5rem; border: 1.5px solid var(--rule); border-radius: 3px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.stamp.on { border-color: var(--teal); color: var(--teal); background: #e2ecea; }
.stamp.on::before { content: "✓ "; }

/* Electives */
.electives { padding-top: 0; }
.elective {
  background: var(--card); border: 1px solid var(--rule); margin-bottom: 40px;
  padding: 24px var(--g) 18px; box-shadow: 6px 8px 0 rgba(30, 34, 64, .07);
}
@media (min-width: 768px) { .elective { padding: 40px 48px 28px; } }
.el-head { display: grid; gap: 1rem; align-items: center; margin-bottom: 1.4rem; border-bottom: 3px double var(--ink); padding-bottom: 1.2rem; }
@media (min-width: 560px) { .el-head { grid-template-columns: 120px 1fr; } }
.el-head .seal { width: 120px; height: 120px; }
.el-n { font: 600 .8rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ox); margin: 0 0 .3rem; }
.el-meta { font: .9rem var(--sans); color: var(--ink-2); margin: 0; }
.back { margin: 0 0 1rem; }
.reading { max-width: 68ch; }
.reading > p:first-child::first-letter { float: left; font-size: 3.4em; line-height: .85; padding: .06em .1em 0 0; color: var(--ox); }
.counter { border-left: 4px solid var(--ox); background: #f7ece4; padding: 1rem 1.2rem; margin: 1.6rem 0; }
.counter h3 { font-size: 1.05rem; color: var(--ox-d); }
.counter p { margin: 0; }

.exp, .nb, .mastery, .src { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px dashed var(--rule); }
.exp { background: #f3eedf; border: 1px solid var(--rule); padding: 1.2rem; margin-left: calc(var(--g) * -1); margin-right: calc(var(--g) * -1); }
@media (min-width: 768px) { .exp { margin-left: -16px; margin-right: -16px; padding: 1.5rem; } }
.exp h3::before { content: "⚗ "; color: var(--ox); }
.nb { background-image: repeating-linear-gradient(transparent 0 27px, #d8e0ea 27px 28px); background-color: #fffdf6; padding: 1.2rem 1.2rem .4rem 2.6rem; border: 1px solid var(--rule); position: relative; }
.nb::before { content: ""; position: absolute; left: 1.6rem; top: 0; bottom: 0; width: 1.5px; background: #e2a3a3; }
.nb h3::before { content: "✎ "; color: var(--ox); }
.mastery h3::before { content: "⇡ "; color: var(--teal); }
.src ul { padding-left: 1.1rem; font-size: .97rem; }
.src li { margin-bottom: .4rem; }
.stampbar { margin-top: 1.4rem; padding-top: 1rem; border-top: 3px double var(--ink); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.stampbar .stamp-toggle { font: 600 .9rem var(--sans); display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: 0 .9rem; border: 1.5px dashed var(--rule); border-radius: 4px; cursor: pointer; }
.stamp-toggle input { width: 20px; height: 20px; accent-color: var(--teal); }
.stamp-toggle:has(input:checked) { border-style: solid; border-color: var(--teal); background: #e2ecea; color: var(--teal); }
.stampbar .fine { margin: 0 0 0 auto; }

/* Controls */
label { font: 600 .92rem var(--sans); }
.q-controls label, .avg-grid label, label.wide { display: grid; grid-template-columns: 1fr auto; gap: .1rem .5rem; margin-bottom: .5rem; }
.q-controls input[type=range], .avg-grid input[type=range], label.wide input[type=range] { grid-column: 1 / -1; }
output { font: 700 .95rem var(--mono); color: var(--ox-d); }
input[type=range] { width: 100%; min-height: 36px; accent-color: var(--ox); cursor: pointer; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; min-height: 44px; padding-top: .4rem; }
label.check input { width: 20px; height: 20px; flex: none; accent-color: var(--ox); margin-top: .1rem; }
.seg { border: 1px solid var(--rule); padding: .4rem .7rem .5rem; margin: .4rem 0 .6rem; display: flex; flex-wrap: wrap; gap: 0 1rem; }
.seg legend { font: 600 .8rem var(--sans); color: var(--ink-2); padding: 0 .3rem; }
.seg label { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; font-weight: 500; }
.seg input { width: 18px; height: 18px; accent-color: var(--ox); }

.q-grid, .pond-grid { display: grid; gap: 1rem; container-type: inline-size; }
@media (min-width: 900px) { .q-grid, .pond-grid { grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr); align-items: start; } }
.q-canvas, .pond { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--rule); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 1rem 0 .5rem; }
.stats div { background: var(--card); border: 1px solid var(--rule); padding: .5rem .7rem; }
.stats dt { font: 600 .74rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.stats dd { margin: 0; font: 700 1.15rem var(--mono); }
.q-note, .f-note, .c-note, .a-note { font: .95rem var(--sans); margin: .4rem 0 0; min-height: 1.5em; }

/* Fair */
.cake { width: 100%; height: auto; display: block; margin-bottom: .4rem; }
.cake .choc { fill: #5b3a29; }
.cake .van { fill: #f1dfae; stroke: #d4bc7b; }
.cake .cutline { stroke: var(--ox); stroke-width: 4; stroke-dasharray: 8 5; }
.cake .pick { fill: none; stroke: var(--teal); stroke-width: 5; }
.cake text { font: 600 15px var(--sans); fill: var(--ink); }

/* Calibration */
.cal-list { padding-left: 1.4rem; margin: 0; }
.cal-list li { padding: .7rem 0; border-bottom: 1px dashed var(--rule); }
.cal-list p { margin: 0 0 .3rem; }
.cal-list .opts { display: flex; flex-wrap: wrap; gap: .3rem; }
.cal-list .opts label { display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; padding: 0 .65rem; border: 1px solid var(--rule); border-radius: 999px; font-weight: 500; font-size: .86rem; cursor: pointer; background: var(--card); }
.cal-list .opts label:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cal-list .opts input { accent-color: var(--ox); }
.cal-list li.ok { background: #e6efe9; }
.cal-list li.no { background: #f7e7e3; }
.cal-list .verdict { font: .88rem var(--sans); margin: .3rem 0 0; }
.cal-result { font: .98rem var(--sans); }
.cal-result table { border-collapse: collapse; margin: .6rem 0; width: 100%; max-width: 480px; }
.cal-result th, .cal-result td { border: 1px solid var(--rule); padding: .35rem .5rem; text-align: left; }

/* Scent chips */
.chips { display: grid; gap: 1rem; }
.chips fieldset { border: 1px solid var(--rule); padding: .5rem .8rem .8rem; margin: 0; }
.chips legend { font: 600 .82rem var(--sans); color: var(--ink-2); padding: 0 .3rem; }
.chips .chipset { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .85rem; border: 1.5px solid var(--rule); border-radius: 999px; font: 500 .92rem var(--sans); cursor: pointer; background: var(--card); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked) { background: var(--teal); color: #fff; border-color: var(--teal); }
.chip:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }
.scent-out { font: .98rem var(--sans); margin-top: 1rem; }
.meter { display: flex; height: 22px; border: 1px solid var(--ink); margin: .5rem 0; max-width: 480px; }
.meter span { display: block; height: 100%; }
.m-src { background: var(--mustard); }
.m-abs { background: var(--teal); }
.m-eval { background: var(--ox); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .88rem; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: .3rem; vertical-align: -1px; }

/* Maps */
.mapviz { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--rule); margin-bottom: .6rem; }
.mapviz rect { stroke-width: 2.5; }
.m-true rect { fill: #e2ecea; stroke: var(--teal); }
.m-merc rect { fill: #f6e3e1; stroke: var(--ox); }
.mapviz text { font: 600 14px var(--sans); fill: var(--ink); text-anchor: middle; }
.mapviz .grat { stroke: var(--rule); stroke-width: 1; }

/* Random */
.seq { font: 700 1.1rem/1.8 var(--mono); letter-spacing: .12em; word-break: break-all; background: var(--card); border: 1px solid var(--rule); padding: .5rem .7rem; min-height: 3.2rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.seq-count { font-size: .85rem; color: var(--ink-2); letter-spacing: 0; }
.r-compare { font: .98rem var(--sans); }
.r-compare .seqline { font: 700 1rem/1.7 var(--mono); letter-spacing: .1em; word-break: break-all; }
.r-compare mark { background: #f3d58a; color: var(--ink); }
.r-compare table { border-collapse: collapse; width: 100%; max-width: 520px; margin: .6rem 0; }
.r-compare th, .r-compare td { border: 1px solid var(--rule); padding: .35rem .5rem; text-align: left; }

/* Average */
.avg-grid { display: grid; gap: .4rem 1.5rem; }
@media (min-width: 768px) { .avg-grid { grid-template-columns: 1fr 1fr; } }
.bars { width: 100%; height: auto; display: block; }
.bars text { font: 700 18px var(--sans); fill: var(--ink); }
.bars .v { font: 700 16px var(--mono); }
.bars .axis { font: 500 12px var(--sans); fill: var(--ink-2); }
.bar-a rect { fill: var(--teal); }
.bar-b rect { fill: var(--ox); }
@media (prefers-reduced-motion: no-preference) { .bars rect { transition: width .3s; } }

/* Ladder */
.rungs { list-style: none; padding: 0; margin: 1.4rem 0; display: grid; gap: 12px; }
.rungs li { background: var(--card); border: 1px solid var(--rule); padding: 1rem 1.2rem; border-left: 6px solid var(--rule); }
.rungs li:first-child { border-left-color: var(--teal); }
.rungs li:last-child { border-left-color: var(--ox); }
.rungs p { margin: 0; }
@media (min-width: 768px) { .rungs { grid-template-columns: repeat(4, 1fr); align-items: end; } .rungs li:nth-child(2) { margin-bottom: 24px; } .rungs li:nth-child(3) { margin-bottom: 48px; } .rungs li:nth-child(4) { margin-bottom: 72px; } }
.lede-s { max-width: 66ch; font-size: 1.12rem; }

/* Write */
.write-card {
  text-align: center; background: var(--ink); color: var(--paper); padding: 48px var(--g);
  border: 6px double var(--paper); outline: 2px solid var(--ink);
}
.write-card h2 { color: #fff; max-width: 22ch; margin: 0 auto .8rem; }
.write-card p { max-width: 52ch; margin: 0 auto 1.4rem; }
.write-card .motto { color: #f0c977; }
.write-card .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.write-card .btn:hover { background: #f0c977; border-color: #f0c977; color: var(--ink); }
.write-card .btn.ghost { background: transparent; color: var(--paper); }
.write-card .btn.ghost:hover { background: var(--paper); color: var(--ink); }
.write-card .fine { color: #d9d6cc; margin-top: 1.2rem; margin-bottom: 0; }
.write-card :focus-visible { outline-color: #f0c977; }

.site-foot { max-width: var(--max); margin: 0 auto; padding: 24px var(--g) 48px; border-top: 3px double var(--ink); font: .95rem var(--sans); }
.site-foot p { margin: .3rem 0; }

/* Seals */
.seal text { font: 700 9.5px var(--sans); letter-spacing: 1.6px; }

@media (min-width: 1440px) { :root { --g: 32px; } }

::view-transition-old(elective), ::view-transition-new(elective) { animation-duration: .3s; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

@media print {
  .top, .skip, .hero-actions, .catalogue, .exp, .stampbar, .write, .site-foot { display: none !important; }
  body { background: #fff; }
  .elective { box-shadow: none; break-before: page; }
}
