/* Vitals HK — "The Warm App" world
   A warm cream ground under white cards, soft large radii, one saturated
   action colour reserved strictly for actionable elements, rounded humanist
   type, a persistent thumb-reachable bottom bar. */

/* Self-hosted Nunito (latin + latin-ext, variable weight). Chinese falls back
   to the platform's PingFang HK / Noto Sans TC, which is the native HK face. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Warm ground + white cards */
  --paper: #f6f1e8;
  --paper-deep: #efe8db;
  --surface: #ffffff;
  /* Warm ink, never grey — muted is tinted from the ink hue */
  --ink: #211c14;
  --muted: #6f675a;
  --line: #eae2d4;
  --line-strong: #ddd3c2;
  --line-control: #8a8068; /* interactive field boundary — clears 3:1 on white */
  /* One saturated action colour — used only where the visitor can act */
  --action: #0e6b4f;
  --action-press: #0a533d;
  --action-soft: #e6f1eb;
  /* State colours ride on top of the world, only where they carry meaning */
  --warn-bg: #fbf0df;
  --warn-ink: #8a5a12;
  --warn-line: #ecdcc0;
  --danger-bg: #faeaea;
  --danger-ink: #a3312a;
  --danger-line: #edcecc;
  --ok-bg: #e6f1eb;
  --ok-ink: #0a3d2e;
  --ok-line: #cfe3d8;
  /* Radii — soft and large */
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 14px;
  --r-pill: 999px;
  /* Depth — offset + soft blur, never a zero-offset halo */
  --shadow: 0 1px 2px rgb(33 28 20 / 5%), 0 8px 24px rgb(33 28 20 / 7%);
  --shadow-press: 0 1px 2px rgb(33 28 20 / 6%);
  --bar-h: 64px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Nunito", "PingFang HK", "Noto Sans TC", "Noto Sans CJK TC",
    system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 16px;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
  text-wrap: pretty;
}

h1, h2 { text-wrap: balance; }

/* ---- Browser surfaces carry the design ---- */
::selection { background: var(--action-soft); color: var(--ink); }
:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 2px;
  border-radius: 6px;
}
input, button, textarea, select { font: inherit; color: inherit; }
textarea, input { caret-color: var(--action); }
a {
  color: var(--action);
  text-decoration: none;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

/* ---- Layout ---- */
.wrap {
  width: min(680px, 100% - 2rem);
  margin-inline: auto;
}

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

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

.skip {
  position: absolute; left: -9999px; top: 0;
}
.skip:focus {
  left: 12px; top: 12px; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--r-sm);
}

/* ---- Header: minimal wordmark + language ---- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
}
.header-inner {
  display: flex; align-items: center; gap: 0.7rem;
  min-height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none; font-weight: 800;
}
.brand-mark {
  display: block; height: 40px; width: auto;
}
.brand-text { display: flex; flex-direction: column; justify-content: space-between; line-height: 1.08; font-size: 1.25rem; letter-spacing: -0.01em; height: 40px; }
.brand-text small {
  font-size: 0.85rem; font-weight: 700; color: var(--muted);
}
.brand-text small[lang^="en"] { letter-spacing: 0.12em; text-transform: uppercase; }
.lang-switch {
  margin-left: auto;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  padding: 0.45rem 0.95rem; font-size: 0.85rem; font-weight: 700;
  color: var(--ink); background: var(--surface); text-decoration: none;
  min-height: 44px; display: inline-flex; align-items: center;
  white-space: nowrap;
}

/* Compact header search (non-home pages) */
.header-search { display: flex; gap: 0.4rem; flex: 1; min-width: 0; margin-left: auto; max-width: 340px; }
.header-search input {
  flex: 1; min-width: 0; min-height: 40px; padding: 0 0.9rem;
  border: 1px solid var(--line-control); border-radius: var(--r-pill);
  background: var(--surface); font-size: 0.92rem;
}
.header-search button {
  min-height: 40px; padding: 0 0.95rem; border: 0; border-radius: var(--r-pill);
  background: var(--action); color: #fff; font-weight: 800; font-size: 0.92rem; cursor: pointer;
}
.header-search + .lang-switch { margin-left: 0.4rem; }

[id] { scroll-margin-top: 76px; }

/* ---- Persistent bottom bar ---- */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-bar nav {
  display: flex; max-width: 680px; margin-inline: auto;
}
.bottom-bar a {
  flex: 1; min-height: var(--bar-h);
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
  color: var(--muted); font-weight: 700; font-size: 0.82rem;
  text-decoration: none; border-radius: var(--r-md);
}
.bottom-bar a.active { color: var(--action); }
.bottom-bar a:hover { color: var(--ink); }

/* ---- Hero + search ---- */
.hero { padding: 1.6rem 0 1.2rem; }
.hero h1 {
  font-size: clamp(1.65rem, 4.5vw, 2.3rem);
  line-height: 1.18; margin: 0 0 0.4rem;
  letter-spacing: -0.02em; font-weight: 800;
  text-wrap: balance; max-width: 20ch;
}
.hero-sub { color: var(--muted); margin: 0 0 1.4rem; font-size: 1rem; }

.search { position: relative; display: flex; gap: 0.5rem; }
.search input {
  flex: 1; min-height: 54px; padding: 0 1.1rem; font-size: 1rem;
  border: 1.5px solid var(--line-control); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--action); box-shadow: 0 0 0 3px var(--action-soft); }
.search button {
  min-height: 54px; padding: 0 1.4rem; border: 0; border-radius: var(--r-md);
  background: var(--action); color: #fff; font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.3, 1), background 0.16s;
}
.search button:hover { background: var(--action-press); }
.search button:active { transform: scale(0.97); }

.search-results {
  position: absolute; top: calc(100% + 0.4rem); left: 0; right: 0; z-index: 50;
  margin: 0; padding: 0.4rem; list-style: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
  max-height: 380px; overflow: auto;
}
.search-results a {
  display: block; padding: 0.7rem 0.8rem; border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none; font-weight: 700;
}
.search-results a:hover, .search-results a:focus { background: var(--action-soft); }
.search-results small { display: block; color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.search-note { color: var(--muted); margin-top: 0.75rem; font-size: 0.9rem; }

/* ---- Section headings ---- */
h2 {
  font-size: 1.22rem; margin: 2.2rem 0 0.9rem;
  letter-spacing: -0.01em; font-weight: 800;
}

/* ---- Cards: one idea each, generous padding ---- */
.card {
  display: block; color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.18s;
}
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
a.card:active { transform: translateY(0); box-shadow: var(--shadow-press); }
.card > strong { font-size: 1.05rem; font-weight: 800; }
.card .muted { font-size: 0.85rem; }
.verdict { display: block; margin-top: 0.6rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.verdict.warn { color: var(--warn-ink); }

/* Building page: the one-glance verdict, above the fact grid */
.verdict-block {
  margin: 1rem 0 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 800;
}
.verdict-block.flag { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.verdict-block.nearby { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.verdict-block.cutoff { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }

/* Home: featured building cards stack in one column */
.featured-list { display: grid; gap: 0.8rem; padding: 0; margin: 0; list-style: none; }

/* Chips — neutral, warm */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.chip {
  font-size: 0.74rem; font-weight: 700; padding: 0.22rem 0.62rem;
  border-radius: var(--r-pill); background: var(--paper-deep); color: var(--muted);
}
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }

/* District grid — a wrapped field of cards */
.district-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; padding: 0; margin: 0; list-style: none; }
.district {
  display: flex; flex-direction: column; gap: 0.15rem; padding: 0.85rem 0.95rem;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow);
}
.district:hover { border-color: var(--line-strong); }
.district .muted { font-size: 0.78rem; }

/* Guides / link list */
.guides { padding-bottom: 1.5rem; }
.link-list { padding-left: 1.15rem; margin: 0; }
.link-list li { margin: 0.55rem 0; }
.link-list a { font-weight: 700; }

/* ---- Building page ---- */
.building-head { padding-top: 1.2rem; }
.breadcrumb { font-size: 0.82rem; color: var(--muted); margin: 1rem 0 0.4rem; }
.breadcrumb a { color: var(--muted); }
.building-head h1 {
  margin: 0 0 0.2rem; font-size: clamp(1.55rem, 4vw, 2.1rem);
  letter-spacing: -0.02em; font-weight: 800;
}
.alt-name { margin: 0; color: var(--muted); }
.address { margin: 0.3rem 0 0.7rem; color: var(--muted); }
.tier-badge {
  display: inline-block; font-size: 0.76rem; font-weight: 800;
  padding: 0.24rem 0.7rem; border-radius: var(--r-pill); margin: 0 0 1rem;
}
.tier-badge.flagship { background: var(--paper-deep); color: var(--ink); }
.tier-badge.basic { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* Fact list — a card of key/value rows */
.fact-grid {
  display: grid; gap: 0; padding: 0; margin: 1.1rem 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow);
}
.fact-grid > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.85rem 1.2rem; border-bottom: 1px solid var(--line);
}
.fact-grid > div:last-child { border-bottom: 0; }
.fact-grid dt { font-size: 0.76rem; font-weight: 700; color: var(--muted); letter-spacing: 0.03em; text-transform: uppercase; }
.fact-grid dd { margin: 0; font-weight: 800; text-align: right; }
.fact-grid dd a { font-weight: 800; }

/* Callouts — full tint, never a one-sided bar */
.callout {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.15rem 1.25rem;
  margin: 1.2rem 0;
}
.callout h2 { margin: 0 0 0.45rem; font-size: 1.05rem; }
.callout p { margin: 0; }
.callout.warning { background: var(--warn-bg); border-color: var(--warn-line); }
.callout.danger { background: var(--danger-bg); border-color: var(--danger-line); }
.callout.info { background: var(--ok-bg); border-color: var(--ok-line); }

/* Notices table */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow); font-variant-numeric: tabular-nums;
}
.data-table th, .data-table td {
  text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.data-table th { background: var(--paper); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }

.slope-list { padding-left: 1.15rem; margin: 0; }
.slope-list li { margin: 0.4rem 0; }
.slope-list code {
  font-family: "Nunito", ui-monospace, monospace; font-size: 0.85em;
  background: var(--paper-deep); padding: 0.1rem 0.35rem; border-radius: 6px;
}

/* Prose — guides & static pages */
.prose { padding-block: 1.2rem 1.8rem; max-width: 640px; }
.prose h1 { letter-spacing: -0.02em; font-weight: 800; font-size: clamp(1.55rem, 4vw, 2.1rem); }
.prose .lead { font-size: 1.05rem; color: var(--muted); font-weight: 600; }
.prose p { margin: 0.9rem 0; }
.prose h2 { margin-top: 1.8rem; }
.meta-foot { color: var(--muted); font-size: 0.82rem; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0.6rem 1.3rem; border-radius: var(--r-md);
  background: var(--action); color: #fff; text-decoration: none; font-weight: 800;
  transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.3, 1), background 0.16s;
}
.button:hover { background: var(--action-press); }
.button:active { transform: scale(0.97); }

/* ---- Footer ---- */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--line); padding: 2rem 0 1rem; }
.site-footer p { margin: 0.4rem 0; font-size: 0.8rem; color: var(--muted); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.8rem 0; }
.footer-nav a { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.fineprint { margin-top: 1rem; }

/* ---- Motion: one authored moment, exponential ease-out, no entry bounce ---- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
