/* Sleep Review — reader-first stylesheet. No external resources. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --ink: #1b1d1c;
  --ink-soft: #3a3d3b;
  --muted: #64615a;
  --line: #e3ded4;
  --line-strong: #cfc9bd;
  --accent: #2c5f68;
  --accent-strong: #204a52;
  --accent-soft: #e9f0f1;
  --accent-ink: #ffffff;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 68ch;
  --wrap: 1180px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 22, 0.05), 0 8px 24px rgba(20, 24, 22, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121413;
    --surface: #191c1b;
    --surface-2: #202422;
    --ink: #ecebe5;
    --ink-soft: #d3d2cb;
    --muted: #a5a39a;
    --line: #2c312e;
    --line-strong: #3b423e;
    --accent: #9dc5ce;
    --accent-strong: #c0dde3;
    --accent-soft: #1e2f32;
    --accent-ink: #10201f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video, iframe { max-width: 100%; }
img { height: auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.5em;
}

p { margin: 0 0 1.2em; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}
.brand:hover { color: var(--ink); }
.brand-name {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-tag {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.primary-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.primary-nav a:hover { background: var(--surface-2); color: var(--ink); }
.primary-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.search-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.86rem;
  white-space: nowrap;
}
.search-link:hover { border-color: var(--accent); color: var(--accent); }
.search-link svg { width: 15px; height: 15px; }

.nav-mobile { display: none; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 72px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 36px;
  padding: 52px 0 36px;
}
.footer-brand .brand-name { font-size: 1.4rem; }
.footer-brand p { color: var(--muted); font-size: 0.9rem; margin-top: 12px; max-width: 32ch; }
.footer-col h2 {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { color: var(--ink-soft); text-decoration: none; font-size: 0.92rem; }
.footer-col a:hover { color: var(--accent); text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
}
.footer-bottom nav { display: flex; gap: 18px; }
.footer-bottom a { color: var(--muted); text-decoration: none; }
.footer-bottom a:hover { color: var(--accent); }

/* ---------- shared ---------- */

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 10px;
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
}
.meta .dot { opacity: 0.5; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-top: 2px solid var(--ink);
  padding-top: 16px;
  margin-bottom: 26px;
}
.section-head h2 {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0;
}
.section-head a { font-size: 0.84rem; text-decoration: none; }
.section-head a:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 11px 20px;
  border-radius: 999px;
}
.btn:hover { background: var(--accent-strong); color: var(--accent-ink); }

/* ---------- home ---------- */

.home-intro {
  padding: 46px 0 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 26px;
  margin-bottom: 34px;
}
.home-intro h1 {
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  max-width: 20ch;
  margin: 0;
  letter-spacing: -0.025em;
}
.home-intro p {
  margin: 0;
  max-width: 38ch;
  color: var(--muted);
  font-size: 1rem;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: 18px 0 54px;
  border-bottom: 1px solid var(--line);
}
.hero.no-media { grid-template-columns: 1fr; }
.hero.no-media .hero-text { max-width: 60ch; }
.hero-text { max-width: 46ch; }
.hero h2 {
  font-size: clamp(1.8rem, 2.8vw, 2.55rem);
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}
.hero h2 a { color: inherit; text-decoration: none; }
.hero h2 a:hover { color: var(--accent); }
.hero .deck {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
  margin-bottom: 18px;
}
.hero-media { margin: 0; }
.hero-media a { display: block; }
.hero-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 46px 0;
  border-bottom: 1px solid var(--line);
}
.secondary-grid article h3 { font-size: 1.55rem; margin-bottom: 10px; }
.secondary-grid article h3 a { color: inherit; text-decoration: none; }
.secondary-grid article h3 a:hover { color: var(--accent); }
.secondary-grid .deck { color: var(--muted); margin-bottom: 12px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
}
.card { display: flex; flex-direction: column; }
.card-media {
  display: block;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.card-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.card:hover .card-media img { transform: scale(1.02); }
.card h3 {
  font-size: 1.28rem;
  line-height: 1.22;
  margin-bottom: 8px;
}
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card .meta { margin-top: auto; }
.card .deck { color: var(--muted); font-size: 0.94rem; line-height: 1.5; margin-bottom: 12px; }

.top-topics {
  padding: 54px 0;
  border-bottom: 1px solid var(--line);
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 36px;
}
.topic-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.topic-row:hover { color: var(--accent); }
.topic-row span.count { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

/* ---------- article ---------- */

.article {
  padding-top: 40px;
}
.breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 26px;
}
.article > .breadcrumb {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.breadcrumb li + li::before { content: "›"; margin-right: 8px; color: var(--line-strong); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

.article-header {
  max-width: 800px;
  margin: 0 auto 30px;
  text-align: left;
}
.article-header h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.7rem);
  letter-spacing: -0.03em;
  line-height: 1.06;
  margin-bottom: 18px;
}
.article-deck {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.7vw, 1.42rem);
  line-height: 1.45;
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 22px;
}
.article-meta {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.article-meta .author { color: var(--ink-soft); font-weight: 500; }
.article-meta .author a { color: inherit; text-decoration: none; }
.article-meta .author a:hover { text-decoration: underline; }
.article-meta .dot { opacity: 0.45; }

.article-hero {
  max-width: 1000px;
  margin: 34px auto;
}
.article-hero img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.article-hero figcaption {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 9px;
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.76;
  color: var(--ink-soft);
}
.prose > * + * { margin-top: 1.15em; }
.prose p { margin: 0; }
.prose h2 {
  font-size: 1.72rem;
  line-height: 1.2;
  margin-top: 1.9em;
  margin-bottom: 0.2em;
  color: var(--ink);
}
.prose h3 {
  font-size: 1.34rem;
  margin-top: 1.7em;
  margin-bottom: 0.2em;
  color: var(--ink);
}
.prose h4, .prose h5, .prose h6 {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 1.9em;
  margin-bottom: 0.4em;
  color: var(--muted);
}
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-strong); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 24px;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--ink-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 1.1em 0; }
.prose li { margin: 0.45em 0; }
.prose li::marker { color: var(--accent); }
.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.8em auto;
  border-radius: 6px;
  background: var(--surface-2);
}
.prose img.alignright { float: right; margin: 0.4em 0 1.2em 1.6em; max-width: 46%; }
.prose img.alignleft { float: left; margin: 0.4em 1.6em 1.2em 0; max-width: 46%; }
.prose img.aligncenter { margin-left: auto; margin-right: auto; }
.prose figure { margin: 1.8em 0; }
.prose figcaption { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); margin-top: 8px; text-align: left; }
.prose iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  margin: 1.8em 0;
}
.prose video, .prose audio { width: 100%; margin: 1.5em 0; }
.prose .table-wrap { overflow-x: auto; margin: 1.8em 0; -webkit-overflow-scrolling: touch; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  min-width: 540px;
}
.prose th, .prose td { border: 1px solid var(--line-strong); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.prose .embed-ref {
  display: block;
  font-family: var(--sans);
  font-size: 0.92rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 1.6em 0;
  color: var(--muted);
}
.prose .embed-ref a { font-weight: 600; }
.prose sup, .prose sub { line-height: 0; }
.prose hr { margin: 2.2em 0; }

.article-tags {
  max-width: var(--measure);
  margin: 42px auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-chip {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 11px;
  text-decoration: none;
}
a.tag-chip:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.related {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  padding-top: 30px;
}
.related h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.related-item h3 { font-size: 1.12rem; line-height: 1.25; margin-bottom: 8px; }
.related-item h3 a { color: inherit; text-decoration: none; }
.related-item h3 a:hover { color: var(--accent); }
.related-item .meta { font-size: 0.78rem; }

.pager {
  margin-top: 54px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding-top: 26px;
}
.pager a { text-decoration: none; color: var(--ink-soft); display: block; }
.pager a:hover { color: var(--accent); }
.pager .label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 6px; }
.pager .title { font-family: var(--serif); font-size: 1.05rem; line-height: 1.3; }
.pager .next { text-align: right; }

/* ---------- list pages ---------- */

.list-header {
  padding: 52px 0 30px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 10px;
}
.list-header h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.5rem);
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}
.list-header .intro {
  color: var(--muted);
  max-width: 62ch;
  margin: 0;
  font-size: 1.02rem;
}
.list-count { color: var(--muted); font-size: 0.82rem; margin-top: 14px; }

.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li {
  border-bottom: 1px solid var(--line);
  padding: 26px 0;
}
.article-list h2 {
  font-size: 1.5rem;
  line-height: 1.22;
  margin: 0 0 8px;
}
.article-list h2 a { color: inherit; text-decoration: none; }
.article-list h2 a:hover { color: var(--accent); }
.article-list .deck { color: var(--muted); font-size: 0.95rem; line-height: 1.55; margin: 0 0 10px; max-width: 78ch; }
.article-list .meta { font-size: 0.8rem; }

.child-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 22px 0 0;
}
.child-topics a {
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.child-topics a:hover { color: var(--accent); border-color: var(--accent); }
.child-topics .count { color: var(--muted); font-size: 0.72rem; }

/* ---------- topics page ---------- */

.topics-section { padding: 40px 0 10px; border-bottom: 1px solid var(--line); }
.topics-section h2 { font-size: 1.7rem; margin-bottom: 6px; }
.topics-section .intro { color: var(--muted); margin-bottom: 24px; }
.topics-columns {
  columns: 3;
  column-gap: 44px;
  padding-bottom: 26px;
}
.topics-columns a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  break-inside: avoid;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
}
.topics-columns a:hover { color: var(--accent); }
.topics-columns .count { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* ---------- archive ---------- */

.archive-year { margin-top: 46px; }
.archive-year > h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 6px;
}
.archive-month h3 { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 26px 0 4px; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}
.archive-list time { flex: 0 0 56px; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.archive-list a { color: var(--ink-soft); text-decoration: none; }
.archive-list a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- events ---------- */

.event-list { display: grid; gap: 0; }
.event-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 28px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.event-date {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  text-align: center;
  padding: 12px 8px;
  background: var(--surface);
}
.event-date .d { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1; }
.event-date .m { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-top: 4px; }
.event-item h2 { font-size: 1.45rem; margin-bottom: 8px; }
.event-item h2 a { color: inherit; text-decoration: none; }
.event-item h2 a:hover { color: var(--accent); }
.event-meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 8px; }
.event-item p { color: var(--muted); font-size: 0.94rem; margin-bottom: 12px; max-width: 74ch; }

.event-detail { max-width: 760px; }
.event-detail .event-facts {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 24px 0 34px;
  display: grid;
  gap: 12px;
  font-size: 0.94rem;
}
.event-facts div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.event-facts dt, .event-facts .k { color: var(--muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.1em; padding-top: 3px; }
.event-facts .v { color: var(--ink-soft); }

/* ---------- magazine ---------- */

.issue-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px 28px;
  padding: 34px 0;
}
.issue-card { display: flex; gap: 16px; align-items: flex-start; }
.issue-card img {
  width: 96px;
  border-radius: 4px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.issue-card h3 { font-size: 1.02rem; line-height: 1.3; margin-bottom: 4px; }
.issue-card a { text-decoration: none; }
.issue-card a:hover h3 { color: var(--accent); }
.issue-card .meta { font-size: 0.76rem; }

/* ---------- search ---------- */

.search-box {
  max-width: 720px;
  margin: 30px 0 12px;
}
.search-box label { display: block; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.search-box input[type="search"] {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.4rem;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.search-box input[type="search"]:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.search-hint { color: var(--muted); font-size: 0.86rem; }
#results { margin-top: 26px; }
#results .result {
  display: block;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
#results .result:hover h2 { color: var(--accent); }
#results h2 { font-size: 1.34rem; margin-bottom: 6px; }
#results p { color: var(--muted); font-size: 0.92rem; margin-bottom: 8px; max-width: 80ch; }
#results .meta { font-size: 0.78rem; }
#result-count { color: var(--muted); font-size: 0.82rem; margin: 18px 0 0; }

/* ---------- pages ---------- */

.page-header { max-width: 820px; padding: 50px 0 26px; border-bottom: 2px solid var(--ink); margin-bottom: 34px; }
.page-header h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); letter-spacing: -0.03em; margin-bottom: 12px; }
.page-header p { color: var(--muted); max-width: 64ch; margin: 0; }
.page-body { max-width: var(--measure); margin: 0 auto; font-size: 1.06rem; line-height: 1.72; }
.page-body h2 { margin-top: 1.8em; }
.page-body h3 { margin-top: 1.5em; }
.page-body img { max-width: 100%; height: auto; border-radius: 6px; }
.page-body table { width: 100%; border-collapse: collapse; }
.page-body th, .page-body td { border: 1px solid var(--line-strong); padding: 10px; }
.page-body .table-wrap { overflow-x: auto; }

.empty-state {
  padding: 48px 0 60px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .issue-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

@media (max-width: 860px) {
  .wrap { padding: 0 18px; }
  .primary-nav { display: none; }
  .search-link { margin-left: auto; }
  .nav-mobile { display: block; position: relative; }
  .nav-mobile summary {
    list-style: none;
    cursor: pointer;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.86rem;
    color: var(--ink-soft);
  }
  .nav-mobile summary::-webkit-details-marker { display: none; }
  .nav-mobile summary:hover { border-color: var(--accent); color: var(--accent); }
  .nav-mobile nav {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 10px;
    display: grid;
    gap: 2px;
    z-index: 60;
  }
  .nav-mobile a {
    padding: 10px 12px;
    border-radius: 7px;
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 0.92rem;
  }
  .nav-mobile a:hover { background: var(--surface-2); color: var(--ink); }

  .hero { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .hero-text { max-width: none; }
  .secondary-grid { grid-template-columns: 1fr; gap: 34px; }
  .home-intro { flex-direction: column; align-items: flex-start; gap: 12px; }
  .topics-columns { columns: 2; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .article-list h2 { font-size: 1.34rem; }
  .event-item { grid-template-columns: 86px 1fr; gap: 18px; }
}

@media (max-width: 620px) {
  .header-inner { min-height: 64px; gap: 12px; }
  .brand-name { font-size: 1.32rem; }
  .brand-tag { display: none; }
  .search-link span { display: none; }
  .search-link { padding: 7px 10px; }

  .home-intro { padding-top: 30px; }
  .card-grid { grid-template-columns: 1fr; gap: 30px; }
  .topic-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; gap: 24px; }
  .topics-columns { columns: 1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; }

  .article { padding-top: 26px; }
  .article-header h1 { font-size: 2.05rem; }
  .prose { font-size: 1.08rem; }
  .prose img.alignright, .prose img.alignleft { float: none; max-width: 100%; margin: 1.5em auto; }
  .pager { grid-template-columns: 1fr; gap: 20px; }
  .pager .next { text-align: left; }
  .archive-list li { gap: 12px; }
  .archive-list time { flex-basis: 46px; }
  .issue-grid { grid-template-columns: 1fr; }
  .event-item { grid-template-columns: 1fr; }
  .event-date { display: flex; align-items: baseline; gap: 8px; width: fit-content; padding: 8px 14px; }
  .event-date .d { font-size: 1.3rem; }
  .event-date .m { margin: 0; }
}

/* ---------- print ---------- */

@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #fff;
    --ink: #000; --ink-soft: #111; --muted: #444;
    --line: #ccc; --line-strong: #999; --accent: #000; --accent-soft: #fff; --accent-ink: #fff;
  }
  .site-header, .site-footer, .breadcrumb, .related, .pager, .article-tags, .skip-link { display: none !important; }
  .article { padding-top: 0; }
  .article-header, .prose { max-width: none; }
  a { color: #000; text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
  .article-hero img { max-height: none; }
}
