/* EA Reverse Engineering — research article.
   Palette is deliberately unlike the audit article's paper+lime: this one is
   white / deep navy / blue-grey / muted cyan, with amber and red reserved for
   rejected hypotheses only. No green-for-good, red-for-bad trading-terminal
   colouring -- the point is a research record, not a performance dashboard. */
:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --ink: #0e1b2c;
  --ink-2: #23364d;
  --muted: #5d7189;
  --line: #dde5ee;
  --accent: #2f93ad;          /* muted cyan */
  --accent-deep: #16576b;
  --amber: #9d7320;
  --reject: #b04a34;          /* rejected hypotheses only */
  --shadow: 0 16px 44px rgba(14, 27, 44, .07);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body {
  margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", system-ui, sans-serif;
  line-height: 1.85;
  /* Japanese line breaking: keep the default break opportunities, but never
     break mid-word inside a term. Critical terms are wrapped in .nw. */
  line-break: strict;
  word-break: normal;
}
img, svg { display: block; max-width: 100%; height: auto; }
.wrap { width: min(100% - 36px, 1040px); margin-inline: auto; }
.narrow { max-width: 760px; }
.section-pad { padding-block: clamp(56px, 11vw, 96px); }

/* Never let a term split across lines. Applied to 内部ロジック, 発注ゲート,
   percentages and their units, and anonymised labels. */
.nw { white-space: nowrap; }

h1, h2, h3 { line-height: 1.32; letter-spacing: -.02em; word-break: normal; }
h2 { margin: 0 0 18px; font-size: clamp(1.6rem, 5.4vw, 2.6rem); }
h3 { margin: 0 0 10px; font-size: clamp(1.05rem, 3.6vw, 1.3rem); }
p { margin: 0 0 1.1em; }
.kicker { margin: 0 0 10px; color: var(--accent-deep); font-size: .72rem;
  font-weight: 800; letter-spacing: .16em; }
.intro { max-width: 660px; color: var(--muted); }
.micro { color: var(--muted); font-size: .74rem; line-height: 1.7; }

/* ---------- hero ---------- */
.hero { background: var(--ink); color: #eef4f8; padding-block: clamp(56px, 14vw, 104px); }
.hero .kicker { color: var(--accent); }
.hero h1 { max-width: 15em; margin: 0; font-size: clamp(2rem, 8.4vw, 4rem); letter-spacing: -.035em; }
.hero .lead { max-width: 42em; margin: 22px 0 0; color: #b8cbd9;
  font-size: clamp(.95rem, 3.4vw, 1.15rem); }
.stats { display: grid; grid-template-columns: 1fr; gap: 1px; margin: 34px 0 0;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.14); border-radius: 4px; overflow: hidden; }
.stats div { padding: 18px 16px; background: #12243a; }
.stats dt { color: var(--accent); font-size: clamp(1.9rem, 8vw, 2.9rem);
  font-weight: 900; line-height: 1.05; letter-spacing: -.045em; }
.stats dd { margin: 6px 0 0; color: #a9bccb; font-size: .78rem; line-height: 1.6; }

/* ---------- takeaways ---------- */
.takeaways { display: grid; gap: 12px; margin: 28px 0 0; padding: 0; list-style: none; counter-reset: t; }
.takeaways li { position: relative; padding: 20px 18px 20px 58px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.takeaways li::before { counter-increment: t; content: "0" counter(t);
  position: absolute; left: 18px; top: 20px; color: var(--accent); font-weight: 900; font-size: .95rem; }

/* ---------- figures ---------- */
figure { margin: 26px 0 0; padding: 20px 16px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
figcaption { margin-top: 14px; color: var(--muted); font-size: .8rem; line-height: 1.7; }

/* horizontal comparison bars (CSS only, no chart library) */
.bars { display: grid; gap: 16px; }
.bar-row { display: grid; gap: 6px; }
.bar-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
  justify-content: space-between; font-size: .82rem; font-weight: 700; }
.bar-head .val { font-size: 1.25rem; font-weight: 900; letter-spacing: -.02em; }
.bar-track { height: 30px; border-radius: 5px; background: #e7edf4; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); }
.bar-row.is-control .bar-fill { background: #9fb1c2; }
.bar-row.is-control .val { color: var(--muted); }
.bar-row.is-second .bar-fill { background: linear-gradient(90deg, #6b8ba6, #9fb1c2); }

/* step-down figure (97.0 -> 58.5) */
.steps { display: grid; gap: 10px; text-align: center; }
.step { padding: 18px 14px; border: 1px solid var(--line); border-radius: 14px; background: #f2f7fa; }
.step b { display: block; font-size: clamp(1.9rem, 8vw, 2.6rem); font-weight: 900;
  line-height: 1.1; letter-spacing: -.04em; color: var(--accent-deep); }
.step span { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.step.is-down b { color: var(--ink-2); }
.step-arrow { color: var(--muted); font-size: 1.2rem; line-height: 1; }

/* rejected block */
.reject-box { margin: 26px 0 0; padding: 24px 18px; border: 1px solid #e2c9c1;
  border-left: 4px solid var(--reject); border-radius: 14px; background: #fdf7f5; }
.reject-box .big { display: block; font-size: clamp(2rem, 9vw, 3rem); font-weight: 900;
  line-height: 1.05; letter-spacing: -.04em; color: var(--ink-2); }
.reject-box .tag { display: inline-block; margin: 12px 0 8px; padding: 4px 12px;
  border-radius: 999px; background: var(--reject); color: #fff;
  font-size: .72rem; font-weight: 800; letter-spacing: .1em; }
.reject-box p { margin: 6px 0 0; color: var(--ink-2); }

/* hypothesis chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.chips li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: #f2f5f9; color: var(--muted); font-size: .76rem;
  text-decoration: line-through; text-decoration-color: var(--reject); }
.chips li.more { text-decoration: none; border-style: dashed; }

/* two-case comparison */
.cases { display: grid; gap: 12px; margin: 26px 0 0; }
.case { padding: 22px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.case h3 { margin: 0 0 12px; color: var(--accent-deep); font-size: .78rem; letter-spacing: .12em; }
.case dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; }
.case dt { color: var(--muted); font-size: .8rem; }
.case dd { margin: 0; font-weight: 800; font-size: .92rem; }
.verdict { display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.verdict.no { background: #f6e7e2; color: var(--reject); }
.verdict.yes { background: #e3eff3; color: var(--accent-deep); }

/* observable / not-observable split */
.split { display: grid; gap: 12px; margin: 26px 0 0; }
.split > div { padding: 22px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.split h3 { margin: 0 0 12px; font-size: .8rem; letter-spacing: .1em; }
.split ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); }
.split li { margin-bottom: 6px; }
.split .obs h3 { color: var(--accent-deep); }
.split .unobs { background: #f4f6f9; border-style: dashed; }
.split .unobs h3 { color: var(--amber); }

/* current status two-column */
.status { display: grid; gap: 12px; margin: 26px 0 0; }
.status > div { padding: 22px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.status h3 { margin: 0 0 12px; font-size: .82rem; letter-spacing: .1em; color: var(--accent-deep); }
.status .hard h3 { color: var(--amber); }
.status ul { margin: 0; padding-left: 1.2em; }
.status li { margin-bottom: 8px; }

/* pipeline list */
.pipeline { margin: 26px 0 0; padding: 0; list-style: none; counter-reset: p; }
.pipeline li { position: relative; padding: 14px 0 14px 46px; border-top: 1px solid var(--line); }
.pipeline li:last-child { border-bottom: 1px solid var(--line); }
.pipeline li::before { counter-increment: p; content: counter(p);
  position: absolute; left: 0; top: 13px; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%;
  background: #e3eff3; color: var(--accent-deep); font-size: .78rem; font-weight: 800; }
.pipeline b { display: block; }
.pipeline span { color: var(--muted); font-size: .84rem; }

.band { background: #0f2136; color: #e8f0f6; }
.band .kicker { color: var(--accent); }
.band h2, .band h3 { color: #fff; }
.band .intro, .band p { color: #b3c6d5; }

.quote { margin: 30px 0 0; padding: 24px 20px; border-radius: 16px;
  background: #12243a; color: #fff; font-size: clamp(1.05rem, 4.2vw, 1.45rem);
  font-weight: 800; line-height: 1.6; letter-spacing: -.02em; }

/* related */
.related { display: grid; gap: 12px; margin: 26px 0 0; }
.related a { display: block; padding: 20px 18px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); color: inherit; text-decoration: none; }
.related a:hover, .related a:focus-visible { border-color: var(--accent); }
.related b { display: block; margin-bottom: 4px; }
.related span { color: var(--muted); font-size: .84rem; }

.disclaimer { padding-block: 40px; background: var(--ink); color: #9db0c1; font-size: .76rem; }
.disclaimer strong { color: #d6e3ec; }

a { color: var(--accent-deep); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (min-width: 620px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: 1fr auto 1fr; align-items: center; }
  .step-arrow { transform: rotate(-90deg); }
}
@media (min-width: 860px) {
  .cases, .split, .status { grid-template-columns: 1fr 1fr; }
  .related { grid-template-columns: repeat(3, 1fr); }
  figure { padding: 28px 26px; }
}

/* ---------- beginner entry (added 2026-08-23) ----------
   The first version put research SCALE above the fold, before the reader had
   understood what the research DOES. On a 390px screen the plain-language
   explanation only arrived on the fourth screen. These blocks front-load
   meaning: what we do, what came out, what did not. */

/* 4-step flow, plain language, vertical on mobile */
.flow { display: grid; gap: 0; margin: 26px 0 0; padding: 0; list-style: none; counter-reset: f; }
.flow li { position: relative; padding: 18px 18px 18px 60px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.flow li + li { margin-top: 26px; }
.flow li + li::after { content: "▼"; position: absolute; top: -22px; left: 30px;
  transform: translateX(-50%); color: var(--accent); font-size: .8rem; line-height: 1; }
.flow li::before { counter-increment: f; content: counter(f);
  position: absolute; left: 16px; top: 18px; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-deep); color: #fff; font-size: .82rem; font-weight: 800; }
.flow b { display: block; font-size: 1.02rem; }
.flow span { display: block; margin-top: 2px; color: var(--muted); font-size: .86rem; }

/* answered / unanswered pair */
.pair { display: grid; gap: 12px; margin: 26px 0 0; }
.pair > div { padding: 24px 20px; border-radius: 16px; }
.pair .got { border: 1px solid #bcd7e0; background: #eef6f9; }
.pair .not { border: 1px dashed #d9cdb4; background: #fbf8f1; }
.pair h3 { margin: 0 0 14px; font-size: 1.05rem; }
.pair .got h3 { color: var(--accent-deep); }
.pair .not h3 { color: var(--amber); }
.pair p { margin: 0 0 .8em; }
.pair p:last-child { margin-bottom: 0; }
.pair .fig { display: block; font-size: clamp(1.5rem, 6vw, 2rem); font-weight: 900;
  letter-spacing: -.03em; line-height: 1.2; }
.pair .got .fig { color: var(--accent-deep); }
.pair .not .fig { color: var(--amber); }

/* small inline gloss for a term's first appearance */
.gloss { color: var(--muted); font-size: .86em; }

@media (min-width: 860px) {
  .pair { grid-template-columns: 1fr 1fr; }
}

/* The scale numbers moved from the hero into the dark .band section, so they
   keep the original dark styling. .gloss defaults to a light-background muted
   grey, which is unreadable there -- lift it. */
.band .gloss { color: #8fa8bd; }

/* Explicit colours: .band sets a near-white body colour, so any light-tinted
   block placed inside one would inherit unreadable text. Never rely on
   inheritance for these. */
.pair > div, .pair p, .pair h3 { color: var(--ink); }
.pair .got h3 { color: var(--accent-deep); }
.pair .not h3 { color: var(--amber); }
.flow li, .flow b { color: var(--ink); }
.flow span { color: var(--muted); }

/* ---------- contrast fixes (2026-08-23) ----------
   .band sets color:#e8f0f6 for its dark background. Any light card placed
   inside a band inherits that unless it says otherwise, and .band h3 (declared
   later in this file) overrides earlier component h3 colours. The .status
   block hit both: white headings and white list text on white cards,
   i.e. contrast 1.0. Measured on the live page before this block existed. */
.band .status > div { color: var(--ink); }
.band .status h3 { color: var(--accent-deep); }
.band .status .hard h3 { color: #7d5b13; }
.band .status ul, .band .status li, .band .status p { color: var(--ink-2); }
.band .split > div { color: var(--ink); }
.band .split h3 { color: var(--accent-deep); }
.band .split .unobs h3 { color: #7d5b13; }
.band .split ul, .band .split li { color: var(--ink-2); }

/* .unobs sits on #f4f6f9; the standard amber only reaches 3.95:1 there. */
.split .unobs h3 { color: #7d5b13; }

/* muted grey is a light-background colour -- lift it on dark grounds */
.hero .micro { color: #93aabe; }
.band figure[style*="12243a"] figcaption,
figure[style*="12243a"] figcaption { color: #9fb6c8; }
