:root {
  --ink: #f6f1e8;
  --surface: #ffffff;
  --surface-raised: #fef6ec;
  --text: #221c14;
  --text-dim: #6b6152;
  --dawn: #c2570f;
  --dawn-soft: rgba(194, 87, 15, 0.09);
  --dawn-soft-strong: rgba(194, 87, 15, 0.16);
  --line: #e6ddcc;
  --link: #a1450a;
  --night: #16213a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #0b1220;
    --surface: #141d33;
    --surface-raised: #1b2645;
    --text: #eef1f7;
    --text-dim: #93a0bf;
    --dawn: #f4a261;
    --dawn-soft: rgba(244, 162, 97, 0.12);
    --dawn-soft-strong: rgba(244, 162, 97, 0.2);
    --line: #263355;
    --link: #ffbf86;
    --night: #0b1220;
  }
}

:root[data-theme="dark"] {
  --ink: #0b1220;
  --surface: #141d33;
  --surface-raised: #1b2645;
  --text: #eef1f7;
  --text-dim: #93a0bf;
  --dawn: #f4a261;
  --dawn-soft: rgba(244, 162, 97, 0.12);
  --dawn-soft-strong: rgba(244, 162, 97, 0.2);
  --line: #263355;
  --link: #ffbf86;
  --night: #0b1220;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.9;
}

h1, h2, .display {
  font-family: "Zen Old Mincho", "Noto Serif JP", serif;
  text-wrap: balance;
}

a { color: var(--link); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: var(--night);
  color: #f2ede2;
  overflow: hidden;
  padding: 76px 24px 0;
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #f4a261;
  margin-bottom: 22px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: #f4a261;
  display: inline-block;
}

.hero h1 {
  font-size: clamp(30px, 5.4vw, 46px);
  font-weight: 700;
  margin: 0 0 18px;
  letter-spacing: 0.02em;
}

.hero p.lead {
  max-width: 32em;
  color: #c9d1e6;
  font-size: 15.5px;
  margin: 0 0 40px;
}

.wave-wrap {
  max-width: 780px;
  margin: 0 auto;
}

canvas#breath {
  display: block;
  width: 100%;
  height: 150px;
}

.wave-caption {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: #7c88a8;
  padding: 6px 0 30px;
  border-top: 1px solid #223056;
}

.wave-caption span:last-child { color: #f4a261; }

/* ---------- Main ---------- */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 52px 24px 90px;
}

.section-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--dawn);
  margin: 0 0 8px;
}

.section-title {
  font-size: 21px;
  margin: 0 0 6px;
}

.section-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0 0 30px;
}

.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--dawn-soft-strong) transparent;
}

.article-list::-webkit-scrollbar { width: 8px; }
.article-list::-webkit-scrollbar-track { background: transparent; }
.article-list::-webkit-scrollbar-thumb {
  background: var(--dawn-soft-strong);
  border-radius: 999px;
}
.article-list::-webkit-scrollbar-thumb:hover { background: var(--dawn); }

.article-item {
  border-bottom: 1px solid var(--line);
}

.article-toggle {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 16px;
  background: none;
  border: none;
  text-align: left;
  padding: 20px 4px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}

.article-toggle:hover .article-title { color: var(--dawn); }
.article-toggle:focus-visible { outline: 2px solid var(--dawn); outline-offset: 4px; }

.num {
  font-family: "Zen Old Mincho", serif;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--dawn);
  flex-shrink: 0;
  padding-top: 2px;
}

.article-title-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-title {
  font-size: 16px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.article-date {
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.chev {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  color: var(--text-dim);
  transition: transform 0.25s ease;
  margin-top: 3px;
}

.article-item[data-open="true"] .chev { transform: rotate(45deg); color: var(--dawn); }

.article-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.article-panel-inner {
  padding: 0 4px 26px 40px;
}

.article-panel-inner p {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--text);
  max-width: 34em;
}

.article-lead {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 34em;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--dawn);
  background: var(--dawn-soft);
  border-radius: 0 6px 6px 0;
}

.article-lead .lead-tag {
  flex-shrink: 0;
  font-family: "Zen Old Mincho", serif;
  font-size: 12px;
  color: var(--dawn);
  letter-spacing: 0.06em;
  padding-top: 1px;
}

.article-lead p {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  max-width: none;
}

.sources {
  background: var(--dawn-soft);
  border: 1px solid var(--dawn-soft-strong);
  border-radius: 4px;
  padding: 14px 16px;
  font-size: 12.5px;
  max-width: 34em;
}

.sources-label {
  font-family: "Zen Old Mincho", serif;
  color: var(--dawn);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  font-size: 12px;
}

.sources ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
}

.sources a { text-decoration: none; }
.sources a:hover { text-decoration: underline; }

/* ---------- Article visuals: tables, bar charts, stats, diagrams ---------- */
.viz {
  max-width: 34em;
  margin: 0 0 22px;
}

.viz-title {
  font-family: "Zen Old Mincho", serif;
  font-size: 13px;
  color: var(--dawn);
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.viz-note {
  font-size: 11.5px;
  color: var(--text-dim);
  margin: 8px 0 0;
}

/* tables */
.viz-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.viz-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.viz-table th,
.viz-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.viz-table thead th {
  background: var(--surface-raised);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
}

.viz-table tbody tr:last-child td { border-bottom: none; }
.viz-table td.num { font-variant-numeric: tabular-nums; color: var(--dawn); }

/* bar charts */
.viz-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-group-label {
  font-size: 12px;
  color: var(--text-dim);
  margin: 10px 0 2px;
  letter-spacing: 0.04em;
}

.bar-group-label:first-child { margin-top: 0; }

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 64px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.3;
}

.bar-sub {
  font-size: 10.5px;
  opacity: 0.85;
}

.bar-track {
  position: relative;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: visible;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--dawn);
}

.bar-fill.fill-warn { background: #d1451f; }
.bar-fill.fill-calm { background: #6fae8f; }

.bar-marker {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 16px;
  background: var(--text);
  opacity: 0.6;
}

.bar-value {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
}

/* stat tiles */
.viz-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-tile {
  background: var(--dawn-soft);
  border: 1px solid var(--dawn-soft-strong);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-value {
  font-family: "Zen Old Mincho", serif;
  font-size: 26px;
  color: var(--dawn);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .viz-stats { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 84px 1fr 54px; }
}

/* diagrams */
.viz-diagram-wrap {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: var(--surface-raised);
}

.viz-diagram-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.d-wall { fill: none; stroke: var(--text-dim); stroke-width: 2; }
.d-tissue { fill: var(--dawn); opacity: 0.55; }
.d-tissue-open { fill: var(--dawn); opacity: 0.3; }
.d-airflow { stroke: var(--link); stroke-width: 2; fill: none; }
.d-airflow-thin { stroke: var(--link); stroke-width: 1.4; fill: none; }
.d-arrowhead { fill: var(--link); }
.d-blocked { font-size: 26px; fill: #d1451f; }
.d-label { font-size: 12px; fill: var(--text); font-weight: 500; }
.d-label-s { font-size: 12px; fill: var(--text); }
.d-sublabel { font-size: 10.5px; fill: var(--text-dim); }
.d-box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.line-good { fill: none; stroke: var(--dawn); stroke-width: 2; stroke-linejoin: round; }
.line-bad { fill: none; stroke: #d1451f; stroke-width: 1.6; stroke-linejoin: round; }

/* ---------- CTA ---------- */
.cta {
  margin-top: 48px;
  padding: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--dawn-soft), transparent);
  border: 1px solid var(--dawn-soft-strong);
}

.cta .section-label { margin-bottom: 10px; }

.cta p {
  margin: 0;
  font-size: 14.5px;
  color: var(--text);
  max-width: 34em;
}

.cta strong { color: var(--dawn); }

footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px 60px;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

@media (prefers-reduced-motion: reduce) {
  .chev, .article-panel { transition: none; }
}
