: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(--sans);
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  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(28px, 4vw, 36px); }
.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: 24px; }
.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; }

.header-bar .mast {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.header-bar .site-header {
  border-bottom: 1px solid var(--line);
  padding-top: calc(18px * var(--space));
  padding-bottom: calc(14px * var(--space));
}
.header-bar .name {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.header-bar .tagline {
  margin-top: 4px;
  font-size: 14px;
  max-width: 52ch;
}
.header-bar nav {
  margin-top: 0;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.header-bar nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.header-bar nav a:hover { color: var(--accent); }

.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;
}
.rail .mainlink,
.rail .mainlink-anno,
.rail .serpzilla {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-word;
}
.rail .mainlink:empty,
.rail .mainlink-anno:empty,
.rail .serpzilla:empty {
  display: none;
}
.rail .mainlink a,
.rail .mainlink-anno a,
.rail .serpzilla a {
  color: var(--accent);
  text-decoration: none;
}
.rail .mainlink a:hover,
.rail .mainlink-anno a:hover,
.rail .serpzilla a:hover {
  text-decoration: underline;
}
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, var(--surface), var(--bg));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.7);
  overflow: hidden;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.rail-item .thumb {
  width: 72px;
  height: auto;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}
.section-title {
  font-family: var(--sans);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  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(--sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
}
.item h2 { font-size: clamp(18px, 2vw, 24px); }
.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: 22px; }

.layout-cards .index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 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;
  box-shadow: 0 1px 2px rgba(20, 24, 31, 0.04), 0 10px 28px rgba(20, 24, 31, 0.04);
}
.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: 18px; line-height: 1.3; }

.layout-stack .index {
  display: grid;
  gap: 16px;
  padding-top: 8px;
}
.layout-stack .item {
  display: grid;
  grid-template-columns: minmax(180px, 0.95fr) minmax(0, 1.35fr);
  gap: 22px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 24, 31, 0.04);
}
.layout-stack .item .thumb {
  width: 100%;
  border: 0;
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--radius) * 0.75);
}
.layout-stack .item h2 { font-size: clamp(18px, 2vw, 24px); }
.layout-stack .excerpt { margin-top: 8px; max-width: 54ch; }

.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(22px, 2.5vw, 28px); }

.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, .layout-stack .story { margin: 0 auto; }
.story h1 {
  font-size: clamp(24px, 2.6vw, 32px);
  max-width: 36em;
  margin-bottom: 10px;
}
.deck {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 8px;
  max-width: 62ch;
}

.prose { font-size: 1.05rem; line-height: 1.65; }
.prose > * + * { margin-top: 0.9em; }
.prose h2, .prose h3 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.15rem; }
.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, .header-bar .mast, .site-footer, .item, .layout-magazine .feature, .layout-stack .item { display: block; }
  .header-nav nav, .header-bar nav, .item .copy, .foot-map { margin-top: 12px; }
  .header-bar nav { justify-content: flex-start; }
  .layout-cards .index { grid-template-columns: 1fr; }
  .item .thumb, .layout-cards .item .thumb, .layout-stack .item .thumb { width: 100%; margin-bottom: 12px; }
  .name { font-size: 24px; }
  .header-bar .name { font-size: 22px; }
  .story h1 { font-size: 24px; }
  .banner { width: 100%; height: auto; min-height: 60px; }
}
