:root {
  --primary: #1e3a5f;
  --primary-2: #274b77;
  --accent: #e0a106;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1b2532;
  --muted: #5c6b7f;
  --border: #e3e8ef;
  --footer-bg: #16263d;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(22, 38, 61, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, .brand-name {
  font-family: 'Outfit', 'Manrope', 'Segoe UI', Arial, sans-serif;
  color: var(--primary);
  line-height: 1.25;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.45rem, 3.6vw, 1.95rem); font-weight: 700; }
h2 { font-size: clamp(1.15rem, 2.6vw, 1.4rem); font-weight: 600; margin-top: 1.6em; }
h3 { font-size: 1.05rem; font-weight: 600; }

p { margin: 0 0 1em; }
a { color: var(--primary-2); }
img { max-width: 100%; height: auto; display: block; border-radius: var(--radius); }

.container { max-width: 980px; margin: 0 auto; padding: 0 18px; }

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; line-height: 1; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; flex: 0 0 auto; }
.brand-name { font-size: 1.05rem; font-weight: 700; color: var(--primary); line-height: 1; display: block; transform: translateY(1px); }
.main-nav { display: flex; gap: 18px; align-items: center; }
.main-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 6px 2px;
}
.main-nav a:hover { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; }
.nav-toggle { display: none; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  padding: 34px 0 30px;
}
.hero h1 { color: #fff; max-width: 640px; }
.hero p { color: rgba(255,255,255,0.85); max-width: 620px; margin-bottom: 0; }

/* Article grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin: 22px 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-2px); }
.card img { border-radius: 0; aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.card-body { padding: 14px 15px 16px; }
.card-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.card-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--primary);
  font-size: 1rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-excerpt { font-size: 0.86rem; color: var(--muted); margin: 8px 0 0; }

/* Article page */
.article { background: var(--card); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); padding: 26px 24px 30px; margin: 0 auto 24px; }
.crumb { font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); }
.meta { font-size: 0.84rem; color: var(--muted); margin: -4px 0 18px; }
.lede { font-size: 1.02rem; font-weight: 500; }
.article figure { margin: 22px 0; }
.article figcaption { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }
.article ul { padding-left: 20px; margin: 0 0 1em; }
.article li { margin-bottom: 6px; }

/* Comparison table */
.table-wrap { overflow-x: auto; margin: 18px 0; }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.9rem; }
th, td { border: 1px solid var(--border); padding: 9px 11px; text-align: left; vertical-align: top; }
th { background: var(--bg); font-family: 'Outfit', sans-serif; color: var(--primary); }

/* Callout */
.callout {
  background: #fdf6e3;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 12px 15px;
  margin: 18px 0;
  font-size: 0.94rem;
}

/* Related */
.related { border-top: 1px solid var(--border); margin-top: 28px; padding-top: 18px; }
.related a { display: block; padding: 7px 0; text-decoration: none; font-weight: 600; font-size: 0.94rem; }
.related a:hover { color: var(--accent); }

.disclaimer {
  margin-top: 22px;
  padding: 12px 15px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Ad slots: plain centered label, no box, no fixed size */
.ad-slot {
  margin: 20px 0;
  display: block;
  text-align: center;
  position: relative;
}
.ad-slot::before {
  content: "advertisement";
  display: block;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Anchor ad */
#adAnchor {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: none;
  padding: 8px 0;
  text-align: center;
}
#adAnchor.show { display: block; }
#adAnchor .ad-slot { margin: 0; }

/* Interstitial */
.inter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 40, 0.72);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.inter-overlay.show { display: flex; }
.inter-box { background: var(--footer-bg); border-radius: 12px; padding: 14px; width: min(92vw, 420px); position: relative; }
.inter-box .ad-slot { margin: 0; }
.inter-box .ad-slot::before { color: rgba(255,255,255,0.6); }

/* Floating buttons */
.fab {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(22, 38, 61, 0.35);
  cursor: pointer;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: fixed;
  right: 18px;
  z-index: 70;
}
.fab.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.fab svg { width: 20px; height: 20px; }
body.home #backTop { bottom: 100px; }
body.inner #backTop { bottom: 190px; }
body.inner #backHome { bottom: 130px; }
body.inner #backHome { opacity: 1; pointer-events: auto; transform: none; }

/* Footer */
.site-footer {
  background: var(--footer-bg);
  color: rgba(255,255,255,0.82);
  margin-top: 40px;
  padding: 30px 0 110px;
  font-size: 0.88rem;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; }
.site-footer h3 { color: #fff; font-size: 0.95rem; margin-bottom: 10px; }
.site-footer a { color: rgba(255,255,255,0.82); text-decoration: none; display: block; padding: 3px 0; }
.site-footer a:hover { color: var(--accent); }
.footer-disclosure {
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 22px;
  padding-top: 14px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
}

/* Search page */
.search-box { display: flex; gap: 10px; margin: 20px 0; }
.search-box input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.search-box button {
  padding: 11px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.result-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; display: block; text-decoration: none; color: var(--text); }
.result-item:hover { border-color: var(--primary-2); }
.result-item h3 { margin: 0 0 4px; font-size: 1rem; color: var(--primary); }
.result-item p { margin: 0; font-size: 0.86rem; color: var(--muted); }

/* Category groups */
.cat-group { margin: 26px 0; }
.cat-group h2 { margin-top: 0; }
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.cat-list a { display: block; padding: 11px 15px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.94rem; }
.cat-list a:hover { color: var(--primary-2); }

/* Category nav (homepage) */
.catnav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.catnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
}
.catnav-bar {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.catnav-bar::-webkit-scrollbar { display: none; }
.catnav-bar li { flex: 0 0 auto; }
.cat-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.cat-btn:hover { border-color: var(--primary-2); color: var(--primary); }
.cat-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.catnav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  flex: 0 0 auto;
}
.catnav-toggle:hover { border-color: var(--primary-2); }
.catnav-toggle .chev { width: 16px; height: 16px; transition: transform 0.2s ease; }
.catnav-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.catnav-dropdown {
  display: none;
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(22, 38, 61, 0.12);
  padding: 12px 18px;
  z-index: 55;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.catnav-dropdown.open { display: flex; }
.catnav-dropdown .cat-btn { font-size: 0.88rem; padding: 8px 15px; }

/* Responsive */
@media (max-width: 720px) {
  .header-inner {
    flex-wrap: nowrap;
    min-height: 54px;
  }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(22, 38, 61, 0.12);
  }
  .main-nav.open { display: flex; }
  .main-nav a {
    padding: 13px 18px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .main-nav a:last-child { border-bottom: none; }
  .nav-toggle { display: inline-flex; }
  .article { padding: 20px 16px 24px; }
  .hero { padding: 26px 0 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 18px 16px; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
