:root {
  --blue: #0D1B6E;
  --blue-mid: #1B3A8C;
  --green: #2DBD6E;
  --text: #1a1a2e;
  --text-light: #475569;
  --muted: #94a3b8;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans HK', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { text-decoration: none; color: var(--blue-mid); transition: color 0.2s; }
a:hover { color: var(--green); }
img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── HEADER ── */
.site-header {
  background: var(--blue);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo {
  color: white;
  font-size: 1.6rem;
  font-weight: 900;
  font-family: 'Noto Serif HK', serif;
}
.site-logo:hover { color: white; }
.logo-dot { color: var(--green); }
.custom-logo { max-height: 40px; width: auto; }

.main-nav { display: none; }
@media (min-width: 860px) {
  .main-nav { display: block; flex: 1; margin: 0 40px; }
  .nav-list { display: flex; gap: 24px; list-style: none; }
  .nav-list a {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    font-weight: 500;
    padding: 20px 0;
    display: block;
    position: relative;
  }
  .nav-list a:hover, .nav-list .current-menu-item > a { color: var(--green); }
}

.header-right { display: flex; align-items: center; gap: 16px; }
.search-toggle, .mobile-toggle {
  background: none; border: none; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
}
.search-toggle:hover, .mobile-toggle:hover { background: rgba(255,255,255,0.1); }
.mobile-toggle { display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 860px) { .mobile-toggle { display: none; } }
.mobile-toggle span { width: 22px; height: 2px; background: white; border-radius: 2px; }

/* ── SEARCH BAR ── */
.search-bar {
  background: var(--blue-mid);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.search-bar.open { max-height: 80px; }
.search-bar .container { padding: 16px 20px; display: flex; justify-content: center; }
.search-form { display: flex; width: 100%; max-width: 600px; }
.search-form input { flex: 1; padding: 10px 16px; border: none; border-radius: 6px 0 0 6px; font-size: 1rem; outline: none; }
.search-form button { background: var(--green); color: white; border: none; padding: 0 20px; border-radius: 0 6px 6px 0; font-weight: 700; cursor: pointer; }

/* ── CATEGORY BAR ── */
.cat-nav-bar { background: var(--blue-mid); overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.cat-nav-bar::-webkit-scrollbar { display: none; }
.cat-nav { display: flex; padding: 0 20px; gap: 8px; margin: 0 auto; max-width: 1200px; align-items: center; height: 48px; }
.cat-nav-item {
  color: rgba(255,255,255,0.8); font-size: 0.9rem; font-weight: 500;
  padding: 4px 14px; border-radius: 20px; transition: all 0.2s;
}
.cat-nav-item:hover, .cat-nav-item.active { background: rgba(255,255,255,0.15); color: white; }

/* ── MOBILE MENU ── */
.mobile-menu { display: none; }

/* ── MAIN LAYOUT ── */
.main-wrap {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 40px 20px 80px;
}
@media (min-width: 960px) {
  .main-wrap { flex-direction: row; align-items: flex-start; }
  .main-content { flex: 1; min-width: 0; }
  .sidebar { width: 320px; flex-shrink: 0; position: sticky; top: 80px; }
}

.section-title {
  font-size: 1.4rem; font-weight: 800; color: var(--blue);
  margin-bottom: 24px; display: flex; align-items: center; gap: 12px;
}
.section-title::after { content: ''; flex: 1; height: 2px; background: var(--border); }

/* ── HERO ── */
.hero-section { background: white; padding: 40px 0; border-bottom: 1px solid var(--border); }
.hero-inner { display: flex; flex-direction: column; gap: 32px; }
@media (min-width: 860px) {
  .hero-inner { flex-direction: row; align-items: center; }
  .hero-main { flex: 1; padding-right: 40px; }
  .hero-thumb { width: 55%; flex-shrink: 0; }
}
.hero-title { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.3; margin: 16px 0; letter-spacing: -0.5px; }
.hero-title a { color: var(--text); }
.hero-title a:hover { color: var(--blue-mid); }
.hero-excerpt { font-size: 1.1rem; color: var(--text-light); line-height: 1.6; margin-bottom: 24px; }
.hero-meta { display: flex; gap: 16px; font-size: 0.9rem; color: var(--muted); }
.cat-badge { display: inline-block; padding: 4px 12px; border-radius: 4px; font-size: 0.8rem; font-weight: 700; color: white; }

/* ── LATEST LIST ── */
.latest-list { display: flex; flex-direction: column; gap: 24px; margin-bottom: 48px; }
.latest-item { display: flex; gap: 20px; align-items: center; }
@media (max-width: 480px) { .latest-item { flex-direction: column; align-items: flex-start; gap: 12px; } }
.latest-thumb { width: 220px; flex-shrink: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 16/10; }
@media (max-width: 480px) { .latest-thumb { width: 100%; aspect-ratio: 16/9; } }
.latest-body { flex: 1; }
.latest-title { font-size: 1.2rem; font-weight: 700; line-height: 1.4; margin: 8px 0; }
.latest-title a { color: var(--text); }
.latest-title a:hover { color: var(--blue-mid); }
.latest-meta { display: flex; gap: 12px; font-size: 0.85rem; color: var(--muted); }
.cat-badge-sm { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; color: white; }

/* ── CARD GRID ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 32px 24px;
}
.card {
  background: var(--card); border-radius: 12px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(13,27,110,0.1); }
.card-thumb-link { position: relative; display: block; aspect-ratio: 16/9; overflow: hidden; }
.card-cat-badge { position: absolute; top: 12px; left: 12px; padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; color: white; z-index: 2; }
.card-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.1rem; font-weight: 700; line-height: 1.4; margin-bottom: 12px; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--blue-mid); }
.card-excerpt { font-size: 0.95rem; color: var(--text-light); margin-bottom: 16px; flex: 1; line-height: 1.6; }
.card-meta { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); margin-top: auto; }

/* ── THUMBNAILS ── */
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.card:hover .card-img { transform: scale(1.05); }
.card-img-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 4rem; color: white; text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* ── SIDEBAR ── */
.sidebar { display: flex; flex-direction: column; gap: 40px; }
.sb-widget-title { font-size: 1.2rem; font-weight: 800; color: var(--blue); padding-bottom: 12px; border-bottom: 2px solid var(--green); margin-bottom: 20px; }

.sb-cat-link {
  display: flex; align-items: center; padding: 12px 16px; margin-bottom: 8px;
  border-radius: 8px; background: white; border: 1px solid var(--border);
  transition: all 0.2s;
}
.sb-cat-link:hover, .sb-cat-link-active { background: var(--cat-bg); border-color: var(--cat-color); transform: translateX(4px); }
.sb-cat-dot { width: 12px; height: 12px; border-radius: 50%; margin-right: 12px; }
.sb-cat-name { flex: 1; font-weight: 600; color: var(--text); font-size: 1rem; }
.sb-cat-count { font-size: 0.85rem; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 12px; }

.sb-post { padding: 16px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.sb-post:first-of-type { padding-top: 0; }
.sb-post:last-of-type { border-bottom: none; }
.sb-post-cat { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; }
.sb-post-title { font-size: 1.05rem; font-weight: 600; line-height: 1.4; color: var(--text); }
.sb-post-title:hover { color: var(--blue-mid); }
.sb-post-date { font-size: 0.85rem; color: var(--muted); }

.sb-about { background: var(--blue-mid); color: white; padding: 24px; border-radius: 12px; }
.sb-about .sb-widget-title { color: white; border-color: var(--green); }
.sb-about p { font-size: 1rem; line-height: 1.6; opacity: 0.9; margin-bottom: 20px; }
.sb-btn { display: inline-block; background: var(--green); color: white; padding: 10px 24px; border-radius: 6px; font-weight: 700; }
.sb-btn:hover { background: #1a9a52; color: white; }

/* ── ARTICLE PAGE ── */
.article-hero { padding: 60px 20px; color: white; text-align: center; }
.article-hero-inner { max-width: 800px; margin: 0 auto; }
.article-breadcrumb { margin-bottom: 24px; font-size: 0.9rem; color: rgba(255,255,255,0.7); display: flex; gap: 8px; justify-content: center; align-items: center; }
.article-breadcrumb a { color: rgba(255,255,255,0.9); }
.article-hero .cat-badge { margin-bottom: 16px; font-size: 0.85rem; padding: 6px 16px; border-radius: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.article-title { font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 900; line-height: 1.3; margin-bottom: 24px; }
.article-meta { display: flex; gap: 20px; justify-content: center; font-size: 0.95rem; opacity: 0.8; }

.article-body { background: white; padding: 48px; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.04); border: 1px solid var(--border); margin-bottom: 48px; }
@media (max-width: 640px) { .article-body { padding: 24px 20px; } }
.article-content { font-size: 1.15rem; line-height: 1.8; color: #334155; }
.article-content h2 { font-size: 1.8rem; color: var(--blue); margin: 48px 0 24px; border-bottom: 2px solid var(--bg); padding-bottom: 12px; }

/* ── CATEGORY PAGE ── */
.cat-header { padding: 60px 20px; color: white; text-align: center; margin-bottom: 20px; }
.cat-header-label { display: inline-block; padding: 4px 12px; border-radius: 4px; font-size: 0.8rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 16px; }
.cat-header-title { font-size: 3rem; font-weight: 900; margin-bottom: 12px; }

/* ── FOOTER ── */
.site-footer { background: var(--blue-mid); color: white; padding: 60px 20px 30px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 40px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-logo { color: white; font-size: 1.8rem; font-weight: 900; font-family: 'Noto Serif HK', serif; display: inline-block; margin-bottom: 16px; }
.footer-logo span { color: var(--green); }
.footer-tagline { color: rgba(255,255,255,0.7); line-height: 1.7; font-size: 1rem; }
.footer-col h4 { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; color: white; }
.footer-col a { display: block; color: rgba(255,255,255,0.7); margin-bottom: 12px; font-size: 1rem; }
.footer-col a:hover { color: var(--green); transform: translateX(4px); }
.footer-bottom { max-width: 1200px; margin: 40px auto 0; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; font-size: 0.9rem; color: rgba(255,255,255,0.5); }

/* ── IMPROVEMENTS v1.1 ── */

/* Article title — smaller for long Chinese titles */
.article-title { font-size: clamp(1.4rem, 3vw, 1.9rem) !important; line-height: 1.35; }

/* Article content — paragraph & heading spacing */
.article-content p { margin-bottom: 1.5em; }
.article-content h3 { font-size: 1.3rem; font-weight: 700; color: var(--blue-mid); margin: 28px 0 14px; }
.article-content ul,
.article-content ol { padding-left: 1.6em; margin-bottom: 1.5em; }
.article-content li { margin-bottom: 0.5em; line-height: 1.7; }

/* Tables — styled comparison tables */
.article-content table { width: 100%; border-collapse: collapse; margin-bottom: 2em; font-size: 0.95rem; border-radius: 8px; overflow: hidden; }
.article-content th { background: var(--blue); color: white; padding: 10px 16px; text-align: left; font-weight: 700; }
.article-content td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.article-content tr:nth-child(even) td { background: var(--bg); }
.article-content tr:last-child td { border-bottom: none; }

/* Card placeholder icon — less overwhelming */
.card-img-placeholder { font-size: 2.5rem !important; }

/* Card title line clamp — prevent overflow */
.card-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
