:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --fg: #0f1b2d;
  --fg-soft: #283344;
  --muted: #64748b;
  --subtle: #475569;
  --line: rgba(15, 27, 45, 0.08);
  --line-strong: rgba(15, 27, 45, 0.14);
  --gold: #c9a45c;
  --gold-strong: #b8860b;
  --gold-soft: #f0e2c0;
  --navy: #13203a;
  --navy-2: #1b3a5e;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.04), 0 12px 32px rgba(15, 27, 45, 0.06);
  --shadow-card: 0 1px 2px rgba(15, 27, 45, 0.03), 0 6px 20px rgba(15, 27, 45, 0.05);
  --shadow-hover: 0 2px 4px rgba(15, 27, 45, 0.05), 0 18px 40px rgba(15, 27, 45, 0.10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--navy); color: #fff; padding: 9px 14px;
  border-radius: 8px; z-index: 100; font-size: 14px;
}
.skip-link:focus { left: 12px; top: 12px; }

:focus-visible { outline: 3px solid var(--gold-strong); outline-offset: 3px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244, 246, 248, 0.84);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 700; font-size: 18px; }
.brand:hover { opacity: 0.88; }
.brand-mark { display: block; width: 28px; height: 28px; border-radius: 7px; }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a { color: var(--muted); font-size: 14px; font-weight: 500; transition: color 0.15s ease; }
.site-nav a:hover { color: var(--fg); }
.nav-cta {
  background: var(--navy); color: #fff !important;
  padding: 8px 16px; border-radius: 999px; font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
}
.nav-cta:hover { background: var(--navy-2); color: #fff; }

.site-main { padding: 48px 24px 80px; min-height: 64vh; }

/* ---------- Feed ---------- */
.post-feed { max-width: 980px; margin: 0 auto; }
.feed-header { text-align: center; margin: 20px auto 44px; max-width: 660px; }
.feed-kicker {
  margin: 0 0 14px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-strong);
}
.feed-title { font-size: 40px; line-height: 1.1; margin: 0 0 14px; letter-spacing: -0.025em; color: var(--fg); }
.feed-description { color: var(--muted); font-size: 18px; line-height: 1.55; margin: 0 0 26px; }
.feed-cta {
  display: inline-block; background: var(--navy); color: #fff;
  padding: 12px 24px; border-radius: 999px; font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow-card); transition: background 0.15s ease, transform 0.15s ease;
}
.feed-cta:hover { background: var(--navy-2); color: #fff; transform: translateY(-1px); }

.post-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.post-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
.post-card.no-image { padding-top: 26px; }
.post-card-media { display: block; }
.post-card-media img { display: block; width: 100%; height: 196px; object-fit: cover; }
.post-card-body { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px 24px; flex: 1; }
.post-card-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.post-card-tag {
  color: var(--fg-soft); background: rgba(201, 164, 92, 0.14);
  padding: 2px 9px; border-radius: 999px; font-weight: 600;
}
.post-card-title { font-size: 20px; line-height: 1.3; margin: 0; letter-spacing: -0.015em; }
.post-card-title a { color: var(--fg); }
.post-card-title a:hover { color: var(--gold-strong); }
.post-card-excerpt { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; flex: 1; }
.post-card-link { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--fg); }
.post-card:hover .post-card-link { color: var(--gold-strong); }

/* ---------- Hub index (guides landing) ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.hub-tile {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 26px 26px 24px; box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.hub-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
.hub-tile-kicker { margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--gold-strong); }
.hub-tile-title { margin: 0 0 8px; font-size: 20px; line-height: 1.3; letter-spacing: -0.015em; color: var(--fg); }
.hub-tile-body { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.hub-tile-link { display: inline-block; margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--gold-strong); }

/* ---------- Single post ---------- */
.post, .page, .error-page {
  max-width: 760px; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 48px 56px;
}
.post-header { margin-bottom: 30px; }
.post-title { font-size: 38px; line-height: 1.14; margin: 0 0 16px; letter-spacing: -0.025em; color: var(--fg); }
.post-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.post-tag {
  font-size: 12px; font-weight: 600; color: var(--fg-soft);
  background: rgba(201, 164, 92, 0.14); border-radius: 999px; padding: 3px 11px;
  transition: background 0.15s ease;
}
.post-tag:hover { background: rgba(201, 164, 92, 0.26); }
.post-feature-image { width: 100%; border-radius: var(--radius-md); margin: 24px 0 0; }

.gh-content { font-size: 17.5px; line-height: 1.75; color: var(--fg-soft); }
.gh-content h2 { font-size: 25px; margin: 40px 0 14px; letter-spacing: -0.018em; color: var(--fg); line-height: 1.25; }
.gh-content h3 { font-size: 20px; margin: 30px 0 10px; color: var(--fg); }
.gh-content h2, .gh-content h3 { scroll-margin-top: 88px; }
.gh-content p, .gh-content ul, .gh-content ol, .gh-content blockquote { margin: 0 0 18px; }
.gh-content ul, .gh-content ol { padding-left: 24px; }
.gh-content li { margin-bottom: 6px; }
.gh-content img { max-width: 100%; height: auto; border-radius: var(--radius-md); }
.gh-content .kg-width-wide { max-width: 920px; margin-left: -80px; margin-right: -80px; }
.gh-content .kg-width-full { max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.gh-content .kg-width-full img { border-radius: 0; }
.gh-content figcaption { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 8px; }
.gh-content strong { color: var(--fg); font-weight: 700; }
.gh-content pre {
  background: #0f1115; color: #e6e6e6; padding: 18px; border-radius: var(--radius-md);
  overflow-x: auto; font-size: 14px; line-height: 1.55;
}
.gh-content code { font-family: var(--mono); font-size: 0.9em; }
.gh-content :not(pre) > code { background: #f1f1ee; padding: 2px 6px; border-radius: 5px; color: var(--fg); }
.gh-content blockquote {
  border-left: 3px solid var(--gold-strong); margin-left: 0; padding: 4px 0 4px 20px;
  color: var(--subtle); font-style: italic;
}
.gh-content a { color: var(--gold-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: rgba(201,164,92,.45); }
.gh-content a:hover { text-decoration-color: var(--gold-strong); }
.gh-content hr { border: none; border-top: 1px solid var(--line); margin: 36px 0; }

/* Tables inside posts (hubs) */
.gh-content table { width: 100%; border-collapse: collapse; margin: 8px 0 22px; font-size: 15px; }
.gh-content th, .gh-content td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.gh-content th { color: var(--fg); font-weight: 700; background: rgba(201,164,92,.08); }

/* ---------- Related guides strip ---------- */
.related-guides {
  max-width: 760px; margin: 28px auto 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 24px 28px; box-shadow: var(--shadow-card);
}
.related-guides h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--subtle); }
.related-guides ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; }
.related-guides a { font-size: 14.5px; font-weight: 500; color: var(--fg-soft); }
.related-guides a:hover { color: var(--gold-strong); }

/* ---------- Author / footer ---------- */
.post-footer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.author-box { display: flex; gap: 14px; align-items: flex-start; }
.author-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.author-name { font-weight: 700; margin: 0; }
.author-bio { color: var(--muted); margin: 3px 0 0; font-size: 14.5px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: space-between; gap: 16px; margin: 44px auto 0; max-width: 980px; font-size: 14.5px; }
.pagination a { font-weight: 600; background: var(--surface); border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-card); }
.pagination a:hover { border-color: var(--line-strong); }
.page-number { color: var(--muted); align-self: center; }

/* ---------- Error ---------- */
.error-page { text-align: center; padding: 96px 40px; }
.error-code { font-size: 64px; margin: 0 0 10px; letter-spacing: -0.03em; color: var(--gold-strong); }
.error-message { color: var(--muted); margin: 0 0 24px; font-size: 17px; }
.error-home { font-weight: 600; display: inline-block; background: var(--navy); color: #fff; padding: 12px 24px; border-radius: 999px; }
.error-home:hover { background: var(--navy-2); color: #fff; }

/* ---------- Site footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0; font-size: 13.5px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: flex-start; }
.footer-brand { display: flex; flex-direction: column; gap: 8px; }
.footer-brand .brand { font-size: 16px; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 44px; }
.footer-col h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--subtle); }
.footer-col nav { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--muted); font-size: 13.5px; }
.footer-col a:hover { color: var(--fg); }
.footer-bottom { width: 100%; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 6px; }

@media (max-width: 760px) {
  .site-main { padding: 32px 18px 60px; }
  .post-grid, .hub-grid { grid-template-columns: 1fr; gap: 18px; }
  .post, .page, .error-page { padding: 30px 22px; }
  .post-title { font-size: 29px; }
  .related-guides ul { grid-template-columns: 1fr; }
  .site-nav { gap: 14px; }
  .site-nav a:not(.nav-cta) { display: none; }
  .brand-mark { width: 25px; height: 25px; }
}
