.tutoring-page {
  max-width: var(--tool-page-max-width);
  margin: 0 auto;
  padding: 0 var(--tool-page-padding);
}

.tutoring-page .hero {
  text-align: center;
  padding: var(--size-five) 0 var(--size-five);
}

.tutoring-page .hero h1 {
  margin-top: 0;
  font-size: var(--font-size-h1);
  line-height: var(--line-height-heading);
}

.tutoring-page .subtitle {
  font-size: var(--font-size-h3);
  opacity: 0.85;
  margin-bottom: var(--size-five);
}

.tutoring-page .hero-description {
  max-width: 48rem;
  margin: 0 auto var(--size-six) auto;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  opacity: 0.9;
}

.tutoring-intro,
.tutoring-tutor,
.tutoring-curriculum,
.tutoring-method,
.tutoring-pair-map,
.tutoring-paths,
.tutoring-ai,
.tutoring-faq,
.tutoring-format,
.tutoring-pricing,
.tutoring-contact {
  margin-bottom: 3rem;
}

.tutoring-page h2 {
  font-size: var(--font-size-h2);
  margin-bottom: var(--size-four);
}

.tutoring-page .cta-button {
  font-size: var(--font-size-h3);
  margin-bottom: var(--size-four);
}

.check-list,
.format-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--size-two);
}

/* Hanging ticks: wrapped lines align with the text, not under the tick. */
.check-list li {
  position: relative;
  padding-left: 1.6em;
  line-height: 1.5;
}

.check-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-text-link);
  font-weight: 700;
}

.format-list li {
  line-height: 1.6;
}

.curriculum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--size-four);
}

.curriculum-card {
  padding: var(--size-four);
  border-radius: var(--radius-xl);
  border: 1px solid oklab(1 0 0 / 0.1);
  background: color-mix(
    in oklab,
    var(--color-surface-main),
    var(--color-text-main) var(--surface-elevation-mix)
  );
}

.curriculum-card h3 {
  font-size: var(--font-size-h4);
  margin: 0 0 var(--size-two) 0;
  display: flex;
  align-items: center;
  gap: var(--size-two);
}

.curriculum-icon {
  flex-shrink: 0;
  opacity: 0.9;
}

.curriculum-icon--danger {
  color: var(--color-red-400);
}

.curriculum-card p {
  margin: 0 0 var(--size-two) 0;
  line-height: 1.6;
  font-size: var(--font-size-body-s);
}

.card-meta {
  font-family: var(--font-mono);
  font-size: var(--font-size-caption);
  opacity: 0.6;
}

.pricing-card {
  padding: var(--size-four);
  border-radius: var(--radius-xl);
  border: 1px solid oklab(1 0 0 / 0.12);
  background: var(--color-surface-elevated);
}

.pricing-price {
  font-size: 2.4rem;
  font-weight: 800;
  margin: 0;
}

.pricing-price span {
  font-size: var(--font-size-body-s);
  font-weight: 400;
  opacity: 0.7;
}

.pricing-note {
  font-size: var(--font-size-body-s);
  opacity: 0.8;
  margin: var(--size-two) 0 var(--size-four) 0;
}

.tutoring-contact a {
  color: var(--color-text-link);
}

.tutoring-contact-form {
  margin-bottom: 3rem;
}

.tutoring-contact-form .contact-form {
  margin-top: var(--size-four);
}

.contact-note {
  font-size: var(--font-size-body-s);
  opacity: 0.8;
  line-height: 1.6;
}

/* ——— Form — identical to /contact/ for consistency ——— */
.contact-form {
  display: grid;
  gap: var(--size-four);
  margin: 0 0 var(--size-five) 0;
  padding: var(--size-four);
  background-color: var(--color-surface-elevated);
  border-radius: var(--radius-lg);
}

.contact-form[hidden] {
  display: none;
}

.form-group {
  display: grid;
  gap: var(--size-two);
}

.form-group label {
  font-family: var(--font-sans);
  font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: var(--size-two) var(--size-three);
  background-color: var(--color-surface-main);
  color: var(--color-text-main);
  border: var(--border-width-thin) solid
    color-mix(in oklab, var(--color-text-main) 20%, transparent);
  border-radius: var(--radius-md);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-text-link);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-text-link) 25%, transparent);
}

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

.contact-status {
  margin: 0;
  padding: var(--size-three);
  border-radius: var(--radius-md);
}

.contact-status--error {
  background-color: var(--color-red-900);
  color: var(--color-red-400);
}

.contact-status--success {
  background-color: var(--color-green-900);
  color: var(--color-green-500);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--size-two);
  min-height: var(--button-min-height);
  padding: var(--size-two) var(--size-four);
  font-family: var(--font-sans);
  font-weight: bold;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-primary {
  background-color: var(--color-text-link);
  color: var(--color-dark-text);
}

.btn-primary:hover,
.btn-primary:focus {
  filter: brightness(1.1);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-spinner {
  display: inline-block;
  width: var(--spinner-size);
  height: var(--spinner-size);
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: contact-spin 0.8s linear infinite;
}

.btn-spinner[hidden] {
  display: none;
}

@keyframes contact-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Pricing: what the month includes ─────────────────────────────── */

.pricing-includes-heading {
  font-size: var(--font-size-body-s);
  font-weight: 700;
  margin: var(--size-three) 0 var(--size-two) 0;
}

.pricing-includes {
  font-size: var(--font-size-body);
  margin: 0 0 var(--size-three) 0;
}

/* ── Exercise demos (learn-reorder / learn-blanks / learn-type-drill) ── */

.tutoring-demos {
  margin-bottom: 3rem;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 52rem), 1fr));
  gap: var(--size-four);
}

.demo-card {
  display: block;
  padding: var(--size-four);
  border-radius: var(--radius-xl);
  border: 1px solid oklab(1 0 0 / 0.1);
  background: var(--color-surface-elevated);
  min-width: 0;
}

.demo-card h3 {
  font-size: var(--font-size-h4);
  margin: 0 0 var(--size-two) 0;
}

.demo-card p {
  /* The global paragraph gap is sized for articles, not compact cards. */
  margin-bottom: var(--size-two);
}

.demo-purpose {
  font-size: var(--font-size-body-s);
  line-height: var(--line-height-body);
  opacity: 0.75;
  font-style: italic;
  margin-top: 0;
}

.demo-instructions,
.demo-source {
  font-size: var(--font-size-body-s);
  opacity: 0.8;
}

.demo-source {
  font-family: var(--font-mono);
  opacity: 0.55;
  margin-bottom: 0;
}

.demo-lines {
  list-style: none;
  padding: 0;
  margin: var(--size-three) 0;
  display: grid;
  /* An auto column grows to the widest line; cap it at the card width. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-one);
}

.demo-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--size-two);
  padding: var(--size-one) var(--size-two);
  border-radius: var(--radius-md);
  background: var(--color-surface-main);
  font-size: var(--font-size-code);
}

.demo-line code {
  /* A flex item won't shrink below its text without min-width: 0, and a long
     line would push the move buttons out of the card. */
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: pre;
}

.demo-line-controls {
  display: flex;
  gap: var(--size-one);
  flex-shrink: 0;
}

.demo-line-controls button,
.demo-check,
.demo-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  font-family: var(--font-serif);
  font-size: var(--font-size-body-s);
  color: var(--color-text-main);
  background: transparent;
  border: 1px solid oklab(1 0 0 / 0.25);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    background-color 0.12s ease;
}

.demo-line-controls button:hover,
.demo-check:hover,
.demo-choice:hover:not(:disabled) {
  border-color: var(--color-text-link);
  background: oklab(1 0 0 / 0.04);
}

.demo-check {
  padding: 0 var(--size-three);
}

.demo-code {
  font-size: var(--font-size-code);
  line-height: 1.6;
  background: var(--color-surface-main);
  padding: var(--size-two);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.demo-blank {
  font: inherit;
  width: 7ch;
  color: var(--color-text-main);
  background: var(--color-surface-elevated);
  border: 1px solid oklab(1 0 0 / 0.3);
  border-radius: var(--radius-sm);
  padding: 0 0.25ch;
}

.demo-blank[data-state='correct'],
.demo-choice[data-state='correct'] {
  border-color: var(--color-green-500);
}

.demo-blank[data-state='wrong'],
.demo-choice[data-state='wrong'] {
  border-color: var(--color-red-500);
}

.demo-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-two);
  margin-bottom: var(--size-three);
}

.demo-choice {
  padding: 0 var(--size-three);
}

.demo-choice:disabled {
  cursor: default;
}

.demo-choice:disabled:not([data-state]) {
  opacity: 0.5;
}

.demo-verdict {
  font-weight: 700;
  margin: var(--size-two) 0;
}

.demo-verdict[data-state='solved'],
.demo-verdict[data-state='correct'] {
  color: var(--color-green-500);
}

.demo-verdict[data-state='unsolved'],
.demo-verdict[data-state='wrong'] {
  color: var(--color-amber-500);
}

.demo-explanation {
  font-size: var(--font-size-body-s);
  line-height: var(--line-height-body);
}

/* ── Demo syntax highlighting (tokens from src/build/lib/python-highlight.ts) ──
   Hard-coded GitHub-dark-style colours. Measured against the code background
   (#0d1b1e): 5.7:1 (comment) to 11.5:1 (string) — all clear WCAG AA 4.5:1. */

.tutoring-demos .tok-keyword {
  color: #ff7b72;
}

.tutoring-demos .tok-string {
  color: #a5d6ff;
}

.tutoring-demos .tok-number,
.tutoring-demos .tok-constant {
  color: #79c0ff;
}

.tutoring-demos .tok-builtin {
  color: #ffa657;
}

.tutoring-demos .tok-function {
  color: #d2a8ff;
}

.tutoring-demos .tok-comment {
  color: #8b949e;
  font-style: italic;
}

/* ——— Hero actions ——— */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--size-three) var(--size-five);
  margin: 0 0 var(--size-five) 0;
}

.tutoring-page .hero-actions .cta-button {
  margin-bottom: 0;
}

.hero-secondary {
  color: var(--color-text-link);
}

.hero-offer {
  font-family: var(--font-mono);
  font-size: var(--font-size-body-s);
  opacity: 0.8;
  margin: 0;
}

/* ——— Method ——— */
.method-steps {
  list-style: none;
  padding: 0;
  margin: var(--size-four) 0 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--size-four);
  counter-reset: method;
}

.method-step {
  counter-increment: method;
  padding-left: var(--size-four);
  border-left: 2px solid var(--color-text-link);
}

.method-step h3 {
  font-size: var(--font-size-h4);
  margin: 0 0 var(--size-two) 0;
}

.method-step h3::before {
  content: counter(method) '. ';
  opacity: 0.6;
}

.method-step p {
  margin: 0;
  line-height: 1.6;
  font-size: var(--font-size-body-s);
}

.tutoring-paths .curriculum-grid {
  margin-top: var(--size-four);
}

/* ——— CTA under the demos ——— */
.demos-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--size-five) var(--size-four);
  margin: var(--size-five) 0 0 0;
}

.tutoring-page .demos-cta .cta-button {
  margin-bottom: 0;
}

.tutoring-ai p {
  margin: 0;
  line-height: 1.6;
}

/* ——— FAQ ——— */
.faq-item {
  border-bottom: 1px solid oklab(1 0 0 / 0.12);
}

.faq-item:first-of-type {
  border-top: 1px solid oklab(1 0 0 / 0.12);
}

/* The whole row is the target; the marker says whether it is open. */
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--size-four);
  min-height: 44px;
  padding: var(--size-three) 0;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  transition: color 0.12s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--color-text-link);
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item summary:hover {
  color: var(--color-text-link);
}

.faq-item p {
  margin: 0 0 var(--size-four) 0;
  line-height: 1.6;
  max-width: 72rem;
}

/* ——— Form additions ——— */
.label-optional {
  font-weight: 400;
  opacity: 0.7;
}

.form-hint {
  margin: var(--size-one) 0 0 0;
  font-size: var(--font-size-body-s);
  opacity: 0.75;
}

/* No-JavaScript notices: /api/contact redirects to #application-sent or
   #application-error after a plain form post. */
.form-notice {
  display: none;
  margin-top: var(--size-four);
}

.form-notice:target {
  display: block;
}

.form-notice a {
  color: inherit;
}

/* ——— Source → target map excerpt ——— */
.pair-map-rows {
  display: grid;
  gap: var(--size-four);
  margin: var(--size-four) 0;
}

.pair-map-row {
  padding: var(--size-four);
  border-radius: var(--radius-xl);
  border: 1px solid oklab(1 0 0 / 0.1);
}

.pair-map-row h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--size-two) var(--size-three);
  font-size: var(--font-size-h4);
  margin: 0 0 var(--size-three) 0;
}

.pair-map-relation {
  font-family: var(--font-mono);
  font-size: var(--font-size-caption);
  font-weight: 400;
  padding: 0 var(--size-two);
  border: 1px solid currentColor;
  border-radius: var(--radius-md);
  opacity: 0.75;
}

.pair-map-sides {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--size-four);
}

/* Grid children may not shrink below their code otherwise. */
.pair-map-sides > div {
  min-width: 0;
}

.pair-map-sides p,
.pair-map-pitfall {
  margin: var(--size-two) 0 0 0;
  line-height: 1.6;
  font-size: var(--font-size-body-s);
}

.pair-map-label {
  font-family: var(--font-mono);
  opacity: 0.7;
}

.pair-map-pitfall {
  margin-top: var(--size-three);
}

/* ——— Fading explainer ——— */
.fading-explainer {
  max-width: 64rem;
  margin: var(--size-four) 0;
  padding-left: var(--size-four);
  border-left: 2px solid var(--color-text-link);
}

.fading-explainer h3 {
  font-size: var(--font-size-h4);
  margin: 0 0 var(--size-two) 0;
}

.fading-explainer p {
  margin: 0;
  line-height: 1.6;
}

/* ——— Billing terms ——— */
.pricing-policy {
  padding-left: var(--size-four);
  margin: var(--size-three) 0 var(--size-four) 0;
  display: grid;
  gap: var(--size-two);
  font-size: var(--font-size-body-s);
  opacity: 0.85;
}

/* ——— Body font for everything base.css leaves on the browser default ——— */
.tutoring-page li,
.tutoring-page summary,
.tutoring-page .cta-button,
.tutoring-page .demo-check,
.tutoring-page input,
.tutoring-page select,
.tutoring-page textarea {
  font-family: var(--font-serif);
}

.hero-other-pairs {
  font-size: var(--font-size-body-s);
  opacity: 0.85;
  margin: 0 0 var(--size-two) 0;
}

/* ——— Two-column blocks; one column until there is room ——— */
.pricing-columns,
.ai-grid {
  display: grid;
  gap: var(--size-four) var(--size-five);
}

.pricing-columns .pricing-policy {
  margin-top: 0;
}

.ai-rule {
  padding-left: var(--size-four);
  border-left: 2px solid var(--color-text-link);
}

/* The type drill is short, so it takes the whole row instead of leaving an
   empty slot: question on the left, code and choices on the right. */
learn-type-drill.demo-card {
  grid-column: 1 / -1;
}

.drill-answer {
  min-width: 0;
}

@media (min-width: 900px) {
  learn-type-drill.demo-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--size-five);
    align-items: start;
  }

  .drill-answer .demo-code {
    margin-top: 0;
  }

  .method-steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .pricing-columns,
  .ai-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ——— Primary CTA: a button, the same wherever it appears ——— */
.tutoring-page a.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--size-two) var(--size-five);
  border-radius: var(--radius-md);
  background: var(--color-text-link);
  color: var(--color-surface-main);
  font-size: var(--font-size-body-l);
  font-weight: 700;
  text-decoration: none;
  transition: filter 0.15s ease;
}

.tutoring-page a.cta-button:hover {
  filter: brightness(1.1);
}

/* The base ring is the button's own colour; use the text colour so it shows. */
.tutoring-page a.cta-button:focus-visible {
  outline: 3px solid var(--color-text-main);
  outline-offset: 3px;
}

.pricing-card > a.cta-button {
  margin-top: var(--size-four);
}

/* ——— Code wraps instead of being cut off or scrolling sideways ——— */
.tutoring-page pre.demo-code,
.tutoring-page .demo-line code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-width: 0;
}

/* ——— Tutor ——— */
.tutoring-tutor p {
  max-width: 72rem;
  line-height: 1.6;
}

.pricing-fit {
  margin: 0 0 var(--size-three) 0;
  line-height: 1.6;
}

.faq-item .pricing-policy {
  max-width: 72rem;
  margin: 0 0 var(--size-four) 0;
  opacity: 1;
  font-size: var(--font-size-body);
}

.form-hint a {
  color: var(--color-text-link);
}

/* ════════════════════════════════════════════════════════════════════════
   Polish layer. Everything above describes the parts; this makes them one
   system: one rhythm, one measure, one card, one code block, one field.
   ════════════════════════════════════════════════════════════════════════ */
.tutoring-page {
  --section-gap: clamp(6.4rem, 8vw, 11.2rem);
  --measure: 72rem;
  --card-border: oklab(1 0 0 / 0.1);
  --code-surface: oklab(0 0 0 / 0.3);
}

/* ——— Rhythm: the same space between every section ———
   flow-root keeps a section's inner margins inside it, so the gap is exactly
   this margin and nothing else. */
.tutoring-page > section {
  display: flow-root;
  margin: 0 0 var(--section-gap) 0;
}

.tutoring-page > section.hero {
  padding: var(--size-five) 0 0 0;
}

.tutoring-page h1,
.tutoring-page h2 {
  text-wrap: balance;
}

.tutoring-page > section > h2 {
  position: relative;
  margin: 0 0 var(--size-four) 0;
  scroll-margin-top: var(--size-five);
}

.tutoring-page > section > h2 + * {
  margin-top: 0;
  margin-bottom: var(--size-six);
}

/* ——— Measure: running text never runs past a comfortable line ———
   :where() keeps these at element-level weight, so every component rule
   above still wins. */
:where(.tutoring-page) p {
  margin: 0 0 var(--size-three) 0;
  line-height: 1.6;
}

:where(.tutoring-page) :is(p, li) {
  max-width: var(--measure);
}

.tutoring-page .hero > p {
  margin-inline: auto;
}

.tutoring-page .hero h1 {
  max-width: 26ch;
  margin-inline: auto;
  margin-bottom: var(--size-five);
}

/* ——— Linkable headings ———
   A "#" hangs in the gutter on hover or focus, as in the docs developers
   read all day. Touch screens have no hover, so it stays faintly visible. */
.heading-anchor {
  position: absolute;
  right: 100%;
  top: 0;
  padding-right: 0.3em;
  color: var(--color-text-link);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.heading-anchor::before {
  content: '#';
}

h2:hover > .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .heading-anchor {
    position: static;
    padding: 0 0 0 0.3em;
    opacity: 0.45;
  }
}

/* ——— One card ——— */
.curriculum-card,
.pair-map-row,
.demo-card,
.pricing-card {
  padding: var(--size-four);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-elevated);
}

/* ——— One code block, set into its card ——— */
.tutoring-page pre.demo-code,
.tutoring-page .demo-line {
  background: var(--code-surface);
  border: 1px solid oklab(1 0 0 / 0.06);
  border-radius: var(--radius-md);
}

.tutoring-page pre.demo-code {
  padding: var(--size-two) var(--size-three);
  font-size: var(--font-size-code);
  line-height: 1.6;
}

.demo-blank {
  background: var(--color-surface-main);
  border-color: oklab(1 0 0 / 0.3);
}

.demo-blank:focus-visible {
  outline: 2px solid var(--color-text-link);
  outline-offset: 1px;
}

/* ——— One field ———
   Columns that may shrink: a select is as wide as its longest option, which
   in Spanish is wider than a small phone. */
.tutoring-page .contact-form,
.tutoring-page .form-group {
  grid-template-columns: minmax(0, 1fr);
}

.tutoring-page .form-group :is(input, select, textarea) {
  width: 100%;
  min-width: 0;
}

.tutoring-page .form-group :is(input, select, textarea) {
  box-sizing: border-box;
}

.tutoring-page .form-group input,
.tutoring-page .form-group select {
  height: 48px;
  font-size: var(--font-size-body);
}

.tutoring-page .form-group textarea {
  font-size: var(--font-size-body);
  line-height: 1.5;
}

.tutoring-page .form-group label {
  font-size: var(--font-size-label);
}

.tutoring-page .contact-form {
  border: 1px solid var(--card-border);
}

/* ——— Small alignments ——— */
.pair-map-sides pre {
  margin: var(--size-two) 0 0 0;
}

.pair-map-rows {
  margin-bottom: var(--size-six);
}

.hero-offer {
  opacity: 0.7;
}

.fading-explainer {
  margin: var(--size-five) 0 var(--size-four) 0;
}
