/* Urbria — Brand Hints Library 系レギュレーション準拠 */
:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #1f2937;
  --muted: #475569;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #0f172a;
  --warn: #475569;
  --ok: #15803d;
  --ng: #b91c1c;
  --tag-bg: #f1f5f9;
  --primary: #0f172a;
  --primary-ink: #ffffff;
  --link: #1d4ed8;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.06);
  --max: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; line-height: 1.7; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; border-radius: 4px; }

/* Layout */
.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
header.site { padding: 32px 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
header.site .container { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand small { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 13px; }
nav.site a { color: var(--ink-2); margin-left: 20px; font-size: 14px; font-weight: 500; }
nav.site a.active { color: var(--primary); border-bottom: 2px solid var(--primary); padding-bottom: 4px; }

main { padding: 32px 0 80px; min-height: 60vh; }

/* Gate */
.gate { position: fixed; inset: 0; background: rgba(251,251,253,.97); display: grid; place-items: center; z-index: 100; }
.gate-card { background: var(--surface); padding: 36px; border-radius: var(--radius); width: min(420px, 92vw); box-shadow: var(--shadow); border: 1px solid var(--line); }
.gate h2 { margin: 0 0 8px; font-size: 22px; }
.gate p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.gate input { width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 16px; font-family: inherit; }
.gate input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.gate button { width: 100%; margin-top: 12px; padding: 12px; border-radius: 10px; border: 0; background: var(--primary); color: var(--primary-ink); font-weight: 600; font-size: 15px; }
.gate .err { color: var(--ng); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* Hero */
.hero { padding: 32px 0 16px; }
.hero h1 { font-size: 36px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -.02em; }
.hero p.lead { color: var(--muted); font-size: 16px; max-width: 760px; margin: 0; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-right: 4px; text-transform: uppercase; letter-spacing: .04em; }
.chip { display: inline-block; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: all .12s; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* Cards */
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.case-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s, border-color .15s; }
.case-card .thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); display: block; border-bottom: 1px solid var(--line); }
.case-card .body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.case-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 6px 18px rgba(15,23,42,.08); }
.case-card h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.case-card h3 small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.case-card .meta-line { color: var(--muted); font-size: 13px; }
.case-card .concept { font-weight: 600; color: var(--ink); font-size: 15px; }
.case-card .tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: var(--tag-bg); color: var(--ink-2); padding: 2px 8px; border-radius: 6px; font-size: 11.5px; }
.case-card a.more { margin-top: auto; align-self: flex-start; font-size: 13px; font-weight: 600; }

/* Detail thumb */
.detail-thumb { width: 100%; aspect-ratio: 16/9; max-height: 320px; object-fit: cover; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); border-radius: var(--radius); margin-bottom: 20px; display: block; }

/* Timeline */
.timeline-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 32px; overflow-x: auto; }
.timeline-wrap h2 { margin: 0 0 8px; font-size: 22px; }
.timeline-wrap p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.timeline { position: relative; min-width: 920px; padding: 30px 0 60px; }
.timeline-axis { position: relative; height: 2px; background: var(--ink); margin: 80px 0 0; }
.timeline-tick { position: absolute; top: -6px; width: 1px; height: 14px; background: var(--muted); }
.timeline-tick-label { position: absolute; top: 14px; font-size: 11px; color: var(--muted); transform: translateX(-50%); }
.timeline-item { position: absolute; transform: translateX(-50%); cursor: pointer; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--primary); margin: 0 auto; }
.timeline-dot.retreat { background: #b91c1c; box-shadow: 0 0 0 1px #b91c1c; }
.timeline-dot.live { background: #15803d; box-shadow: 0 0 0 1px #15803d; }
.timeline-dot.under { background: #f59e0b; box-shadow: 0 0 0 1px #f59e0b; }
.timeline-label { position: absolute; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--ink); white-space: nowrap; text-align: center; max-width: 110px; line-height: 1.3; }
.timeline-label a { color: inherit; text-decoration: none; }
.timeline-label a:hover { text-decoration: underline; color: var(--link); }
.timeline-item.above .timeline-label { bottom: 18px; }
.timeline-item.below .timeline-label { top: 18px; }
.timeline-legend { display: flex; gap: 18px; margin-bottom: 16px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 5px; }
.timeline-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Word Cloud */
.wordcloud-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; margin-bottom: 32px; }
.wordcloud-wrap h2 { margin: 0 0 6px; font-size: 22px; }
.wordcloud-wrap p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.wordcloud { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; justify-content: center; padding: 20px; line-height: 1.4; }
.wordcloud .word { display: inline-block; padding: 2px 6px; border-radius: 6px; cursor: pointer; color: var(--ink); transition: background .15s, color .15s; line-height: 1.2; }
.wordcloud .word:hover { background: var(--primary); color: var(--primary-ink); text-decoration: none; }
.wordcloud .word a { color: inherit; text-decoration: none; }

/* Phase badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.badge.live { background: #dcfce7; color: #166534; }
.badge.partial { background: #dbeafe; color: #1e40af; }
.badge.under { background: #fef9c3; color: #854d0e; }
.badge.retreat { background: #fee2e2; color: #991b1b; }

/* Case Detail */
.detail-header { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; margin-bottom: 24px; }
.detail-header h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.02em; }
.detail-header .subtitle { color: var(--muted); font-size: 15px; margin-bottom: 16px; }
.detail-header .meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.meta-item .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.meta-item .v { font-size: 14px; color: var(--ink); font-weight: 500; }

.layer-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 16px; }
.layer-section h2 { margin: 0 0 16px; font-size: 20px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 12px; }
.layer-section h2 .layer-id { color: var(--muted); font-size: 13px; font-weight: 600; }
.layer-section .field { margin-bottom: 14px; }
.layer-section .field-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.layer-section .field-value { font-size: 15px; color: var(--ink-2); }
.layer-section .field-value ul { padding-left: 20px; margin: 4px 0; }
.layer-section .field-value li { margin-bottom: 4px; }
.layer-section .source-line { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.layer-section .source-line a { word-break: break-all; }
.field-source { font-size: 11.5px; color: var(--muted); margin-top: 4px; padding-left: 6px; border-left: 2px solid var(--line); word-break: break-all; }
.field-source a { color: var(--link); }

/* 確度マーカー */
.confidence-mark { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; margin-right: 6px; vertical-align: middle; }
.confidence-mark.ok { background: #dcfce7; color: #166534; }
.confidence-mark.warn { background: #fef9c3; color: #854d0e; }
.confidence-mark.unverified { background: #fee2e2; color: #991b1b; }

/* Evidence pane */
.evidence-pane { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 22px; margin-top: 24px; }
.evidence-pane h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.evidence-pane ol { margin: 0; padding-left: 22px; font-size: 13px; }
.evidence-pane li { margin-bottom: 4px; }
.evidence-pane li a { word-break: break-all; }

/* Pitfalls / Lessons */
.lesson-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-top: 16px; }
.lesson-block h2 { margin: 0 0 12px; font-size: 18px; }
.lesson-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.lesson-list li { padding: 12px 14px; border-left: 3px solid var(--line-strong); background: #f8fafc; border-radius: 0 8px 8px 0; font-size: 14px; }
.lesson-list.pitfall li { border-left-color: #dc2626; }
.lesson-list.lesson li { border-left-color: #15803d; }

/* Cross view (matrix) */
.matrix-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.matrix-table th, .matrix-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13.5px; vertical-align: top; }
.matrix-table th { background: #f1f5f9; font-weight: 600; color: var(--ink); position: sticky; top: 64px; }
.matrix-table tbody tr:hover { background: #f8fafc; }
.matrix-wrap { overflow-x: auto; }

/* Concept word cloud */
.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.concept-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; }
.concept-card .word { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.concept-card .case { font-size: 12px; color: var(--muted); }

/* Source legend */
.source-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 12.5px; color: var(--muted); }
.source-legend strong { color: var(--ink); }

/* Empty / Footer */
footer { padding: 32px 0; border-top: 1px solid var(--line); margin-top: 60px; color: var(--muted); font-size: 13px; text-align: center; background: var(--surface); }

/* Mobile */
@media (max-width: 720px) {
  .hero h1 { font-size: 28px; }
  .detail-header { padding: 22px; }
  .detail-header h1 { font-size: 24px; }
  .layer-section { padding: 22px; }
  header.site .container { flex-direction: column; align-items: flex-start; gap: 8px; }
  nav.site { display: flex; gap: 8px; }
  nav.site a { margin-left: 0; margin-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
