:root {
  --paper: #faf7f2;
  --paper-dark: #f0ebe3;
  --ink: #1a2332;
  --ink-soft: #4a5568;
  --accent: #8b2942;
  --accent-light: #c44d6a;
  --rule: #d4cfc6;
  --link: #6b2d4a;
  --max: 1140px;
  --header-h: 62px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-sans: "Source Sans 3", "Noto Sans SC", sans-serif;
  --font-display: "Playfair Display", "Noto Serif SC", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 40px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-light); }
.container { width: min(100% - 2rem, var(--max)); margin-inline: auto; }

.site-header {
  position: sticky; top: 0; z-index: 500;
  background: var(--paper);
  border-bottom: 3px double var(--ink);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--header-h); gap: 1rem;
}
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--ink); font-family: var(--font-display);
  font-weight: 700; font-size: 1.05rem; text-decoration: none;
}
.brand:hover { color: var(--accent); text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 4px; }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  width: 44px; height: 44px; padding: 10px;
  border: 1px solid var(--rule); border-radius: 4px;
  background: var(--paper-dark); cursor: pointer;
}
.nav-toggle span { height: 2px; background: var(--ink); border-radius: 1px; transition: 0.25s; }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.2rem 1.5rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  color: var(--ink-soft); font-size: 0.9rem; font-weight: 600;
  text-decoration: none; letter-spacing: 0.02em;
  border-bottom: 2px solid transparent; padding-bottom: 2px;
}
.site-nav a:hover, .site-nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.ads-top-bar {
  padding: 0.55rem 0;
  background: var(--paper-dark);
  border-bottom: 1px solid var(--rule);
}
#ads {
  display: flex; justify-content: center; align-items: flex-start;
  flex-wrap: wrap; background: transparent; margin: 8px 0; gap: 0.5rem;
}
#ads > div, #ads .ads-item {
  display: flex; flex-direction: column; align-items: center;
  width: 70px; box-sizing: border-box;
}
#ads img {
  width: 65px; height: 65px; object-fit: cover; border-radius: 18px;
  box-shadow: 0 6px 18px rgba(24, 24, 24, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease;
  display: block; border: none; background: #fff;
}
#ads a { display: inline-block; text-decoration: none; border-radius: 15px; }
#ads img:hover { transform: translateY(-4px) scale(1.04); box-shadow: 0 10px 24px rgba(24, 24, 24, 0.18); }
#ads figcaption, #ads .caption {
  height: 15px; font-size: 11px; color: #666; text-align: center;
  max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px;
}
.applist-title { text-align: center; font-size: 0.88rem; color: var(--ink-soft); font-weight: 600; }

.masthead {
  text-align: center; padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.masthead .edition {
  font-size: 0.78rem; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 0.5rem;
}
.masthead h1 {
  font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.75rem; line-height: 1.25; font-weight: 700;
}
.masthead .deck {
  font-family: var(--font-serif); font-size: 1.05rem;
  color: var(--ink-soft); max-width: 38em; margin: 0 auto;
}

.link-strip {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem 1.2rem;
  padding: 1.25rem 0; border-bottom: 1px solid var(--rule);
}
.link-strip a {
  padding: 0.45rem 1rem; border: 1px solid var(--accent);
  color: var(--accent); font-weight: 600; font-size: 0.88rem;
  text-decoration: none; border-radius: 2px;
}
.link-strip a:hover { background: var(--accent); color: #fff; }

.article-section { padding: 2.5rem 0; border-bottom: 1px solid var(--rule); }
.article-section:nth-child(even) { background: var(--paper-dark); }
.section-label {
  display: inline-block; font-size: 0.72rem; letter-spacing: 0.2em;
  color: var(--accent); font-weight: 700; margin-bottom: 0.5rem;
}
.article-section h2 {
  font-family: var(--font-display); font-size: 1.65rem;
  margin: 0 0 1rem; line-height: 1.3;
}

.columns-2 {
  column-count: 2; column-gap: 2.5rem; column-rule: 1px solid var(--rule);
}
.columns-2 p { margin: 0 0 1rem; text-align: justify; }
.columns-2 p:first-of-type::first-letter {
  float: left; font-family: var(--font-display);
  font-size: 3.2rem; line-height: 0.85; padding: 0.08em 0.12em 0 0;
  color: var(--accent); font-weight: 700;
}

.pullquote {
  float: right; width: 38%; margin: 0 0 1rem 1.5rem; padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent); background: var(--paper);
  font-family: var(--font-serif); font-size: 1.05rem; font-style: italic;
  color: var(--ink-soft); line-height: 1.6;
}

.feature-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;
  align-items: start; margin: 1.5rem 0;
}
.feature-row img { border: 1px solid var(--rule); box-shadow: 0 8px 24px rgba(26,35,50,0.08); }

.chip-nav {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.5rem;
}
.chip-nav a {
  padding: 0.35rem 0.85rem; background: var(--paper);
  border: 1px solid var(--rule); font-size: 0.82rem;
  color: var(--ink-soft); text-decoration: none; border-radius: 2px;
}
.chip-nav a:hover { border-color: var(--accent); color: var(--accent); }

.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.prose strong { color: var(--ink); }

.page-hero {
  padding: 2rem 0; border-bottom: 1px solid var(--rule);
  background: var(--paper-dark);
}
.page-hero h1 { font-family: var(--font-display); margin: 0.5rem 0 0; font-size: 1.8rem; }
.breadcrumb { font-size: 0.85rem; color: var(--ink-soft); }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.error-wrap { text-align: center; padding: 4rem 0; }
.error-wrap .code { font-size: 4rem; color: var(--accent); font-family: var(--font-display); margin: 0; }

.site-footer {
  margin-top: 1rem; padding: 2rem 0;
  border-top: 3px double var(--ink);
  font-size: 0.88rem; color: var(--ink-soft);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin-bottom: 1rem; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .columns-2 { column-count: 1; column-rule: none; }
  .pullquote { float: none; width: 100%; margin: 1rem 0; }
  .feature-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    padding: 1rem; transform: translateY(-120%); opacity: 0; visibility: hidden;
    transition: 0.3s; box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  }
  .site-nav.is-open { transform: translateY(0); opacity: 1; visibility: visible; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { display: block; padding: 0.65rem 0; border-bottom: 1px solid var(--rule); }
  .ads-top-bar .container { width: 100%; padding-inline: 0.75rem; }
  #ads {
    flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity;
    justify-content: flex-start; -webkit-overflow-scrolling: touch;
  }
  #ads::-webkit-scrollbar { display: none; }
  #ads > div, #ads .ads-item { width: 84px; flex-shrink: 0; scroll-snap-align: center; }
}
