/* Christcollege Primary and Secondary School
   Direction: the school exercise book. Faint ruled lines, a red margin,
   headlines written in charcoal ink, crimson and charcoal from the school's own brand,
   brass for small finishing details. */

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

:root {
  /* Brand palette, built from the school's crimson and charcoal */
  --primary:      #C4002F;
  --primary-mid:  #A3002A;
  --primary-dark: #7A0020;
  --accent:       #A8823A;  /* brass */
  --accent-mid:   #E0C07A;  /* light brass, for use on charcoal */
  --charcoal:     #3F3F3F;
  --charcoal-dark:#2F2E2D;

  /* Neutrals */
  --bg:        #FBF9F4;
  --surface:   #ffffff;
  --border:    #DCD6CA;
  --text:      #2B2A29;
  --text-soft: #514D48;
  --text-muted:#6A655E;
  --on-dark:   #ffffff;
  --on-dark-soft: #E4E0D8;

  /* Exercise book */
  --rule-line:   #C9D5E2;
  --margin-line: #DE8F9F;
  --rule: 1.75rem;

  /* Typography */
  --font-display: 'Lora', Georgia, 'Times New Roman', serif;
  --font-body:    'Cabin', 'Segoe UI', system-ui, sans-serif;

  /* Spacing and shape */
  --section-pad: clamp(60px, 8vw, 120px);
  --container:   1200px;
  --radius:      4px;
  --radius-lg:   10px;
  --rail-w:      17rem;
  --bar-h:       4.25rem;

  /* base.css hooks */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-text: var(--text);
  --color-muted: var(--text-soft);
  --color-accent: var(--primary);
  --color-accent-text: #ffffff;
  --color-line: #CFC8BB;
  --focus: var(--primary-dark);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding-bottom: var(--bar-h);
}

h1, h2, h3 { text-wrap: balance; letter-spacing: 0; color: var(--text); }
h1 { line-height: 1.2; font-weight: 600; }
h2 { line-height: 1.2; font-weight: 600; }
h3 { line-height: 1.25; font-weight: 600; }

a { color: var(--primary-mid); }
a:hover { color: var(--primary-dark); }

[id] { scroll-margin-top: 5.5rem; }
.email-link { max-width: 100%; overflow-wrap: normal; word-break: normal; display: inline-block; }
a[href^="mailto:"].email-link { overflow-wrap: normal; }

.container { padding-inline: clamp(1rem, 5vw, 2rem); width: min(100%, var(--container)); }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius); font-family: var(--font-body); letter-spacing: 0.01em; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-outline { color: var(--text); border-color: var(--charcoal); background: transparent; }
.btn-outline:hover { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.btn-light { background: #fff; color: var(--primary-dark); border-color: #fff; }
.btn-light:hover { background: var(--accent-mid); border-color: var(--accent-mid); color: var(--charcoal-dark); }
.btn:focus-visible { outline-offset: 3px; }

/* ---------- Header / rail ---------- */
.site-header {
  --focus: var(--accent-mid);
  position: sticky; top: 0; z-index: 50;
  background: var(--charcoal);
  color: var(--on-dark);
  border-bottom: 3px solid var(--primary);
}
.rail-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem clamp(1rem, 5vw, 2rem);
}
.brand {
  display: flex; align-items: center; gap: 0.7rem;
  color: var(--on-dark); text-decoration: none; min-width: 0;
}
.brand:hover { color: var(--on-dark); }
.crest { width: 2.4rem; height: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: #fff; }
.brand-sub { font-size: var(--step--1); color: var(--on-dark-soft); }

.nav-toggle {
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 44px; padding: 0.4rem 0.85rem;
  background: transparent; color: #fff;
  border: 1px solid #8C8883; border-radius: var(--radius);
  cursor: pointer; font-weight: 600;
  transition: background 0.2s, border-color 0.2s;
}
.nav-toggle:hover { background: var(--charcoal-dark); border-color: var(--accent-mid); }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 1.1rem; height: 2px; background: #fff; border-radius: 2px;
  transition: transform 0.2s, background 0.2s;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav { background: var(--charcoal-dark); }
.site-nav ul { list-style: none; padding: 0.5rem clamp(1rem, 5vw, 2rem) 1rem; }
.site-nav a {
  display: block; padding: 0.8rem 0.25rem;
  color: #fff; text-decoration: none; font-weight: 500;
  border-bottom: 1px solid #4A4846;
  transition: color 0.2s, padding 0.2s;
}
.site-nav a:hover { color: var(--accent-mid); }
.site-nav a[aria-current="page"] { color: var(--accent-mid); font-weight: 700; }

/* Bottom contact bar on phones and tablets */
.rail-contact {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.6rem clamp(0.75rem, 4vw, 2rem);
  background: var(--charcoal);
  border-top: 3px solid var(--primary);
  color: #fff;
}
.rail-place { display: none; }
.rail-phone {
  color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap;
  display: flex; flex-direction: column; line-height: 1.25; font-size: 1rem;
}
.rail-phone:hover { color: var(--accent-mid); }
.rail-label { font-size: var(--step--1); font-weight: 500; color: var(--on-dark-soft); }
.rail-btn { min-height: 44px; padding: 0.55em 1em; white-space: nowrap; }
.rail-btn .long { display: none; }
@media (min-width: 420px) { .rail-btn .long { display: inline; } }

/* ---------- Ruled paper ---------- */
.paper {
  position: relative;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(to bottom,
    transparent 0, transparent calc(var(--rule) - 1px),
    var(--rule-line) calc(var(--rule) - 1px), var(--rule-line) var(--rule));
}
.paper::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2px;
  left: max(clamp(0.5rem, 2.5vw, 1rem), (100% - var(--container)) / 2 + 0.5rem);
  background: var(--margin-line);
  transform-origin: top;
}
.paper > .container { position: relative; padding-left: clamp(1.75rem, 6vw, 3.5rem); }

/* ---------- Home hero ---------- */
.hero {
  --h1-fs: 2.35rem;
  --h1-lh: calc(var(--rule) * 2);
  padding-top: calc(var(--rule) * 2);
  padding-bottom: calc(var(--rule) * 2);
  background-position: 0 calc(-1 * ((var(--h1-lh) - var(--h1-fs)) / 2 + 0.2 * var(--h1-fs)));
}
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
.hero h1, .page-head h1 {
  font-size: var(--h1-fs);
  line-height: var(--h1-lh);
  color: var(--text);
  font-weight: 600;
  max-width: 16ch;
}
.ink-line { display: block; }
.ink-underline {
  display: block; width: min(15rem, 70%); height: 0.9rem; margin-top: 0.15rem;
  color: var(--primary); overflow: visible;
}
.hero-lede, .page-lede {
  font-size: 1.08rem; line-height: var(--rule);
  color: var(--text-soft); margin-top: var(--rule); max-width: 36rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--rule); }
.hero-place {
  margin-top: var(--rule); font-size: var(--step--1); color: var(--text-muted);
  line-height: var(--rule);
}

/* Photos mounted like pictures stuck into a book: photo corners */
.mounted {
  position: relative; margin: 0;
  background: #fff; padding: 0.6rem;
  box-shadow: 0 1px 0 var(--border), 0 14px 30px -18px rgba(47, 46, 45, 0.45);
  transform: rotate(-1.2deg);
  max-width: 34rem;
}
.mounted img { width: 100%; aspect-ratio: 4 / 3; max-height: 55vh; object-fit: cover; }
.mounted::before, .mounted::after {
  content: ""; position: absolute; width: 2.2rem; height: 2.2rem;
  background: var(--charcoal);
}
.mounted::before { top: -0.35rem; left: -0.35rem; clip-path: polygon(0 0, 100% 0, 0 100%); }
.mounted::after { bottom: -0.35rem; right: -0.35rem; clip-path: polygon(100% 0, 100% 100%, 0 100%); background: var(--primary); }
.mounted.tilt-right { transform: rotate(1.1deg); }

/* ---------- Page heads (inner pages) ---------- */
.page-head {
  --h1-fs: 2.2rem;
  --h1-lh: calc(var(--rule) * 2);
  padding-top: calc(var(--rule) * 2);
  padding-bottom: calc(var(--rule) * 2);
  background-position: 0 calc(-1 * ((var(--h1-lh) - var(--h1-fs)) / 2 + 0.2 * var(--h1-fs)));
  border-bottom: 1px solid var(--border);
}
.page-head h1 { max-width: 20ch; }
.hero h1 { max-width: none; }
.page-head-grid { display: grid; gap: 2.5rem; align-items: center; }

/* ---------- Sections ---------- */
.section { padding-block: var(--section-pad); }
.section-tight { padding-block: clamp(48px, 6vw, 88px); }
.section-head { max-width: 40rem; margin-bottom: 2rem; }
.section-head p { margin-top: 0.9rem; color: var(--text-soft); }

/* Teacher's underline under section headings, drawn as it comes into view */
.reveal { position: relative; padding-bottom: 0.5rem; }
.reveal::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 4.5rem; height: 3px; border-radius: 3px;
  background: var(--primary);
  transform-origin: left;
  transform: rotate(-1deg);
}
.has-io .reveal::after { transform: rotate(-1deg) scaleX(0); transition: transform 0.35s ease-out; }
.has-io .reveal.visible::after { transform: rotate(-1deg) scaleX(1); }
.on-dark .reveal::after { background: var(--accent-mid); }

/* Two-page spread: primary and secondary */
.spread {
  display: grid; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.spread-page { padding: clamp(1.5rem, 4vw, 2.75rem); position: relative; }
.spread-page + .spread-page { border-top: 1px dashed var(--border); }
.spread-page h3 { font-size: var(--step-3); }
.spread-page p { margin-top: 0.9rem; color: var(--text-soft); }
.spread-page .stage-tag {
  display: inline-block; font-family: var(--font-display); font-style: italic;
  color: var(--primary-mid); margin-bottom: 0.4rem; font-size: 1.05rem;
}
.text-link {
  display: inline-block; margin-top: 1.1rem; font-weight: 700;
  color: var(--primary-mid); text-decoration-thickness: 2px; text-underline-offset: 0.25em;
  transition: color 0.2s;
}
.text-link:hover { color: var(--primary-dark); }
.spread-note {
  margin-top: 1.5rem; max-width: 46rem;
  font-family: var(--font-display); font-style: italic; font-size: 1.1rem; color: var(--text-soft);
  padding-left: 1rem; border-left: 2px solid var(--margin-line);
}

/* Charcoal band with angled crimson edge, a nod to the school's diagonal bands */
.on-dark {
  --focus: var(--accent-mid);
  background: var(--charcoal);
  color: var(--on-dark);
  position: relative; overflow: hidden;
}
.on-dark h2, .on-dark h3 { color: #fff; }
.on-dark p, .on-dark li, .on-dark dt, .on-dark dd { color: var(--on-dark-soft); }
.on-dark a:not(.btn) { color: #fff; }
.on-dark a:not(.btn):hover { color: var(--accent-mid); }
.band { padding-top: calc(var(--section-pad) + 1.5rem); }
.band::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2.25rem;
  background: var(--primary);
  clip-path: polygon(0 0, 100% 0, 100% 15%, 0 100%);
}
.band-grid { display: grid; gap: 2rem; align-items: end; }
.band-grid p { margin-top: 1rem; max-width: 34rem; }
.contact-lines { list-style: none; display: grid; gap: 1.1rem; }
.contact-lines .label { display: block; font-size: var(--step--1); color: var(--accent-mid); font-weight: 600; }
.on-dark .contact-lines .label { color: var(--accent-mid); }
.contact-lines a, .contact-lines .value { font-size: 1.15rem; font-weight: 600; color: #fff; }
.band .btn { margin-top: 1.5rem; }

/* Contents page: the site's index, written like the front of an exercise book */
.contents { list-style: none; border-top: 2px solid var(--charcoal); }
.contents li { border-bottom: 1px solid var(--rule-line); }
.contents a {
  display: grid; gap: 0.2rem; padding: 1.1rem 0.25rem;
  text-decoration: none; color: var(--text);
  transition: background 0.2s, padding 0.2s;
}
.contents a:hover { background: #F3EEE3; padding-left: 0.75rem; }
.contents .c-title { font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; transition: color 0.2s; }
.contents a:hover .c-title { color: var(--primary-mid); }
.contents .c-leader { display: none; }
.contents .c-desc { color: var(--text-soft); }

/* Closing call to action */
.closing { text-align: left; }
.closing-inner { display: grid; gap: 1.5rem; align-items: center; }
.closing p { color: var(--text-soft); margin-top: 0.8rem; }
.closing .cluster { gap: 0.75rem; }

/* Ruled lists */
.ruled-list { list-style: none; border-top: 1px solid var(--rule-line); }
.ruled-list li {
  padding: 0.75rem 0 0.75rem 1.6rem; border-bottom: 1px solid var(--rule-line); position: relative;
}
.ruled-list li::before {
  content: ""; position: absolute; left: 0.2rem; top: 1.3rem;
  width: 0.55rem; height: 0.55rem; border: 2px solid var(--primary); border-radius: 50%;
}

.two-col { display: grid; gap: 2.5rem; }
.prose p + p { margin-top: 1rem; }
.prose p { color: var(--text-soft); }
.prose h2 + p, .prose h3 + p { margin-top: 1rem; }

/* Ways to enquire */
.ways { display: grid; gap: 0; border-top: 2px solid var(--charcoal); }
.way { padding: 1.4rem 0; border-bottom: 1px solid var(--border); }
.way h3 { font-size: var(--step-1); }
.way p { margin-top: 0.4rem; color: var(--text-soft); }
.way a { font-weight: 700; }

/* Question and answer lists */
.qa { border-top: 2px solid var(--charcoal); }
.qa-row { display: grid; gap: 0.5rem; padding: 1.4rem 0; border-bottom: 1px solid var(--border); }
.qa dt { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); line-height: 1.35; color: var(--text); }
.qa dd { color: var(--text-soft); max-width: 40rem; }
.qa dd + dd { margin-top: 0.6rem; }

/* Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.stage-table { width: 100%; min-width: 20rem; border-collapse: collapse; background: var(--surface); }
.stage-table caption { text-align: left; font-family: var(--font-display); font-style: italic; color: var(--text-soft); padding-bottom: 0.6rem; }
.stage-table th, .stage-table td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--rule-line); }
.stage-table thead th { background: var(--charcoal); color: #fff; font-weight: 600; }
.stage-table tbody th { font-family: var(--font-display); font-weight: 600; }
.small-note { font-size: var(--step--1); color: var(--text-muted); margin-top: 0.8rem; }

/* Subject notes */
.subjects { display: grid; gap: 0; border-top: 1px solid var(--rule-line); }
.subject { padding: 1.1rem 0; border-bottom: 1px solid var(--rule-line); display: grid; gap: 0.3rem; }
.subject h3 { font-size: var(--step-1); color: var(--primary-mid); }
.subject p { color: var(--text-soft); }

.stage-block + .stage-block { margin-top: var(--section-pad); }

/* Designed exercise book graphic (parents page) */
.book {
  position: relative; width: min(100%, 22rem); aspect-ratio: 5 / 6; max-height: 50vh;
  margin-inline: auto;
  background:
    linear-gradient(to right, rgba(0,0,0,0.18) 0, rgba(0,0,0,0) 0.9rem),
    linear-gradient(160deg, var(--primary) 0%, var(--primary-mid) 60%, var(--primary-dark) 100%);
  border-radius: 3px 8px 8px 3px;
  box-shadow: 0 18px 30px -18px rgba(47,46,45,0.6), 6px 6px 0 -1px #F1ECE1, 6px 6px 0 0 var(--border);
  transform: rotate(-2deg);
  display: flex; align-items: center; justify-content: center;
}
.book-label {
  width: 72%; background: #FDFBF6; border: 2px solid var(--charcoal);
  border-radius: 6px; padding: 0.9rem 1rem;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 1.65rem, var(--rule-line) 1.65rem, var(--rule-line) 1.75rem);
  background-position: 0 0.4rem;
}
.book-label span { display: block; font-family: var(--font-display); color: var(--text); line-height: 1.75rem; font-size: 1rem; }
.book-label .bl-key { font-family: var(--font-body); font-size: 0.8rem; color: var(--text-muted); line-height: 1.75rem; }
.book-label .bl-val { font-style: italic; font-size: 1.1rem; }

/* Notes for parents */
.notes { border-top: 2px solid var(--charcoal); }
.note { display: grid; gap: 0.6rem; padding: 1.6rem 0; border-bottom: 1px solid var(--border); }
.note dt { font-family: var(--font-display); font-weight: 600; font-size: var(--step-2); line-height: 1.25; }
.note dd { color: var(--text-soft); max-width: 42rem; }
.note dd + dd { margin-top: 0.4rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 3rem; }
.contact-card {
  --focus: var(--accent-mid);
  background: var(--charcoal); color: #fff; padding: clamp(1.5rem, 4vw, 2.25rem);
  border-radius: var(--radius-lg); border-top: 6px solid var(--primary);
  align-self: start;
}
.contact-card h2 { font-size: var(--step-3); color: #fff; }
.contact-card p { color: var(--on-dark-soft); margin-top: 0.8rem; }
.contact-card .contact-lines { margin-top: 1.5rem; }

.form-paper {
  position: relative;
  background-color: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 2.5rem) clamp(1.5rem, 4vw, 2.5rem) clamp(2rem, 6vw, 3.5rem);
  overflow: hidden;
}
.form-paper::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: clamp(1rem, 3vw, 1.75rem); width: 2px; background: var(--margin-line);
}
.form-paper h2 { font-size: var(--step-3); }
.form-intro { color: var(--text-soft); margin-top: 0.6rem; }
.enquiry-form { display: grid; gap: 1.25rem; margin-top: 1.75rem; }
.field-row { display: grid; gap: 1.25rem; }
.enquiry-form label { color: var(--text); }
.enquiry-form .optional { font-weight: 400; color: var(--text-muted); }
.enquiry-form input:not([type="checkbox"]):not([type="radio"]), .enquiry-form textarea {
  background: #FDFCF8;
  border: 1px solid #A9A296;
  border-bottom: 2px solid var(--charcoal);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}
.enquiry-form input:hover, .enquiry-form textarea:hover { border-bottom-color: var(--primary); }
.enquiry-form input:focus-visible, .enquiry-form textarea:focus-visible { background: #fff; outline-color: var(--primary-dark); }
.form-privacy { font-size: var(--step--1); color: var(--text-muted); }
.form-submit { justify-self: start; }
.form-thanks { margin-top: 1.75rem; padding: 1.5rem; border-left: 4px solid var(--primary); background: #F6F1E7; }
.form-thanks h3 { font-size: var(--step-2); }
.form-thanks p { margin-top: 0.5rem; color: var(--text-soft); }
.form-thanks:focus { outline: none; }
.form-thanks:focus-visible { outline: 3px solid var(--primary-dark); }
[hidden] { display: none !important; }

/* ---------- Privacy ---------- */
.legal { max-width: 46rem; }
.legal h2 { font-size: var(--step-2); margin-top: 2.25rem; }
.legal p, .legal li { color: var(--text-soft); margin-top: 0.8rem; }
.legal ul { padding-left: 1.25rem; }

/* ---------- Footer ---------- */
.site-footer {
  --focus: var(--accent-mid);
  background: var(--charcoal-dark); color: var(--on-dark-soft);
  padding-block: clamp(48px, 6vw, 80px) 1.5rem;
  border-top: 4px solid var(--primary);
}
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--accent-mid); }
.footer-grid { display: grid; gap: 2rem; }
.footer-name { font-family: var(--font-display); font-size: var(--step-2); color: #fff; font-weight: 600; line-height: 1.25; }
.footer-sub { color: var(--on-dark-soft); margin-top: 0.3rem; }
.footer-heading { font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--accent-mid); margin-bottom: 0.6rem; }
.footer-links { list-style: none; display: grid; gap: 0.4rem; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-contact { list-style: none; display: grid; gap: 0.5rem; color: var(--on-dark-soft); }
.footer-bottom {
  margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid #4E4B48;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between;
  font-size: var(--step--1); color: var(--on-dark-soft);
}
.footer-bottom p { color: var(--on-dark-soft); }

/* ---------- Entrance: the headline is written in along the ruled lines ---------- */
@keyframes write-in { from { clip-path: inset(-0.2em 100% -0.3em 0); } to { clip-path: inset(-0.2em -0.1em -0.3em 0); } }
@keyframes draw-margin { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes draw-stroke { from { stroke-dashoffset: 260; } to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: rotate(-4deg) translateY(16px); } to { opacity: 1; transform: rotate(-1.2deg); } }
@keyframes settle-r { from { opacity: 0; transform: rotate(3.5deg) translateY(16px); } to { opacity: 1; transform: rotate(1.1deg); } }

@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .animate .paper-anim::before { animation: draw-margin 0.7s ease-out both; }
  .animate .ink-line { animation: write-in 0.6s cubic-bezier(0.55, 0.1, 0.45, 1) both; }
  .animate .ink-line:nth-child(1) { animation-delay: 0.2s; }
  .animate .ink-line:nth-child(2) { animation-delay: 0.7s; }
  .animate .ink-underline path { stroke-dasharray: 260; animation: draw-stroke 0.5s ease-out 1.2s both; }
  .animate .hero-lede, .animate .page-lede { animation: rise 0.4s ease-out 1.05s both; }
  .animate .hero-actions { animation: rise 0.4s ease-out 1.35s both; }
  .animate .hero-place { animation: rise 0.4s ease-out 1.5s both; }
  .animate .mounted { animation: settle 0.7s ease-out 0.35s both; }
  .animate .mounted.tilt-right { animation-name: settle-r; }
  .animate .book { animation: rise 0.6s ease-out 0.35s both; }
}

/* ---------- Tablet ---------- */
@media (min-width: 768px) {
  :root { --rule: 2rem; }
  .hero { --h1-fs: 3.1rem; }
  .page-head { --h1-fs: 2.8rem; }
  .hero-lede, .page-lede { font-size: 1.2rem; }

  .rail-top { padding-block: 0.7rem; }
  .site-header { display: flex; align-items: center; justify-content: space-between; padding-right: clamp(1rem, 3vw, 2rem); }
  .nav-toggle { display: none; }
  .brand-sub { display: none; }
  .site-nav { background: transparent; }
  .site-nav ul { display: flex; gap: 0.25rem; padding: 0; }
  .site-nav a { border-bottom: 0; padding: 0.55rem 0.7rem; font-size: 1rem; position: relative; }
  .site-nav a[aria-current="page"]::after {
    content: ""; position: absolute; left: 0.7rem; right: 0.7rem; bottom: 0.2rem; height: 2px; background: var(--accent-mid);
  }

  .spread { grid-template-columns: 1fr 1fr; }
  .spread-page + .spread-page { border-top: 0; border-left: 1px dashed var(--border); }
  .spread::before { content: none; }

  .contents a { grid-template-columns: auto 1fr minmax(14rem, 22rem); align-items: baseline; gap: 1rem; }
  .contents .c-leader { display: block; border-bottom: 2px dotted #B9B1A3; transform: translateY(-0.35rem); }

  .ways { grid-template-columns: repeat(3, 1fr); border-top: 0; }
  .way { padding: 1.25rem 1.5rem 1.25rem 0; border-bottom: 0; border-top: 2px solid var(--charcoal); }
  .way + .way { padding-left: 1.5rem; border-left: 1px solid var(--border); }

  .qa-row { grid-template-columns: minmax(14rem, 0.8fr) 1.2fr; gap: 2rem; }
  .note { grid-template-columns: minmax(14rem, 0.75fr) 1.25fr; gap: 2rem; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .subjects { grid-template-columns: repeat(3, 1fr); gap: 0 2rem; }

  .footer-grid { grid-template-columns: 1.4fr 1fr 1.2fr; }
  .band-grid { grid-template-columns: 1.3fr 1fr; }
}

/* ---------- Desktop: fixed side rail ---------- */
@media (min-width: 1024px) {
  body { padding-bottom: 0; padding-left: var(--rail-w); }
  .hero { --h1-fs: 3.4rem; }

  .site-header {
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--rail-w);
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
    padding: 0; border-bottom: 0; border-right: 3px solid var(--primary);
    overflow-y: auto;
  }
  .site-header::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 12.5rem;
    background: var(--primary);
    clip-path: polygon(0 0, 100% 0, 100% 78%, 0 100%);
    z-index: 0;
  }
  .rail-top { position: relative; z-index: 1; padding: 2rem 1.5rem 3.5rem; }
  .brand { flex-direction: column; align-items: flex-start; gap: 0.9rem; }
  .crest { width: 3.6rem; }
  .brand-name { font-size: 1.45rem; }
  .brand-sub { display: block; color: #fff; }

  .site-nav { padding: 0.5rem 1.5rem; position: relative; z-index: 1; }
  .rail-contact { position: relative; z-index: 1; }
  [id] { scroll-margin-top: 2rem; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { padding: 0.7rem 0 0.7rem 1rem; font-size: 1.05rem; border-left: 3px solid transparent; }
  .site-nav a:hover { border-left-color: #6F6B66; padding-left: 1.2rem; }
  .site-nav a[aria-current="page"] { border-left-color: var(--accent-mid); }
  .site-nav a[aria-current="page"]::after { content: none; }

  .rail-contact {
    position: relative; height: auto; margin-top: auto;
    flex-direction: column; align-items: stretch; gap: 0.9rem;
    padding: 1.5rem; border-top: 1px solid #55524F;
  }
  .rail-place { display: block; color: var(--on-dark-soft); font-size: var(--step--1); }
  .rail-phone { font-size: 1.25rem; }
  .rail-btn .long { display: inline; }
  .rail-btn { white-space: normal; }

  .hero { padding-top: calc(var(--rule) * 3); padding-bottom: calc(var(--rule) * 3); }
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; gap: 3.5rem; }
  .page-head-grid { grid-template-columns: 1.15fr 0.85fr; gap: 3.5rem; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 4rem; }
  .contact-grid { grid-template-columns: 0.8fr 1.2fr; gap: 3.5rem; }
  .closing-inner { grid-template-columns: 1.4fr auto; }
}

@media (min-width: 1280px) {
  .hero { --h1-fs: 3.4rem; }
}

/* ---------- Polish ---------- */
.rail-btn { gap: 0.3em; justify-content: center; text-align: center; }
.stage-table { min-width: 24rem; }
.stage-table th, .stage-table td { white-space: nowrap; }
.stage-table td:nth-child(2) { white-space: normal; min-width: 9rem; }

.hero-actions .btn { flex: 1 1 100%; justify-content: center; text-align: center; }
@media (min-width: 560px) { .hero-actions .btn { flex: 0 0 auto; } }

/* Ruled paper carried into the cards and question lists */
.spread-page {
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), #E6ECF3 calc(var(--rule) - 1px), #E6ECF3 var(--rule));
  padding-left: clamp(2.25rem, 6vw, 3.25rem);
}
.spread-page::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: clamp(1rem, 3vw, 1.5rem);
  width: 2px; background: var(--margin-line);
}
.qa-row, .note { position: relative; }
.qa-row::before, .note::before {
  content: ""; position: absolute; left: -0.9rem; top: 1.5rem; bottom: 1.5rem;
  width: 2px; background: var(--margin-line); opacity: 0.7;
}
.qa, .notes { margin-left: 0.9rem; }
.mounted { margin-inline: 0.5rem; }
.section-head { margin-bottom: 1.75rem; }
.spread-note { margin-bottom: 0; }

@media (max-width: 767.98px) {
  .stage-block + .stage-block { margin-top: 3rem; }
  .hero { padding-bottom: 2.5rem; }
  .hero-grid { gap: 2rem; }
}

/* ---------- Mobile navigation: kept last so nothing can override it ---------- */
@media (max-width: 767.98px) {
  .site-header .site-nav,
  .site-header.scrolled .site-nav { display: none; }
  .site-header .site-nav.is-open,
  .site-header.scrolled .site-nav.is-open { display: block; }
}
