/* school.edubaania.com — tokens aligned with EduBaania design-system.css */
:root {
  color-scheme: light;
  --canvas: #fbfdfd;
  --surface: #ffffff;
  --ink: #262b35;
  --muted: #69717d;
  --line: #e8eef0;
  --teal: #58c5bd;
  --teal-strong: #31aaa1;
  --teal-soft: #eafafa;
  --coral: #f27f87;
  --coral-soft: #fff0f2;
  --sand-soft: #fff7ed;
  --shadow: 0 12px 30px rgba(49, 79, 90, 0.08);   /* official --soft-shadow */
  --shadow-lg: 0 18px 45px rgba(49, 79, 90, 0.12); /* official --shadow (feature imagery) */
  --radius: 22px;
  --content-max: 1080px;
  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --ink-strong: #1d2330;
  --soft: #4d5a66;       /* softened body ink — 6.9:1 on canvas */
  --teal-ink: #1f6f68;   /* text links — 4.5:1 on white */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Noto Sans TC', system-ui, 'PingFang TC', sans-serif;
  font-size: 16px;
  line-height: 1.75;
}
a { color: var(--teal-ink); text-decoration: none; }
::selection { background: rgba(88, 197, 189, 0.24); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: fixed; top: -60px; left: 12px; z-index: 100;
  padding: 10px 18px; border-radius: 999px; background: var(--teal-strong);
  color: #fff; font-weight: 800; transition: top 160ms var(--ease); }
.skip-link:focus { top: 12px; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 20px; }
.num { font-variant-numeric: tabular-nums; }

/* header / footer */
.hdr {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 253, 253, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.hdr-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); letter-spacing: 0.01em; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--ink); font-weight: 700; }
.nav .btn.small { min-height: 36px; padding: 0 16px; font-size: 0.88rem; color: #fff; }
.nav a:last-child { color: var(--teal-ink); }
.ftr {
  margin-top: 56px; padding: 32px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.85rem;
}

/* content blocks */
.crumb { margin: 22px 0 6px; color: var(--muted); font-size: 0.9rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin: 18px 0;
}
.card h1 { margin: 0 0 6px; font-family: var(--serif); font-weight: 700; color: var(--ink-strong); font-size: clamp(1.5rem, 2.8vw, 2rem); line-height: 1.4; }
.card h2 { margin: 0 0 14px; font-size: 1.18rem; font-weight: 700; color: var(--ink-strong); letter-spacing: 0.01em; }
.badges { margin: 0 0 14px; }
.badge {
  display: inline-block; padding: 2px 12px; margin-right: 8px;
  border-radius: 999px; background: var(--teal-soft);
  color: var(--teal-strong); font-weight: 700; font-size: 0.85rem;
}
.badge.quasi { background: var(--sand-soft); color: #a06a1f; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* tables */
.tbl-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; white-space: nowrap; }
.card.warn { border-color: #f3d3d6; background: #fffafa; }
.ok { color: var(--teal-strong); font-weight: 700; }
.src { color: var(--muted); font-size: 0.8rem; }

/* google block */
.map-embed iframe {
  width: 100%; aspect-ratio: 16 / 10; height: auto; min-height: 280px; border: 0;
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin: 18px 0;
}
.g-attr { font-size: 0.75rem; color: var(--muted); font-weight: 400; margin-left: 8px; }
.g-rating strong { font-size: 1.4rem; }
.stars { color: #e7a53a; }
.g-review {
  margin: 12px 0; padding: 14px 18px;
  background: var(--teal-soft); border: 1px solid rgba(88, 197, 189, 0.35);
  border-radius: 14px; font-size: 0.92rem;
}
.g-review cite { display: block; margin-top: 6px; color: var(--muted); font-style: normal; font-size: 0.8rem; }

/* review form */
form { display: grid; gap: 14px; max-width: 560px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 0.92rem; }
input, select, textarea {
  font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
textarea { resize: vertical; }
button, .btn {
  position: relative; display: inline-flex; align-items: center;
  justify-content: center; gap: 9px;
  font: inherit; font-weight: 800; font-size: 0.95rem; cursor: pointer;
  min-height: 44px; padding: 0 24px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #35a096, #2b8f87); color: #fff;
  box-shadow: 0 12px 24px rgba(49, 170, 161, 0.24);
  overflow: hidden;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
button::before, .btn::before {
  content: ""; position: absolute; inset: -50% -34%; z-index: 0;
  background: linear-gradient(120deg, transparent 28%, rgba(255,255,255,0.48) 48%, transparent 68%);
  opacity: 0; pointer-events: none;
  transform: translateX(-120%) rotate(7deg);
  transition: opacity 180ms ease, transform 520ms var(--ease);
}
button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(49, 170, 161, 0.3);
  text-decoration: none;
}
button:hover::before, .btn:hover::before { opacity: 0.7; transform: translateX(120%) rotate(7deg); }
button:disabled { background: var(--muted); cursor: default; box-shadow: none; transform: none; }
button:disabled::before { display: none; }
.btn-arrow { position: relative; z-index: 1; display: inline-block; line-height: 1; transition: transform 160ms var(--ease); }
button:hover .btn-arrow, .btn:hover .btn-arrow { transform: translateX(3px); }
.hp { position: absolute; left: -9999px; }
.form-msg { font-weight: 700; color: var(--teal-strong); }

/* AiMii CTA */
.cta {
  margin: 28px 0; padding: 30px 32px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--teal-soft), var(--coral-soft));
  border: 1px solid rgba(88, 197, 189, 0.35);
  box-shadow: var(--shadow);
}
.cta h2 { margin: 0 0 8px; font-weight: 700; color: var(--ink-strong); font-size: 1.4rem; letter-spacing: 0.01em; }
.cta p { margin: 0 0 16px; color: #445565; }


/* home */
.hero { padding: 52px 0 12px; }
body {
  background:
    radial-gradient(circle at 8% 0%, rgba(88, 197, 189, 0.10), transparent 420px),
    radial-gradient(circle at 95% 6%, rgba(242, 127, 135, 0.07), transparent 380px),
    var(--canvas);
  background-attachment: fixed;
}
.hero h1 { font-family: var(--serif); font-weight: 700; color: var(--ink-strong); font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.4; letter-spacing: 0; margin: 0 0 16px; }
.hero p { color: var(--soft, #4d5a66); max-width: 620px; font-size: 1.05rem; line-height: 1.9; }
.city-grid {
  display: grid; gap: 14px; margin: 26px 0;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.city-card {
  display: grid; gap: 2px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; color: var(--ink); box-shadow: var(--shadow);
}
.city-card { transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease); }
.city-card:hover { border-color: var(--teal); text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
tbody tr { transition: background 120ms var(--ease); }
tbody tr:hover { background: #f4fbfa; }
.city-card span { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dt { margin-top: 10px; }
}

/* footer — mirrors www.edubaania.com */
.footer {
  margin-top: 64px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.footer-shell {
  max-width: var(--content-max); margin: 0 auto;
  padding: 44px 20px 36px;
  display: grid; gap: 28px;
  grid-template-columns: 1.4fr repeat(4, 1fr);
}
.footer-brand p { color: var(--muted); font-size: 0.88rem; max-width: 260px; }
.brand-logo { height: 44px; width: auto; }
.footer-group { display: grid; gap: 8px; align-content: start; }
.footer-group h3 { margin: 0 0 6px; font-size: 0.95rem; }
.footer-group a { color: var(--muted); font-size: 0.88rem; }
.footer-group a:hover { color: var(--teal-strong); }
.footer-bottom {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 18px; margin-top: 8px;
  color: var(--muted); font-size: 0.8rem;
}
.footer-legal { display: flex; gap: 16px; }
.footer-legal a { color: var(--muted); }
.footer-attr { flex-basis: 100%; margin: 4px 0 0; color: var(--muted); }
@media (max-width: 900px) {
  .footer-shell { grid-template-columns: repeat(2, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}

/* hero with illustration */
.hero-split {
  display: grid; gap: 32px; align-items: center;
  grid-template-columns: 1.1fr 0.9fr;
}
.hero-img {
  width: 100%; height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
@media (max-width: 760px) {
  .hero-split { grid-template-columns: 1fr; }
}

/* level entrances */
.level-grid {
  display: grid; gap: 12px; margin-top: 20px;
  grid-template-columns: repeat(4, 1fr);
}
.level-card {
  display: grid; gap: 2px; padding: 14px 16px; text-align: center;
  background: var(--teal-soft); border: 1px solid rgba(88,197,189,0.4);
  border-radius: 16px; color: var(--ink); font-weight: 700;
  box-shadow: var(--shadow);
}
.level-card span { color: var(--teal-strong); font-size: 0.85rem; font-weight: 700; }
.level-card { transition: box-shadow 160ms var(--ease), transform 160ms var(--ease); }
.level-card:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.sec-title { margin: 40px 0 6px; font-weight: 700; color: var(--ink-strong); font-size: clamp(1.25rem, 2.2vw, 1.5rem); letter-spacing: 0.01em; }
@media (max-width: 640px) { .level-grid { grid-template-columns: repeat(2, 1fr); } }

/* search */
.search-wrap { position: relative; margin: 22px 0 10px; max-width: 560px; }
#site-search {
  width: 100%; padding: 14px 18px; font-size: 1rem;
  border: 2px solid var(--teal); border-radius: 999px;
  background: var(--surface); outline: none;
  box-shadow: 0 8px 22px rgba(49, 79, 90, 0.07);
}
#site-search::placeholder { color: #5c6570; }
#site-search:focus { border-color: var(--teal-strong); box-shadow: var(--shadow); }
.search-results a.is-active { background: var(--teal-soft); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.search-results a {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 16px; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--teal-soft); text-decoration: none; }
.search-loc { color: var(--muted); font-size: 0.85rem; margin-left: auto; }
.search-empty { padding: 12px 16px; margin: 0; color: var(--muted); font-size: 0.9rem; }
.trust-line { color: var(--muted); margin: 0 0 4px; }
.trust-line strong { color: var(--ink); }

/* pill row */
.pill-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 50px; padding: 0 24px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid #c4dedb;
  color: var(--ink-strong); font-weight: 800; font-size: 0.98rem;
  box-shadow: 0 10px 24px rgba(49, 79, 90, 0.1);
  transition: transform 160ms var(--ease), border-color 160ms var(--ease),
              box-shadow 160ms var(--ease);
}
.pill:hover {
  border-color: var(--teal-strong); text-decoration: none;
  transform: translateY(-2px); box-shadow: 0 16px 32px rgba(49, 79, 90, 0.16);
}

/* overview stat cards */
.stat-grid {
  display: grid; gap: 14px; margin: 14px 0 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat-card {
  display: grid; gap: 2px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.stat-card strong { font-family: var(--serif); font-weight: 700; font-size: 1.7rem; color: var(--ink-strong); }
.stat-card span { color: var(--muted); font-size: 0.85rem; }
.warn-num { color: #c0504a; }

/* violations list */
details.card summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; color: var(--ink-strong); }
.v-list { columns: 2; margin: 14px 0 0; padding-left: 20px; }
.v-list li { margin-bottom: 6px; }
@media (max-width: 640px) { .v-list { columns: 1; } }


/* WCAG AA: reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  button:hover, .btn:hover, .btn-arrow,
  .city-card:hover, .level-card:hover, .near-card:hover,
  .pill:hover, .act:hover { transform: none !important; }
}

/* mobile header: brand row + scrollable nav row */
@media (max-width: 760px) {
  .hdr-in {
    flex-wrap: wrap; height: auto;
    padding: 10px 20px 0; row-gap: 0;
  }
  .brand { font-size: 1rem; white-space: nowrap; }
  .nav {
    order: 3; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 18px; padding: 8px 2px 12px;
    white-space: nowrap; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav .btn.small { min-height: 32px; padding: 0 14px; font-size: 0.82rem; }
}

/* detail layout with sticky page index */
.detail-layout { display: grid; grid-template-columns: 150px 1fr; gap: 26px; align-items: start; }
.detail-main { min-width: 0; }
.page-index {
  position: sticky; top: 84px;
  display: grid; gap: 2px; padding: 14px 0;
  border-left: 1px solid var(--line);
}
.page-index-title { padding: 0 14px 8px; color: var(--muted); font-size: 0.78rem; }
.page-index a {
  padding: 6px 14px; color: var(--ink); font-size: 0.88rem;
  border-left: 2px solid transparent; margin-left: -1px;
}
.page-index a:hover { color: var(--teal-ink); border-left-color: var(--teal); text-decoration: none; }
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .page-index {
    position: static; border-left: 0;
    display: flex; overflow-x: auto; gap: 6px; padding: 8px 0;
    white-space: nowrap; scrollbar-width: none;
  }
  .page-index::-webkit-scrollbar { display: none; }
  .page-index-title { display: none; }
  .page-index a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
}
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* quick actions */
.act-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.act {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid #c4dedb; background: var(--surface);
  color: var(--ink-strong); font-weight: 700; font-size: 0.9rem;
  transition: border-color 160ms var(--ease), transform 160ms var(--ease);
}
.act:hover { border-color: var(--teal-strong); transform: translateY(-1px); text-decoration: none; }
.act.primary { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }

/* histogram bars */
.bars { display: grid; gap: 7px; margin-top: 14px; }
.bar-row { display: grid; grid-template-columns: 72px 1fr max-content; gap: 12px; align-items: center; }
.bar-label { color: var(--muted); font-size: 0.85rem; text-align: right; }
.bar-track { background: #eef4f3; border-radius: 999px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: #c9ddda; }
.bar-count { color: var(--muted); font-size: 0.85rem; }
.bar-row.is-self .bar-fill { background: linear-gradient(90deg, var(--teal), var(--teal-strong)); }
.bar-row.is-self .bar-label, .bar-row.is-self .bar-count { color: var(--teal-ink); font-weight: 700; }

/* nearby comparison */
.near-grid { display: grid; gap: 12px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.near-card {
  display: grid; gap: 4px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  color: var(--ink); box-shadow: var(--shadow);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}
.near-card:hover { border-color: var(--teal); box-shadow: var(--shadow-lg); text-decoration: none; transform: translateY(-2px); }
.near-card span { color: var(--muted); font-size: 0.88rem; }

/* subsidy tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  min-height: 38px; padding: 0 18px; font-size: 0.9rem; font-weight: 700;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line);
  box-shadow: none;
}
.tab::before { display: none; }
.tab:hover { transform: none; box-shadow: none; border-color: var(--teal); }
.tab.is-on { background: var(--teal-soft); border-color: var(--teal-strong); color: var(--teal-ink); }
.subsidy-pay strong { font-family: var(--serif); font-weight: 700; font-size: 2rem; color: var(--teal-ink); }
