/* Shared base for every page in blog/. One column, system fonts, neutral palette.
   Accent colors are reserved for meaning (series / highlighted material), never decoration. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #ffffff;
  --fg: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --soft: #f4f4f4;
  --accent: #2457d6;
  --accent-soft: #e6edfb;
  --accent-2: #2f7a4a;
  --accent-2-soft: #e3f0e7;
  --mark: #fff0a3;
  --mark-fg: #1c1c1c;
  --warn: #c0392b;
  --sans: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --fg: #e6e6e6; --muted: #9a9a9a; --line: #2b2b2b; --soft: #1c1c1c;
    --accent: #8aa8ff; --accent-soft: #1c2540; --accent-2: #7cc496; --accent-2-soft: #19301f;
    --mark: #5a4c10; --mark-fg: #fff6cc; --warn: #ef8a7a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --fg: #e6e6e6; --muted: #9a9a9a; --line: #2b2b2b; --soft: #1c1c1c;
  --accent: #8aa8ff; --accent-soft: #1c2540; --accent-2: #7cc496; --accent-2-soft: #19301f;
  --mark: #5a4c10; --mark-fg: #fff6cc; --warn: #ef8a7a;
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
  padding-block: 64px 96px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; }
header { display: flex; flex-direction: column; gap: 12px; }
section { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

h1, h2, h3 { font-weight: 700; line-height: 1.4; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 5vw, 2.25rem); letter-spacing: 0.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); }
mark { background: var(--mark); color: var(--mark-fg); padding: 0 0.15em; border-radius: 2px; }
code, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Small label above or below a title */
.meta { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); letter-spacing: 0.04em; }

/* Bordered container for a figure or demo */
.box { border: 1px solid var(--line); border-radius: 8px; padding: 20px; min-width: 0; }

/* Toggle buttons */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font: inherit; font-size: 0.88rem; line-height: 1.5;
  color: var(--fg); background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 14px; cursor: pointer;
}
.chips button:hover { border-color: var(--muted); }
.chips button[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }

/* Tables */
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th { border-bottom-color: var(--fg); }
tr:last-child td, tr:last-child th { border-bottom: none; }

@media (prefers-reduced-motion: no-preference) {
  .chips button { transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
}
