/* ============================================================
   report-pipeline — BASE
   構造・レイアウトの中立CSS。色は :root 変数経由で、
   テーマファイル（themes/*.css）が上書きする。
   ============================================================ */

:root {
  /* palette（デフォルト = neo-brutalism） */
  --bg: #faf6ef;
  --ink: #111;
  --border: #111;
  --red: #ff5d5d;
  --yellow: #ffd60a;
  --mint: #6ee7b7;
  --blue: #6eb5ff;
  --pink: #ff9ec7;
  --white: #fff;

  /* geometry */
  --radius: 6px;
  --shadow: 6px 6px 0 var(--ink);

  /* typography */
  --font-body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-display: "M PLUS Rounded 1c", "Noto Sans JP", sans-serif;
  --font-serif: "Zen Old Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --font-mono: "JetBrains Mono", monospace;

  /* component tokens（テーマが上書き可） */
  --hdr-bg: var(--ink);
  --hdr-fg: var(--bg);
  --hdr-tag-bg: var(--yellow);
  --th-bg: var(--ink);
  --th-fg: var(--yellow);
  --stripe: #fff7dd;
  --pre-bg: var(--ink);
  --pre-fg: var(--mint);
  --pre-shadow: var(--yellow);
  --hl: var(--yellow);
  --strip-bg: var(--yellow);
  --strip-fg: var(--ink);
  --on-accent: var(--ink);
  --dots-r: 6px;
  --dots-gap: 32px;
  --bspace: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* ================= Accessibility ================= */
/* 文字サイズ切替（JS が html[data-fs] を付与） */
html[data-fs="s"] {
  font-size: 87.5%;
}

html[data-fs="l"] {
  font-size: 118.75%;
}

/* キーボード操作の可視フォーカス（テーマが上書き可） */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* スキップリンク（フォーカス時のみ表示） */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 999;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  background: var(--ink);
  color: var(--bg);
  border: 3px solid var(--border);
  padding: 0.5rem 1rem;
  box-shadow: 4px 4px 0 var(--bg);
}

.skip-link:focus {
  top: 1rem;
}

/* スクリーンリーダー専用ラベル / 色づけボックスへの種別ラベル */
.sr-only,
.box-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.9;
  color: var(--ink);
  background: var(--bg);
  overflow-wrap: anywhere;
}

/* ================= Kusama polka dots ================= */
.dots-strip {
  height: 24px;
  background-color: var(--strip-bg);
  background-image: radial-gradient(circle, var(--strip-fg) var(--dots-r), transparent calc(var(--dots-r) + 1px)),
    radial-gradient(circle, var(--strip-fg) var(--dots-r), transparent calc(var(--dots-r) + 1px));
  background-size: var(--dots-gap) var(--dots-gap);
  background-position: 0 0, calc(var(--dots-gap) / 2) calc(var(--dots-gap) / 2);
  border-bottom: 4px solid var(--border);
}

.dots-strip--red {
  --strip-bg: var(--red);
  --dots-r: 4px;
  --dots-gap: 24px;
}

.dots-strip--pink {
  --strip-bg: var(--pink);
}

/* ================= Header ================= */
header {
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  border-bottom: 4px solid var(--border);
  padding: calc(var(--bspace) * 2) var(--bspace);
  text-align: center;
  position: relative;
  overflow: hidden;
}

header::before,
header::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  border: 3px solid var(--hdr-fg);
  opacity: 0.6;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

header::before {
  left: -30px;
}

header::after {
  right: -30px;
}

header h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 1.4rem + 2.4vw, 3.2rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.8rem;
}

header .subtitle {
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
  font-weight: 400;
  opacity: 0.85;
  max-width: 720px;
  margin: 0 auto;
}

header .header-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--hdr-tag-bg);
  color: var(--ink);
  border: 3px solid var(--border);
  padding: 0.2rem 0.7rem;
  margin-bottom: 1rem;
  box-shadow: 4px 4px 0 var(--red);
}

/* ================= Layout ================= */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(1.2rem, 1rem + 1vw, 2rem);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: var(--bspace);
}

.topbar .homelink {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  border: 3px solid var(--border);
  background: var(--white);
  padding: 0.35rem 0.9rem;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.topbar .homelink:hover {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.topbar .published {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  background: var(--hdr-tag-bg);
  border: 3px solid var(--border);
  padding: 0.2rem 0.6rem;
  box-shadow: 3px 3px 0 var(--ink);
}

/* ================= Theme switcher ================= */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.theme-switch .theme-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 3px solid var(--border);
  background: var(--white);
  padding: 0.25rem 0.5rem;
  box-shadow: 2px 2px 0 var(--ink);
}

.theme-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--sw, var(--yellow));
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  padding: 0;
}

.theme-chip:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.theme-chip[aria-pressed="true"] {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* ================= Font-size switcher ================= */
.fs-switch {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.fs-btn {
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1;
  border: 3px solid var(--border);
  background: var(--white);
  color: var(--ink);
  padding: 0.28rem 0.42rem;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}

.fs-btn[data-fs="s"] {
  font-size: 0.68rem;
}

.fs-btn[data-fs="m"] {
  font-size: 0.85rem;
}

.fs-btn[data-fs="l"] {
  font-size: 1rem;
}

.fs-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.fs-btn[aria-pressed="true"] {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* ================= Cards ================= */
.card {
  background: var(--white);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 1rem + 1vw, 2rem);
  margin: var(--bspace) 0;
}

/* ================= Typography ================= */
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  font-weight: 900;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--border);
}

h2 .sec-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.1em;
  height: 2.1em;
  font-size: 0.6em;
  background: var(--th-bg, var(--ink));
  color: var(--th-fg, var(--yellow));
  border: 3px solid var(--border);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
}

h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
  display: inline-block;
  background: linear-gradient(transparent 62%, var(--hl) 62%);
  padding: 0 0.25em 0.05em;
}

h4 {
  font-weight: 800;
  font-size: 1.05em;
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
}

p {
  margin-bottom: 1rem;
}

strong {
  font-weight: 700;
}

/* Lists */
ul,
ol {
  margin-left: 1.6rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

li::marker {
  font-weight: 900;
}

ul li::marker {
  color: var(--red);
}

/* ================= Table ================= */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0 1.6rem;
  font-size: 0.95em;
  background: var(--white);
}

th,
td {
  border: 2.5px solid var(--ink);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--th-bg);
  color: var(--th-fg);
  font-weight: 700;
}

tr:nth-child(even) td {
  background: var(--stripe);
}

/* ================= Alert boxes ================= */
.alert {
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0 1.6rem;
  box-shadow: 5px 5px 0 var(--ink);
  color: var(--on-accent);
}

.alert-warning {
  background: var(--yellow);
  border-left: 10px solid var(--border);
  outline: 3px dashed var(--ink);
  outline-offset: 4px;
}

.alert-danger {
  background: var(--red);
}

.alert-success {
  background: var(--mint);
}

.alert-empathy {
  background: var(--pink);
}

.alert p:last-child {
  margin-bottom: 0;
}

/* ================= Info / Concept boxes ================= */
.info-box {
  background: var(--blue);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0 1.6rem;
  box-shadow: 5px 5px 0 var(--ink);
  color: var(--on-accent);
}

.concept-box {
  background: var(--bg);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin: 1.2rem 0 1.6rem;
  box-shadow: 5px 5px 0 var(--ink);
}

.scenario-box {
  background: var(--white);
  border: 3px solid var(--border);
  border-left: 10px solid var(--red);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin: 1.2rem 0 1.6rem;
  box-shadow: 5px 5px 0 var(--ink);
}

.scenario-box h4 {
  margin-top: 0;
}

.scenario-box .persona {
  font-weight: 700;
  background: var(--yellow);
  color: var(--on-accent);
  border: 2.5px solid var(--border);
  padding: 0.15em 0.5em;
  display: inline-block;
}

/* ================= Code & links ================= */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--hl);
  border: 2px solid var(--border);
  padding: 0.05em 0.35em;
}

pre {
  background: var(--pre-bg);
  color: var(--pre-fg);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin: 1.2rem 0 1.6rem;
  box-shadow: 5px 5px 0 var(--pre-shadow);
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2.5px;
  text-underline-offset: 3px;
}

a:hover {
  background: var(--hl);
  text-decoration: none;
}

blockquote {
  border: 3px solid var(--border);
  border-left: 12px solid var(--blue);
  background: var(--white);
  padding: 0.9rem 1.2rem;
  margin: 1.2rem 0 1.6rem;
  box-shadow: 5px 5px 0 var(--ink);
  color: var(--on-accent);
}

blockquote p:last-child {
  margin-bottom: 0;
}

hr {
  border: none;
  border-top: 3px dashed var(--ink);
  margin: 2rem 0;
}

img {
  max-width: 100%;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
}

/* ================= Buttons ================= */
.tag {
  display: inline-block;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  border: 3px solid var(--border);
  padding: 0.15em 0.6em;
  margin: 0 0.4rem 0.4rem 0;
  background: var(--white);
  box-shadow: 3px 3px 0 var(--ink);
}

/* ================= Index listing ================= */
.postlist {
  list-style: none;
  margin: 0;
}

.postlist li {
  margin: 0;
}

.postlist a {
  text-decoration: none;
  display: block;
  background: var(--white);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.postlist a:hover {
  background: var(--hl);
  transform: translate(3px, 3px);
  box-shadow: 3px 3px 0 var(--ink);
}

.postlist a:hover .title {
  text-decoration: underline;
}

.postlist .top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.postlist .title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}

.postlist .meta {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--ink);
  opacity: 0.75;
}

.postlist .summary {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.92em;
  opacity: 0.85;
  line-height: 1.7;
}

.postlist .tags {
  display: block;
  margin-top: 0.7rem;
}

.postlist .tag-theme {
  background: var(--hl);
  font-weight: 700;
}

/* ================= Similar reports widget ================= */
#similar-reports {
  margin-top: calc(var(--bspace) * 0.75);
}

#similar-reports[hidden] {
  display: none;
}

/* ================= Footer ================= */
footer {
  text-align: center;
  padding: 2rem var(--bspace) 3rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  border-top: 4px solid var(--border);
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -24px;
  height: 24px;
  background-color: var(--strip-bg);
  background-image: radial-gradient(circle, var(--strip-fg) var(--dots-r), transparent calc(var(--dots-r) + 1px)),
    radial-gradient(circle, var(--strip-fg) var(--dots-r), transparent calc(var(--dots-r) + 1px));
  background-size: var(--dots-gap) var(--dots-gap);
  background-position: 0 0, calc(var(--dots-gap) / 2) calc(var(--dots-gap) / 2);
  border-top: 4px solid var(--border);
  border-bottom: 4px solid var(--border);
}

footer a {
  color: var(--hdr-tag-bg);
}

/* ================= Responsive ================= */
@media (max-width: 640px) {
  header {
    padding: calc(var(--bspace) * 1.3) var(--bspace);
  }

  .card {
    padding: 1.2rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ================= Print ================= */
@media print {
  body {
    background: #fff;
  }

  .card {
    box-shadow: none;
  }

  header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

@page {
  size: A4;
  margin: 18mm;
}

/* ================= Reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ================= High-contrast (OS設定) ================= */
@media (prefers-contrast: more) {
  a {
    text-decoration-thickness: 3px;
  }

  code,
  th,
  td,
  .sec-num {
    border-width: 3px;
  }

  .postlist .meta,
  .postlist .summary {
    opacity: 1;
  }

  :focus-visible {
    outline: 4px solid var(--ink);
    outline-offset: 3px;
  }
}
/* ============================================================
   Theme: neo-brutalism（デフォルト）
   クリーム紙 × 黒フレーム × ハードシャドウ × うす水玉
   ============================================================ */

:root {
  --bg: #faf6ef;
  --ink: #111;
  --border: #111;
  --red: #ff5d5d;
  --yellow: #ffd60a;
  --mint: #6ee7b7;
  --blue: #6eb5ff;
  --pink: #ff9ec7;
  --white: #fff;
  --radius: 6px;
  --shadow: 6px 6px 0 #111;
  --stripe: #fff7dd;
  --hdr-bg: #111;
  --hdr-fg: #faf6ef;
  --hdr-tag-bg: #ffd60a;
  --th-bg: #111;
  --th-fg: #ffd60a;
  --strip-bg: #ffd60a;
  --strip-fg: #111;
  --dots-r: 6px;
  --dots-gap: 32px;
}

body {
  background: radial-gradient(circle, rgba(17, 17, 17, 0.07) 4px, transparent 5px),
    radial-gradient(circle, rgba(17, 17, 17, 0.07) 4px, transparent 5px),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto;
  background-position: 0 0, 22px 22px, 0 0;
}