/* Shared styles for the guide pages (the home page keeps its own inline copy of the tokens). */
:root {
  --ground: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #121A23;
  --ink-2: #47535F;
  --ink-3: #75808B;
  --line: #DDE2E8;
  --accent: #C4213F;
  --accent-soft: #FBE9EC;
  --blue: #0A6CF0;
  --good: #23805A;
  --warn: #A3680C;
  --radius: 18px;
  --cat-normal: #23805A;
  --cat-elevated: #A3680C;
  --cat-stage1: #D2561B;
  --cat-stage2: #C4213F;
  --cat-severe: #7A1027;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0D1116;
    --surface: #161C23;
    --ink: #E9EEF3;
    --ink-2: #AEB8C2;
    --ink-3: #7E8994;
    --line: #27313B;
    --accent: #F0607A;
    --accent-soft: #331C22;
    --blue: #4C9BFF;
    --good: #63C496;
    --warn: #E3AE52;
    --cat-normal: #63C496;
    --cat-elevated: #E3AE52;
    --cat-stage1: #F08A4B;
    --cat-stage2: #F0607A;
    --cat-severe: #FF8FA3;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 17px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
nav .links { display: flex; gap: 22px; font-size: 15px; }
nav .links a { color: var(--ink-2); text-decoration: none; }
nav .links a:hover { color: var(--ink); }
@media (max-width: 620px) { nav .links a:not(.keep) { display: none; } }

/* Article */
.crumbs { font-size: 14px; color: var(--ink-3); margin: 18px 0 0; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
article { max-width: 720px; margin: 0 auto; padding: 8px 0 24px; }
article h1 { font-size: clamp(32px, 4.6vw, 46px); line-height: 1.1; letter-spacing: -0.025em; margin: 14px 0 14px; text-wrap: balance; }
article .lede { font-size: 20px; color: var(--ink-2); margin: 0 0 18px; text-wrap: pretty; }
article .meta { font-size: 14px; color: var(--ink-3); margin: 0 0 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
article h2 { font-size: 27px; line-height: 1.2; letter-spacing: -0.015em; margin: 44px 0 12px; text-wrap: balance; scroll-margin-top: 16px; }
article h3 { font-size: 20px; margin: 30px 0 8px; scroll-margin-top: 16px; }
article p, article li { color: var(--ink-2); }
article p { margin: 0 0 16px; }
article ul, article ol { padding-left: 22px; margin: 0 0 18px; }
article li { margin-bottom: 8px; }
article strong { color: var(--ink); }

.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; margin: 0 0 8px; font-size: 15.5px; }
.toc strong { display: block; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin-bottom: 4px; }

.callout { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px; padding: 16px 20px; margin: 22px 0; }
.callout.warn { border-left-color: var(--accent); }
.callout p:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 18px 0 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td { color: var(--ink-2); }
.cat { font-weight: 650; white-space: nowrap; }
.cat::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: currentColor; vertical-align: 0; }
.cat-normal { color: var(--cat-normal); }
.cat-elevated { color: var(--cat-elevated); }
.cat-stage1 { color: var(--cat-stage1); }
.cat-stage2 { color: var(--cat-stage2); }
.cat-severe { color: var(--cat-severe); }
.cat-low { color: var(--blue); }

/* Reading checker */
.checker { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 22px 0 8px; }
.checker .inputs { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.checker label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; }
.checker input { font: inherit; font-size: 24px; font-variant-numeric: tabular-nums; width: 112px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); }
.checker .slash { font-size: 28px; color: var(--ink-3); padding-bottom: 8px; }
.checker .result { margin-top: 16px; min-height: 52px; }
.checker .result strong { font-size: 20px; }
.checker .result p { margin: 4px 0 0; color: var(--ink-2); }

/* App promo inside articles */
.promo { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 34px 0; }
.promo img.icon { width: 64px; height: 64px; border-radius: 15px; }
.promo h3 { margin: 0 0 4px; font-size: 18px; }
.promo p { margin: 0 0 12px; font-size: 15.5px; }
.promo .badge img { height: 44px; width: auto; }
@media (max-width: 560px) { .promo { grid-template-columns: 1fr; } }

.sources { font-size: 14.5px; }
.sources li { margin-bottom: 6px; }
.related { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.related ul { list-style: none; padding: 0; }
.related li { margin-bottom: 10px; }
.related a { font-weight: 600; text-decoration: none; }

.dl { display: inline-flex; align-items: center; gap: 8px; background: var(--blue); color: #fff; text-decoration: none; font-weight: 650; padding: 13px 20px; border-radius: 12px; margin: 6px 12px 6px 0; }
.dl.secondary { background: transparent; color: var(--blue); border: 1px solid var(--line); }

/* Blog index */
.index-head { max-width: 680px; padding: 24px 0 26px; }
.index-head h1 { font-size: clamp(34px, 4.8vw, 50px); line-height: 1.08; letter-spacing: -0.025em; margin: 10px 0 12px; }
.index-head p { color: var(--ink-2); font-size: 19px; margin: 0; }
.posts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-decoration: none; color: inherit; display: block; }
.post:hover { border-color: var(--blue); }
.post .kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.post h2 { font-size: 21px; line-height: 1.25; margin: 8px 0 8px; color: var(--ink); letter-spacing: -0.01em; }
.post p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 760px) { .posts { grid-template-columns: 1fr; } }

footer { padding: 48px 0 60px; color: var(--ink-3); font-size: 14px; margin-top: 40px; border-top: 1px solid var(--line); }
footer .row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer a { color: var(--ink-2); text-decoration: none; margin-right: 18px; }
footer .disclaimer { margin-top: 18px; max-width: 80ch; }

#consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; z-index: 10;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 20px 50px -20px rgba(15, 25, 40, .4); font-size: 14.5px; color: var(--ink-2);
  display: none; gap: 14px; align-items: center; flex-wrap: wrap;
}
#consent p { margin: 0; flex: 1 1 260px; }
#consent button { font: inherit; font-weight: 600; border-radius: 10px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--ink); }
#consent button.yes { background: var(--blue); border-color: var(--blue); color: #fff; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

@media print {
  nav, footer, #consent, .promo, .related, .toc, .crumbs { display: none !important; }
  body { background: #fff; }
}

/* Japanese pages: system CJK fonts on Mac, Windows and Android. */
html:lang(ja) body { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif; }
