/* ============================================================
   Jeff — styles.css  (Apple-inspired)
   System font (SF Pro feel), white + #F5F5F7, Apple blue,
   frosted nav, pill buttons, restrained depth.
   ============================================================ */

/* ---------- Theme tokens ---------- */
:root {
  --color-bg: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F5F5F7;
  --color-ink: #1D1D1F;
  --color-ink-soft: #424245;
  --color-muted: #86868B;
  --color-accent: #0066CC;
  --color-accent-hover: #0077ED;
  --color-accent-soft: #E8F1FD;
  --color-border: #D2D2D7;
  --color-border-strong: #C6C6CB;

  --color-success: #248A3D;
  --color-warning: #B25000;
  --color-danger: #D70015;
  --color-info: #0066CC;

  --shadow-xs: 0 1px 2px  rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px  rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 30px rgba(0,0,0,.10);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.12);
  --shadow-2xl: 0 40px 80px rgba(0,0,0,.16);

  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;

  --maxw: 1024px;
  --readw: 720px;
  --radius-pill: 980px;
  --radius-card: 18px;
  --radius-input: 12px;
}

[data-theme="dark"] {
  --color-bg: #000000;
  --color-surface: #1D1D1F;
  --color-surface-alt: #161617;
  --color-ink: #F5F5F7;
  --color-ink-soft: #D2D2D7;
  --color-muted: #86868B;
  --color-accent: #2997FF;
  --color-accent-hover: #47A6FF;
  --color-accent-soft: #0A2A4A;
  --color-border: #38383C;
  --color-border-strong: #48484A;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 17px; line-height: 1.47; color: var(--color-ink);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--color-accent-hover); }
::selection { background: var(--color-accent-soft); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 600; color: var(--color-ink); }
.display { font-weight: 600; font-size: clamp(36px, 8vw, 72px);
  line-height: 1.05; letter-spacing: -.02em; }
h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.08; letter-spacing: -.015em; }
h2 { font-size: clamp(26px, 4vw, 36px); line-height: 1.12; letter-spacing: -.01em; }
h3 { font-size: 24px; line-height: 1.25; letter-spacing: -.005em; }
h4 { font-size: 19px; line-height: 1.30; }
.lead { font-size: 19px; line-height: 1.50; color: var(--color-ink-soft); }
.meta { font-size: 14px; font-weight: 400; line-height: 1.45; color: var(--color-muted); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-accent); }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.read-col { max-width: var(--readw); margin: 0 auto; }
.section { padding: 100px 0; }
.section-sm { padding: 72px 0; }
.band { background: var(--color-surface-alt); }
.stack > * + * { margin-top: 16px; }

/* ---------- Nav (frosted) ---------- */
.nav { position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.08); }
[data-theme="dark"] .nav { background: rgba(0,0,0,.72); border-bottom-color: rgba(255,255,255,.10); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { font-weight: 600; font-size: 20px; color: var(--color-ink); letter-spacing: -.01em;
  display: flex; align-items: center; gap: 9px; }
.brand .mark { width: 26px; height: 26px; border-radius: 8px; background: var(--color-accent);
  color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-link { color: var(--color-ink-soft); font: 400 14px/1 var(--font-body); padding: 8px 2px;
  transition: color .15s ease; }
.nav-link:hover { color: var(--color-ink); }
.nav-link.active { color: var(--color-accent); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--color-border);
  background: transparent; color: var(--color-ink); cursor: pointer; font-size: 15px;
  display: grid; place-items: center; transition: border-color .15s ease; }
.theme-toggle:hover { border-color: var(--color-ink); }
.nav-burger { display: none; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--color-border); background: transparent;
  color: var(--color-ink); cursor: pointer; font-size: 17px; }

/* ---------- Buttons (pill) ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 400 15px/1 var(--font-body);
  padding: 12px 22px; border-radius: var(--radius-pill); border: 1px solid transparent;
  cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); color: #fff; }
.btn-secondary { background: var(--color-surface); color: var(--color-accent);
  border-color: var(--color-border-strong); }
.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-accent); }
.btn-ghost { background: transparent; color: var(--color-accent); }
.btn-ghost:hover { text-decoration: underline; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-card); overflow: hidden;
  box-shadow: var(--shadow-xs), 0 6px 18px rgba(0,0,0,.05);
  transition: transform .25s ease, box-shadow .25s ease; }
.card:hover { transform: translateY(-4px);
  box-shadow: var(--shadow-sm), 0 14px 36px rgba(0,0,0,.09); }
.card-cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.card-body { padding: 24px; }
.card-title { margin: 10px 0 8px; }
.card-excerpt { color: var(--color-ink-soft); font-size: 15px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ---------- Inputs ---------- */
.input { width: 100%; font: 400 15px/1.5 var(--font-body); color: var(--color-ink);
  background: var(--color-surface); border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-input); padding: 12px 14px;
  transition: border-color .15s ease, box-shadow .15s ease; }
.input::placeholder { color: var(--color-muted); }
.input:focus { outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft); }
.field-row { display: flex; gap: 10px; }
.field-row .input { flex: 1; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; font: 600 12px/1 var(--font-body);
  letter-spacing: .03em; color: var(--color-accent); background: var(--color-accent-soft);
  padding: 5px 12px; border-radius: var(--radius-pill); }

/* ---------- Hero ---------- */
.hero { padding: 140px 0 90px; text-align: center; }
.hero .eyebrow { display: block; margin-bottom: 18px; }
.hero p { max-width: 600px; margin: 22px auto 0; }
.hero-actions { display: flex; gap: 14px; justify-content: center; margin-top: 34px; flex-wrap: wrap; }
.hero-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; margin: 0 auto 22px;
  border: 3px solid #fff; box-shadow: var(--shadow-md); }
.hero-tagline { margin-top: 18px; font-size: 14px; font-weight: 600; letter-spacing: .04em;
  color: var(--color-accent); text-transform: uppercase; }

/* ---------- Section heads ---------- */
.section-head { margin-bottom: 32px; }
.section-head h2 { margin-bottom: 8px; }
.section-head .text-muted { font-size: 16px; }

/* ---------- Topic cards (ktdaddy-style) ---------- */
.topics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.topic-card { display: flex; flex-direction: column; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: 26px 24px 22px;
  box-shadow: var(--shadow-xs); transition: transform .25s ease, box-shadow .25s ease, border-color .2s ease; }
.topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--color-accent); }
.topic-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--color-accent-soft);
  color: var(--color-accent); display: grid; place-items: center; margin-bottom: 16px; }
.topic-icon svg { width: 24px; height: 24px; }
.topic-card h3 { margin-bottom: 8px; }
.topic-card p { color: var(--color-ink-soft); font-size: 15px; line-height: 1.5; flex: 1; }
.topic-link { margin-top: 16px; font-size: 14px; font-weight: 500; color: var(--color-accent); }
.topic-card:hover .topic-link { text-decoration: underline; }

/* ---------- Category header ---------- */
.category-header { margin-bottom: 8px; }
.category-header h1 { margin-bottom: 10px; }
.category-header .lead { max-width: 640px; }

/* ---------- Post article ---------- */
.post-cover { width: 100%; aspect-ratio: 21/9; object-fit: cover; border-radius: var(--radius-card);
  margin: 32px 0; }
.post-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--color-muted);
  font-size: 14px; }
.post-meta .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--color-accent);
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.post-body { font-size: 18px; line-height: 1.6; color: var(--color-ink-soft); }
.post-body h2 { margin: 44px 0 16px; color: var(--color-ink); }
.post-body h3 { margin: 32px 0 12px; color: var(--color-ink); }
.post-body p { margin: 18px 0; }
.post-body blockquote { border-left: 3px solid var(--color-accent); padding: 6px 0 6px 22px;
  margin: 24px 0; font-size: 22px; line-height: 1.45; color: var(--color-ink); font-weight: 500; }
.post-body pre { background: var(--color-surface-alt); border: 1px solid var(--color-border);
  border-radius: var(--radius-input); padding: 18px; overflow-x: auto; font-size: 14px; line-height: 1.6;
  margin: 24px 0; }
.post-body code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--color-surface-alt); padding: 2px 6px; border-radius: 6px; font-size: .88em; }
.post-body pre code { background: none; padding: 0; }
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 36px; }

/* ---------- Article sections (板块) & TOC ---------- */
.toc { background: var(--color-surface-alt); border-radius: var(--radius-input);
  padding: 20px 24px; margin: 32px 0; }
.toc h4 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted); margin-bottom: 12px; font-weight: 600; }
.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; padding: 6px 0; font-size: 15px; }
.toc li::before { content: counter(toc, decimal-leading-zero);
  color: var(--color-accent); font-weight: 600; margin-right: 10px;
  font-variant-numeric: tabular-nums; }
.toc a { color: var(--color-ink-soft); }
.toc a:hover { color: var(--color-accent); }

.section-block { scroll-margin-top: 80px; }
.sec-eyebrow { display: flex; align-items: center; gap: 10px;
  color: var(--color-accent); font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; }
.sec-num { display: inline-grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent);
  font-size: 12px; font-weight: 600; }

/* ---------- Newsletter ---------- */
.newsletter { background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-card); padding: 56px 48px; text-align: center;
  box-shadow: var(--shadow-sm); }
.newsletter h2 { margin-bottom: 10px; }
.newsletter .field-row { max-width: 440px; margin: 24px auto 0; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--color-border); padding: 56px 0 40px; margin-top: 40px; }
.footer.band { border-top: 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer h4 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted); margin-bottom: 16px; font-weight: 600; }
.footer a { display: block; color: var(--color-ink-soft); font-size: 14px; padding: 5px 0; }
.footer a:hover { color: var(--color-accent); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--color-border);
  color: var(--color-muted); font-size: 13px; flex-wrap: wrap; gap: 12px; }
.to-top { background: var(--color-surface); border: 1px solid var(--color-border);
  color: var(--color-ink); width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; transition: border-color .15s ease; }
.to-top:hover { border-color: var(--color-ink); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  opacity: 0; animation: overlay-in .2s ease forwards; z-index: 100; padding: 16px; }
.modal { background: var(--color-surface); border-radius: 20px; padding: 32px;
  box-shadow: var(--shadow-2xl); max-width: 480px; width: 100%;
  transform: translateY(8px) scale(.98); animation: modal-in .24s cubic-bezier(.2,.8,.2,1) forwards; }
.modal h3 { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
@keyframes overlay-in { to { opacity: 1; } }
@keyframes modal-in { to { transform: translateY(0) scale(1); } }

/* ---------- Utilities ---------- */
.divider { height: 1px; background: var(--color-border); border: 0; margin: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--color-muted); } .text-center { text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .topics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .section { padding: 64px 0; }
  .hero { padding: 96px 0 60px; }
  .grid-2 { grid-template-columns: 1fr; }
  .topics { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; position: absolute; top: 52px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--color-surface);
    border-bottom: 1px solid var(--color-border); padding: 8px 20px 16px; }
  .nav-links.open .nav-link { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
  .nav-burger { display: grid; place-items: center; }
  .newsletter { padding: 36px 22px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .field-row { flex-direction: column; }
  .field-row .btn { width: 100%; justify-content: center; }
}
