/* Shared styles for the static site: landing page + writing archive.
   Palette intentionally matches all_lessons/style.css for a unified feel. */
:root {
  color-scheme: light;
  --bg:           #fafafa;
  --surface:      #ffffff;
  --surface-soft: #f4f5f8;
  --text:         #1a1d23;
  --muted:        #595f6c;
  --dim:          #8a909e;
  --border:       #e2e5eb;
  --border-soft:  #ecedf1;
  --accent:       #2563eb;
  --accent-soft:  #e6effd;
  --accent-2:     #d97706;
  --shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow:       0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg:    0 12px 32px rgba(15, 23, 42, 0.08);
  --radius:       10px;
  --radius-lg:    14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(880px, calc(100% - 40px)); margin: 0 auto; }
.wrap-wide { width: min(1100px, calc(100% - 40px)); margin: 0 auto; }

/* ── Top navigation ─────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  min-height: 56px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; font-size: 14px;
}
.topbar .brand { font-weight: 700; color: var(--text); }
.topbar nav a { color: var(--muted); margin-left: 20px; font-weight: 500; }
.topbar nav a:hover { color: var(--accent); text-decoration: none; }

/* ── Hero / intro ───────────────────────────────── */
.hero { padding: 64px 0 32px; display: flex; gap: 40px; align-items: center; flex-wrap: wrap; }
.hero-avatar {
  width: 132px; height: 132px; border-radius: 50%;
  object-fit: cover; box-shadow: var(--shadow-lg); flex-shrink: 0;
}
.hero-text { flex: 1; min-width: 280px; }
.hero .kicker { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
.hero h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.02em; }
.hero p.lead { color: var(--muted); font-size: 17px; margin: 0 0 18px; }
.social-row a { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-size: 14px; font-weight: 500; color: var(--muted); }
.social-row a:hover { color: var(--accent); text-decoration: none; }

/* ── Cards ──────────────────────────────────────── */
.section-title { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin: 40px 0 16px; font-weight: 700; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfd4dd; text-decoration: none; }
.card .icon { font-size: 26px; }
.card h3 { margin: 12px 0 6px; font-size: 19px; color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.card .more { display: inline-block; margin-top: 14px; color: var(--accent); font-weight: 600; font-size: 14px; }

/* ── Archive listing ────────────────────────────── */
.year-head { font-size: 22px; margin: 36px 0 4px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); align-items: baseline; }
.post-list .date { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 13px; min-width: 64px; flex-shrink: 0; }
.post-list .ptitle { font-weight: 600; color: var(--text); font-size: 16px; }
.post-list .ptitle:hover { color: var(--accent); text-decoration: none; }
.post-list .cat { color: var(--dim); font-size: 13px; }

/* ── Article (rendered post) ────────────────────── */
.article { padding: 40px 0 64px; }
.article h1.post-title { font-size: clamp(26px, 3.5vw, 36px); line-height: 1.2; margin: 0 0 10px; letter-spacing: -0.02em; }
.post-meta { color: var(--dim); font-size: 13.5px; margin-bottom: 4px; }
.tag { display: inline-block; background: var(--surface-soft); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 12px; margin: 0 6px 6px 0; }
.article-body { font-size: 16.5px; }
.article-body h2 { margin-top: 36px; font-size: 24px; letter-spacing: -0.01em; }
.article-body h3 { margin-top: 28px; font-size: 19px; }
.article-body p, .article-body li { color: #2b2f37; }
.article-body img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.article-body a { color: var(--accent); }
.article-body blockquote { border-left: 3px solid var(--accent); margin: 18px 0; padding: 4px 18px; color: var(--muted); background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.article-body code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; background: var(--surface-soft); border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 5px; }
/* Code blocks: Pygments (light "friendly" theme) wraps in .codehilite with an
   inline background; we only add the frame so it reads as a card. */
.article-body .codehilite { border: 1px solid var(--border); border-radius: var(--radius); margin: 18px 0; overflow: hidden; }
.article-body .codehilite pre { margin: 0; padding: 16px 18px; overflow-x: auto; line-height: 1.5; font-size: 13.5px; }
.article-body pre { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; line-height: 1.5; font-size: 13.5px; }
.article-body pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.article-body table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 14.5px; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-body th { background: var(--surface-soft); }
.backlink { display: inline-block; margin-bottom: 24px; color: var(--muted); font-size: 14px; font-weight: 500; }

/* ── Footer ─────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 28px 0; color: var(--dim); font-size: 13px; text-align: center; }

@media (max-width: 600px) {
  .hero { padding: 40px 0 24px; gap: 24px; }
  .post-list li { flex-direction: column; gap: 2px; }
}
