/* 港聞速報 — editorial news stylesheet */
:root {
  --ink: #122033;
  --ink-soft: #3a4a5c;
  --muted: #6b7a8c;
  --paper: #f7f4ef;
  --paper-2: #efeae2;
  --card: #ffffff;
  --line: #d9d2c6;
  --navy: #0b1f33;
  --navy-2: #14324f;
  --accent: #b33a2b;
  --accent-soft: #f3e0dc;
  --gold: #c9972e;
  --ok: #1f7a4c;
  --fail: #9b2c2c;
  --shadow: 0 10px 30px rgba(11, 31, 51, 0.08);
  --radius: 14px;
  --font-sans: "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", serif;
  --max: 1120px;
  --header-h: 0px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--navy-2);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--paper-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.container {
  width: min(100% - 2rem, var(--max));
  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;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--navy);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 1000;
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

.is-hidden {
  display: none !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-top {
  background: var(--navy);
  color: #e8eef5;
  font-size: 0.82rem;
}

.header-top-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  flex-wrap: wrap;
}

.header-top .tagline {
  margin: 0;
  opacity: 0.9;
}

.header-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.header-meta .dot {
  opacity: 0.5;
}

.header-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 0;
}

.brand-link {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--navy), var(--navy-2));
  color: var(--gold);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: var(--shadow);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.primary-nav {
  justify-self: center;
}

.nav-panel {
  display: flex;
  gap: 0.35rem 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-panel a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav-panel a:hover,
.nav-panel a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 2.6rem;
  height: 2.6rem;
  cursor: pointer;
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: var(--ink);
  margin: 0 auto;
  position: relative;
  content: "";
}

.nav-toggle-bars::before {
  position: absolute;
  top: -6px;
}

.nav-toggle-bars::after {
  position: absolute;
  top: 6px;
}

.search-form {
  display: flex;
  gap: 0.4rem;
}

.search-form input {
  width: min(220px, 36vw);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  background: #fff;
  font: inherit;
}

.search-form input:focus {
  outline: 2px solid rgba(179, 58, 43, 0.35);
  border-color: var(--accent);
}

.btn-search,
.btn-more,
.btn-ghost,
.btn-primary {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid transparent;
}

.btn-search {
  background: var(--navy);
  color: #fff;
  padding: 0.55rem 1rem;
}

.btn-search:hover {
  background: var(--navy-2);
}

.category-bar {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.category-bar-inner {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0;
  overflow-x: auto;
}

.cat-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.cat-tab.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.lang-filter {
  margin-left: auto;
}

.lang-filter select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: #fff;
}

/* Hero */
.hero {
  padding: 2rem 0 1rem;
}

.hero-head h1,
.section-head h2 {
  font-family: var(--font-serif);
  margin: 0 0 0.35rem;
  letter-spacing: 0.03em;
}

.hero-lead,
.section-head p {
  margin: 0;
  color: var(--muted);
}

.hero-grid {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: auto auto;
  gap: 1rem;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100%;
}

.hero-card.is-lead {
  grid-row: 1 / span 2;
  background:
    linear-gradient(180deg, rgba(11, 31, 51, 0.92), rgba(11, 31, 51, 0.88)),
    radial-gradient(circle at top right, rgba(201, 151, 46, 0.35), transparent 50%);
  color: #f5f0e8;
  border-color: transparent;
}

.hero-card.is-lead a {
  color: #ffd98a;
}

.hero-card .kicker {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.hero-card.is-lead .kicker {
  color: #ffd98a;
}

.hero-card h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  line-height: 1.35;
  margin: 0;
}

.hero-card p {
  margin: 0;
  color: inherit;
  opacity: 0.92;
}

.hero-card:not(.is-lead) p {
  color: var(--ink-soft);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: auto;
}

.hero-card.is-lead .meta-row {
  color: rgba(245, 240, 232, 0.78);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-weight: 600;
  font-size: 0.78rem;
}

.hero-card.is-lead .source-badge {
  background: rgba(255, 217, 138, 0.18);
  color: #ffd98a;
}

.cat-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
  background: #fff;
}

.hero-card.is-lead .cat-chip {
  border-color: rgba(255, 255, 255, 0.25);
  background: transparent;
  color: rgba(245, 240, 232, 0.85);
}

.read-link {
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.read-link::after {
  content: "↗";
  font-size: 0.9em;
}

/* Stats */
.stats-strip {
  padding: 0.5rem 0 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.75rem;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 0.75rem;
  text-align: center;
}

.stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy);
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
}

/* Sections & cards */
.section {
  padding: 2rem 0 2.5rem;
}

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

.section-head {
  margin-bottom: 1.25rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.news-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 4px 16px rgba(11, 31, 51, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.news-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.news-card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
  font-weight: 700;
}

.news-card h3 a {
  color: inherit;
  text-decoration: none;
}

.news-card h3 a:hover {
  color: var(--accent);
}

.news-card .snippet {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  flex: 1;
}

.section-more {
  margin-top: 1.25rem;
  text-align: center;
}

.btn-more {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  padding: 0.65rem 1.25rem;
}

.btn-more:hover {
  border-color: var(--navy);
}

.btn-more:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  padding: 0.55rem 1rem;
  margin-top: 1rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 0.65rem 1.2rem;
  text-decoration: none;
  display: inline-flex;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
}

/* Sources table */
.sources-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.sources-table th,
.sources-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.sources-table th {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
}

.sources-table tr:last-child td {
  border-bottom: 0;
}

.status-ok {
  color: var(--ok);
  font-weight: 600;
}

.status-fail {
  color: var(--fail);
  font-weight: 600;
}

.disclaimer {
  padding: 2rem 0 3rem;
}

.disclaimer h2 {
  font-family: var(--font-serif);
  margin: 0 0 0.5rem;
}

.disclaimer p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 70ch;
}

.site-footer {
  background: var(--navy);
  color: #d7e0ea;
  padding: 2rem 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 1.5rem;
}

.site-footer a {
  color: #ffd98a;
  display: inline-block;
  margin-right: 1rem;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-note code {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--navy);
  color: #fff;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 80;
  max-width: min(90vw, 360px);
}

.skeleton {
  background: linear-gradient(90deg, #e8e2d8, #f5f1ea, #e8e2d8);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: var(--radius);
  min-height: 140px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* About page extras */
.about-hero {
  padding: 2.5rem 0 1rem;
}

.about-hero h1 {
  font-family: var(--font-serif);
  margin: 0 0 0.5rem;
}

.prose {
  max-width: 70ch;
}

.prose h2 {
  font-family: var(--font-serif);
  margin-top: 2rem;
}

.prose ul {
  padding-left: 1.2rem;
}

.source-list {
  display: grid;
  gap: 0.75rem;
}

.source-list article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

/* Responsive */
@media (max-width: 960px) {
  .header-main {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand toggle"
      "search search";
  }

  .brand { grid-area: brand; }
  .primary-nav { grid-area: toggle; justify-self: end; }
  .search-form { grid-area: search; }
  .search-form input { width: 100%; flex: 1; }

  .nav-toggle { display: inline-grid; place-items: center; }

  .nav-panel {
    display: none;
    position: absolute;
    right: 1rem;
    top: calc(100% - 3.2rem);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem;
    flex-direction: column;
    min-width: 180px;
    box-shadow: var(--shadow);
    z-index: 60;
  }

  .primary-nav.is-open .nav-panel {
    display: flex;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-card.is-lead {
    grid-row: auto;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .brand-sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skeleton { animation: none; }
  .news-card { transition: none; }
}

.topic-chip { background: #fff4e5; color: #9a4b00; }
.via-note { display:block; color:#888; font-size:.75rem; margin-top:.2rem; }
@media (max-width: 1000px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
