/* ==========================================================================
   TutGather brand system — "Mathematics, drawn beautifully."

   Loaded after styles.css and topic.css and owns the current visual identity:
   graph-paper surfaces, blueprint bands, editorial type and the logo lockup.
   Palette and grid knobs live in the :root block of styles.css.
   ========================================================================== */

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.08;
}

::selection { background: var(--blue); color: #fff; }

a { color: var(--blue); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link { background: var(--blue); color: #fff; }

/* ------------------------------------------------------------ backgrounds
   Every decorative surface is CSS or SVG; nothing here is a bitmap. */

/* ---------------------------------------------------------------- dots
   A dot layer for the hero and one feature band. Knobs live in :root
   (--dot-size, --dot-gap, --dot-color, --dot-fade). Dots stay decorative:
   never text, never a page-wide texture, always masked away from copy. */

.bg-dots-fine {
  background-image: radial-gradient(
    circle at center,
    var(--dot-color) var(--dot-size),
    transparent calc(var(--dot-size) + 0.4px)
  );
  background-size: var(--dot-gap) var(--dot-gap);
}

/* Two aligned lattices: fine dots fade in from the top-left, coarser dots
   grow toward the bottom-right corner, so the field reads as a halftone. */
.bg-halftone {
  position: relative;
  z-index: 0;
}

.bg-halftone::before,
.bg-halftone::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(
    circle at center,
    var(--dot-color) var(--dot-size),
    transparent calc(var(--dot-size) + 0.4px)
  );
  background-size: var(--dot-gap) var(--dot-gap);
}

.bg-halftone::before {
  -webkit-mask-image: radial-gradient(ellipse 96% 84% at 100% 112%, #000 0%, #000 52%, transparent 86%);
  mask-image: radial-gradient(ellipse 96% 84% at 100% 112%, #000 0%, #000 52%, transparent 86%);
}

.bg-halftone::after {
  background-image: radial-gradient(
    circle at center,
    var(--dot-color-strong) calc(var(--dot-size) * 1.9),
    transparent calc(var(--dot-size) * 1.9 + 0.4px)
  );
  -webkit-mask-image: radial-gradient(ellipse 86% 74% at 100% 112%, #000 0%, #000 48%, transparent 82%);
  mask-image: radial-gradient(ellipse 86% 74% at 100% 112%, #000 0%, #000 48%, transparent 82%);
}

/* Hero dot layer: a static field kept clear of the copy column, with the
   ripple rings above it. The mask starts past the headline so no letter
   sits on a dot. */
.hero-dots {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  --dot-fade: ellipse 44% 78% at 94% 18%;
  -webkit-mask-image: radial-gradient(var(--dot-fade), #000 0%, #000 55%, transparent 94%);
  mask-image: radial-gradient(var(--dot-fade), #000 0%, #000 55%, transparent 94%);
}

/* Hero only: two rings of larger dots expand across the field and fade.
   Transform and opacity only, so there is no repaint and no layout shift. */
.bg-dots-ripple::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(
    circle at center,
    var(--dot-color-strong) calc(var(--dot-size) * 1.5),
    transparent calc(var(--dot-size) * 1.5 + 0.4px)
  );
  background-size: var(--dot-gap) var(--dot-gap);
  -webkit-mask-image:
    radial-gradient(circle at 84% 30%, transparent 0 66px, #000 66px 90px, transparent 118px),
    radial-gradient(circle at 84% 30%, transparent 0 148px, #000 148px 170px, transparent 200px);
  mask-image:
    radial-gradient(circle at 84% 30%, transparent 0 66px, #000 66px 90px, transparent 118px),
    radial-gradient(circle at 84% 30%, transparent 0 148px, #000 148px 170px, transparent 200px);
  transform-origin: 84% 30%;
  opacity: 0;
  animation: tg-dot-ripple 32s ease-out infinite;
}

@keyframes tg-dot-ripple {
  0%   { transform: scale(0.94); opacity: 0; }
  30%  { opacity: 0.55; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* ---------------------------------------------------------------- lockup */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: none;
}

.brand-mark {
  display: block;
  width: 168px;
  height: 32px;
  flex: none;
}

/* ---------------------------------------------------------------- header */

.site-head {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-head .nav {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 74px;
}

.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 14px;
  justify-self: auto;
}

.nav-links > a {
  position: relative;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  padding: 6px 0;
  white-space: nowrap;
}

.nav-links > a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease-out;
}

.nav-links > a:hover::after,
.nav-links > a[aria-current="page"]::after { transform: scaleX(1); }

.nav-links > a span {
  margin-left: 5px;
  font-family: var(--cjk);
  font-size: 0.82em;
  font-weight: 400;
  color: var(--muted-soft);
}

/* The one filled control in the header. */
.nav-links > .nav-tutoring {
  padding: 9px 16px;
  border-radius: 3px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}

.nav-links > .nav-tutoring::after { display: none; }
.nav-links > .nav-tutoring:hover { background: var(--blue-hover); color: #fff; }
.nav-links > .nav-tutoring span { color: rgba(255, 255, 255, 0.72); }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.btn span[lang] {
  margin-left: 2px;
  font-family: var(--cjk);
  font-size: 0.86em;
  font-weight: 400;
  opacity: 0.72;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); transform: none; }

.btn-secondary {
  background: var(--paper);
  border-color: var(--line-strong);
  color: var(--blue);
}

.btn-secondary:hover { border-color: var(--blue); background: var(--blue-soft); transform: none; }

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

.plate {
  position: relative;
  overflow: clip;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.plate::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-line-major) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-major) 1px, transparent 1px);
  background-size:
    var(--grid-minor) var(--grid-minor),
    var(--grid-minor) var(--grid-minor),
    var(--grid-major) var(--grid-major),
    var(--grid-major) var(--grid-major);
  background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(105deg, #000 0%, rgba(0, 0, 0, 0.55) 46%, transparent 78%);
  mask-image: linear-gradient(105deg, #000 0%, rgba(0, 0, 0, 0.55) 46%, transparent 78%);
}

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

.hero-editorial--solo > div {
  max-width: 46rem;
}

.hero-editorial {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(32px, 5vw, 76px);
  align-items: center;
  padding-block: clamp(44px, 5.5vw, 78px) clamp(36px, 4.5vw, 56px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
  flex: none;
}

.hero-title {
  margin: 18px 0 0;
  font-size: clamp(40px, 5.6vw, 70px);
  line-height: 1.0;
  letter-spacing: -0.045em;
  font-weight: 600;
}

.hero-title em { font-style: normal; color: var(--blue); white-space: nowrap; }

/* The tutoring headline is longer than the homepage one, so it sets a touch smaller. */
.hero-title-tutor { font-size: clamp(36px, 4.5vw, 56px); }

.hero-title .zh {
  display: block;
  margin-top: 14px;
  font-family: var(--cjk);
  font-size: clamp(15px, 1.5vw, 18px);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.hero-sub {
  max-width: 48ch;
  margin: 22px 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

.hero-sub .zh {
  display: block;
  margin-top: 10px;
  font-family: var(--cjk);
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--muted-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.figure {
  position: relative;
  margin: 0;
  padding: 12px 12px 0;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.figure img { display: block; width: 100%; height: auto; }

.figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 12px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  font: 500 10px/1.5 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

/* ---------------------------------------------------------------- facts */

.facts-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.facts-strip > div {
  padding: 16px 18px 20px 0;
  border-right: 1px solid var(--line);
}

.facts-strip > div:last-child { border-right: 0; }

.facts-strip dt {
  font: 500 9.5px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.facts-strip dd {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.facts-strip dd span {
  display: block;
  margin-top: 3px;
  font-family: var(--cjk);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted-soft);
}

/* ---------------------------------------------------------------- bands */

.band {
  padding: var(--section) 0;
}

.band-tint {
  background: var(--blue-soft);
  border-block: 1px solid var(--line);
}

.band-paper {
  background: var(--paper);
  border-block: 1px solid var(--line);
}

.band-head {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(18px, 4vw, 64px);
  align-items: end;
  padding-bottom: 32px;
  margin-bottom: clamp(26px, 3.5vw, 42px);
  border-bottom: 1px solid var(--line);
}

.band-index {
  display: block;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.16em;
  color: var(--blue);
}

.band-title {
  margin: 14px 0 0;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.band-title .zh {
  display: block;
  margin-top: 10px;
  font-family: var(--cjk);
  font-size: 0.44em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.band-lede {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.68;
}

.band-lede .zh {
  display: block;
  margin-top: 10px;
  font-family: var(--cjk);
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted-soft);
}

/* ---------------------------------------------------------------- intro */

/* ---------------------------------------------------------------- programmes */

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

.prog {
  position: relative;
  padding: 28px 26px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}

.prog:hover { border-color: var(--blue-line); box-shadow: var(--shadow-soft); }

/* Used on the tutoring page: the programme card sits above its explanation. */
.prog-grid-stack { grid-template-columns: minmax(0, 1fr); gap: 28px; }

.prog-level {
  margin: 0;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}

.prog h3 { margin: 12px 0 8px; font-size: 24px; letter-spacing: -0.03em; }

.prog p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.65; }

.prog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font: 500 10px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg);
  font-size: 13px;
  color: var(--ink);
}

.chips li span {
  margin-left: 5px;
  font-family: var(--cjk);
  font-size: 11.5px;
  color: var(--muted-soft);
}

/* ---------------------------------------------------------------- resources */

.res-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.res-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 22px 22px;
  background: var(--paper);
  text-decoration: none;
  color: var(--ink);
  transition: background-color 160ms ease-out;
}

.res-card:hover { background: var(--blue-soft); }

.res-code {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.16em;
  color: var(--blue);
}

.res-card h3 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }

.res-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.res-card em {
  margin-top: auto;
  padding-top: 10px;
  font-style: normal;
  font: 600 12px/1 var(--sans);
  color: var(--blue);
}

.res-card em span { font-family: var(--cjk); font-weight: 400; opacity: 0.75; margin-left: 4px; }

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

.foot {
  --foot-plate: url("/assets/art/footer-aqueduct.png");
  position: relative;
  overflow: clip;
  padding: 56px 0 34px;
  color: var(--dark-muted);
  background-color: var(--dark);
  background-image:
    linear-gradient(to bottom, var(--bg), rgba(244, 247, 252, 0) 56px),
    linear-gradient(
      to bottom,
      rgba(14, 31, 56, 0.86) 0%,
      rgba(14, 31, 56, 0.84) 55%,
      rgba(14, 31, 56, 0.86) 100%
    ),
    var(--foot-plate);
  background-repeat: no-repeat;
  background-size: auto, auto, cover;
  background-position: top, center 92%, center 92%;
}

@supports (background-image: image-set(url("/x.avif") type("image/avif"))) {
  .foot {
    --foot-plate: image-set(
      url("/assets/art/footer-aqueduct.avif") type("image/avif"),
      url("/assets/art/footer-aqueduct.webp") type("image/webp"),
      url("/assets/art/footer-aqueduct.png") type("image/png")
    );
  }
}

.foot::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at center, var(--dot-color-dark) 1.5px, transparent 1.9px),
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px, 24px 24px, 24px 24px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 62%);
  mask-image: linear-gradient(to bottom, #000, transparent 62%);
}

.foot > .wrap { position: relative; z-index: 1; }

.foot-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--dark-line);
}

.foot h3 {
  margin: 0 0 16px;
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
}

.foot ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }

.foot a {
  color: var(--dark-muted);
  font-size: 13.5px;
  text-decoration: none;
}

.foot a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.foot .brand:hover { text-decoration: none; }

.foot-about {
  margin: 16px 0 0;
  max-width: 34ch;
  font-size: 13px;
  line-height: 1.7;
  color: var(--dark-muted);
}

.foot-about span { display: block; margin-top: 6px; font-family: var(--cjk); }

.foot-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 8px;
  font-size: 12px;
  color: #7f93ad;
}

.foot-bottom span span { display: block; font-family: var(--cjk); }

/* ==========================================================================
   Library: chapters, hubs, paper cards.
   These override the generated pages without changing their markup.
   ========================================================================== */

.topic-main {
  padding-block: 40px 96px;
}

.crumbs {
  margin-bottom: 26px;
  font: 500 10px/1.5 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.crumbs a { color: var(--muted-soft); text-decoration: none; }
.crumbs a:hover { color: var(--blue); text-decoration: none; }
.crumbs li + li::before { color: var(--line-strong); }

.topic-main h1 {
  max-width: 26ch;
  margin: 6px 0 16px;
  font-size: clamp(30px, 4.2vw, 50px);
  letter-spacing: -0.04em;
}

.topic-main h1 .zh {
  margin-top: 10px;
  font-size: 0.42em;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

.topic-main h2 {
  margin: 52px 0 14px;
  font-size: clamp(21px, 2.4vw, 28px);
  letter-spacing: -0.03em;
}

.topic-main .lede {
  max-width: 66ch;
  margin: 0 0 12px;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--muted);
}

.muted { color: var(--muted-soft); }

.part { margin-top: 18px; }
.part > h2 { margin-top: 42px; }

.form-topic-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.form-topic-row:hover { border-color: var(--blue-line); background: var(--blue-soft); }

.form-topic-row.missing { color: var(--muted-soft); }
.form-topic-row.missing .t-name { color: var(--muted-soft); }

.t-code {
  font: 500 10px/1.4 var(--mono);
  letter-spacing: 0.08em;
  color: var(--blue);
  white-space: nowrap;
}

.t-name { font-size: 14.5px; line-height: 1.45; color: var(--ink); }

.t-zh {
  margin-left: 8px;
  font-family: var(--cjk);
  font-size: 12.5px;
  color: var(--muted-soft);
}

.share-note {
  margin-left: 8px;
  font: 500 9px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.t-lang { font-size: 12px; color: var(--muted-soft); }

.paper-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.paper-actions-split { gap: 14px; }

.paper-label {
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.paper-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 140ms ease-out, color 140ms ease-out, border-color 140ms ease-out;
}

.paper-link:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.paper-card,
.route-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  padding: 20px;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}

.paper-card:hover,
.route-card:hover {
  border-color: var(--blue-line);
  box-shadow: var(--shadow-soft);
  transform: none;
}

.route-card { min-height: 0; gap: 6px; }

.route-code {
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}

.route-card strong { font-size: clamp(20px, 2vw, 25px); letter-spacing: -0.03em; }
.route-card span:not(.route-code) { font-size: 13px; color: var(--muted); }
.route-card em { font-size: 12.5px; color: var(--blue); font-weight: 600; }

.paper-card h3 { font-size: 17px; margin: 0 0 6px; }
.paper-card .muted { font-size: 12.5px; }

.paper-lang-list { margin: 10px 0 0; padding: 0; list-style: none; }
.paper-lang-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.paper-name { min-width: 58px; font: 500 10px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-soft); }

.btn-like {
  border-radius: 3px;
  background: var(--blue);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 18px;
  text-decoration: none;
  display: inline-block;
  margin: 10px 8px 0 0;
}

.btn-like:hover { background: var(--blue-hover); }

.btn-like-quiet {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--blue);
}

.btn-like-quiet:hover { background: var(--blue-soft); color: var(--blue); }

.module-links a,
.extra-papers a { color: var(--blue); }

/* ---------------------------------------------------------------- chips detail */

.chips li .sub-en { margin: 0; font-family: var(--sans); font-size: 13px; color: var(--ink); }
.chips li .sub-zh { margin-left: 5px; font-family: var(--cjk); font-size: 11.5px; color: var(--muted-soft); }

.zh-block { font-family: var(--cjk); font-size: 14.5px; line-height: 1.85; color: var(--muted); }
.zh-block p { margin: 0 0 8px; }
.band .zh-block, .split .zh-block { margin: 26px 0 0; max-width: 74ch; }

/* ---------------------------------------------------------------- enquiry */

.enq-form {
  max-width: 900px;
  margin-top: 4px;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
}

.enq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }

.enq-field {
  display: grid;
  gap: 7px;
  font: 500 10px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.enq-field input,
.enq-field select,
.enq-field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--sans);
  letter-spacing: 0;
  text-transform: none;
}

.enq-field textarea { resize: vertical; min-height: 96px; }

.enq-field input:focus,
.enq-field select:focus,
.enq-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.enq-field-wide { margin-top: 18px; }

.enq-subjects { margin: 20px 0 0; padding: 0; border: 0; }

.enq-subjects legend {
  padding: 0;
  font: 500 10px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.enq-subjects legend span { margin-left: 5px; font-family: var(--cjk); letter-spacing: 0; }

.enq-check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }

.enq-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  font-size: 14px;
  cursor: pointer;
}

.enq-check:hover { border-color: var(--line-strong); background: var(--blue-soft); }
.enq-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue); flex: none; }
.enq-check span span { color: var(--muted-soft); font-family: var(--cjk); font-size: 12px; }
.enq-subjects.is-invalid .enq-check-grid { outline: 2px solid #b3261e; outline-offset: 4px; }

.enq-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 22px; }
.enq-honesty { margin: 0; color: var(--muted-soft); font-size: 12.5px; }

.enq-result {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}

.enq-result p { margin: 0; }
.enq-result a { display: inline-block; margin-top: 8px; color: var(--blue); font-weight: 600; }
.enq-result a[hidden] { display: none; }
.enq-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- faq */

.faq-list { display: grid; gap: 8px; max-width: 900px; }
.faq-list details { border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--paper); }
.faq-list details[open] { border-color: var(--blue-line); box-shadow: none; }
.faq-list summary { padding: 17px 20px; font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.faq-list summary::after { color: var(--blue); font-weight: 400; }
.faq-list .answer { padding: 0 20px 18px; color: var(--muted); font-size: 14.5px; }
.faq-list .answer p[lang="zh-Hant-HK"] { font-family: var(--cjk); }
.faq-list .answer a { color: var(--blue); }

/* ---------------------------------------------------------------- nav burger */

.nav-burger {
  display: none;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--paper);
}

/* ---------------------------------------------------------------- hero media
   The homepage header is one surface: the plate is the background and the copy
   sits in its wash, so image and text are never two separate blocks. */

.hero-media {
  position: relative;
  isolation: isolate;
  background: var(--paper);
  overflow: hidden;
}

.hero-media__art {
  display: block;
  width: 100%;
  height: auto;
}

.hero-media__fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, #ffffff 0%, rgba(255, 255, 255, 0.96) 26%, rgba(255, 255, 255, 0.72) 44%, rgba(255, 255, 255, 0) 64%),
    linear-gradient(to top, var(--bg) 0%, rgba(244, 247, 252, 0.9) 20%, rgba(244, 247, 252, 0) 52%);
}

.hero-media__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(24px, 4vw, 56px);
  z-index: 1;
}

.hero-media__body .eyebrow,
.hero-media__body .hero-title,
.hero-media__body .hero-sub {
  max-width: 54rem;
}

.hero-media__body .hero-link {
  margin-top: 26px;
}

/* Narrow screens: the plate cannot carry the copy, so it stacks. */
@media (max-width: 1100px) {
  .hero-media {
    background: var(--bg);
  }

  .hero-media__fade {
    background: linear-gradient(to top, var(--bg) 0%, rgba(244, 247, 252, 0.96) 16%, rgba(244, 247, 252, 0) 56%);
  }

  .hero-media__body {
    position: relative;
    z-index: 1;
    padding-block: 28px 12px;
  }

  .hero-media__body .eyebrow,
  .hero-media__body .hero-title,
  .hero-media__body .hero-sub {
    max-width: none;
  }
}

/* ---------------------------------------------------------------- rates */

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

.rate {
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
}

.rate-featured { border-color: var(--blue); box-shadow: 0 18px 40px rgba(18, 63, 130, 0.1); }

.rate-tag {
  margin: 0;
  font: 500 9.5px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.rate h3 { margin: 10px 0 8px; font-size: 21px; }

.rate-price {
  margin: 0;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.rate-price span { font: 400 13px var(--sans); color: var(--muted); }
.rate-desc { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.rate-list { display: grid; gap: 8px; margin: 16px 0 20px; padding: 0; list-style: none; }

.rate-list li { position: relative; padding-left: 18px; color: var(--muted); font-size: 13.5px; }

.rate-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent);
}

.rate .btn { margin-top: auto; width: 100%; justify-content: center; }

.price-note { margin: 20px 0 0; max-width: 70ch; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.price-note span { font-family: var(--cjk); }

@media (max-width: 980px) { .rates { grid-template-columns: minmax(0, 1fr); } }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1060px) {
  .hero-editorial { grid-template-columns: minmax(0, 1fr); }
  .figure { max-width: 560px; }
  .facts-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts-strip > div:nth-child(3n) { border-right: 0; }
  .facts-strip > div:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .band-head { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .res-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .prog-grid { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1100px) {
  .site-head .nav { min-height: 66px; }
  .nav-links {
    position: fixed;
    top: 66px;
    left: 0;
    right: 0;
    margin: 0;
    padding: 18px var(--gutter) 26px;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 48px rgba(18, 63, 130, 0.12);
    max-height: calc(100vh - 66px);
    overflow-y: auto;
  }
  .nav-links.is-open { display: flex; }
  .nav-links > a { padding: 12px 0; font-size: 16px; width: 100%; }
  .nav-links > a::after { display: none; }
  .nav-links > .nav-tutoring {
    align-self: flex-start;
    margin: 6px 0 10px;
    padding: 11px 18px;
    font-size: 15px;
  }
  .nav-burger { display: flex; }
}

@media (max-width: 700px) {
  .facts-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts-strip > div {
    padding-right: 14px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .facts-strip > div:nth-child(2n) { border-right: 0; }
  .facts-strip > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .res-grid { grid-template-columns: minmax(0, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 24px 20px; }
  .foot-grid > div:first-child { grid-column: 1 / -1; }
  .form-topic-row { grid-template-columns: 68px minmax(0, 1fr); gap: 10px 12px; }
  .form-topic-row .paper-actions,
  .form-topic-row .t-lang { grid-column: 2; }
  .figure figcaption { flex-direction: column; gap: 4px; }
  .topic-main { padding-block: 28px 72px; }
}

@media (max-width: 560px) {
  .hero-editorial { padding-top: 32px; }
  .hero-title { font-size: clamp(34px, 9.6vw, 44px); }
  .hero-sub { font-size: 16px; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .facts-strip > div { padding: 13px 12px 16px 0; }
  .band { padding: 56px 0; }
  .prog { padding: 22px 18px; }
}

/* Mobile: thin out the graph paper and the dot field so text stays crisp. */
@media (max-width: 700px) {
  :root {
    --grid-minor: 16px;
    --grid-major: 80px;
    --grid-line: rgba(18, 63, 130, 0.05);
    --grid-line-major: rgba(18, 63, 130, 0.09);
    /* Halve the dot density: a wider pitch over the same area. */
    --dot-gap: 26px;
    --dot-size: 1.2px;
  }
  .plate::before { -webkit-mask-image: linear-gradient(180deg, #000, transparent 72%); mask-image: linear-gradient(180deg, #000, transparent 72%); }
  /* The mobile hero is text-dense: drop its dot field and keep the band dots. */
  .hero-dots { display: none; }
  .bg-dots-ripple::after { animation: none; opacity: 0.4; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-dots-ripple::after { animation: none; opacity: 0.5; transform: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}


/* ---------------------------------------------------------------- flat
   No filled buttons and no card frames. Sections are separated by a hairline
   and space, so the page reads as one surface instead of a grid of boxes. */

.btn,
.btn-primary,
.btn-secondary {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  gap: 7px;
}

.btn::after {
  content: "\2192";
  font-weight: 400;
}

.btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-primary:hover,
.btn-secondary:hover {
  background: none;
  border: 0;
}

.btn-secondary {
  color: var(--muted);
}

/* A form action is a real button; keep it one. */
.enq-form .btn,
form .btn[type="submit"] {
  min-height: 46px;
  padding: 0 22px;
  justify-content: center;
  border-radius: 3px;
  background: var(--blue);
  color: #fff;
}

.enq-form .btn::after,
form .btn[type="submit"]::after {
  content: none;
}

.enq-form .btn:disabled,
.enq-form .btn.is-sending {
  cursor: progress;
}

.enq-form .btn:disabled:hover,
.enq-form .btn.is-sending:hover {
  background: var(--blue);
  text-decoration: none;
}

/* Cards become rule-separated entries. */
.facts-strip {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.facts-strip > div {
  border-right: 0;
  padding: 18px 22px 0 0;
}

.prog {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 22px 0 0;
}

.prog:hover {
  border-color: var(--line);
  box-shadow: none;
}

.route-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 16px 0;
}

.route-card:hover {
  background: none;
}

.res-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 16px 0;
}

.res-card:hover {
  background: none;
}

.form-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 14px 0;
}

.form-card:hover {
  border-color: var(--line);
}

.rate {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 20px 0 0;
}

.rate-featured {
  border-color: var(--line);
  box-shadow: none;
}

.rate .btn {
  width: auto;
  margin-top: 6px;
  justify-content: flex-start;
}

.faq-list {
  gap: 0;
}

.faq-list details {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.faq-list summary {
  padding: 16px 0;
}

.faq-list .answer {
  padding: 0 0 18px;
}


/* The resource row and the paper rows are lists, not panels. */
.res-grid {
  gap: 0;
  border: 0;
  background: none;
}

.paper-card,
.route-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 16px 0;
}

.paper-card:hover,
.route-card:hover {
  border-color: var(--line);
  box-shadow: none;
}


/* Inline action links, not buttons in a row. */
.btn-like {
  display: inline;
  margin: 0 20px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.btn-like::after {
  content: "\2192";
  margin-left: 5px;
  font-weight: 400;
}

.btn-like:hover,
.btn-like-quiet:hover {
  background: none;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-like-quiet {
  border: 0;
  background: none;
  color: var(--muted);
}


@media (max-width: 700px) {
  .foot {
    padding: 44px 0 26px;
  }
}


/* Footer copy sits on the plate, so it is lifted to hold contrast over the
   brightest parts of the image. */
.foot a,
.foot-about,
.foot-bottom {
  color: #ffffff;
}


/* Library discovery: search, filters and provenance. */
.library-search {
  margin: 0 0 26px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
}

.library-search__form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.library-search__label {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: 500 10px/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.library-search__label input,
.library-filter__label input {
  font: 16px/1.4 var(--sans);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
}

.library-search__label input:focus-visible,
.library-filter__label input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.library-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.library-chip {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 6px 12px;
  font: 600 12px/1 var(--sans);
  cursor: pointer;
}

.library-chip:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.library-chip.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.library-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.library-results {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.library-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.library-result__title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.library-result__title:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.library-result__code {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--blue);
}

.library-result__zh {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.library-result__meta {
  color: var(--muted);
  font-size: 12px;
}

.library-result__papers {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.library-filter {
  margin: 18px 0 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
}

.library-filter__label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: 500 10px/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.is-filtered-out {
  display: none !important;
}

.library-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.library-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 0;
  padding: 0;
}

.library-stats dt {
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.library-stats dd {
  margin: 6px 0 0;
  font: 600 20px/1 var(--display);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.library-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.library-note a {
  color: var(--blue);
  font-weight: 600;
}

.subject-pairs {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.subject-pairs li {
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.subject-pairs strong {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 800px) {
  .library-meta {
    grid-template-columns: 1fr;
  }

  .library-result {
    grid-template-columns: 1fr;
  }

  .library-result__papers {
    grid-column: 1;
    grid-row: auto;
  }
}


/* Home page: compact bands, two-column tutoring/enquiry, full-bleed library plate. */
#tutoring,
#papers,
#faq {
  padding-block: clamp(32px, 3.4vw, 48px);
}

#papers {
  padding-top: 0;
}

#papers > .wrap {
  padding-block: clamp(20px, 2.4vw, 30px) clamp(28px, 3.2vw, 40px);
}

.band-head {
  padding-bottom: 16px;
  margin-bottom: clamp(16px, 1.6vw, 22px);
}

.enq-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}

.enq-copy__lead,
.enq-copy__note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.7;
}

.enq-copy h3 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.enq-copy .zh-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.8;
}

.enq-panel__title {
  margin: 0 0 8px;
  font-size: clamp(22px, 2vw, 28px);
  letter-spacing: -0.03em;
}

.enq-panel__title .zh {
  display: block;
  margin-top: 6px;
  font-family: var(--cjk);
  font-size: 0.56em;
  font-weight: 500;
  letter-spacing: 0;
}

.enq-panel__lede {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.enq-panel .enq-form {
  max-width: none;
  margin-top: 0;
  padding: 18px;
}

.enq-panel .enq-field textarea {
  min-height: 80px;
}

.enq-panel .enq-grid {
  grid-template-columns: 1fr 1fr;
}

.enq-panel .enq-grid .enq-field:last-child {
  grid-column: 1 / -1;
}

.library-plate {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--paper);
}

.library-plate__art {
  display: block;
  width: 100%;
  height: clamp(260px, 26vw, 360px);
  object-fit: cover;
  object-position: right center;
}

.library-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    #fff 0%,
    rgba(255, 255, 255, 0.97) 30%,
    rgba(255, 255, 255, 0.82) 48%,
    rgba(255, 255, 255, 0) 72%
  );
  pointer-events: none;
}

.library-plate__body {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
}

.library-plate__body .band-title {
  max-width: 21ch;
}

.library-plate__body .band-lede {
  max-width: 38rem;
  margin-top: 12px;
}

.papers-grid {
  margin-top: 18px;
  gap: 10px;
}

.papers-grid .route-card,
.papers-grid .paper-card {
  min-height: 104px;
  padding: 14px;
}

.library-search {
  margin-bottom: 14px;
  padding: 14px;
}

.library-meta {
  margin-top: 16px;
  padding-top: 14px;
}

.faq-list summary {
  padding: 12px 18px;
  font-size: 16px;
}

.faq-list .answer {
  padding: 0 18px 14px;
}

@media (max-width: 980px) {
  .enq-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .library-plate__art {
    height: 220px;
    object-position: 72% center;
  }

  .library-plate::after {
    display: none;
  }

  .library-plate__body {
    position: static;
    padding-block: 22px 4px;
  }

  .library-plate__body .band-title {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .enq-panel .enq-grid {
    grid-template-columns: 1fr;
  }

  .enq-panel .enq-grid .enq-field:last-child {
    grid-column: auto;
  }
}

/* Clearer sectioning: white tutoring, tinted library, blue FAQ. */
#tutoring {
  background: var(--paper);
  border-block: 1px solid var(--line);
}

#papers {
  background: var(--bg);
  border-block: 1px solid var(--line);
}

#faq {
  background: #e4eefb;
  border-block: 1px solid var(--line-strong);
}

.band-head {
  border-bottom-color: var(--line-strong);
}

.band-index {
  display: flex;
  align-items: center;
  gap: 10px;
}

.band-index::before {
  content: "";
  flex: none;
  width: 22px;
  height: 1px;
  background: currentColor;
}

/* Stronger edges so cards and panels read against the tinted surface. */
.papers-grid .route-card,
.papers-grid .paper-card,
.library-search,
.library-filter,
.library-meta {
  border-color: var(--line-strong);
}

.enq-panel .enq-form {
  border-color: var(--line-strong);
  border-top: 3px solid var(--blue);
}

.library-plate {
  border-bottom: 1px solid var(--line);
}

.hero-media__picture,
.library-plate__picture {
  display: block;
}

/* Location plate in the tutoring column. */
.location {
  margin: 22px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--paper);
}

.location picture,
.location img {
  display: block;
  width: 100%;
  height: auto;
}

.location figcaption {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.location__zh {
  display: block;
  margin-top: 4px;
  font-family: var(--cjk);
}

.location figcaption a {
  color: var(--blue);
  font-weight: 600;
}

.location .map-credit {
  display: block;
  margin-top: 8px;
  color: var(--muted-soft);
  font-size: 11px;
}

/* Compact tutoring column: the section title lives beside the form. */
.enq-copy .band-index {
  margin-bottom: 4px;
}

.enq-copy .band-title {
  margin: 12px 0 0;
  max-width: 17ch;
  font-size: clamp(26px, 3vw, 40px);
}

.enq-copy__lead {
  margin: 12px 0 0;
  font-size: 16.5px;
}

.enq-copy .zh-block {
  margin-top: 14px;
  padding-top: 0;
  border-top: 0;
}

.enq-copy .zh-block p {
  margin: 0;
}

.enq-copy__note span[lang] {
  display: block;
  margin-top: 5px;
  font-family: var(--cjk);
}

/* Facts as a crisp table, not floating labels. */
.facts-strip {
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
}

.facts-strip > div {
  background: var(--paper);
  border: 0;
  padding: 18px 20px 20px;
}

.facts-strip dt {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.facts-strip dd {
  margin-top: 7px;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

@media (max-width: 700px) {
  .facts-strip > div {
    padding: 14px 14px 16px;
  }

  .facts-strip dd {
    font-size: 15.5px;
  }
}

/* Header lockup: the pillar mark (the tab icon) left of the outlined wordmark.
   32px matches the wordmark box. The gap is the padding between them.
   Keep the bar height. The footer wordmark is unchanged. */
.site-head .brand {
  gap: 12px;
}

.site-head .brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  flex: none;
}

.site-head .nav {
  min-height: 78px;
}

.brand-mark {
  width: 168px;
  height: 32px;
}

/* The added mark is 44px wider than the wordmark alone. Below 340px the
   gutter, 12px gap and 24px nav gap leave almost no slack beside the burger. */
@media (max-width: 340px) {
  .site-head .brand { gap: 8px; }
  .site-head .nav { gap: 12px; }
}

@media (max-width: 1100px) {
  .site-head .nav {
    min-height: 70px;
  }
}

/* Let the format value stay on one line in the six-column facts row. */
.facts-strip > div {
  padding: 17px 16px 19px;
}

.facts-strip dd {
  font-size: 16px;
}

/* The Others option carries its own subject field. */
.enq-check-other {
  grid-column: 1 / -1;
  gap: 12px;
  cursor: default;
}

.enq-check-other:hover {
  background: var(--paper);
  border-color: var(--line);
}

.enq-other-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  cursor: pointer;
}

.enq-other-input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: 400 14px/1.4 var(--sans);
}

.enq-other-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------- header alignment
   Loaded last so it wins over the stacked nav rules:
   bar height 80 / min-height 74 / 78 / 70 / 66, Papers padding 10px 9px
   against the text links' 6px 0, and a 14px padding-top below 900px.
   The Tutoring pill keeps its fill, padding and radius. */

.site-head .nav {
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

@media (min-width: 1101px) {
  .site-head .nav {
    height: 80px;
    min-height: 80px;
  }

  .site-head .nav-links {
    display: flex;
    align-items: center;
  }

  .site-head .nav-item {
    display: inline-flex;
    align-items: center;
  }

  .site-head .nav-links > a,
  .site-head .nav-item > a {
    display: inline-flex;
    align-items: center;
  }

  /* Same vertical padding as the plain links, so Papers does not
     sit in a wider box and open the gaps on either side of it. */
  .site-head .nav-item > a {
    padding: 6px 0;
  }

  .site-head .nav-item > a span {
    margin-left: 5px;
    font-family: var(--cjk);
    font-size: 0.82em;
    font-weight: 400;
    color: var(--muted-soft);
  }

  .site-head .nav-links > .nav-tutoring {
    padding: 9px 16px;
    border-radius: 3px;
  }
}

@media (max-width: 1100px) {
  .site-head .nav {
    height: 70px;
    min-height: 70px;
  }

  .site-head .nav-links {
    top: 70px;
    height: calc(100dvh - 70px);
    max-height: calc(100dvh - 70px);
  }

  .site-head .nav-item {
    display: block;
    width: 100%;
    margin-top: 0;
  }

  .site-head .nav-item > a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 48px 12px 0;
    font-size: 16px;
    border-radius: 0;
    box-sizing: border-box;
  }

  .site-head .nav-item > a span {
    margin-left: 5px;
    font-size: 0.82em;
  }

  /* Sit on the Papers row only. Centering against the whole item
     would drop the chevron into the open menu. */
  .site-head .nav-sub-toggle {
    top: 3px;
    bottom: auto;
    height: 44px;
    margin: 0;
  }
}
