:root {
  color-scheme: light;
  --bg-top: #f9f4ea;
  --bg: #f7f5ef;
  --bg-bottom: #f2efe8;
  --panel: #ffffff;
  --panel-soft: #fffdfa;
  --line: #d8d0c4;
  --ink: #1d1c1a;
  --muted: #6a665d;
  --accent: #2d5b88;
  --accent-strong: #1f466e;
  --accent-soft: #eaf1fb;
  --market: #3c6f4a;
  --market-soft: #e8f5eb;
  --warn: #9b5f00;
  --warn-soft: #fff2de;
  --danger: #8b2f2f;
  --danger-soft: #fdeaea;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --shadow: 0 8px 24px rgba(32, 27, 18, 0.05);
  --font-sans: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  font-family: var(--font-sans);
  line-height: 1.7;
  letter-spacing: 0;
}

a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 4px;
}

a:hover { color: var(--accent-strong); }
a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 3px; }

img, svg, video { max-width: 100%; height: auto; }
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

/* Header */
.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 16px;
}

.brand { color: var(--ink); font-weight: 700; letter-spacing: 0; text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip, .pill, .tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.language-switch {
  display: inline-flex;
  align-items: stretch;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--panel-soft);
}

.language-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 42px;
  padding: 4px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.language-option + .language-option { border-left: 1px solid var(--line); }
.language-option.is-active { background: var(--ink); color: var(--panel); }
.language-option:not(.is-active):hover { background: var(--accent-soft); color: var(--accent); }

/* Home hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  align-items: center;
  gap: 32px;
  padding: 36px 0 32px;
}

.hero > *, .lead-layout > * { min-width: 0; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.hero h1 {
  max-width: 20ch;
  margin: 0 0 16px;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.hero-copy { max-width: 38ch; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }

.hero-panel {
  min-width: 0;
  min-height: 300px;
  padding: 24px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, #f7fbff, var(--accent-soft));
  box-shadow: var(--shadow);
}

.panel-label { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }

.signal-bars {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  height: 150px;
  margin: 22px 0 18px;
  gap: 7px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
}

.signal-bars span {
  min-width: 0;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #7397bd, var(--accent));
}

.signal-bars span:nth-child(3n) { background: linear-gradient(180deg, #7ca58a, var(--market)); }
.panel-statement { max-width: 330px; margin: 0; color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1.4; }

/* Home summary */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--line);
}

.stat { padding: 18px; background: var(--panel); }
.stat strong { display: block; color: var(--ink); font-size: 28px; line-height: 1; }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 16px;
  padding-top: 24px;
  border-top: 2px solid var(--ink);
}

.section-head h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: 0; }
.section-head p { max-width: 520px; margin: 0; color: var(--muted); font-size: 14px; }

.lead-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 1fr;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 40px;
}

.lead-story, .side-brief, .story-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.lead-story {
  min-height: 280px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.lead-story h2 { margin: 12px 0; font-size: 24px; font-weight: 700; line-height: 1.35; letter-spacing: 0; overflow-wrap: anywhere; }
.lead-story h2 a, .story-card h3 a { color: var(--ink); text-decoration: none; }
.lead-story h2 a:hover, .story-card h3 a:hover { color: var(--accent); }
.lead-story p { max-width: 720px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }

.side-brief { padding: 22px; background: var(--panel-soft); }
.side-brief h3 { margin: 0 0 10px; font-size: 18px; font-weight: 700; }
.side-brief p, .side-brief li { color: var(--muted); font-size: 14px; line-height: 1.65; }
.side-brief ul { margin: 10px 0 0; padding-left: 18px; }

.article-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding-bottom: 56px;
}

.story-card {
  min-width: 0;
  min-height: 290px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.story-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); transition: transform 150ms ease, border-color 150ms ease; }

.kicker {
  display: inline-flex;
  width: fit-content;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.story-card h3 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.45; letter-spacing: 0; overflow-wrap: anywhere; }
.story-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.story-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.story-meta span { padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--radius-full); background: var(--panel-soft); color: var(--muted); font-size: 12px; }

/* Article pages */
.article-header { border-bottom: 1px solid var(--line); background: var(--panel); }
.article-hero { width: min(860px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 30px; }
.article-hero h1 { margin: 14px 0; font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 700; line-height: 1.22; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.article-hero p { color: var(--muted); font-size: 16px; line-height: 1.7; }

.article {
  width: min(860px, calc(100% - 40px));
  margin: 28px auto 60px;
  padding: 32px clamp(20px, 4vw, 46px) 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.article > :first-child { margin-top: 0; }
.article h2 { margin-top: 42px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 24px; font-weight: 700; line-height: 1.4; letter-spacing: 0; }
.article h3 { margin-top: 30px; font-size: 19px; font-weight: 700; line-height: 1.5; letter-spacing: 0; }
.article h4 { margin-top: 24px; font-size: 17px; }
.article p, .article li { font-size: 16px; line-height: 1.8; }
.article li + li { margin-top: 0.4em; }
.article img, .article iframe { max-width: 100%; border-radius: var(--radius-lg); }
.article iframe { width: 100%; border: 1px solid var(--line); }
.article blockquote { margin: 20px 0; padding: 4px 18px; border-left: 4px solid var(--line); color: var(--muted); }

.notice { margin: 20px 0; padding: 14px 16px; border-left: 5px solid var(--warn); border-radius: var(--radius-md); background: var(--warn-soft); color: #4b2d0b; }
.info-box { margin: 20px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-soft); color: var(--muted); font-size: 14px; }
.info-box ul { margin: 8px 0 0; padding-left: 20px; }
.admonition { margin: 18px 0; padding: 12px 16px; border-left: 5px solid var(--accent); border-radius: var(--radius-md); background: var(--accent-soft); }
.admonition.warning { border-left-color: var(--warn); background: var(--warn-soft); }
.admonition-title { margin-top: 0; font-weight: 700; }

.grid.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding: 0; list-style: none; }
.grid.cards > * { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-soft); }

table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 18px 0;
  overflow-x: auto;
  border-collapse: collapse;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

th, td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { background: var(--panel-soft); font-weight: 700; }
pre { max-width: 100%; padding: 14px; overflow-x: auto; border-radius: var(--radius-lg); background: #1f2430; color: #f5f7ff; }
code { padding: 2px 6px; border-radius: var(--radius-sm); background: #f1ece1; font-family: var(--font-mono); font-size: 0.9em; overflow-wrap: anywhere; }
pre code { padding: 0; background: transparent; }

.md-button, .copy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.md-button:hover, .copy-link:hover { background: var(--accent-strong); color: #fff; }
.sns-share-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }
.footnote, .footnote-ref, .footnote-backref { font-size: 0.9em; }

/* Privacy page */
.privacy-page { width: min(860px, calc(100% - 40px)); margin: 34px auto 56px; padding: clamp(24px, 5vw, 46px); border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--panel); box-shadow: var(--shadow); }
.privacy-page h1 { margin: 0 0 10px; font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; }
.privacy-page h2 { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 1.35rem; }
.privacy-page p, .privacy-page li { color: var(--muted); }
.updated { color: var(--muted); font-size: 0.92rem; }

/* Footer */
.site-footer { padding: 24px 0; border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .story-card:hover { transform: none; transition: none; }
}

@media (max-width: 860px) {
  .hero, .lead-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 38px; }
  .hero-panel { min-height: 240px; }
  .lead-story h2 { font-size: 22px; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head { display: block; }
  .section-head p { margin-top: 8px; }
}

@media (max-width: 560px) {
  .wrap, .article, .article-hero, .privacy-page { width: calc(100% - 28px); }
  .topbar { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .hero { padding-top: 24px; gap: 20px; }
  .hero h1 { max-width: 11ch; font-size: 30px; }
  .hero-copy { max-width: 30ch; font-size: 15px; overflow-wrap: anywhere; word-break: break-word; }
  .hero-panel { min-height: 220px; padding: 18px; }
  .signal-bars { height: 120px; gap: 4px; }
  .panel-label span:last-child { display: none; }
  .panel-statement { font-size: 16px; }
  .stats-row { grid-template-columns: 1fr; }
  .story-card { min-height: auto; }
  .article { margin-top: 18px; padding: 24px 18px 40px; }
  .article-hero h1 { font-size: 27px; }
  .article h2 { font-size: 21px; }
  .grid.cards { grid-template-columns: 1fr; }
}
