/* HK Cost Compare — mobile-first, zh-HK */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5c6570;
  --border: #e2e6ea;
  --primary: #0d6e6e;
  --primary-soft: #e6f4f4;
  --accent: #c45c26;
  --cheap-bg: #e8f7ef;
  --cheap-border: #2d8a5a;
  --cheap-text: #1b6b42;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --font: "PingFang HK", "Noto Sans TC", "Microsoft JhengHei",
    "Helvetica Neue", Arial, sans-serif;
  --max: 720px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
  color: var(--primary);
}

.logo span {
  color: var(--primary);
}

.badge-demo {
  font-size: 0.7rem;
  font-weight: 600;
  background: #fff3e6;
  color: var(--accent);
  border: 1px solid #f0d4b8;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 1.55rem;
  line-height: 1.3;
  margin: 0 0 0.6rem;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.disclaimer-banner {
  background: #fff8f0;
  border: 1px solid #f0d4b8;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #6b4a2e;
  margin-bottom: 1.5rem;
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
}

.card:hover,
.card:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(13, 110, 110, 0.12);
  text-decoration: none;
  outline: none;
}

.card-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
}

.card .cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.35rem;
}

.page-nav {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.page-header {
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
}

.page-header .meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.toolbar label {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toolbar select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.legend {
  font-size: 0.8rem;
  color: var(--cheap-text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--cheap-border);
  display: inline-block;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--primary-soft);
}

th,
td {
  padding: 0.7rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--primary);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tr.cheapest {
  background: var(--cheap-bg);
}

tr.cheapest td:first-child {
  border-left: 3px solid var(--cheap-border);
}

.price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.tag-cheap {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--cheap-border);
  color: #fff;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.source,
.date {
  color: var(--muted);
  font-size: 0.85rem;
}

.status {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.status.error {
  color: #a33;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin: 0.25rem 0;
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}

/* Card list fallback for very narrow / accessibility */
@media (max-width: 400px) {
  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  tr:last-child {
    border-bottom: none;
  }

  td {
    border: none;
    padding: 0.15rem 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.1rem;
  }

  tr.cheapest td:first-child {
    border-left: none;
    padding-left: 0;
  }

  tr.cheapest {
    border-left: 3px solid var(--cheap-border);
  }
}
