/* GR — BIST project page
   =====================
   Same page format as the Mangru project page; the palette is GR's own.

   Two colours carry the whole argument: a green (--accent) for savings and
   for observations that MATCH the construction record, and a warm ember
   (--ember, --candle) for the places that deserve a second look: increases,
   mismatches, the links, and the one button we want pressed. */

:root {
  --bg:           #070d0a;
  --bg-deep:      #040806;
  --panel:        #121a15;
  --panel-2:      #151f18;
  --border:       rgba(180, 200, 186, 0.10);
  --text:         #e9efe8;
  --body:         rgba(233, 239, 232, .84);
  --dim:          #93a096;
  --dimmer:       #576359;
  --accent:       #34d399;   /* green — savings, MATCH */
  --ember:        #f5b878;   /* warm — increases, MISMATCH, links */
  --candle:       #ffd9a8;

  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --brand: 'Gugi', var(--mono);

  /* The page is wide; the COLUMN is what stays readable. --shell is the
     outer bound, and text inside it splits into two columns rather than
     running to 150 characters a line. */
  --shell: 82rem;
  --pad:   clamp(24px, 5vw, 60px);
  --label: 12rem;   /* the section-label gutter on wide screens */

  color-scheme: dark;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.95;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

/* ── Language ─────────────────────────────────────────────────
   Both languages are in the markup and one is hidden here, so the page is
   correct before any script runs. The toggle only flips one attribute. */
[data-lang="en"] .ko,
[data-lang="ko"] .en { display: none; }

/* JetBrains Mono carries no Hangul; Korean prose gets one face for the whole
   run so the rhythm of the line does not fight itself. The mono is kept for
   the Latin-and-numerals furniture, where it belongs. */
[data-lang="ko"] body,
[data-lang="ko"] h2 {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR',
               'Nanum Gothic', system-ui, sans-serif;
  line-height: 1.9;
  letter-spacing: 0;
}
[data-lang="ko"] .body > p { font-size: 15.5px; }
[data-lang="ko"] .w-note { line-height: 1.85; }

/* Korean wraps between syllables by default; keep-all makes it break at
   word boundaries like the English. */
[data-lang="ko"] body,
[data-lang="ko"] .question,
[data-lang="ko"] .visit-lede { word-break: keep-all; }

/* Wide tracking is a Latin device. On Hangul it pulls a word apart, so every
   tracked style gets a much smaller value in Korean. */
[data-lang="ko"] .kicker,
[data-lang="ko"] h2,
[data-lang="ko"] .counts dd,
[data-lang="ko"] .foot-back,
[data-lang="ko"] .visit-btn { letter-spacing: .04em; }
[data-lang="ko"] h2,
[data-lang="ko"] .counts dd,
[data-lang="ko"] .foot-back { text-transform: none; }

/* Instrument Serif carries no Hangul; the display lines get their own stack
   and their own measure. */
[data-lang="ko"] .question {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR',
               system-ui, sans-serif;
  font-size: clamp(24px, 3.6vw, 40px);
  line-height: 1.5;
  max-width: 20ch;
  font-weight: 300;
}
[data-lang="ko"] .visit-lede {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR',
               system-ui, sans-serif;
  font-size: clamp(19px, 2.4vw, 25px);
}

a { color: var(--ember); text-decoration: none; }
a:hover { color: var(--candle); text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--text); font-weight: 500; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 12px; top: 12px; z-index: 10;
  background: var(--ember); color: var(--bg-deep); padding: 10px 16px;
}

/* ── Top bar ──────────────────────────────────────────────────
   Sticky: the logo is the only way back into the lab site and the toggle is
   the only way to change language, so neither should scroll out of reach. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
}
.topbar-home { color: var(--dimmer); display: inline-block; }
.topbar-home:hover { color: var(--ember); text-decoration: none; }

.lang-toggle {
  flex: 0 0 auto;
  font: inherit; font-size: 11px; letter-spacing: .18em;
  font-family: var(--mono);
  background: none; color: var(--dim);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 7px 14px; cursor: pointer;
}
.lang-toggle:hover { color: var(--ember); border-color: var(--ember); }
.lang-toggle .en {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  letter-spacing: .06em;
}

/* The lab mark, held back to match the rest of the chrome and brought to
   full strength on hover. Width/height on the element so the bar does not
   jump while it loads. */
.bist-logo {
  display: block;
  height: 34px; width: auto;
  opacity: .72;
}
.topbar a:hover .bist-logo { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .bist-logo { transition: opacity .18s ease; }
}

/* ── Shell ───────────────────────────────────────────────────
   Everything shares one outer width so figures and text line up on the
   left edge all the way down the page. */
.hero, .sec, .fig, .visit, .foot {
  max-width: var(--shell); margin-inline: auto; padding-inline: var(--pad);
}

/* ── Hero ─────────────────────────────────────────────────────
   Wordmark and question on the left, the knowledge graph on the right.
   Below 980px the graph drops under the text. */
.hero {
  padding-top: clamp(40px, 6vw, 80px);
  padding-bottom: clamp(20px, 4vw, 44px);
  display: grid; gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
@media (min-width: 980px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(320px, 520px); }
}

.hero-text { min-width: 0; }

.hero-media { margin: 0; }
.hero-media img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-deep);
}
.hero-media figcaption {
  margin: 10px 0 0;
  font-size: 11.5px; line-height: 1.65; color: var(--dimmer);
}

/* Mark and wordmark are one link to the demo. Hovering lights the window. */
.wordmark { display: inline-block; color: inherit; text-decoration: none; }
.wordmark:hover { text-decoration: none; }

.glyph { display: block; width: 64px; height: 64px; margin: 0 0 28px; }
.glyph .frame {
  fill: none; stroke: var(--dim); stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round;
}
.glyph .halo { fill: var(--ember); opacity: 0; }
.glyph .glow { fill: var(--ember); opacity: .22; }
.glyph .lamp { fill: var(--candle); }

/* Hovering the link lights the building's window: the halo comes up, the
   glow strengthens, and the wordmark warms toward the same colour, so it
   reads as one gesture. */
.wordmark:hover .glyph .halo,
.wordmark:focus-visible .glyph .halo { opacity: .16; }
.wordmark:hover .glyph .glow,
.wordmark:focus-visible .glyph .glow { opacity: .45; }
.wordmark:hover .glyph .lamp,
.wordmark:focus-visible .glyph .lamp {
  filter: drop-shadow(0 0 2.5px var(--candle));
}
.wordmark:hover .glyph .frame,
.wordmark:focus-visible .glyph .frame { stroke: var(--text); }
.wordmark:hover h1,
.wordmark:focus-visible h1 { color: var(--candle); }

@media (prefers-reduced-motion: no-preference) {
  .glyph .halo, .glyph .glow, .glyph .lamp, .glyph .frame, .wordmark h1 {
    transition: opacity .25s ease, filter .25s ease,
                stroke .25s ease, color .25s ease;
  }
}

h1 {
  margin: 0 0 14px;
  font-family: var(--brand); font-weight: 400;
  font-size: clamp(46px, 8vw, 88px); line-height: 1;
  letter-spacing: .01em; color: var(--text);
}
.kicker {
  margin: 0 0 36px;
  font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--dimmer);
}
.kicker .han {
  font-family: system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  letter-spacing: .1em; color: var(--ember); margin-right: 6px;
}
/* The one line allowed to be large and slow. */
.question {
  margin: 0; max-width: 24ch;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(28px, 5vw, 54px); line-height: 1.22;
  color: var(--text); text-wrap: balance;
}

/* ── Sections ─────────────────────────────────────────────────
   Label in a left gutter, prose in the rest. Past 1180px the prose splits
   into two columns. */
.sec { padding-block: clamp(30px, 4vw, 54px); }

h2 {
  margin: 0 0 20px;
  font-family: var(--mono); font-weight: 400;
  font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--dim);
}
h2::before {
  content: ""; display: inline-block;
  width: 18px; height: 1px; margin-right: 12px; vertical-align: middle;
  background: var(--dimmer);
}

.body > p { margin: 0 0 1.45em; color: var(--body); }
.body > p:last-child { margin-bottom: 0; }
.lede { color: var(--text); }

@media (min-width: 900px) {
  .sec {
    display: grid; grid-template-columns: var(--label) minmax(0, 1fr);
    column-gap: 40px; align-items: start;
  }
  h2 { margin-bottom: 0; padding-top: .55em; }
  h2::before { display: none; }
}

@media (min-width: 1180px) {
  .body { columns: 2; column-gap: 56px; }
  .body > p { orphans: 2; widows: 2; }
  .body > p:first-child { margin-top: 0; }
}

/* ── Figures ────────────────────────────────────────────────── */
.fig { margin-block: clamp(20px, 3.5vw, 40px); }
/* A footnote inside the caption: same voice, quieter. */
.fn {
  display: block; margin-top: 9px; padding-top: 9px;
  border-top: 1px solid var(--border);
  color: var(--dimmer); font-size: 11.5px; line-height: 1.65;
}

.fig figcaption {
  max-width: 46rem; margin: 16px 0 0;
  font-size: 12.5px; line-height: 1.7; color: var(--dimmer);
}
.fig img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: 4px;
}
/* The pipeline diagram is a working document with a white ground; boxed and
   dimmed slightly so it reads as an exhibit on this page, not a hole in it. */
.fig img.diagram { background: #fff; opacity: .96; }

/* Counts */
.counts {
  display: grid; gap: 26px 20px; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding: clamp(26px, 3vw, 38px) clamp(22px, 3vw, 34px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
}
.counts dt {
  font-family: var(--mono); font-weight: 300;
  font-size: clamp(30px, 3.4vw, 42px); line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.counts dd {
  margin: 10px 0 0; font-size: 11.5px; letter-spacing: .12em;
  text-transform: uppercase; line-height: 1.5; color: var(--dim);
}

/* What it reads — descriptions, so a list rather than a table. */
.watch { list-style: none; margin: 0; padding: 0; }
.watch li {
  display: grid; gap: 4px 28px; padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.watch li:first-child { padding-top: 0; }
.watch li:last-child { border-bottom: none; padding-bottom: 0; }
.w-head { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.w-name { color: var(--text); }
.w-note { color: var(--dim); font-size: 14px; line-height: 1.8; }

/* Drawn the same way as the building glyph in the hero: thin even strokes,
   round joins, no fill. Decorative; the name beside each carries the
   meaning. */
.w-ico {
  flex: 0 0 auto; width: 26px; height: 26px;
  margin-top: 1px;
  fill: none; stroke: var(--dim); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}

@media (min-width: 720px) {
  .watch li { grid-template-columns: 15rem minmax(0, 1fr); align-items: baseline; }
}
@media (min-width: 1180px) {
  .watch { columns: 2; column-gap: 56px; }
  .watch li {
    grid-template-columns: minmax(0, 1fr);
    break-inside: avoid;
  }
  .watch li .w-note { padding-left: 37px; }
  .watch li:first-child { padding-top: 18px; }
  .watch li:last-child { border-bottom: 1px solid var(--border); }
}

/* Usage bars — nine buildings, savings in green, increases in ember. The
   warm colour is exactly where the page wants the reader to look: the
   increases are where the interesting diagnoses live. */
.bars { list-style: none; margin: 0; padding: 0; }
.bars li {
  display: grid; grid-template-columns: 13rem minmax(0, 1fr) 4.5rem;
  align-items: center; gap: 18px; padding: 11px 0;
}
.b-lab { color: var(--dim); font-size: 13.5px; }
.b-track {
  height: 8px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 2px; overflow: hidden;
}
.b-fill { display: block; height: 100%; background: var(--accent); opacity: .55; }
.b-fill.up { background: var(--ember); opacity: .5; }
.b-val {
  text-align: right; color: var(--accent);
  font-variant-numeric: tabular-nums; font-size: 14px;
}
.b-val.up { color: var(--ember); }
@media (max-width: 620px) {
  .bars li { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .b-lab { grid-column: 1 / -1; }
}

/* ── Verdict cards ────────────────────────────────────────────
   One card per building: what each path observed, and what the evidence
   made of it. The tag colours repeat the bar colours, so MATCH/green and
   MISMATCH/ember read as one vocabulary across the page. */
.verdicts {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.verdicts li {
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  padding: 18px 20px 12px;
}
.v-head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 10px;
}
.v-code {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  color: var(--dimmer);
}
.v-name { color: var(--text); font-size: 14.5px; }
.v-delta {
  margin-left: auto; font-family: var(--mono); font-size: 13px;
  font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap;
}
.v-delta.up { color: var(--ember); }
.v-line {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; border-top: 1px solid var(--border);
  font-size: 13px; line-height: 1.7;
}
.v-tag {
  flex: 0 0 auto; margin-top: 2px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  padding: 1px 7px; border-radius: 2px; white-space: nowrap;
  border: 1px solid var(--border); color: var(--dimmer);
}
.v-tag.match { color: var(--accent); border-color: rgba(52, 211, 153, .35); }
.v-tag.mis   { color: var(--ember);  border-color: rgba(245, 184, 120, .35); }
.v-note { color: var(--dim); min-width: 0; }
[data-lang="ko"] .v-note { word-break: keep-all; }

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

/* ── Dempster-Shafer figure ───────────────────────────────────
   The theory drawn in the page's own vocabulary: green mass is belief
   assigned to hypotheses, grey is preserved uncertainty, ember is the
   conflict term K. Built in markup, so it ships inside the page with no
   image file. */
.ds { display: grid; gap: 14px; }
.ds-block {
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  padding: 20px 22px;
}
.ds-h {
  margin: 0 0 16px; font-family: var(--mono); font-weight: 400;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim);
}
[data-lang="ko"] .ds-h { letter-spacing: .06em; }
.ds-pair { display: grid; gap: 14px; }
@media (min-width: 860px) { .ds-pair { grid-template-columns: 1fr 1fr; } }

/* Formulas set in the serif so the maths reads as maths; the surrounding
   chrome stays mono. */
.math {
  margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 40px;
  font-family: var(--serif); font-style: italic;
  font-size: 20px; color: var(--text);
}
.m-eq { display: inline-flex; align-items: center; gap: 8px; }
.math sub { font-size: .58em; font-style: normal; color: var(--dim); }
.frac { display: inline-flex; flex-direction: column; text-align: center; }
.frac .num { padding: 0 10px 5px; border-bottom: 1px solid var(--dim); }
.frac .den { padding-top: 5px; }
.sum {
  display: inline-flex; flex-direction: column; align-items: center;
  line-height: 1; margin-right: 5px; font-style: normal;
}
.sum small { font-size: 9.5px; letter-spacing: .02em; color: var(--dim); margin-top: 3px; }
.m-note { margin: 14px 0 0; font-size: 12px; line-height: 1.7; color: var(--dimmer); }

/* Mass bars: flex weights stand in for the shares. */
.ds-bar { display: flex; gap: 3px; }
.ds-bar .seg {
  min-width: 0; padding: 9px 6px; border-radius: 2px; text-align: center;
  font-size: 11px; line-height: 1.45;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--dim);
}
.ds-bar .s-sup { background: rgba(52, 211, 153, .13); border-color: rgba(52, 211, 153, .35); color: var(--accent); }
.ds-bar .s-con { background: rgba(245, 184, 120, .12); border-color: rgba(245, 184, 120, .4); color: var(--ember); }
.ds-note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.75; color: var(--dim); }

/* The combination process: evidence chips falling into one mass bar. */
.ds-case + .ds-case { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.ds-case-t { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text); }
.ds-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-chips i {
  font-style: normal; font-size: 11px; padding: 5px 11px; border-radius: 2px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--body);
}
.ds-arrow {
  margin: 9px 0; font-size: 10.5px; color: var(--dimmer);
  letter-spacing: .16em; text-transform: uppercase;
}
[data-lang="ko"] .ds-arrow { letter-spacing: .08em; }

/* ── Visit ────────────────────────────────────────────────── */
.visit {
  margin-top: clamp(30px, 5vw, 56px);
  padding-block: clamp(56px, 8vw, 92px);
  border-top: 1px solid var(--border);
  text-align: center;
}
.visit-lede {
  margin: 0 0 26px;
  font-family: var(--serif); font-size: clamp(22px, 3vw, 30px);
  line-height: 1.4; color: var(--dim);
}
.visit-btn {
  display: inline-block; padding: 15px 42px;
  border: 1px solid var(--ember); border-radius: 3px; color: var(--candle);
  font-size: 13px; letter-spacing: .16em; text-transform: uppercase;
}
.visit-btn:hover { background: var(--ember); color: var(--bg-deep); text-decoration: none; }
.visit-note { margin: 18px 0 0; font-size: 11.5px; letter-spacing: .1em; color: var(--dimmer); }

/* ── Footer ───────────────────────────────────────────────── */
.foot {
  padding-block: 30px 56px; border-top: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.8; color: var(--dim);
}
.credits { max-width: 46rem; }
.credits p { margin: 0 0 .9em; }
.credits .thin { color: var(--dimmer); }
.foot-back {
  display: inline-block; margin-top: 14px;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--dimmer);
}
.foot-back:hover { color: var(--ember); text-decoration: none; }
