/* Deckhand: harbour-yard palette, container paint per course level. */

@font-face {
  font-family: 'Big Shoulders';
  src: url('../fonts/big-shoulders.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Big Shoulders Stencil';
  src: url('../fonts/big-shoulders-stencil.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('../fonts/atkinson-next.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('../fonts/atkinson-next-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Mono';
  src: url('../fonts/atkinson-mono.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --fog: #e4e9ee;
  --surface: #f4f6f8;
  --white: #ffffff;
  --hull: #172536;
  --hull-2: #263a52;
  --steel: #4c5d6f;
  --rule: #c2ccd6;
  --signal: #f2b705;
  --ok: #1f6e43;
  --ok-tint: #e3f1e8;
  --bad: #a8261c;
  --bad-tint: #f8e5e3;
  --level: #2b5f8a;

  --display: 'Big Shoulders', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --stencil: 'Big Shoulders Stencil', 'Big Shoulders', 'Arial Narrow', sans-serif;
  --body: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Atkinson Hyperlegible Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bar-h: 64px;
}

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

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

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--hull);
  background: var(--fog);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.1;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

code {
  font-family: var(--mono);
}

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--hull);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--signal);
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--signal);
  color: var(--hull);
  font-weight: 700;
}

.skip:focus {
  top: 12px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.55em 1.15em;
  font: 700 1rem/1.2 var(--body);
  color: var(--white);
  background: var(--hull);
  border: 2px solid var(--hull);
  border-radius: 3px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}

.btn:hover {
  background: var(--hull-2);
  border-color: var(--hull-2);
}

.btn--quiet {
  color: var(--hull);
  background: transparent;
}

.btn--quiet:hover {
  color: var(--hull);
  background: rgba(23, 37, 54, 0.07);
  border-color: var(--hull);
}

.btn--small {
  min-height: 38px;
  padding: 0.35em 0.9em;
  font-size: 0.9375rem;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* ---------- plate: a painted course code, used wherever a course is named ---------- */

.plate {
  display: inline-block;
  padding: 0.12em 0.5em 0.06em;
  font-family: var(--stencil);
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: 0.06em;
  color: var(--white);
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(0, 0, 0, 0.13) 7px 8px, rgba(255, 255, 255, 0.08) 8px 9px),
    var(--paint, var(--level));
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.plate--small {
  font-size: 1.05rem;
}

/* ---------- lists with ticks ---------- */

.ticks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticks li {
  position: relative;
  padding-left: 1.6em;
}

.ticks li + li {
  margin-top: 0.4em;
}

.ticks li::before {
  content: '';
  position: absolute;
  left: 0.15em;
  top: 0.55em;
  width: 0.7em;
  height: 0.38em;
  border-left: 2.5px solid var(--paint, var(--level));
  border-bottom: 2.5px solid var(--paint, var(--level));
  transform: rotate(-45deg);
}

/* =====================================================================
   Catalog page
   ===================================================================== */

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px clamp(20px, 5vw, 64px);
}

.wordmark {
  font-family: var(--stencil);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.series-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.series-nav a {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0 4px;
  font-weight: 700;
  color: var(--steel);
  text-decoration: none;
  border-bottom: 4px solid transparent;
}

.series-nav a:hover {
  color: var(--hull);
  border-bottom-color: var(--rule);
}

.series-nav a[aria-current='page'] {
  color: var(--hull);
  border-bottom-color: var(--signal);
}

.series-count {
  font-weight: 400;
  font-size: 0.875rem;
}

/* The stack sits beside the headline; the selected course's detail flows under the intro. */
.yard {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  grid-template-areas:
    'stack hero'
    'stack detail';
  grid-template-rows: auto 1fr;
  column-gap: clamp(40px, 6vw, 96px);
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 40px) clamp(20px, 5vw, 64px) 0;
}

.hero {
  grid-area: hero;
}

.hero h1 {
  max-width: 11ch;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.2rem, 6.4vw, 5.75rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
}

.hero-intro {
  max-width: 54ch;
  margin-top: 22px;
  font-size: 1.1875rem;
  line-height: 1.55;
}

.yard-stack {
  grid-area: stack;
  position: sticky;
  top: 24px;
  padding: 18px 20px 0 0;
}

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

/* A shipping container: corrugated sides, darker end frames, corner castings, doors on the right. */
.box {
  --frame: color-mix(in srgb, var(--paint) 72%, black);
  position: relative;
  display: grid;
  grid-template-columns: 6.2rem 1fr;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 92px;
  padding: 12px 64px 12px 26px;
  color: var(--white);
  text-align: left;
  background:
    linear-gradient(var(--frame), var(--frame)) left / 12px 100% no-repeat,
    linear-gradient(var(--frame), var(--frame)) right / 12px 100% no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)) top / 100% 3px no-repeat,
    linear-gradient(rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.28)) bottom / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(0, 0, 0, 0.14) 11px 13px, rgba(255, 255, 255, 0.07) 13px 15px),
    var(--paint);
  border: 0;
  border-radius: 1px;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.box::before,
.box::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background:
    linear-gradient(#0e1724, #0e1724) top / 100% 10px no-repeat,
    linear-gradient(#0e1724, #0e1724) bottom / 100% 10px no-repeat;
  opacity: 0.55;
}

.box::before {
  left: 0;
}

.box::after {
  right: 0;
}

.box-doors {
  position: absolute;
  top: 12px;
  bottom: 12px;
  right: 22px;
  width: 22px;
  border-left: 3px solid rgba(255, 255, 255, 0.28);
  border-right: 3px solid rgba(255, 255, 255, 0.28);
}

.box-code {
  font-family: var(--stencil);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.box-text {
  display: grid;
  gap: 2px;
}

.box-title {
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.25;
}

.box-meta {
  font-size: 0.875rem;
  opacity: 0.92;
}

.box:hover {
  transform: translateX(6px);
}

.box[aria-pressed='true'] {
  transform: translateX(18px);
}

.box[aria-pressed='true'] .box-doors {
  border-color: var(--signal);
}

.box[aria-pressed='true'] .box-code::after {
  content: '';
  position: absolute;
  right: -16px;
  top: 50%;
  border: 10px solid transparent;
  border-left: 12px solid var(--signal);
  border-right: 0;
  transform: translateY(-50%);
}

.quay {
  height: 20px;
  margin: 8px -20px 0 -12px;
  background: var(--hull);
  border-top: 5px solid var(--signal);
}

.stack-hint {
  margin-top: 14px;
  color: var(--steel);
  font-size: 0.9375rem;
}

@media (prefers-reduced-motion: no-preference) {
  .stack li {
    animation: lower 0.6s cubic-bezier(0.35, 0, 0.25, 1) both;
    animation-delay: calc(var(--i) * 130ms + 120ms);
  }

  @keyframes lower {
    0% {
      transform: translateY(-120px);
      opacity: 0;
    }
    15% {
      opacity: 1;
    }
    78% {
      transform: translateY(3px);
    }
    100% {
      transform: none;
    }
  }
}

.detail {
  grid-area: detail;
  min-width: 0;
  max-width: 62ch;
  margin-top: 48px;
  padding-left: 28px;
  border-left: 6px solid var(--paint, var(--level));
}

.detail-title {
  margin-top: 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.2rem, 4vw, 3rem);
  line-height: 0.95;
}

.detail-facts {
  margin-top: 10px;
  color: var(--steel);
}

.detail-summary {
  margin-top: 18px;
  font-size: 1.125rem;
}

.detail h3 {
  margin: 28px 0 10px;
  font-size: 1.0625rem;
}

.detail-lessons {
  margin: 0;
  padding-left: 1.4em;
}

.detail-lessons li + li {
  margin-top: 0.25em;
}

.detail-cta {
  margin-top: 32px;
}

.method {
  max-width: 1280px;
  margin: clamp(64px, 9vw, 112px) auto 0;
  padding: 0 clamp(20px, 5vw, 64px);
}

.method h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.25rem;
}

.method-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 24px 0 0;
  border-top: 3px solid var(--hull);
}

.method-list > div {
  padding: 18px 24px 0 0;
}

.method-list > div + div {
  padding-left: 24px;
  border-left: 1px solid var(--rule);
}

.method-list dt {
  font-weight: 700;
  font-size: 1.125rem;
}

.method-list dd {
  margin: 6px 0 0;
  color: var(--steel);
}

.site-foot {
  max-width: 1280px;
  margin: clamp(56px, 8vw, 96px) auto 0;
  padding: 24px clamp(20px, 5vw, 64px) 40px;
  border-top: 1px solid var(--rule);
  color: var(--steel);
  font-size: 0.9375rem;
}

.site-foot p + p {
  margin-top: 6px;
}

@media (max-width: 879px) {
  .yard {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'hero' 'stack' 'detail';
    grid-template-rows: auto;
  }

  .yard-stack {
    position: static;
    max-width: 560px;
    padding-top: 40px;
  }

  .detail {
    scroll-margin-top: 16px;
  }

  .box[aria-pressed='true'] .box-code::after {
    display: none;
  }

  .method-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .method-list > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .box {
    grid-template-columns: 1fr;
    gap: 4px;
    padding-right: 52px;
  }

  .box-code {
    font-size: 1.7rem;
  }

  .box[aria-pressed='true'] {
    transform: translateX(10px);
  }

  .box[aria-pressed='true'] .box-code::after {
    display: none;
  }

  .method-list {
    grid-template-columns: 1fr;
  }

  .method-list > div + div {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
    margin-top: 16px;
  }
}

/* =====================================================================
   Course player
   ===================================================================== */

.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--bar-h);
  padding: 0 20px;
  color: var(--white);
  background: var(--hull);
  border-bottom: 5px solid var(--level);
}

.bar :focus-visible {
  outline-color: var(--signal);
  box-shadow: none;
}

.bar-brand {
  font-family: var(--stencil);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.bar-course {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  padding-left: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.bar-code {
  font-family: var(--stencil);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.bar-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #c9d5e0;
}

.meter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 0.875rem;
  color: #c9d5e0;
  white-space: nowrap;
}

.meter-bar {
  position: relative;
  width: 140px;
  height: 8px;
  background: rgba(255, 255, 255, 0.14);
}

.meter-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--signal);
  transition: width 0.4s ease;
}

.outline-toggle {
  display: none;
  min-height: 40px;
  padding: 0 14px;
  color: var(--white);
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  font-weight: 700;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: calc(100vh - var(--bar-h));
}

.outline {
  position: sticky;
  top: var(--bar-h);
  align-self: start;
  height: calc(100vh - var(--bar-h));
  overflow-y: auto;
  padding: 24px 0 32px;
  background: var(--fog);
  border-right: 1px solid var(--rule);
}

.outline-overview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 20px 18px;
  font-weight: 700;
  text-decoration: none;
}

.outline-overview[aria-current='page'] > span:last-child {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.outline-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.outline-link {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 11px 20px 11px 16px;
  border-left: 4px solid transparent;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  line-height: 1.35;
}

.outline-link:hover {
  background: rgba(255, 255, 255, 0.55);
}

.outline-link[aria-current='page'] {
  background: var(--surface);
  border-left-color: var(--level);
  font-weight: 700;
}

.outline-num {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1.1;
  color: var(--steel);
}

.outline-link[aria-current='page'] .outline-num {
  color: var(--hull);
}

.outline-title small {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--steel);
}

.outline-state {
  color: var(--ok);
  padding-top: 2px;
}

.outline-exam {
  margin-top: 14px;
  border-top: 1px solid var(--rule);
}

.outline-note {
  margin: 20px 20px 0;
  font-size: 0.8125rem;
  color: var(--steel);
}

.outline-home {
  display: inline-block;
  margin: 14px 20px 0;
  font-size: 0.9375rem;
  font-weight: 700;
}

.stage {
  min-width: 0;
  padding: clamp(28px, 5vw, 64px) clamp(20px, 5vw, 80px) 120px;
  background: var(--surface);
}

.stage:focus {
  outline: none;
}

.stage > * {
  max-width: 760px;
}

@media (max-width: 959px) {
  .outline-toggle {
    display: inline-block;
  }

  .meter-bar {
    width: 72px;
  }

  .bar-title {
    display: none;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .outline {
    position: fixed;
    z-index: 25;
    top: var(--bar-h);
    left: 0;
    width: min(320px, 88vw);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s 0.25s;
    box-shadow: 8px 0 30px rgba(23, 37, 54, 0.18);
  }

  .outline-open .outline {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
  }
}

@media (max-width: 560px) {
  .bar {
    gap: 12px;
    padding: 0 12px;
  }

  .bar-course {
    padding-left: 12px;
  }

  .meter-label {
    display: none;
  }
}

/* ---------- overview and exam intro ---------- */

.overview h1,
.exam-intro h1,
.lesson-head h1,
.results h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.005em;
}

.overview h1,
.exam-intro h1 {
  margin-top: 16px;
}

/* Headings receive focus on navigation so screen readers announce the new view; they aren't controls. */
[data-focus]:focus,
[data-focus]:focus-visible {
  outline: none;
  box-shadow: none;
}

.lede {
  margin-top: 18px;
  max-width: 60ch;
  font-size: 1.1875rem;
  line-height: 1.55;
}

.facts {
  margin: 14px 0 26px;
  color: var(--steel);
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  margin-top: 48px;
}

.overview h2 {
  margin-bottom: 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.6rem;
}

.overview > section {
  margin-top: 48px;
}

.syllabus {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: syl;
  border-top: 2px solid var(--hull);
}

.syllabus li {
  counter-increment: syl;
  border-bottom: 1px solid var(--rule);
}

.syllabus a {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 12px 4px;
  text-decoration: none;
}

.syllabus a::before {
  content: counter(syl);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--steel);
}

.syllabus .syl-exam a::before {
  content: 'E';
}

.syllabus a:hover .syl-title {
  text-decoration: underline;
}

.syl-time {
  color: var(--steel);
  font-size: 0.9375rem;
  white-space: nowrap;
}

.exam-intro .ticks {
  margin: 26px 0 0;
}

.exam-warning {
  margin-top: 24px;
  padding: 12px 16px;
  background: #fff6d6;
  border-left: 5px solid var(--signal);
}

.exam-intro > p:last-child {
  margin-top: 32px;
}

@media (max-width: 700px) {
  .overview-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .overview-grid > section + section {
    margin-top: 40px;
  }
}

/* ---------- lesson content ---------- */

.lesson-count {
  color: var(--steel);
  font-size: 0.9375rem;
}

.lesson-head h1 {
  margin-top: 8px;
}

.prose {
  margin-top: 32px;
}

.prose > * + * {
  margin-top: 1em;
}

.prose h2 {
  margin-top: 2.2em;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.05;
}

.prose h3 {
  margin-top: 1.8em;
  font-size: 1.125rem;
  line-height: 1.3;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 0.6em;
}

.prose p,
.prose li {
  max-width: 68ch;
}

.prose ul,
.prose ol {
  margin-bottom: 0;
  padding-left: 1.35em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.4em;
}

.prose dfn {
  font-style: normal;
  font-weight: 700;
}

.prose :not(pre) > code {
  padding: 0.06em 0.32em;
  font-size: 0.88em;
  background: rgba(23, 37, 54, 0.075);
  border-radius: 3px;
  overflow-wrap: anywhere;
}

.prose .formula {
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--white);
  border: 1px solid var(--rule);
}

.prose aside {
  margin-top: 1.6em;
  margin-bottom: 1.6em;
  padding: 14px 18px;
  background: var(--white);
  border-left: 5px solid var(--steel);
}

.prose aside > * + * {
  margin-top: 0.6em;
}

.prose aside.tip {
  border-left-color: var(--level);
}

.prose aside.warn {
  background: #fff6d6;
  border-left-color: var(--signal);
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5em 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.prose th,
.prose td {
  padding: 10px 16px 10px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.prose th {
  border-bottom: 2px solid var(--hull);
}

.prose td:first-child {
  font-weight: 700;
  white-space: nowrap;
}

.prose td:first-child code {
  font-weight: 400;
}

.prose dl.terms {
  display: grid;
  grid-template-columns: minmax(9rem, 13.5rem) 1fr;
  margin: 1.5em 0;
  border-top: 1px solid var(--rule);
}

.prose dl.terms dt {
  padding: 12px 20px 12px 0;
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
  overflow-wrap: anywhere;
}

.prose dl.terms dd {
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

@media (max-width: 640px) {
  .prose dl.terms {
    grid-template-columns: 1fr;
  }

  .prose dl.terms dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .prose td:first-child {
    white-space: normal;
  }
}

/* code blocks */

.code {
  margin: 1.5em 0;
  overflow: hidden;
  color: #dce6ee;
  background: var(--hull);
  border-radius: 4px;
}

.code figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 7px 16px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: #a9bacb;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.code pre {
  margin: 0;
  padding: 14px 18px 16px;
  overflow-x: auto;
  font: 400 0.875rem/1.6 var(--mono);
  tab-size: 2;
}

.code .copy {
  padding: 3px 10px;
  font: 600 0.75rem/1.4 var(--body);
  color: #dce6ee;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
}

.code .copy:hover {
  background: rgba(255, 255, 255, 0.15);
}

.code :focus-visible,
.term :focus-visible {
  outline-color: var(--signal);
  box-shadow: none;
}

.t-key {
  color: #8ec5f0;
}

.t-str {
  color: #f2d27a;
}

.t-num,
.t-lit {
  color: #f4a98c;
}

.t-com {
  color: #8597a8;
}

.t-op {
  color: #a9bacb;
}

.t-prompt {
  color: var(--signal);
  user-select: none;
}

.t-cmd {
  color: #ffffff;
}

.t-out {
  color: #b2c2d0;
}

.code--sh .t-com {
  color: #8fa2b4;
}

/* diagrams: a left-to-right (or top-to-bottom) chain of steps */

.prose .flow {
  display: flex;
  align-items: stretch;
  gap: 34px;
  margin: 1.8em 0;
  padding: 0;
  list-style: none;
}

.prose .flow li {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  font-size: 0.875rem;
  line-height: 1.35;
  background: var(--white);
  border: 2px solid var(--hull);
}

.flow li strong {
  display: block;
  margin-bottom: 2px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.1;
}

.flow li.is-key {
  color: var(--white);
  background: var(--hull);
}

.flow li + li::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 50%;
  width: 20px;
  height: 2px;
  background: var(--hull);
}

.flow li + li::after {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  border: 6px solid transparent;
  border-left: 8px solid var(--hull);
  border-right: 0;
  transform: translateY(-50%);
}

.flow--down {
  flex-direction: column;
  gap: 26px;
  max-width: 460px;
}

.flow--down li + li::before {
  left: 50%;
  top: -24px;
  width: 2px;
  height: 16px;
}

.flow--down li + li::after {
  left: 50%;
  top: -10px;
  border: 6px solid transparent;
  border-top: 8px solid var(--hull);
  border-bottom: 0;
  transform: translateX(-50%);
}

.prose figure.diagram {
  margin: 1.8em 0;
}

.prose figure.diagram figcaption,
.prose .flow + .caption {
  margin-top: 10px;
  font-size: 0.9375rem;
  color: var(--steel);
}

@media (max-width: 640px) {
  .flow:not(.flow--down) {
    flex-direction: column;
    gap: 26px;
  }

  .flow:not(.flow--down) li + li::before {
    left: 50%;
    top: -24px;
    width: 2px;
    height: 16px;
  }

  .flow:not(.flow--down) li + li::after {
    left: 50%;
    top: -10px;
    border: 6px solid transparent;
    border-top: 8px solid var(--hull);
    border-bottom: 0;
    transform: translateX(-50%);
  }
}

/* tiers: a stepped pyramid, narrowest tier on top; set --t from 0 (top) */

.prose .tiers {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 1.8em 0;
  padding: 0;
  list-style: none;
}

.prose .tiers li {
  width: calc(46% + var(--t, 0) * 18%);
  max-width: none;
  margin: 0;
  padding: 10px 16px;
  font-size: 0.875rem;
  line-height: 1.35;
  text-align: center;
  color: var(--white);
  background: var(--hull-2);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.tiers li strong {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1.1;
}

.prose .tiers .tier-ban {
  background: var(--bad);
}

.prose .tiers .tier-high {
  background: #a9520f;
}

.prose .tiers .tier-minimal {
  background: var(--ok);
}

@media (max-width: 640px) {
  .prose .tiers li {
    width: 100%;
  }
}

/* cluster architecture diagram */

.arch {
  display: grid;
  gap: 28px;
}

.arch-plane,
.arch-node {
  padding: 14px 16px 16px;
  border: 2px solid var(--hull);
}

.arch-plane {
  position: relative;
  color: var(--white);
  background: var(--hull);
}

.arch-plane::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -30px;
  width: 2px;
  height: 28px;
  background: var(--hull);
}

.arch-label {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
}

.prose .arch-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.prose .arch-parts li {
  max-width: none;
  margin: 0;
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.arch-plane .arch-parts li {
  border-color: rgba(255, 255, 255, 0.45);
}

.arch-plane .arch-parts li.is-key {
  color: var(--hull);
  background: var(--signal);
  border-color: var(--signal);
}

.arch-nodes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 14px;
  border-top: 2px solid var(--hull);
}

.arch-node {
  background: var(--white);
}

.arch-pods {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.arch-pods span {
  padding: 2px 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--white);
  background: var(--level);
  border-radius: 999px;
}

@media (max-width: 640px) {
  .arch-nodes {
    grid-template-columns: 1fr;
  }
}

/* side-by-side comparison of two code blocks */

.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pair > .code {
  margin: 0;
}

@media (max-width: 700px) {
  .pair {
    grid-template-columns: 1fr;
  }
}

/* ---------- labs ---------- */

.lab {
  margin-top: 56px;
  background: var(--white);
  border: 2px solid var(--hull);
}

.lab-head {
  padding: 20px 24px 6px;
}

.lab-head h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.75rem;
}

.lab-intro {
  margin-top: 8px;
  max-width: 64ch;
}

.lab-intro > * + * {
  margin-top: 0.6em;
}

.lab-intro blockquote {
  margin: 0.8em 0 0;
  padding: 10px 16px;
  background: var(--surface);
  border-left: 4px solid var(--rule);
}

.lab-intro blockquote > * + * {
  margin-top: 0.5em;
}

.lab-intro code,
.lab-steps code {
  padding: 0.04em 0.3em;
  font-size: 0.88em;
  background: rgba(23, 37, 54, 0.075);
  border-radius: 3px;
}

.lab-steps {
  margin: 10px 0 0;
  padding: 0 24px 18px 50px;
}

.lab-steps li {
  padding: 4px 0 4px 4px;
  color: var(--steel);
}

.lab-steps li::marker {
  font-weight: 700;
}

.lab-steps li.is-current {
  color: var(--hull);
  font-weight: 700;
  background: linear-gradient(90deg, rgba(242, 183, 5, 0.22), transparent 85%);
}

.lab-steps li.is-done {
  color: var(--ok);
}

.lab-steps li.is-done::after {
  content: ' (done)';
  font-size: 0.875rem;
}

.term {
  font: 0.875rem/1.55 var(--mono);
  color: #dce6ee;
  background: var(--hull);
  cursor: text;
}

.term-log {
  min-height: 150px;
  max-height: 360px;
  overflow-y: auto;
  padding: 16px 18px 4px;
}

.term-entry + .term-entry {
  margin-top: 4px;
}

.term-entry pre {
  margin: 2px 0 8px;
  overflow-x: auto;
  font: inherit;
  color: #b2c2d0;
}

.term-entry code {
  color: #ffffff;
}

.term-cmd {
  color: #ffffff;
  white-space: pre-wrap;
  word-break: break-all;
}

.term-cmd::before {
  content: '$ ';
  color: var(--signal);
}

.term-note {
  color: #a9bacb;
}

.term-warn {
  color: #f2d27a;
}

.term-ok {
  color: #8fd6a8;
}

.term-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 16px;
}

.term-prompt {
  color: var(--signal);
}

.term-line input {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  font: inherit;
  color: #ffffff;
  background: transparent;
  border: 0;
  caret-color: var(--signal);
}

.term-line input:focus {
  outline: none;
  box-shadow: none;
}

.term-line:focus-within {
  box-shadow: inset 0 -2px 0 var(--signal);
}

.lab-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px 14px;
  border-top: 1px solid var(--rule);
}

/* chat labs: the same console, set as a conversation */

.lab--chat .term {
  font: 0.9375rem/1.55 var(--body);
}

.lab--chat .term-cmd {
  margin-top: 12px;
  word-break: normal;
  overflow-wrap: anywhere;
}

.lab--chat .term-cmd::before {
  content: 'You: ';
  font-weight: 700;
}

.term-speaker {
  margin-top: 10px;
  font-weight: 700;
  color: var(--signal);
}

.lab--chat .term-entry pre {
  white-space: pre-wrap;
  color: #dce6ee;
}

.lab--chat .term-prompt {
  font-weight: 700;
}

.lab--chat .term-line input::placeholder {
  color: #8296a9;
  opacity: 1;
}

.lab.is-complete .lab-head h2::after {
  content: ' (complete)';
  font-family: var(--body);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ok);
}

/* ---------- questions ---------- */

.check {
  margin-top: 64px;
  padding-top: 26px;
  border-top: 3px solid var(--hull);
}

.check h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2rem;
}

.check-note {
  margin-top: 6px;
  color: var(--steel);
}

.question {
  margin-top: 24px;
  padding: 22px 24px 24px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-left: 5px solid var(--level);
}

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

.q-text {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.45;
}

.q-text code,
.option code,
.order-text code,
.review code,
.feedback code {
  padding: 0.04em 0.3em;
  font-size: 0.9em;
  font-weight: 400;
  background: rgba(23, 37, 54, 0.075);
  border-radius: 3px;
}

.q-hint {
  margin: -6px 0 12px;
  color: var(--steel);
  font-size: 0.9375rem;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: start;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}

.option:hover {
  border-color: var(--hull);
}

.option:has(input:checked) {
  background: #e6edf3;
  border-color: var(--hull);
  box-shadow: inset 4px 0 0 var(--hull);
}

.option input {
  width: 1.15em;
  height: 1.15em;
  margin: 0.22em 0 0;
  accent-color: var(--hull);
}

.option:has(input:disabled) {
  cursor: default;
}

/* .options prefix outranks the :has(input:checked) selection style above. */
.options .option.is-correct {
  background: var(--ok-tint);
  border-color: var(--ok);
  box-shadow: inset 4px 0 0 var(--ok);
}

.options .option.is-wrong {
  background: var(--bad-tint);
  border-color: var(--bad);
  box-shadow: inset 4px 0 0 var(--bad);
}

.mark {
  grid-column: 2;
  font-size: 0.8125rem;
  font-weight: 700;
}

.is-correct .mark {
  color: var(--ok);
}

.is-wrong .mark {
  color: var(--bad);
}

.order-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ord;
}

.order-item {
  counter-increment: ord;
  display: grid;
  grid-template-columns: 1.8rem 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.order-item::before {
  content: counter(ord);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1;
}

.order-moves {
  display: flex;
  gap: 4px;
}

.order-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--hull);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}

.order-btn:hover {
  border-color: var(--hull);
}

.order-btn[aria-disabled='true'],
.order-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.order-item.is-correct {
  background: var(--ok-tint);
  border-color: var(--ok);
}

.order-item.is-wrong {
  background: var(--bad-tint);
  border-color: var(--bad);
}

@media (prefers-reduced-motion: no-preference) {
  .order-item.just-moved {
    animation: settle 0.5s ease;
  }

  @keyframes settle {
    from {
      background: #fff1c2;
    }
  }
}

.text-answer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-family: var(--mono);
  background: var(--hull);
  border-radius: 3px;
}

.text-prompt {
  color: var(--signal);
}

.text-answer input {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  font: 0.95rem var(--mono);
  color: var(--white);
  background: transparent;
  border: 0;
  caret-color: var(--signal);
}

.text-answer input::placeholder {
  color: #7f92a5;
}

.text-answer input:focus {
  outline: none;
  box-shadow: none;
}

.text-answer:focus-within {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
}

.text-answer.is-correct {
  box-shadow: inset 5px 0 0 #6fcf97;
}

.text-answer.is-wrong {
  box-shadow: inset 5px 0 0 #ff8a7a;
}

.q-actions {
  margin-top: 16px;
}

.feedback:empty {
  display: none;
}

.feedback {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 3px;
}

.feedback > * + * {
  margin-top: 0.5em;
}

.feedback ol {
  margin-bottom: 0;
  padding-left: 1.4em;
}

.feedback--ok {
  background: var(--ok-tint);
}

.feedback--bad {
  background: var(--bad-tint);
}

/* ---------- pager ---------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.pager .btn--primary {
  margin-left: auto;
}

/* ---------- exam ---------- */

.exam-pos {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.2rem;
  line-height: 1;
}

.exam-track {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 16px 0 28px;
  padding: 0;
  list-style: none;
}

.exam-track button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--hull);
  background: transparent;
  border: 2px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
}

.exam-track .is-answered button {
  color: var(--white);
  background: var(--level);
  border-color: var(--level);
}

.exam-track .is-current button {
  border-color: var(--hull);
  box-shadow: 0 4px 0 -1px var(--signal);
}

.question--exam {
  margin-top: 0;
}

.exam-msg:empty {
  display: none;
}

.exam-msg {
  margin-top: 20px;
  padding: 14px 18px;
  background: #fff6d6;
  border-left: 5px solid var(--signal);
}

.exam-msg > * + * {
  margin-top: 10px;
}

/* ---------- results ---------- */

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
}

.score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin-top: 14px;
}

.score-num {
  font-family: var(--display);
  font-weight: 800;
  font-size: 3.4rem;
  line-height: 1;
}

.score-detail {
  color: var(--steel);
}

.stamp {
  flex: none;
  padding: 2px 18px 0;
  font-family: var(--stencil);
  font-weight: 800;
  font-size: 2.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ok);
  border: 5px solid currentColor;
  border-radius: 4px;
  transform: rotate(-5deg);
}

.results--fail .stamp {
  color: var(--bad);
}

@media (prefers-reduced-motion: no-preference) {
  .stamp {
    animation: stamp 0.4s cubic-bezier(0.2, 1.3, 0.4, 1) 0.15s both;
  }

  @keyframes stamp {
    from {
      opacity: 0;
      transform: rotate(-5deg) scale(1.9);
    }
    to {
      opacity: 1;
      transform: rotate(-5deg) scale(1);
    }
  }
}

.results > p,
.results > ul {
  margin-top: 20px;
  max-width: 64ch;
}

.results .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.results > h2 {
  margin-top: 56px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 2rem;
}

.review {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.review-item {
  padding: 20px 0 22px 20px;
  border-bottom: 1px solid var(--rule);
  border-left: 5px solid var(--ok);
}

.review-item + .review-item {
  margin-top: 12px;
}

.review-item.is-bad {
  border-left-color: var(--bad);
}

.review-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ok);
}

.is-bad .review-status {
  color: var(--bad);
}

.review-q {
  margin-top: 6px;
  font-weight: 700;
}

.review-answers {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 6px 12px;
  margin: 12px 0 0;
}

.review-answers dt {
  color: var(--steel);
}

.review-answers dd {
  margin: 0;
}

.review-answers ul,
.review-answers ol {
  margin: 0;
  padding-left: 1.3em;
}

.review-explain {
  margin-top: 12px;
  max-width: 66ch;
}

.review-link {
  margin-top: 8px;
  font-size: 0.9375rem;
}

@media (max-width: 560px) {
  .review-answers {
    grid-template-columns: 1fr;
  }

  .review-answers dd + dt {
    margin-top: 6px;
  }
}

/* certificate */

.cert-wrap {
  margin-top: 40px;
}

.cert {
  padding: 40px 40px 28px;
  text-align: center;
  background: var(--white);
  border: 2px solid var(--hull);
  outline: 1px solid var(--hull);
  outline-offset: -10px;
}

.cert .plate {
  font-size: 1.6rem;
}

.cert-kind {
  margin-top: 18px;
  color: var(--steel);
  font-size: 1.0625rem;
}

.cert-name {
  margin-top: 18px;
  padding-bottom: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1;
  border-bottom: 2px solid var(--hull);
  overflow-wrap: anywhere;
}

.cert-body {
  max-width: 48ch;
  margin: 18px auto 0;
}

.cert-note {
  max-width: 60ch;
  margin: 16px auto 0;
  color: var(--steel);
  font-size: 0.875rem;
  line-height: 1.5;
}

.cert-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 32px;
  color: var(--steel);
  font-size: 0.9375rem;
}

.cert-mark {
  font-family: var(--stencil);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  color: var(--hull);
}

.cert-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 16px;
}

.cert-tools label {
  font-weight: 700;
}

.cert-tools input {
  flex: 1 1 200px;
  min-height: 40px;
  padding: 6px 10px;
  font: inherit;
  color: var(--hull);
  background: var(--white);
  border: 2px solid var(--steel);
  border-radius: 3px;
}

@media print {
  .printing-cert {
    background: #fff;
  }

  .printing-cert .bar,
  .printing-cert .outline,
  .printing-cert .skip,
  .printing-cert .cert-tools,
  .printing-cert .results > :not(.cert-wrap) {
    display: none !important;
  }

  .printing-cert .shell {
    display: block;
  }

  .printing-cert .stage {
    padding: 0;
    background: #fff;
  }

  .printing-cert .cert-wrap {
    margin: 0;
  }

  .printing-cert .cert {
    padding: 72px 56px 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
}
