
:root {
  color-scheme: light dark;
  --bg: #fbfaff;
  --bg-soft: #f2f0fb;
  --surface: #ffffff;
  --surface-2: #f7f5ff;
  --border: #e3dff5;
  --border-strong: #cec8ea;
  --ink: #1b1930;
  --ink-soft: #4c4870;
  --ink-mute: #74708f;
  --accent: #5b4bd6;
  --accent-ink: #ffffff;
  --accent-soft: #ece9fd;
  --gold: #b8860b;
  --danger: #c0392b;
  --ok: #1e7d55;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(27,25,48,.05), 0 8px 24px -12px rgba(27,25,48,.16);
  --maxw: 1120px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100f18;
    --bg-soft: #16152098;
    --surface: #1a1826;
    --surface-2: #211f31;
    --border: #2e2b42;
    --border-strong: #403c5c;
    --ink: #eceaf7;
    --ink-soft: #b9b4d4;
    --ink-mute: #918cb0;
    --accent: #a99cff;
    --accent-ink: #17142b;
    --accent-soft: #262243;
    --gold: #e0b64a;
    --danger: #ff8a7a;
    --ok: #5fd3a0;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: 17px; line-height: 1.65;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--accent);
  color: var(--accent-ink); padding: 10px 16px; z-index: 50; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif);
  font-size: 1.22rem; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .moon { width: 26px; height: 26px; flex: none; color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: .93rem; font-weight: 500;
  padding: 7px 11px; border-radius: 8px;
}
.header-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.lang-switch {
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 13px !important;
  font-size: .85rem !important;
}
.header-search { flex: 1; max-width: 380px; }

/* ---------- search box ---------- */
.searchbox { display: flex; position: relative; }
.searchbox input {
  width: 100%; font: inherit; font-size: .95rem; padding: 9px 42px 9px 15px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink);
}
.searchbox input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.searchbox button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--ink-mute); cursor: pointer;
  padding: 6px 10px; border-radius: 999px; display: flex;
}
.searchbox button:hover { color: var(--accent); }
.searchbox--hero input { font-size: 1.06rem; padding: 15px 56px 15px 22px; box-shadow: var(--shadow); }
.searchbox--hero button { right: 7px; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(165deg, var(--accent-soft), transparent 70%), var(--bg);
  border-bottom: 1px solid var(--border); padding: 56px 0 44px;
}
.hero h1 {
  font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em;
}
.hero p.lede { font-size: 1.1rem; color: var(--ink-soft); margin: 0 0 26px; max-width: 62ch; }
.hero .searchbox { max-width: 560px; }
.hero-meta { margin-top: 14px; font-size: .9rem; color: var(--ink-mute); }

/* ---------- layout ---------- */
main { padding: 40px 0 60px; }
.cols { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 44px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; gap: 34px; } }
.section { margin: 0 0 42px; }
.section > h2, .section > h3 {
  font-family: var(--font-serif); font-size: 1.35rem; margin: 0 0 16px;
  letter-spacing: -.01em;
}

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: inherit; display: block;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.card h3 { margin: 0 0 6px; font-size: 1.02rem; font-family: var(--font-serif); font-weight: 600; }
.card p { margin: 0; font-size: .88rem; color: var(--ink-mute); line-height: 1.5; }

/* ---------- letter navigation ---------- */
.letter-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.letter-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 54px; padding: 9px 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink); font-weight: 600; line-height: 1.1;
  transition: all .14s;
}
.letter-nav a:hover, .letter-nav a[aria-current="page"] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.letter-nav a span { font-size: .68rem; font-weight: 500; opacity: .65; margin-top: 2px; }
.letter-nav a.is-empty { opacity: .35; pointer-events: none; }

/* ---------- entry list ---------- */
.entry-list { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 32px; }
@media (max-width: 640px) { .entry-list { columns: 1; } }
.entry-list li { break-inside: avoid; margin: 0 0 3px; }
.entry-list a {
  display: block; padding: 7px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink); font-size: .95rem;
}
.entry-list a:hover { background: var(--accent-soft); color: var(--ink); text-decoration: none; }

/* ---------- article ---------- */
.article-head { margin-bottom: 26px; }
.article-head h1 {
  font-family: var(--font-serif); font-size: clamp(1.75rem, 4vw, 2.45rem);
  line-height: 1.2; margin: 0 0 10px; letter-spacing: -.02em;
}
.crumbs { font-size: .85rem; color: var(--ink-mute); margin: 0 0 14px; }
.crumbs a { color: var(--ink-mute); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs span { margin: 0 7px; opacity: .5; }
.article-meta { font-size: .85rem; color: var(--ink-mute); display: flex; gap: 14px; flex-wrap: wrap; }
.hero-figure { margin: 0 0 26px; }
.hero-figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

.prose { font-size: 1.045rem; line-height: 1.75; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose h2 {
  font-family: var(--font-serif); font-size: 1.5rem; margin: 2em 0 .6em;
  letter-spacing: -.01em; line-height: 1.25;
}
.prose h3 { font-family: var(--font-serif); font-size: 1.22rem; margin: 1.7em 0 .5em; }
.prose img { border-radius: var(--radius); border: 1px solid var(--border); margin: 1.6em 0; display: block; }
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent);
  color: var(--ink-soft); font-style: italic;
}
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin-bottom: .4em; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose a { text-decoration: underline; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.2em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.prose th { background: var(--surface-2); }

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: 86px; }
.widget {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px;
}
.widget h3 {
  font-family: var(--font-serif); font-size: 1.02rem; margin: 0 0 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { margin-bottom: 2px; }
.widget li a {
  display: block; padding: 5px 8px; margin-left: -8px; border-radius: 7px;
  font-size: .92rem; color: var(--ink-soft); text-decoration: none;
}
.widget li a:hover { background: var(--accent-soft); color: var(--ink); text-decoration: none; }

/* ---------- comments ---------- */
.comments { margin-top: 52px; padding-top: 34px; border-top: 1px solid var(--border); }
.comments > h2 { font-family: var(--font-serif); font-size: 1.4rem; margin: 0 0 20px; }
.comment {
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.comment:last-of-type { border-bottom: 0; }
.comment.is-reply { margin-left: 26px; padding-left: 18px; border-left: 2px solid var(--accent-soft); }
.comment-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.comment-author { font-weight: 650; font-size: .95rem; }
.comment-badge {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent); color: var(--accent-ink); padding: 2px 7px; border-radius: 999px;
}
.comment-date { font-size: .8rem; color: var(--ink-mute); }
.comment-body { margin: 0; color: var(--ink-soft); white-space: pre-wrap; font-size: .97rem; }

.comment-form { margin-top: 32px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; }
.comment-form h3 { font-family: var(--font-serif); margin: 0 0 6px; font-size: 1.2rem; }
.comment-form .hint { margin: 0 0 18px; font-size: .89rem; color: var(--ink-mute); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: .95rem; padding: 10px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
.field textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
.hp { position: absolute; left: -9999px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: .94rem;
  font-weight: 600; padding: 10px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn-sm { padding: 6px 13px; font-size: .85rem; }
.btn-danger { background: var(--danger); color: #fff; }

.notice { padding: 13px 17px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: .94rem; }
.notice-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.notice-err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 40px 0 34px; margin-top: auto; font-size: .9rem;
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 26px 44px; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-note { color: var(--ink-mute); margin: 18px 0 0; font-size: .84rem; max-width: 68ch; }
.footer-copy { color: var(--ink-mute); margin: 8px 0 0; font-size: .84rem; }
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1; }

/* ---------- ads ---------- */
.ad { margin: 30px 0; min-height: 90px; overflow: hidden; }
.ad--article { margin: 34px 0; }
.ad--sidebar { margin: 0 0 20px; min-height: 250px; }
.ad ins { display: block; }
@media (max-width: 900px) { .ad--sidebar { display: none; } }

/* ---------- misc ---------- */
.pill {
  display: inline-block; font-size: .74rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 999px;
}
.empty { color: var(--ink-mute); font-style: italic; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  text-decoration: none; color: var(--ink-soft); font-size: .9rem;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
