/* Readable content-site theme: CJK-friendly typography, constrained reading column,
   sticky header nav, article cards, footer. Zero-JS, light + dark aware.
   Themes are variants layered via :root[data-theme="..."] over the CSS variables and a
   small known class set (see src/aiseo/content/theme_prompt.py for the contract). */
:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-weak: #eff4ff;
  --maxw: 720px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 1px 3px rgba(17, 24, 39, .04);
  --shadow-lg: 0 10px 30px -12px rgba(17, 24, 39, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --text: #e6e8eb; --muted: #9aa4b2;
    --line: #262b33; --accent: #6ea8ff; --accent-weak: #182234;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 34px -12px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 17px; line-height: 1.8;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-weak); }

/* header / nav */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  max-width: 1040px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--accent); }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; margin-left: 18px; transition: color .15s; }
.nav a:hover { color: var(--accent); }

/* main reading column */
main { max-width: var(--maxw); margin: 0 auto; padding: 40px 20px 72px; }
.wide { max-width: 1040px; }

/* article typography */
article h1 { font-size: 2.1rem; line-height: 1.25; margin: .2em 0 .5em; letter-spacing: -.02em; }
article h2 {
  font-size: 1.42rem; margin: 2em 0 .6em; padding-bottom: .25em;
  border-bottom: 1px solid var(--line);
}
article h3 { font-size: 1.16rem; margin: 1.6em 0 .4em; }
article p { margin: 0 0 1.15em; }
article a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
article a:hover { text-decoration-thickness: 2px; }
article ul, article ol { padding-left: 1.4em; margin: 0 0 1.15em; }
article li { margin: .35em 0; }
article li::marker { color: var(--accent); }
article img, article svg { max-width: 100%; height: auto; border-radius: var(--radius); }
article img.hero { width: 100%; margin: 0 0 1.6em; display: block; box-shadow: var(--shadow); }
article blockquote {
  margin: 1.4em 0; padding: .6em 1.2em; border-left: 3px solid var(--accent);
  background: var(--accent-weak); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text);
}
article pre { background: var(--surface); padding: 14px 16px; border-radius: var(--radius); overflow: auto; border: 1px solid var(--line); }
article code { background: var(--surface); padding: .12em .38em; border-radius: 6px; font-size: .9em; }
article pre code { background: none; padding: 0; border: 0; }
article hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.post-meta { color: var(--muted); font-size: 14px; margin: -.2em 0 1.6em; }

/* homepage */
.home-hero { margin-bottom: 34px; }
.home-hero h1 { font-size: 2.2rem; margin: 0 0 .25em; letter-spacing: -.02em; }
.home-hero p { color: var(--muted); margin: 0; font-size: 1.05rem; }
.card-list { display: grid; gap: 16px; }
.card {
  display: block; padding: 20px 22px; border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  background: var(--bg); box-shadow: var(--shadow);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card h2 { font-size: 1.18rem; margin: 0 0 .35em; letter-spacing: -.01em; }
.card p { color: var(--muted); font-size: 15px; margin: 0; line-height: 1.65; }
.card .date { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); }

/* pagination (homepage) */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-wrap: wrap; margin: 44px 0 8px; }
.pagination .pg { display: inline-block; min-width: 36px; text-align: center;
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--text);
  text-decoration: none; font-size: 15px; transition: border-color .15s, color .15s, background .15s; }
.pagination .pg:hover { border-color: var(--accent); color: var(--accent); }
.pagination .pg.current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.pagination .pg.disabled { color: var(--muted); opacity: .5; pointer-events: none; }
.pagination .pg-nums { display: inline-flex; gap: 6px; align-items: center; }
.pagination .pg-ellipsis { color: var(--muted); padding: 0 2px; }

/* ===== site-type structure variants (orthogonal to theme) ===== */
/* blog: roomier cards with an excerpt + a read-more affordance */
.card-list.blog { gap: 20px; }
.card-list.blog .card { padding: 24px 26px; }
.card-list.blog .card h2 { font-size: 1.35rem; margin-bottom: .45em; }
.card-list.blog .card p { font-size: 15.5px; line-height: 1.7; }
.readmore { display: inline-block; margin-top: 12px; color: var(--accent); font-size: 14px; font-weight: 600; }

/* docs: dense, scannable index instead of cards */
.docs-index { list-style: none; padding: 0; margin: 8px 0; border-top: 1px solid var(--line); }
.docs-index li { padding: 12px 4px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.docs-index a { color: var(--text); text-decoration: none; font-weight: 600; }
.docs-index a:hover { color: var(--accent); }
.docs-index .d { color: var(--muted); font-size: 14px; }

/* footer */
.site-footer {
  border-top: 1px solid var(--line); color: var(--muted); font-size: 14px;
  padding: 32px 20px; text-align: center;
}

/* ===== theme: magazine — warm accent, bold display headings, 2-col card grid ===== */
:root[data-theme="magazine"] { --accent: #e0622d; --accent-weak: #fdeee6; --maxw: 760px; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="magazine"] { --accent: #ff8a5b; --accent-weak: #2a1a12; }
}
:root[data-theme="magazine"] .brand { font-size: 22px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; }
:root[data-theme="magazine"] .home-hero h1 { font-size: 2.9rem; font-weight: 900; letter-spacing: -.03em; }
:root[data-theme="magazine"] article h1 { font-size: 2.6rem; font-weight: 900; }
:root[data-theme="magazine"] article h2 { border-bottom-width: 2px; }
:root[data-theme="magazine"] .card-list { grid-template-columns: 1fr 1fr; }
:root[data-theme="magazine"] .card { background: var(--surface); border-radius: 16px; }
:root[data-theme="magazine"] .card h2 { font-size: 1.28rem; font-weight: 800; }
@media (max-width: 640px) { :root[data-theme="magazine"] .card-list { grid-template-columns: 1fr; } }

/* ===== theme: minimal — monochrome, serif reading typography, understated ===== */
:root[data-theme="minimal"] {
  --accent: #111418; --accent-weak: #f0f1f2; --maxw: 680px;
  --shadow: none; --shadow-lg: none;
  --font: Georgia, "Times New Roman", "Songti SC", "Noto Serif SC", "SimSun", serif;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="minimal"] { --accent: #dfe3e8; --accent-weak: #1a1d22; }
}
:root[data-theme="minimal"] .site-header { backdrop-filter: none; background: var(--bg); }
:root[data-theme="minimal"] .brand { font-weight: 700; letter-spacing: 0; }
:root[data-theme="minimal"] article a { text-decoration-thickness: 1px; }
:root[data-theme="minimal"] article h2 { border-bottom: 0; }
:root[data-theme="minimal"] .card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 20px 0; }
:root[data-theme="minimal"] .card:hover { transform: none; border-color: var(--line); box-shadow: none; }
:root[data-theme="minimal"] .card h2 { font-weight: 700; }
:root[data-theme="minimal"] article h1, :root[data-theme="minimal"] .home-hero h1 { font-weight: 700; letter-spacing: 0; }

/* ===== theme: ocean — airy teal, soft rounded shadowed cards (Pico-inspired clean) ===== */
:root[data-theme="ocean"] {
  --accent: #0891b2; --accent-weak: #ecfeff; --surface: #f4fbfd;
  --line: #d9eef3; --maxw: 760px; --radius: 16px;
  --shadow: 0 1px 2px rgba(8, 145, 178, .06), 0 4px 12px -6px rgba(8, 145, 178, .10);
  --shadow-lg: 0 16px 40px -16px rgba(8, 145, 178, .30);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="ocean"] {
    --bg: #0c1416; --surface: #12201f; --text: #e4eef0; --muted: #8fa9ac;
    --line: #1d3033; --accent: #34d0e6; --accent-weak: #0d2429;
  }
}
:root[data-theme="ocean"] .brand { color: var(--accent); font-weight: 900; }
:root[data-theme="ocean"] .home-hero h1 { font-size: 2.5rem; font-weight: 800; }
:root[data-theme="ocean"] .card { background: var(--surface); border-color: transparent; }
:root[data-theme="ocean"] .card:hover { border-color: transparent; }
:root[data-theme="ocean"] article h2 { border-bottom-color: var(--accent-weak); }

/* ===== theme: sepia — warm cream paper, serif reading, easy on the eyes ===== */
:root[data-theme="sepia"] {
  --bg: #f8f3e9; --surface: #f1e7d3; --text: #43392b; --muted: #8a795c;
  --line: #e6d8bd; --accent: #9a5b31; --accent-weak: #f0e4cd; --maxw: 700px;
  --shadow: 0 1px 2px rgba(120, 90, 50, .10);
  --shadow-lg: 0 12px 30px -14px rgba(120, 90, 50, .28);
  --font: Georgia, "Iowan Old Style", "Songti SC", "Noto Serif SC", "SimSun", serif;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="sepia"] {
    --bg: #211c15; --surface: #2b241a; --text: #e9ddc7; --muted: #ab9a7c;
    --line: #3a3126; --accent: #d29a63; --accent-weak: #302719;
  }
}
:root[data-theme="sepia"] .site-header { backdrop-filter: none; background: var(--bg); }
:root[data-theme="sepia"] .brand { font-weight: 700; }
:root[data-theme="sepia"] article h1, :root[data-theme="sepia"] .home-hero h1 { font-weight: 700; letter-spacing: 0; }
:root[data-theme="sepia"] .card { background: var(--surface); border-color: var(--line); }

/* ===== theme: slate — professional cool slate/indigo, crisp cards (tech/reviews) ===== */
:root[data-theme="slate"] {
  --accent: #4f46e5; --accent-weak: #eef2ff; --surface: #f8fafc; --line: #e2e8f0;
  --text: #0f172a; --muted: #64748b; --maxw: 760px; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="slate"] {
    --bg: #0b0f19; --surface: #131a2a; --text: #e2e8f0; --muted: #94a3b8;
    --line: #1e293b; --accent: #818cf8; --accent-weak: #1e1b34;
  }
}
:root[data-theme="slate"] .brand { font-weight: 800; letter-spacing: -.02em; }
:root[data-theme="slate"] .home-hero h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; }
:root[data-theme="slate"] .card { border-radius: 10px; }
:root[data-theme="slate"] .card h2 { font-weight: 700; letter-spacing: -.01em; }
:root[data-theme="slate"] article h2 { border-bottom: 0; padding-left: 12px; border-left: 3px solid var(--accent); }

/* ===== theme: forest — calm green, gentle (health/lifestyle/eco) ===== */
:root[data-theme="forest"] {
  --accent: #059669; --accent-weak: #ecfdf5; --surface: #f5faf7; --line: #dcece2; --maxw: 720px;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="forest"] {
    --bg: #0c1512; --surface: #10201a; --text: #e6efe9; --muted: #93a89d;
    --line: #1c2e26; --accent: #34d399; --accent-weak: #0c241b;
  }
}
:root[data-theme="forest"] .brand { font-weight: 800; color: var(--accent); }
:root[data-theme="forest"] .card { border-radius: 14px; }
:root[data-theme="forest"] .card:hover { box-shadow: var(--shadow-lg); }
:root[data-theme="forest"] article blockquote { border-radius: 10px; }

/* ===== theme: midnight — always-dark, neon accent, glow cards (gaming/crypto/tech) ===== */
:root[data-theme="midnight"] {
  --bg: #0a0a0f; --surface: #14141f; --text: #e8e8f2; --muted: #8b8bad;
  --line: #23233a; --accent: #a855f7; --accent-weak: #1e1433; --maxw: 760px; --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.5); --shadow-lg: 0 0 0 1px rgba(168,85,247,.25), 0 14px 40px -12px rgba(168,85,247,.35);
}
:root[data-theme="midnight"] .site-header { background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom-color: var(--line); }
:root[data-theme="midnight"] .brand { color: var(--accent); font-weight: 900; letter-spacing: -.01em; }
:root[data-theme="midnight"] .home-hero h1 { font-size: 2.6rem; font-weight: 900; }
:root[data-theme="midnight"] .card { background: var(--surface); border-color: var(--line); }
:root[data-theme="midnight"] .card:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: var(--shadow-lg); }
:root[data-theme="midnight"] article a { text-decoration-color: var(--accent); }

/* ===== theme: coral — warm coral, rounded friendly cards (lifestyle/food/travel) ===== */
:root[data-theme="coral"] {
  --accent: #f43f5e; --accent-weak: #fff1f2; --surface: #fff6f7; --line: #ffe0e4;
  --maxw: 720px; --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="coral"] {
    --bg: #14100f; --surface: #201517; --text: #f2e7e8; --muted: #b79aa0;
    --line: #34232a; --accent: #fb7185; --accent-weak: #2a1418;
  }
}
:root[data-theme="coral"] .brand { font-weight: 900; color: var(--accent); }
:root[data-theme="coral"] .home-hero h1 { font-size: 2.5rem; font-weight: 800; }
:root[data-theme="coral"] .card { border-radius: 18px; background: var(--surface); border-color: transparent; }
:root[data-theme="coral"] .card:hover { border-color: transparent; transform: translateY(-3px); }

/* ===== theme: broadsheet — authoritative serif newspaper, rule-lined (news/finance) ===== */
:root[data-theme="broadsheet"] {
  --accent: #7f1d1d; --accent-weak: #fef2f2; --surface: #faf9f7; --line: #d6d3d1;
  --text: #1c1917; --muted: #78716c; --maxw: 760px;
  --font: Georgia, "Times New Roman", "Songti SC", "Noto Serif SC", "SimSun", serif;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="broadsheet"] {
    --bg: #16130f; --surface: #1e1a15; --text: #ece5da; --muted: #a89c8b;
    --line: #2f2a22; --accent: #ef8a7f; --accent-weak: #2a1614;
  }
}
:root[data-theme="broadsheet"] .site-header { backdrop-filter: none; background: var(--bg); border-bottom: 2px solid var(--text); }
:root[data-theme="broadsheet"] .brand { font-weight: 900; letter-spacing: .01em; }
:root[data-theme="broadsheet"] .home-hero h1 { font-size: 2.8rem; font-weight: 900; letter-spacing: -.02em; }
:root[data-theme="broadsheet"] article h1 { font-size: 2.6rem; font-weight: 900; }
:root[data-theme="broadsheet"] article h2 { border-bottom-width: 2px; border-bottom-color: var(--text); font-weight: 800; }
:root[data-theme="broadsheet"] .card { border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: 18px 0; box-shadow: none; }
:root[data-theme="broadsheet"] .card:hover { transform: none; border-color: var(--accent); box-shadow: none; }
:root[data-theme="broadsheet"] .card h2 { font-weight: 800; }
