/* Generated school and directory pages (H#62 PR 5, board E).

   Linked by every page that .github/scripts/build_school_pages.py and
   build_directory_pages.py write — /school/**, /directory/** — after
   /zodi-page.css, which brings in /tokens.css, the font, the page colour and
   the phone shell (bottom tab bar and its padding come from /nav.css).

   Tokens only: no colour literal here (sch-tracker/tokens.test.js checks it,
   and tests/test_generated_skin.py checks the generated pages carry no
   colour in their own markup either).

   Looks only. The builders' text, headings, links and structured data are
   what search engines read and stay exactly as they were; a few wrappers
   and class names were added so these rules have something to hold on to. */

* { box-sizing: border-box; }
body.lang-en .zh { display: none; }
body.lang-zh .en { display: none; }

/* --- Breadcrumb: 44px tap targets, no underline --------------------- */
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px;
  font-size: var(--z-fs-small); color: var(--z-muted); margin: 0 0 4px; }
.crumb a { display: inline-flex; align-items: center; min-height: var(--z-tap);
  color: var(--z-lavender-strong); font-weight: 800; text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* --- Title block ----------------------------------------------------- */
.page-head h1 .h1-en { font-size: 15px; font-weight: 600; color: var(--z-muted); letter-spacing: 0; }
.page-head .pills, .page-head .pills + * { margin-top: 12px; }
.page-head .pills { display: flex; flex-wrap: wrap; gap: 8px; }
.page-head .note { font-size: var(--z-fs-small); color: var(--z-muted); margin: 6px 0 0; }

/* --- Chips ----------------------------------------------------------- */
.pill, .tag { display: inline-flex; align-items: center; min-height: var(--z-chip-h);
  padding: 0 14px; border-radius: var(--z-radius-pill); font-size: var(--z-fs-chip);
  font-weight: 700; line-height: 1.2; white-space: nowrap; margin: 0;
  background: var(--z-mist); color: var(--z-lavender-strong); }
.pill-region { background: var(--z-sky); color: var(--z-sky-ink); }
.pill-closed { background: var(--z-rose); color: var(--z-rose-ink); }
.tag { min-height: 26px; padding: 0 10px; font-size: 12px; margin: 2px 6px 2px 0; vertical-align: middle; }

/* --- Cards ----------------------------------------------------------- */
.card { background: var(--z-card); border: 0; border-radius: var(--z-radius-card);
  box-shadow: var(--z-shadow-card); padding: var(--z-pad-card); margin: 0 0 var(--z-gap); }
.card h2 { display: flex; align-items: center; gap: 12px; font-size: var(--z-fs-h3);
  font-weight: 800; line-height: 1.3; color: var(--z-ink); margin: 0 0 12px; }
.card p, .card li, .card td, .card th { line-height: 1.6; font-size: var(--z-fs-body); }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.card a { color: var(--z-lavender-strong); font-weight: 700; text-decoration: none; }
.card a:hover { text-decoration: underline; }
.note, .card p.note { font-size: var(--z-fs-small); color: var(--z-muted); }
.card-quiet { background: var(--z-mist-soft); box-shadow: none; }

/* Line icon tile at the start of a card title (replaces the old emoji) */
.h-ico { flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--z-mist);
  color: var(--z-lavender-strong); display: inline-flex; align-items: center; justify-content: center; }
.h-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.closed-card .h-ico { background: var(--z-rose); color: var(--z-rose-ink); }
.changes .h-ico { background: var(--z-mint); color: var(--z-mint-ink); }

/* --- Key details: label / value rows --------------------------------- */
.facts { width: 100%; border-collapse: collapse; }
.facts th, .facts td { padding: 13px 0; border-top: 1px solid var(--z-line); vertical-align: top; }
.facts tr:first-child th, .facts tr:first-child td { border-top: 0; }
.facts th { text-align: left; width: 38%; padding-right: 14px; color: var(--z-muted); font-weight: 600; }
.facts td { text-align: right; font-weight: 800; color: var(--z-ink); overflow-wrap: anywhere; }
.facts td .note { font-weight: 600; }

/* --- What changed (crawler history) ---------------------------------- */
.changes { background: var(--z-card); }
.changelist { list-style: none; padding: 0; margin: 8px 0 0; }
.changelist li { padding: 12px 0; border-top: 1px solid var(--z-line); font-size: var(--z-fs-small); }
.changelist li:first-child { border-top: 0; }
.changelist strong { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px;
  margin-right: 6px; border-radius: var(--z-radius-pill); background: var(--z-mint); color: var(--z-mint-ink);
  font-size: 12px; }

/* --- School lists (/school, /school/region/*): rows with a chevron ----
   The whole row is the tap target (a stretched link), without moving the
   name, English name or dates into the link's own text. */
.sch-list, .schools { list-style: none; padding: 0; margin: 0; }
.sch-list li, .schools li { position: relative; padding: 14px 0; border-top: 1px solid var(--z-line);
  line-height: 1.45; font-size: var(--z-fs-body); }
.sch-list li:first-child, .schools li:first-child { border-top: 0; }
.sch-list li { min-height: 56px; padding-right: 32px; }
.sch-list li > a { color: var(--z-ink); text-decoration: none; font-weight: 800; font-size: 16px; }
.sch-list li > a::after { content: ""; position: absolute; inset: 0; }
.sch-list li:hover > a { color: var(--z-lavender-strong); }
.sch-list li::after { content: ""; position: absolute; right: 8px; top: 50%; width: 9px; height: 9px;
  margin-top: -5px; border-right: 2.4px solid var(--z-muted); border-top: 2.4px solid var(--z-muted);
  transform: rotate(45deg); }
.sch-list .meta, .schools .meta { color: var(--z-muted); font-size: var(--z-fs-small); }
.sch-list .meta { font-weight: 600; }
.sch-list a:focus-visible { outline: none; }
.sch-list li:has(> a:focus-visible) { outline: 2px solid var(--z-lavender); outline-offset: 2px; border-radius: 12px; }

/* --- Directory district pages: one school per row --------------------- */
.schools li > strong { font-size: 16px; font-weight: 800; color: var(--z-ink); margin-right: 6px; }
.schools .meta a { display: inline-flex; align-items: center; min-height: var(--z-tap);
  color: var(--z-lavender-strong); font-weight: 700; text-decoration: none; }

/* --- Directory index grids (levels, districts) ----------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.grid a { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  min-height: 56px; padding: 10px 40px 10px 16px; border: 2px solid var(--z-border); border-radius: 18px;
  background: var(--z-white); color: var(--z-ink); text-decoration: none; }
.grid a strong { font-size: 16px; font-weight: 800; }
.grid a br { display: none; }
.grid a:hover { border-color: var(--z-lavender); text-decoration: none; }
.grid a::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px;
  margin-top: -5px; border-right: 2.4px solid var(--z-muted); border-top: 2.4px solid var(--z-muted);
  transform: rotate(45deg); }
.grid .n { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px;
  border-radius: var(--z-radius-pill); background: var(--z-mist); color: var(--z-lavender-strong);
  font-size: 13px; font-weight: 800; }

/* --- School page layout: one column on a phone, two on a desktop ------ */
.sp-side .card { margin-bottom: var(--z-gap); }
@media (min-width: 900px) {
  .sp-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 var(--z-gap); align-items: start; }
  .sch-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  .sch-list li:nth-child(2) { border-top: 0; }
}

@media (max-width: 640px) {
  .card { padding: var(--z-pad-card-phone); }
  .facts th { width: 42%; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
}

/* =====================================================================
   H#62 PR 5b: polish from C-UX's PR 5 review. CSS only: the text, links
   and markup search engines read are unchanged.
   ===================================================================== */

/* Phone and website rows: the link is a 44px tap target. */
.facts td a { display: inline-flex; align-items: center; justify-content: flex-end; min-height: var(--z-tap); }
.facts tr:has(td a) th, .facts tr:has(td a) td { vertical-align: middle; }

/* Directory district pages: the school's phone and website links sit on a
   line of their own under the address, each 44px tall. The " · " between
   them is text in the page; it is only made invisible here (font-size 0 on
   the line, the address and links bring their own size back). */
.schools .meta { display: block; font-size: 0; }
.schools .meta > span, .schools .meta > a { font-size: var(--z-fs-small); }
/* Only the language being shown: .en / .zh stay hidden by the page's rule. */
body.lang-en .schools .meta > .en, body.lang-zh .schools .meta > .zh { display: block; }
.schools .meta > a { margin: 2px 18px 0 0; }
.schools .meta > a:last-child { margin-right: 0; }
/* Long English names (the EDB writes many in capitals): a step lighter so a
   two-line capitals name does not shout. Text unchanged. */
.schools li > strong .en { font-weight: 700; letter-spacing: .005em; }

@media (max-width: 640px) {
  /* A website address is one long word: on a phone its row puts the label
     above the value, so the address gets the full width and keeps whole.
     anywhere stays only as the last resort for an address wider than that. */
  /* On a phone the table lays out as a grid (same label / value columns),
     so a row can become one column without squeezing into the first. */
  .facts, .facts tbody { display: block; }
  .facts tr { display: grid; grid-template-columns: 42% minmax(0, 1fr); border-top: 1px solid var(--z-line); }
  .facts tr:first-child { border-top: 0; }
  .facts th, .facts td { border-top: 0; width: auto; }
  .facts tr:has(td a[href^="http"]) { grid-template-columns: minmax(0, 1fr); }
  .facts tr:has(td a[href^="http"]) th,
  .facts tr:has(td a[href^="http"]) td { text-align: left; }
  .facts tr:has(td a[href^="http"]) th { padding-bottom: 0; }
  .facts tr:has(td a[href^="http"]) td { padding-top: 2px; }
  .facts tr:has(td a[href^="http"]) td a { justify-content: flex-start; font-size: var(--z-fs-small); font-weight: 700; }
  .facts tr:has(td a) { align-items: center; }
}

/* =====================================================================
   H#67b (board E): Call / Map / Website under the title, and the "more in
   this region" list. Tokens only.
   ===================================================================== */
.sp-actions { display: flex; gap: 10px; margin: 0 0 var(--z-gap); }
.sp-act { flex: 1 1 0; min-width: 0; min-height: var(--z-btn-h); display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; padding: 0 12px; border: 2px solid var(--z-border);
  border-radius: var(--z-radius-pill); background: var(--z-white); color: var(--z-lavender-strong);
  font: 800 15px/1 var(--z-font); text-decoration: none; white-space: nowrap; }
.sp-act:hover { border-color: var(--z-lavender); text-decoration: none; }
.sp-act svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.sp-more { margin-top: var(--z-gap); }
@media (min-width: 900px) {
  .sp-actions { max-width: 560px; }
}
