:root {
  color-scheme: light;
  --background: #ffffff;
  --background-texture: none;
  --surface: #ffffff;
  --surface-soft: #f7f7f2;
  --text: #191919;
  --muted: #6b6b6b;
  --border: #e6e6e6;
  --accent: #1a8917;
  --accent-strong: #0f730c;
  --accent-soft: #eef7ee;
  --shadow: none;
  --radius: 999px;
  --header-blur: 14px;
  --prose-paper-shadow: none;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --background: #161616;
  --surface: #161616;
  --surface-soft: #202020;
  --text: #f2f2f2;
  --muted: #a8a8a8;
  --border: #333333;
  --accent: #6bc46b;
  --accent-strong: #8ce08c;
  --accent-soft: #1d331d;
}

[data-theme="book"] {
  color-scheme: light;
  --background: #f1e4bf;
  --background-texture:
    radial-gradient(circle at 18% 22%, rgba(95, 58, 24, .055) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 76% 42%, rgba(95, 58, 24, .04) 0 1px, transparent 1px 100%),
    linear-gradient(90deg, rgba(111, 72, 32, .08), transparent 16%, transparent 84%, rgba(111, 72, 32, .08)),
    linear-gradient(180deg, rgba(255, 255, 255, .28), transparent 26%, rgba(98, 65, 28, .06));
  --surface: #fbf1d2;
  --surface-soft: #ead9ad;
  --text: #2c2117;
  --muted: #705f49;
  --border: #cdbb8b;
  --accent: #6f4f24;
  --accent-strong: #493415;
  --accent-soft: #e3cf99;
  --header-blur: 4px;
  --prose-paper-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--background);
  background-image: var(--background-texture);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

body.menu-open { overflow: hidden; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: .18em; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--background) 96%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(var(--header-blur));
}

.nav {
  width: min(1192px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  line-height: 1;
  min-width: max-content;
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}
.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0;
}
.brand-subtitle { display: none; }

.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .91rem;
  text-decoration: none;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: transparent; }
.nav-links a.active { font-weight: 650; }

.icon-button, .menu-button {
  min-width: 36px;
  width: auto;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0 9px;
  font-size: .98rem;
  line-height: 1;
}
.icon-button:hover, .menu-button:hover { border-color: var(--muted); }
.menu-button { display: none; }

.container { width: min(1032px, calc(100% - 48px)); margin: 0 auto; }
.narrow { width: min(728px, calc(100% - 48px)); margin: 0 auto; }
.section { padding: 64px 0; }
.section-tight { padding: 42px 0 72px; }

.hero {
  padding: 76px 0 54px;
  border-bottom: 1px solid var(--text);
  background: var(--background);
}
.hero .container { width: min(1192px, calc(100% - 48px)); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 48px;
  align-items: end;
}
.eyebrow, .category {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: 0; }
h1 {
  font-family: var(--serif);
  font-size: clamp(3.4rem, 6.2vw, 5.35rem);
  font-weight: 500;
  max-width: 1000px;
}
h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 500;
}
h3 { font-family: var(--serif); font-size: 1.48rem; font-weight: 600; }
.lead {
  color: var(--text);
  font-size: clamp(1.18rem, 2vw, 1.38rem);
  line-height: 1.42;
  max-width: 680px;
  margin: 22px 0 0;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--background);
  font-size: .94rem;
  font-weight: 500;
  text-decoration: none;
}
.button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.button:hover { border-color: var(--muted); }

.editorial-note {
  border-left: 1px solid var(--border);
  padding: 4px 0 4px 24px;
}
.editorial-note p { margin: 10px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 24px; }
.stat { border-top: 1px solid var(--border); padding-top: 12px; }
.stat strong { display: block; color: var(--text); font-size: 1.22rem; line-height: 1; }
.stat span { color: var(--muted); font-size: .86rem; }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  align-items: end;
  gap: 40px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
}
.section-head p { margin: 0; color: var(--muted); }

.article-grid { display: grid; grid-template-columns: 1fr; }
.month-group + .month-group { margin-top: 40px; }
.month-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  border-bottom: 1px solid var(--border);
  padding-bottom: 13px;
  margin-bottom: 0;
}
.month-head h2 {
  font-family: var(--sans);
  font-size: .96rem;
  font-weight: 700;
  color: var(--muted);
}
.article-card {
  min-height: 100%;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 24px 0;
  text-decoration: none;
  display: grid;
  gap: 8px;
}
.article-card:hover h3 { color: color-mix(in srgb, var(--text) 70%, var(--accent)); }
.article-card .category { margin-bottom: 2px; }
.article-card p {
  color: var(--muted);
  margin: 0;
  max-width: 720px;
}
.author-profile {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.author-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
  object-position: center 34%;
}
.meta { color: var(--muted); font-size: .88rem; }

.search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 30px;
}
.search-panel input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 18px;
  font: inherit;
}

.book-feature {
  display: grid;
  grid-template-columns: minmax(150px, 240px) minmax(0, 620px);
  gap: 34px;
  align-items: center;
  justify-content: center;
}
.book-cover { border-radius: 4px; box-shadow: 0 18px 44px rgba(0, 0, 0, .12); border: 1px solid var(--border); }
.book-copy p { color: var(--muted); font-size: 1.06rem; }
.pdf-reader {
  display: block;
  width: 100%;
  height: min(82vh, 860px);
  min-height: 620px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-soft);
}
.info-list { display: grid; gap: 0; margin: 22px 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.info-list li { border-bottom: 1px solid var(--border); padding: 10px 0; color: var(--muted); }
.info-list strong { color: var(--text); }

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 46px;
  align-items: start;
}
.contact-form {
  display: grid;
  gap: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.contact-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 600;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
}
.contact-form textarea {
  resize: vertical;
  min-height: 164px;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
  outline: 0;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.form-status {
  color: var(--muted);
  font-size: .92rem;
}
.form-status.success { color: var(--accent-strong); }
.form-status.error { color: #b42318; }
.contact-note {
  border-left: 1px solid var(--border);
  padding-left: 24px;
}
.contact-note h2 {
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  margin-top: 8px;
}
.contact-note p { color: var(--muted); margin: 14px 0 0; }

.page-title { padding: 66px 0 42px; border-bottom: 1px solid var(--border); }
.page-title .container { width: min(820px, calc(100% - 48px)); }
.page-title h1 { font-size: clamp(2.7rem, 6vw, 5rem); }
.page-title p { max-width: 700px; color: var(--muted); font-size: 1.18rem; line-height: 1.48; margin: 18px 0 0; }

.article-hero { padding: 58px 0 22px; }
.article-hero h1 { font-size: clamp(2.7rem, 7vw, 5.1rem); }
.article-hero .lead { color: var(--muted); }
.article-hero .meta { margin-top: 20px; }
.cover-image { margin: 28px auto 0; border-radius: 4px; border: 1px solid var(--border); overflow: hidden; }

.prose {
  width: min(680px, calc(100% - 48px));
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(1.18rem, 2vw, 1.3rem);
  line-height: 1.78;
  padding: 28px 0 72px;
  text-shadow: var(--prose-paper-shadow);
}
.prose > * { margin-left: 0; margin-right: 0; }
.prose p { margin-top: 0; margin-bottom: 1.25em; }
.prose h2, .prose h3 {
  font-family: var(--sans);
  font-size: 1.34rem;
  line-height: 1.25;
  margin-top: 2em;
  margin-bottom: .65em;
}
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-bottom: .45em; }
.prose blockquote {
  border-left: 3px solid var(--text);
  padding-left: 20px;
  color: var(--muted);
  font-style: italic;
}
.prose code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.prose pre {
  width: 100%;
  overflow-x: auto;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px;
  font-size: .92rem;
  line-height: 1.55;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: .95rem;
}
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 12px; text-align: left; }

.author-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  color: var(--muted);
}
.share { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.footer {
  border-top: 1px solid var(--border);
  padding: 30px 0;
  color: var(--muted);
  font-size: .9rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .menu-button { display: inline-grid; }
  .nav-links {
    position: fixed;
    inset: 58px 16px auto 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .12);
  }
  .nav-links.open { display: flex; }
  .nav-links a { justify-content: center; }
  .hero { padding: 54px 0 42px; }
  .hero-grid, .section-head, .book-feature, .contact-layout { grid-template-columns: 1fr; gap: 28px; }
  .editorial-note, .contact-note { border-left: 0; border-top: 1px solid var(--border); padding: 24px 0 0; }
  .month-head { align-items: start; flex-direction: column; gap: 4px; }
}

@media (max-width: 520px) {
  .nav, .container, .narrow, .page-title .container, .prose { width: min(100% - 28px, 1032px); }
  .brand strong { font-size: 1.28rem; }
  .hero { padding-top: 42px; }
  h1 { font-size: clamp(3.05rem, 18vw, 4.1rem); }
  .actions, .search-panel { display: grid; grid-template-columns: 1fr; }
  .form-grid, .form-actions { display: grid; grid-template-columns: 1fr; }
  .button { width: 100%; }
  .section { padding: 48px 0; }
  .page-title { padding: 44px 0 30px; }
  .article-card { padding: 22px 0; }
  .author-profile { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; }
  .author-avatar { width: 72px; height: 72px; }
  .pdf-reader { min-height: 520px; }
}
