:root { --space: 1; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg, #f4f2ee);
  color: var(--text, #1c1b19);
  font-family: var(--sans, "Segoe UI", sans-serif);
  font-size: 17px;
  line-height: 1.6;
}

a { color: inherit; }

.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }

.density-compact { --space: 0.82; }
.density-regular { --space: 1; }
.density-airy { --space: 1.28; }

.preview-bar {
  background: #1c1b17;
  color: #f6f3ec;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 8px 12px;
}

.site-header { padding: calc(28px * var(--space)) 0 calc(18px * var(--space)); }
.banner {
  width: 468px;
  height: 90px;
  max-width: 100%;
  margin: 18px auto 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner iframe, .banner img, .banner object { max-width: 468px; max-height: 90px; }
.name {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-decoration: none;
}
.tagline { margin: 8px 0 0; color: var(--muted); max-width: 46ch; }
.site-header nav { display: flex; gap: 16px; margin-top: 16px; }
.site-header nav a { color: var(--accent); text-underline-offset: 3px; }

.header-masthead .mast { text-align: center; }
.header-masthead .site-header { border-bottom: 1px solid var(--line); }
.header-masthead .name { font-size: clamp(48px, 8vw, 84px); }
.header-masthead .tagline { margin-left: auto; margin-right: auto; }
.header-masthead nav { justify-content: center; }

.header-nav .mast {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.header-nav .site-header { border-bottom: 1px solid var(--line); }
.header-nav .name { font-size: 32px; }
.header-nav nav { margin-top: 0; }

.header-plain .name {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
.header-plain .site-header { padding-bottom: 8px; }

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 36px;
  align-items: start;
  padding-top: calc(8px * var(--space));
}
.rail h2 {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.rail section + section { margin-top: 28px; }
.rubric-list { list-style: none; margin: 0; padding: 0; }
.rubric-list li + li { margin-top: 6px; }
.rubric-list a { color: var(--accent); text-decoration: none; }
.rubric-list a:hover { text-decoration: underline; }
.rail-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.3;
}
.rail-item:hover { color: var(--accent); }
.ad-box {
  min-height: 120px;
  padding: 12px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.thumb {
  display: block;
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(135deg, var(--surface), var(--bg));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.7);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-item .thumb { width: 72px; height: 48px; aspect-ratio: auto; }
.section-title {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -0.03em;
  margin: 8px 0 0;
}

.index { padding-bottom: calc(28px * var(--space)); }
.item {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: calc(18px * var(--space)) 0;
  border-top: 1px solid var(--line);
}
.item .thumb { width: 168px; }
.item h2, .story h1 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}
.item h2 { font-size: clamp(28px, 3vw, 40px); }
.item h2 a { text-decoration: none; }
.item h2 a:hover { color: var(--accent); }
.meta, .quiet { color: var(--muted); }
.meta { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.excerpt { margin: 10px 0 0; max-width: 62ch; }
.draft {
  margin-left: 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 1px 6px;
  letter-spacing: 0;
  text-transform: none;
}

.layout-feed .item h2 { font-size: 28px; }

.layout-cards .index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  padding-top: 8px;
}
.layout-cards .item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
}
.layout-cards .item .thumb { width: 100%; border: 0; border-radius: 0; aspect-ratio: 16 / 9; }
.layout-cards .item .copy { padding: 14px 16px 16px; }
.layout-cards .item h2 { font-size: 24px; }

.layout-magazine .feature {
  grid-template-columns: minmax(220px, 1.15fr) minmax(0, 1fr);
  align-items: center;
  padding-bottom: calc(28px * var(--space));
}
.layout-magazine .feature .thumb { width: 100%; aspect-ratio: 16 / 10; }
.layout-magazine .feature h2 { font-size: clamp(32px, 4vw, 52px); }

.story { padding: calc(12px * var(--space)) 0 calc(48px * var(--space)); max-width: 72ch; }
.cover { margin: 18px 0 8px; }
.cover img { width: 100%; height: auto; display: block; border-radius: var(--radius); }
.map-list { padding-left: 18px; }
.map-list a { color: var(--accent); }
.layout-cards .story, .layout-magazine .story { margin: 0 auto; }
.story h1 { font-size: clamp(36px, 5vw, 60px); }
.deck { font-size: 1.15rem; color: var(--muted); }

.prose { font-size: 1.05rem; }
.prose > * + * { margin-top: 0.9em; }
.prose h2, .prose h3 { font-family: var(--serif); letter-spacing: -0.03em; line-height: 1.15; }
.prose a { color: var(--accent); }
.prose blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.prose code { font-size: 0.92em; }
.prose pre {
  overflow: auto;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.prose img { max-width: 100%; height: auto; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border-bottom: 1px solid var(--line); text-align: left; padding: 6px 8px; }

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding: 22px 0 36px;
  margin-top: 12px;
}
.foot-rubrics { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }
.foot-rubrics a, .foot-map a { color: var(--accent); }
.foot-map { margin: 0; display: flex; gap: 14px; align-items: start; }
.counters { grid-column: 1 / -1; }

.pager { display: flex; gap: 14px; align-items: center; padding-bottom: 28px; }
.pager a { color: var(--accent); }

.unknown {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f4f1ea;
  color: #1c1b19;
  font-family: Georgia, serif;
}
.unknown main { width: min(520px, calc(100% - 40px)); }
.unknown h1 { font-size: 48px; letter-spacing: -0.04em; margin: 0 0 8px; }

@media (max-width: 860px) {
  .page, .header-nav .mast, .site-footer, .item, .layout-magazine .feature { display: block; }
  .header-nav nav, .item .copy, .foot-map { margin-top: 12px; }
  .item .thumb, .layout-cards .item .thumb { width: 100%; margin-bottom: 12px; }
  .name { font-size: 36px; }
  .banner { width: 100%; height: auto; min-height: 60px; }
}
