:root {
  --bg: #f7f3ee;
  --panel: #fffdf9;
  --ink: #111111;
  --muted: #5d554f;
  --line: rgba(23, 20, 18, 0.12);
  --accent: #8c5e3c;
  --accent-soft: #efe0d1;
  --shadow: rgba(23, 20, 18, 0.06);
  --article-size: 18px;
  --article-line-height: 1.8;
  --article-serif-stack: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Georgia", "Times New Roman", serif;
  --article-sans-stack: "Inter", "Segoe UI", sans-serif;
}

html.dark-mode {
  --bg: #141311;
  --panel: #1b1918;
  --ink: #f3efe8;
  --muted: #d6cfc7;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #dba77d;
  --accent-soft: #2a211d;
  --shadow: rgba(0, 0, 0, 0.28);
}

body.dark-mode {
  --bg: #141311;
  --panel: #1b1918;
  --ink: #f3efe8;
  --muted: #d6cfc7;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #dba77d;
  --accent-soft: #2a211d;
  --shadow: rgba(0, 0, 0, 0.28);
}

html.dark-mode body,
body.dark-mode {
  background: var(--bg);
  color: var(--ink);
}

html.dark-mode .site-header,
html.dark-mode .site-footer,
body.dark-mode .site-header,
body.dark-mode .site-footer {
  background: rgba(14, 14, 14, 0.96);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .brand,
html.dark-mode .main-nav a,
html.dark-mode .main-nav a.active,
html.dark-mode .main-nav a:hover,
html.dark-mode .nav-theme-toggle,
html.dark-mode .site-footer p,
html.dark-mode .site-footer .brand.small,
html.dark-mode .footer-copyright,
html.dark-mode .footer-changelog a,
body.dark-mode .brand,
body.dark-mode .main-nav a,
body.dark-mode .main-nav a.active,
body.dark-mode .main-nav a:hover,
body.dark-mode .nav-theme-toggle,
body.dark-mode .site-footer p,
body.dark-mode .site-footer .brand.small,
body.dark-mode .footer-copyright,
body.dark-mode .footer-changelog a {
  color: #faf5ee;
}

html.dark-mode .main-nav a,
body.dark-mode .main-nav a {
  opacity: 0.8;
}

html.dark-mode .main-nav a.active,
html.dark-mode .main-nav a:hover,
body.dark-mode .main-nav a.active,
body.dark-mode .main-nav a:hover {
  opacity: 1;
}

html.dark-mode .nav-theme-toggle,
body.dark-mode .nav-theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}

html.dark-mode .button.primary,
body.dark-mode .button.primary {
  background: #f3efe8;
  color: #141311;
  border-color: #f3efe8;
}

body.dark-mode .button.secondary {
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  border-color: var(--line);
}

body.dark-mode .site-footer {
  background: #171613;
  border-top-color: var(--line);
}

body.dark-mode .footer-changelog a,
body.dark-mode .footer-copyright,
body.dark-mode .footer-links,
body.dark-mode .site-footer p,
body.dark-mode .site-footer .brand.small {
  color: var(--ink);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  transition: background-color 180ms ease, color 180ms ease;
}

main {
  flex: 1 0 auto;
}

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(247, 243, 238, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.2rem 0;
}

.nav-theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.brand {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand.small {
  font-size: 1.1rem;
}

.main-nav {
  display: flex;
  gap: 1.3rem;
  font-size: 0.96rem;
  color: var(--muted);
}

.main-nav a.active,
.main-nav a:hover {
  color: var(--ink);
}

.hero {
  padding: 6rem 0 4rem;
}

.hero-inner {
  max-width: 760px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

h1, h2 {
  font-family: "Cormorant Garamond", serif;
  line-height: 0.98;
  margin: 0 0 1rem;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(3rem, 6vw, 6rem);
}

h2 {
  font-size: clamp(2.3rem, 4vw, 3.3rem);
}

h3,
.article-card h3,
.library-item h3,
.article-header h1,
.changelog-page h1,
.changelog-page h2 {
  font-family: "Inter", sans-serif;
  line-height: 1.2;
  margin: 0 0 0.8rem;
  letter-spacing: -0.04em;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 600;
}

.article-header h1 {
  font-family: "Inter", sans-serif;
  font-size: clamp(2.2rem, 3.6vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
  font-weight: 700;
  max-width: 860px;
  margin-bottom: 0.8rem;
  color: var(--ink);
}

.article-subtitle {
  margin: 0 0 1.35rem;
  font-size: 1.18rem;
  line-height: 1.45;
  color: rgba(17, 17, 17, 0.72);
  max-width: 700px;
}

.article-byline {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.25rem;
  color: var(--ink);
}

.author-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1a74d7;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(17, 17, 17, 0.08);
}

.author-avatar--initials {
  font-size: 0.75rem;
}

.author-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.author-name {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink);
}

.article-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.changelog-page h1 {
  font-size: clamp(2.1rem, 3vw, 2.8rem);
}

.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 660px;
}

.cta-row {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--ink);
  transition: 0.2s ease;
  font-weight: 600;
}

.button.primary {
  background: var(--ink);
  color: #fff;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
}

.button:hover {
  transform: translateY(-1px);
}

.section {
  padding: 2rem 0 4rem;
}

body.dark-mode .loading-splash {
  background: rgba(20, 19, 17, 0.96);
}

.loading-splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(247, 243, 238, 0.98);
  z-index: 40;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loading-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-splash-inner {
  max-width: 520px;
  padding: 2rem 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  box-shadow: 0 18px 38px rgba(17, 17, 17, 0.08);
}

.loading-splash blockquote {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.1rem, 4vw, 3.3rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.quote-attribution {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.feature-article-section {
  padding-top: 1rem;
}

.featured-article-card {
  max-width: 980px;
  margin: 0 auto;
  background: linear-gradient(135deg, rgba(140, 94, 60, 0.06), rgba(255, 255, 255, 0.74));
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: clamp(2rem, 4vw, 3.5rem);
  text-align: center;
  box-shadow: 0 18px 42px var(--shadow);
}

.featured-article-card h2 {
  margin: 0.4rem 0 1rem;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.featured-article-card h2 a {
  color: var(--ink);
  text-decoration: none;
}

.featured-article-lede {
  max-width: 720px;
  margin: 0 auto 1.1rem;
  font-size: clamp(1.08rem, 2vw, 1.4rem);
  line-height: 1.45;
  color: var(--muted);
}

.featured-article-meta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section.narrow {
  max-width: 860px;
}

.about-page {
  padding-top: 3rem;
}

.about-page h1 {
  font-family: "Inter", sans-serif;
  font-size: clamp(2.2rem, 4.2vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.062em;
  max-width: 940px;
  margin: 0 0 1.3rem;
}

.about-page h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 2.7vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 600;
  color: var(--ink);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1.5rem;
}

.card-grid {
  display: grid;
  gap: 1.25rem;
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 12px 24px var(--shadow);
}

.meta,
.library-meta,
.library-footer,
.article-meta {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
}

.library-list {
  display: grid;
  gap: 1.2rem;
  margin-top: 2rem;
}

.library-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.4rem 1.5rem;
}

.library-meta,
.library-footer,
.article-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.prose {
  font-size: 1.08rem;
  color: var(--muted);
}

.article-shell {
  padding-top: 3rem;
  padding-bottom: 4rem;
}

.article-card {
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 2rem 2rem 2.25rem;
  box-shadow: 0 18px 32px rgba(17, 17, 17, 0.03);
}

.article-body {
  font-family: "Charter", "Bitstream Charter", "Sitka Text", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  line-height: 1.82;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.article-body p,
.article-body li,
.article-body strong,
.article-body em,
.article-body blockquote {
  color: var(--ink);
  font-family: inherit;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: "Inter", sans-serif;
  letter-spacing: -0.05em;
  color: var(--ink);
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  margin: 2rem 0 1rem;
}

.article-body h1 { font-size: 1.9rem; }
.article-body h2 { font-size: 1.55rem; }
.article-body h3 { font-size: 1.3rem; }

.article-body .article-body-extra {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  transition: max-height 700ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 420ms ease, margin-top 420ms ease;
}

.article-body .article-body-extra.is-open {
  opacity: 1;
  margin-top: 1.2rem;
}

.read-more-toggle {
  margin-top: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, color 180ms ease;
}

.read-more-toggle:hover {
  transform: translateY(-1px);
}

.read-more-toggle:active {
  transform: scale(0.98);
}

@media (max-width: 760px) {
  .article-card {
    padding: 1.25rem 1.1rem 1.4rem;
  }

  .article-header h1 {
    font-size: clamp(2rem, 7vw, 2.7rem);
  }
}

.article-header {
  margin-bottom: 2rem;
}

.article-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.voice-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.reading-tools {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-slider {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
}

.control-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.compact-slider input[type="range"] {
  width: 110px;
  accent-color: var(--ink);
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
}

.segmented-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms ease;
}

.segmented-button.is-active {
  background: var(--ink);
  color: var(--panel);
}

.theme-toggle {
  min-width: 110px;
}

.article-body {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  font-family: var(--article-serif-stack);
  font-size: var(--article-size);
  line-height: var(--article-line-height);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

.article-body--sans {
  font-family: var(--article-sans-stack);
  letter-spacing: -0.005em;
}

.article-body p {
  margin: 0 0 1.55rem;
  color: var(--ink);
  font-family: inherit;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: var(--article-sans-stack);
  line-height: 1.2;
  letter-spacing: -0.04em;
  margin: 2rem 0 0.9rem;
  color: var(--ink);
}

.article-body p,
.article-body li,
.article-body strong,
.article-body em,
.article-body blockquote {
  color: var(--ink);
}

.article-body blockquote {
  border-left: 2px solid var(--line);
  padding-left: 1rem;
  color: var(--ink);
  font-style: italic;
}

.subscribe-form,
.admin-form {
  display: grid;
  gap: 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.5rem;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  font: inherit;
  color: var(--ink);
}

textarea { resize: vertical; }

.flash-wrap {
  width: min(1100px, calc(100% - 2rem));
  margin: 1rem auto 0;
}

.flash {
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  margin-bottom: 0.6rem;
}

.flash.success { background: #edf9f1; }
.flash.error { background: #fff1f1; }

.md-dropzone {
  border: 1px dashed var(--line);
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
}

.md-dropzone.dragging {
  border-color: var(--accent);
  background: #f8f1ea;
}

.md-dropzone-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.admin-list li a:last-child {
  color: var(--accent);
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  background: #f1eae0;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
}

.footer-changelog {
  min-width: 260px;
}

.footer-changelog h4 {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.footer-changelog ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.footer-changelog li {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-changelog a {
  color: var(--ink);
}

.footer-copyright {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--muted);
}

.center-text { text-align: center; }

.admin-list {
  margin-top: 2rem;
}

@media (max-width: 760px) {
  .three-up { grid-template-columns: 1fr; }
  .nav-row,
  .footer-row,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-group {
    width: 100%;
    justify-content: space-between;
    padding: 0.4rem 0 0.15rem;
    gap: 1rem;
  }

  .main-nav {
    flex-wrap: wrap;
  }

  .hero { padding-top: 4rem; }
}
