:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --border: #e1e4ee;
  --text: #1b2033;
  --text-muted: #5d6580;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eceafd;
  --on-accent: #ffffff;
  --mark: #fff0a8;
  --shadow: 0 1px 2px rgb(27 32 51 / 6%), 0 4px 16px rgb(27 32 51 / 6%);
  --shadow-hover: 0 2px 4px rgb(27 32 51 / 8%), 0 10px 28px rgb(27 32 51 / 12%);
  --font: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --t-application-bugs: 340 75% 46%;
  --t-hardware-fault: 24 90% 42%;
  --t-infrastructure-failure: 200 85% 36%;
  --t-job-failure: 275 60% 48%;
  --t-maintainance: 160 70% 30%;
  --t-misconfiguration: 45 90% 34%;
  --t-request-increase: 225 75% 50%;
  --t-external-failure: 0 70% 46%;
  --t-other: 215 15% 45%;
  --t-none: 215 12% 55%;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e111b;
  --surface: #161a28;
  --surface-2: #1d2233;
  --border: #2a3047;
  --text: #e8eaf4;
  --text-muted: #9aa2bf;
  --accent: #8b87ff;
  --accent-strong: #a9a6ff;
  --accent-soft: #25264a;
  --on-accent: #0e111b;
  --mark: #5b4d00;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 30%);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / 50%), 0 10px 28px rgb(0 0 0 / 45%);

  --t-application-bugs: 340 85% 70%;
  --t-hardware-fault: 28 90% 66%;
  --t-infrastructure-failure: 195 85% 62%;
  --t-job-failure: 275 80% 75%;
  --t-maintainance: 160 60% 58%;
  --t-misconfiguration: 48 90% 62%;
  --t-request-increase: 225 90% 74%;
  --t-external-failure: 0 85% 70%;
  --t-other: 215 20% 72%;
  --t-none: 215 15% 62%;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e111b;
    --surface: #161a28;
    --surface-2: #1d2233;
    --border: #2a3047;
    --text: #e8eaf4;
    --text-muted: #9aa2bf;
    --accent: #8b87ff;
    --accent-strong: #a9a6ff;
    --accent-soft: #25264a;
    --on-accent: #0e111b;
    --mark: #5b4d00;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 30%);
    --shadow-hover: 0 2px 4px rgb(0 0 0 / 50%), 0 10px 28px rgb(0 0 0 / 45%);

    --t-application-bugs: 340 85% 70%;
    --t-hardware-fault: 28 90% 66%;
    --t-infrastructure-failure: 195 85% 62%;
    --t-job-failure: 275 80% 75%;
    --t-maintainance: 160 60% 58%;
    --t-misconfiguration: 48 90% 62%;
    --t-request-increase: 225 90% 74%;
    --t-external-failure: 0 85% 70%;
    --t-other: 215 20% 72%;
    --t-none: 215 15% 62%;
  }
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--accent-strong); text-underline-offset: 3px; }
svg { display: block; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
 
}

.container { width: min(1120px, 100% - 40px); margin-inline: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--on-accent);
 
  transition: top 0.15s;
}
.skip-link:focus { top: 12px; }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.05rem; text-decoration: none; letter-spacing: 0.01em; }
.brand-mark { width: 30px; height: 30px; color: #fff; }
.brand-mark rect { fill: var(--accent); }
:root[data-theme="dark"] .brand-mark { color: var(--on-accent); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.link-button {
  padding: 6px 14px;
  border: 1px solid var(--border);
 
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
}
.link-button:hover { border-color: var(--accent); color: var(--accent-strong); }
.icon-button {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
 
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--accent); color: var(--accent-strong); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* hero */
.hero {
  padding: 56px 0 36px;
  background:
    radial-gradient(900px 340px at 85% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(700px 300px at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
}
.eyebrow { color: var(--accent-strong); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; }
.hero h1 { margin-top: 8px; font-size: clamp(1.7rem, 4.2vw, 2.6rem); line-height: 1.25; letter-spacing: 0.01em; }
.lead { margin-top: 14px; max-width: 42em; color: var(--text-muted); font-size: 1.02rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 30px; }
.stat { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat dt { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }
.stat dd { margin-top: 2px; font-size: 1.75rem; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat dd small { margin-left: 4px; color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

/* insights */
.insights { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; margin-top: 8px; }
.panel { min-width: 0; padding: 20px 22px 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.panel h3 { font-size: 1rem; }
.panel-note { color: var(--text-muted); font-size: 0.78rem; }

.bars { display: grid; gap: 6px; margin-top: 14px; }
.bar-button {
  display: grid;
  grid-template-columns: minmax(8.5em, 11em) 1fr 2.2em;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
 
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.bar-button:hover { background: var(--surface-2); }
.bar-button[aria-pressed="true"] { background: var(--accent-soft); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--surface-2); overflow: hidden; }
.bar-button[aria-pressed="true"] .bar-track { background: var(--surface); }
.bar-fill { display: block; height: 100%; min-width: 4px; background: hsl(var(--tone)); transition: width 0.4s ease; }
.bar-value { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 700; }

.columns { display: flex; align-items: flex-end; gap: 6px; width: 100%; height: 170px; margin-top: 14px; min-width: 0; }
.columns.is-compact { gap: 2px; }
.column { position: relative; flex: 1 1 0; min-width: 0; height: 100%; container-type: inline-size; container-name: yearcol; }
.column:has(.column-year) { z-index: 1; }
.column:has(.column-button:hover),
.column:has(.column-button:focus-visible),
.column:has(.column-button[aria-pressed="true"]) { z-index: 2; }
.column-button {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 2px 0 16px;
  border: 0;
 
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}
.column-button:hover { background: var(--surface-2); }
.column-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
.column-count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.column-button:disabled { cursor: default; }
.column-button:disabled:hover { background: transparent; }
.column-fill { width: 70%; max-width: 28px; min-width: 3px; height: calc(var(--ratio, 0) * 96px); min-height: 3px; background: var(--accent); opacity: 0.8; transition: height 0.4s ease; }
.column-button:disabled .column-fill { background: var(--border); opacity: 1; }
.y-short { display: none; }
.column-button:hover .column-fill, .column-button[aria-pressed="true"] .column-fill { opacity: 1; }
.column-year {
  position: absolute;
  left: 50%;
  bottom: 1px;
  transform: translateX(-50%);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}
.column:first-child .column-year { left: 0; transform: none; }
.column:last-child .column-year { left: auto; right: 0; transform: none; }
.column:first-child:last-child .column-year { left: 50%; right: auto; transform: translateX(-50%); }
@container yearcol (max-width: 20px) {
  .column-count {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    visibility: hidden;
    padding: 0 4px;
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--border);
  }
  .column-button:hover .column-count,
  .column-button:focus-visible .column-count,
  .column-button[aria-pressed="true"] .column-count { visibility: visible; }
  .column-button:hover .column-count,
  .column-button:focus-visible .column-count { background: var(--surface-2); }
  .column-button[aria-pressed="true"] .column-count { background: var(--accent-soft); }
}

/* controls */
.controls-wrap { margin-top: 26px; }
.controls {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr));
  gap: 14px 16px;
  align-items: end;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
 
  box-shadow: var(--shadow);
}
.field { display: grid; gap: 4px; min-width: 0; }
.field label { color: var(--text-muted); font-size: 0.78rem; font-weight: 700; }
.field select, .search-box input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
 
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}
.field select:hover, .search-box input:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.field select:focus-visible, .search-box input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; translate: 0 -50%; fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search-box input { padding-left: 38px; }
.check { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 8px; width: fit-content; font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border: 1px solid color-mix(in srgb, hsl(var(--tone)) 45%, var(--border));
 
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.chip::before { content: ""; width: 8px; height: 8px; background: hsl(var(--tone)); }
.chip:hover { background: color-mix(in srgb, hsl(var(--tone)) 12%, var(--surface)); }
.chip[aria-pressed="true"] { background: hsl(var(--tone)); border-color: hsl(var(--tone)); color: var(--surface); }
.chip[aria-pressed="true"]::before { background: var(--surface); }

/* results */
.results { margin-top: 28px; padding-bottom: 72px; outline: none; }
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin-bottom: 14px; }
.count { color: var(--text-muted); font-size: 0.92rem; }
.count strong { color: var(--text); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.text-button { padding: 6px 12px; border: 0; background: transparent; color: var(--accent-strong); font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; }
.text-button:hover { background: var(--accent-soft); }
.primary-button { padding: 10px 20px; border: 0; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; cursor: pointer; }
.primary-button:hover { background: var(--accent-strong); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid hsl(var(--tone));
 
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.82rem; }
.provider { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
 
  background: hsl(var(--avatar) / 0.16);
  color: hsl(var(--avatar));
  font-size: 0.8rem;
  font-weight: 800;
}
.provider-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date { flex: none; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.date.is-unknown { font-style: italic; opacity: 0.8; }
.card-title { font-size: 1.02rem; line-height: 1.5; font-weight: 700; overflow-wrap: anywhere; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent-strong); text-decoration: underline; }
.card-title a::after { content: " ↗"; color: var(--text-muted); font-weight: 400; font-size: 0.85em; }
.card-cause { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-muted); font-size: 0.9rem; line-height: 1.7; }
.card-cause.is-empty { font-style: italic; opacity: 0.75; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  padding: 1px 10px;
 
  background: color-mix(in srgb, hsl(var(--tone)) 14%, var(--surface));
  color: hsl(var(--tone));
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.7;
}
.tag.is-muted { background: var(--surface-2); color: var(--text-muted); font-weight: 600; }
.detail-button { padding: 4px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.detail-button:hover { border-color: var(--accent); color: var(--accent-strong); }
.detail-button::after { content: " →"; }

mark { padding: 0 2px; background: var(--mark); color: inherit; }

.empty { display: grid; justify-items: center; gap: 14px; padding: 64px 20px; text-align: center; color: var(--text-muted); }
.empty[hidden] { display: none; }
.empty svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; opacity: 0.6; }

/* dialog */
dialog {
  width: min(720px, calc(100% - 24px));
  max-height: min(86vh, 860px);
  padding: 0;
  border: 1px solid var(--border);
 
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgb(0 0 0 / 35%);
  overflow: hidden;
}
dialog::backdrop { background: rgb(10 12 24 / 55%); backdrop-filter: blur(3px); }
dialog[open] { display: flex; flex-direction: column; animation: pop 0.18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.detail { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 26px 28px 28px; border-top: 5px solid hsl(var(--tone)); }
.detail:focus { outline: none; }
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.close-button { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.close-button:hover { border-color: var(--accent); color: var(--accent-strong); }
.detail h2 { margin-top: 12px; font-size: 1.35rem; line-height: 1.45; overflow-wrap: anywhere; }
.detail .tags { margin-top: 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 20px; }
.fact { padding: 10px 14px; background: var(--surface-2); }
.fact dt { color: var(--text-muted); font-size: 0.72rem; font-weight: 700; }
.fact dd { font-size: 0.9rem; overflow-wrap: anywhere; }
.detail-section { margin-top: 22px; }
.detail-section h3 { margin-bottom: 4px; font-size: 0.85rem; color: var(--text-muted); letter-spacing: 0.04em; }
.detail-section p { overflow-wrap: anywhere; white-space: pre-line; }
.detail-section .is-empty { color: var(--text-muted); font-style: italic; }
.notice { margin-top: 18px; padding: 10px 14px; background: var(--accent-soft); font-size: 0.85rem; }
.detail-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.detail-links a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 0.9rem; text-decoration: none; }
.detail-links a:hover { border-color: var(--accent); color: var(--accent-strong); }
.detail-links a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.detail-links a.primary:hover { background: var(--accent-strong); color: var(--on-accent); }

/* footer */
.site-footer { padding: 28px 0 40px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.82rem; }
.footer-inner { display: grid; gap: 4px; }

@media (max-width: 860px) {
  .insights { grid-template-columns: minmax(0, 1fr); }
  .controls { grid-template-columns: 1fr 1fr; }
  .field-search { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .container { width: calc(100% - 28px); }
  .hero { padding: 36px 0 24px; }
  .controls { grid-template-columns: 1fr; padding: 16px; }
  .bar-button { grid-template-columns: 9.5em 1fr 1.8em; gap: 8px; font-size: 0.8rem; }
  .stat dd { font-size: 1.45rem; white-space: nowrap; }
  .stats { gap: 10px; }
  .columns { gap: 3px; }
  .columns.is-compact { gap: 1px; }
  .column-button { font-size: 0.62rem; }
  .y-full { display: none; }
  .y-short { display: inline; }
  .detail { padding: 20px 18px 22px; }
  .link-button { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
