/* jsr site — one stylesheet, no external fonts, light/dark by prefers-color-scheme */
:root {
  --bg: #ffffff;
  --surface: #f4f6fa;
  --surface-2: #e9eef6;
  --ink: #12202f;
  --muted: #4b5b6b;
  --rule: #d3dbe6;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --up: #0b7d5b;
  --down: #b3261e;
  --flat: #5b6b7b;
  --shadow: 0 1px 2px rgba(18, 32, 47, .06), 0 8px 24px rgba(18, 32, 47, .06);
  --radius: 10px;
  --wrap: 1200px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #121b2c;
    --surface-2: #18233a;
    --ink: #e6edf6;
    --muted: #a9b8c9;
    --rule: #26344d;
    --accent: #7fb0ff;
    --accent-ink: #08111f;
    --up: #3ddc97;
    --down: #ff8a80;
    --flat: #a9b8c9;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
img { max-width: 100%; height: auto; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.col-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; font-weight: 700; }
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* header */
.site-header { background: var(--bg); border-bottom: 1px solid var(--rule); }
.header-row { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.site-name {
  font-weight: 800; font-size: 17px; letter-spacing: .02em; color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.primary { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-left: 8px; }
.primary a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 2px; border-bottom: 2px solid transparent; }
.primary a:hover { border-bottom-color: var(--accent); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tool {
  font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none;
  border: 1px solid var(--rule); border-radius: 999px; padding: 5px 12px; background: var(--surface);
  cursor: pointer;
}
summary.tool { list-style: none; }
summary.tool::-webkit-details-marker { display: none; }
.mega { position: relative; }
.mega-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: min(92vw, 980px); background: var(--bg); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.mega-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; }
.mega-col .col-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; }
.mega-col ul { list-style: none; margin: 0; padding: 0; }
.mega-col li { margin: 2px 0; }
.mega-col a { color: var(--ink); text-decoration: none; font-size: 14px; }
.mega-col a:hover { color: var(--accent); }
.mega-note { color: var(--muted); font-size: 12px; }
.mega-aside { border-top: 1px solid var(--rule); margin-top: 14px; padding-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ticker */
.ticker { border-top: 1px solid var(--rule); background: var(--surface); }
.ticker-row { display: flex; gap: 22px; overflow-x: auto; padding: 7px 0; scrollbar-width: thin; }
.tick { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; font-size: 13px; }
.tick .name { color: var(--muted); font-weight: 600; }
.tick .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.tick .dir { font-size: 11px; font-weight: 700; }
.dir.up { color: var(--up); }
.dir.down { color: var(--down); }
.dir.flat { color: var(--flat); }

/* layout */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: 26px 0 48px; }
.layout.solo { grid-template-columns: minmax(0, 1fr); }
.layout > .main { min-width: 0; }
.crumbs { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding: 0; }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--rule); }
.crumbs a { color: var(--muted); }
.side { font-size: 14px; }
.side .col-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; }
.side ul { list-style: none; margin: 0 0 16px; padding: 0; border-left: 2px solid var(--rule); }
.side li { margin: 0; }
.side a { display: block; padding: 4px 10px; color: var(--ink); text-decoration: none; border-left: 2px solid transparent; margin-left: -2px; }
.side a:hover { color: var(--accent); }
.side a[aria-current="page"] { border-left-color: var(--accent); font-weight: 700; }

/* headings */
h1, h2, h3, h4 { line-height: 1.35; }
h1 { font-size: clamp(26px, 3.4vw, 40px); margin: 0 0 10px; letter-spacing: .01em; }
h2 { font-size: 22px; margin: 34px 0 10px; }
h3 { font-size: 18px; margin: 24px 0 8px; }
h4 { font-size: 16px; margin: 18px 0 6px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.dek { font-size: 17px; color: var(--muted); margin: 0 0 12px; }
.byline, .dateline { font-size: 13px; color: var(--muted); margin: 2px 0; }

/* hub */
.hub-head, .issue-head, .quote-head, .topic-head, .author-head, .archive-head, .page-head { margin-bottom: 20px; }
.lead { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; align-items: start;
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; background: var(--surface); margin-bottom: 26px; }
.lead h2 { margin: 0 0 6px; font-size: 24px; }
.lead p { margin: 0 0 8px; color: var(--muted); }
.lead img { border-radius: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 18px 0 8px; }
.card { border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; background: var(--bg); }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 8px; }
.rail { margin: 26px 0; }
.rail h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rail li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.rail time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rail a { color: var(--ink); text-decoration: none; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tile { display: block; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--surface); font-weight: 600; font-size: 14px; }
.tile:hover { border-color: var(--accent); }
.section-title { font-size: 16px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 6px; margin-top: 32px; }

/* article */
.issue-head { border-bottom: 1px solid var(--rule); padding-bottom: 16px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0 0; }
.tags li a { display: inline-block; font-size: 12px; padding: 2px 10px; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); text-decoration: none; }
.tags li a:hover { border-color: var(--accent); color: var(--accent); }
figure { margin: 22px 0; }
figure img { display: block; border: 1px solid var(--rule); border-radius: 8px; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.levels { margin: 22px 0; }
.levels table { width: 100%; border-collapse: collapse; font-size: 14px; }
.levels th, .levels td { border-bottom: 1px solid var(--rule); padding: 7px 8px; text-align: left; vertical-align: top; }
.levels th { color: var(--muted); font-weight: 600; font-size: 12px; }
.levels .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.prose { font-size: 16.5px; }
.prose p { margin: 0 0 1.05em; }
.prose ul, .prose ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: 1.2em 0; padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--surface); color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 6px 8px; text-align: left; }
.prose th { background: var(--surface); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose code { background: var(--surface-2); padding: 1px 4px; border-radius: 4px; font-size: .92em; }
.prose pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; }
.prose img { border-radius: 8px; }
.related { margin: 34px 0 0; }
.related h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.related .cards { margin-top: 10px; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 26px 0; }
.prevnext a { display: block; border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; text-decoration: none; color: var(--ink); background: var(--surface); }
.prevnext .label { display: block; font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.citation { margin: 26px 0; border-top: 1px solid var(--rule); padding-top: 14px; font-size: 13px; color: var(--muted); }
.citation code { display: block; margin-top: 6px; background: var(--surface); padding: 10px; border-radius: 6px; color: var(--ink); }
.generated { margin: 22px 0; padding: 10px 14px; border: 1px dashed var(--rule); border-radius: 8px; font-size: 13px; color: var(--muted); }
.disclaimer { margin: 28px 0 0; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); }

/* quote / series */
.latest-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; background: var(--surface); }
.latest-value .big { font-size: clamp(28px, 4vw, 44px); font-weight: 800; font-variant-numeric: tabular-nums; }
.latest-value .asof { color: var(--muted); font-size: 13px; }
.stats, .history { margin: 24px 0; }
.stats table, .history table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats th, .stats td, .history th, .history td { border-bottom: 1px solid var(--rule); padding: 7px 8px; text-align: left; }
.stats th, .history th { color: var(--muted); font-size: 12px; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }

/* topic / author / archive */
.list-issues { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.list-issues li { border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
.list-issues a { font-weight: 700; color: var(--ink); text-decoration: none; }
.list-issues p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.month-group h2 { font-size: 18px; margin-top: 28px; }

/* search */
.search-box { border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.search-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.search-box input { width: 100%; font-size: 16px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); color: var(--ink); }
.search-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.result-list { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 12px; }
.result-list li { border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
.result-list a { font-weight: 700; color: var(--ink); text-decoration: none; }
.result-list p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.result-list .empty { color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--rule); background: var(--surface); margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px; padding: 34px 0 18px; }
.footer-col .col-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 3px 0; }
.footer-col a { color: var(--ink); text-decoration: none; font-size: 13px; }
.footer-col a:hover { color: var(--accent); }
.footer-legal { border-top: 1px solid var(--rule); padding: 14px 0 28px; display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; }
.privacy, .copyright { margin: 0; font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .lead { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mega-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .header-row { flex-wrap: wrap; min-height: 0; padding: 10px 0; }
  .primary { order: 3; width: 100%; margin-left: 0; gap: 4px 12px; }
  .header-tools { margin-left: auto; }
  .mega-panel { position: fixed; left: 16px; right: 16px; top: 70px; width: auto; max-height: 70vh; overflow: auto; }
  .footer-grid { grid-template-columns: 1fr; }
  .prevnext { grid-template-columns: 1fr; }
  .rail li { grid-template-columns: 1fr; gap: 2px; }
}
@media print {
  .site-header .ticker, .side, .mega, .header-tools, .site-footer { display: none; }
  .layout { display: block; }
}

/* -- member login (E2EE) and locked issue body ---------------------------- */
.login-box {
  margin: 0 0 26px;
  padding: 20px 22px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-head h2 { margin: 0 0 6px; font-size: 20px; }
.login-lead { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.login-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
}
#e2ee-change-panel .login-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.login-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.login-submit {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.login-submit:hover { filter: brightness(1.06); }
.login-submit:disabled { opacity: .6; cursor: wait; }
.login-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.login-status { margin: 2px 0 6px; color: var(--up); font-weight: 700; }
.login-error {
  margin: 12px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--down);
  border-left: 5px solid var(--down);
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
}
.login-box [hidden] { display: none !important; }

.e2ee-locked {
  margin: 20px 0;
  padding: 34px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
}
.e2ee-lock-icon { margin: 0 0 8px; font-size: 24px; line-height: 1; }
.e2ee-lock-text { margin: 0 0 10px; color: var(--muted); }
.e2ee-lock { margin: 0; }
/* .prose p is more specific than a single class; keep the lock spacing. */
.e2ee-locked .e2ee-lock-icon { margin: 0 0 8px; font-size: 24px; line-height: 1; }
.e2ee-locked .e2ee-lock-text { margin: 0 0 10px; color: var(--muted); }
.e2ee-locked .e2ee-lock { margin: 0; }
.e2ee-locked a { color: var(--accent); font-weight: 700; }
.e2ee-content { margin-top: 8px; }
.e2ee-error { color: var(--down); font-size: 14px; }

@media (max-width: 720px) {
  .login-grid,
  #e2ee-change-panel .login-grid { grid-template-columns: 1fr; }
  .login-submit { width: 100%; }
}
