/* ICOS realization-gap project page — classic academic layout (white page, centred header,
   the 3D viewer as the teaser). Semantic colours follow the paper's figures:
   brick red = abstract design space, steel blue = fabricable, orange = the printed connector. */
:root {
  --bg: #ffffff;
  --panel: #f5f6f8;
  --panel-2: #eceef2;
  --ink: #111418;
  --ink-2: #3b434c;
  --muted: #6b7480;
  --rule: #e4e7ec;
  --steel: #1f6fb4;
  --brick: #c0392b;
  --orange: #e8a23a;
  --btn: #1c2026;
  --btn-ink: #ffffff;
  --viewport: #0f1216;
  --focus: #1f6fb4;
  --shadow: 0 1px 2px rgba(17, 20, 24, .05), 0 12px 32px rgba(17, 20, 24, .10);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --panel: #171b21; --panel-2: #1f252d;
    --ink: #e8ecf1; --ink-2: #c3cbd5; --muted: #98a2ae; --rule: #262c35;
    --steel: #5fa3e8; --brick: #e0685c; --orange: #f0b15a;
    --btn: #e8ecf1; --btn-ink: #0f1216; --viewport: #0a0d11; --focus: #5fa3e8;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --panel: #171b21; --panel-2: #1f252d;
  --ink: #e8ecf1; --ink-2: #c3cbd5; --muted: #98a2ae; --rule: #262c35;
  --steel: #5fa3e8; --brick: #e0685c; --orange: #f0b15a;
  --btn: #e8ecf1; --btn-ink: #0f1216; --viewport: #0a0d11; --focus: #5fa3e8;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.mono { font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -.015em; }
h1 { font-weight: 700; font-size: clamp(1.9rem, 1.1rem + 2.9vw, 3.15rem); line-height: 1.08; }
h2 { font-weight: 650; font-size: clamp(1.4rem, 1.05rem + 1.3vw, 2rem); line-height: 1.15; text-align: center; }
h3 { font-weight: 600; font-size: 1rem; }
.eyebrow { font-family: "IBM Plex Mono", monospace; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }
.wrap.narrow { max-width: 780px; }
.center { text-align: center; }
section { padding: clamp(40px, 6vw, 80px) 0 0; }
section > .wrap > h2 { margin-bottom: 8px; }
.sub { text-align: center; color: var(--muted); font-size: .95rem; margin: 0 auto 26px; max-width: 76ch; text-wrap: balance; }
.brick-t { color: var(--brick); } .steel-t { color: var(--steel); }
.hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header ---- */
header.top { padding: clamp(40px, 6vw, 72px) 0 0; text-align: center; }
header.top .eyebrow { margin-bottom: 18px; }
header.top h1 { max-width: 30ch; margin: 0 auto; }
.subtitle { margin: 14px auto 0; color: var(--ink-2); font-size: clamp(1rem, .9rem + .5vw, 1.25rem); font-weight: 400; max-width: 40ch; text-wrap: balance; }
.authors { margin: 26px auto 0; font-size: 1.05rem; line-height: 1.7; }
.authors a { color: var(--ink); }
.authors a:hover { color: var(--steel); }
.authors sup { font-size: .62em; color: var(--muted); margin-left: 1px; }
.affil { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  background: var(--btn); color: var(--btn-ink); border: 1px solid var(--btn); text-decoration: none;
  font-size: .9rem; font-weight: 500; letter-spacing: .01em; cursor: pointer; line-height: 1;
}
.btn:hover { text-decoration: none; opacity: .88; }
.btn svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink-2); opacity: 1; }

/* ---- viewer (teaser) ---- */
.viewer-shell { margin: 36px auto 0; border-radius: 14px; overflow: hidden; background: var(--viewport); box-shadow: var(--shadow); border: 1px solid var(--rule); text-align: left; }
#viewport { position: relative; height: clamp(380px, 58vh, 600px); background: var(--viewport); cursor: grab; }
#viewport:active { cursor: grabbing; }
#viewport canvas { display: block; width: 100%; height: 100%; }
#viewport::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 88px; background: linear-gradient(rgba(6,8,11,.65), rgba(6,8,11,0)); pointer-events: none; z-index: 1; }
.hud, .readout { z-index: 2; }
.hud { position: absolute; left: 18px; top: 14px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.hud .name { font-weight: 650; color: #f3f5f8; font-size: 1.1rem; letter-spacing: -.01em; }
.hud .tag { font-family: "IBM Plex Mono", monospace; font-size: .74rem; color: #a6afbb; }
.hud .tag b { color: #f0b15a; font-weight: 500; }
.readout { position: absolute; right: 18px; top: 14px; display: grid; grid-template-columns: auto auto; gap: 2px 12px; font-family: "IBM Plex Mono", monospace; font-size: .76rem; color: #a6afbb; pointer-events: none; text-align: right; }
.readout b { color: #f3f5f8; font-weight: 500; font-variant-numeric: tabular-nums; }
.hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); font-family: "IBM Plex Mono", monospace; font-size: .7rem; color: #6b7684; pointer-events: none; white-space: nowrap; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: #a6afbb; font-family: "IBM Plex Mono", monospace; font-size: .85rem; background: rgba(10,13,17,.55); z-index: 3; }
.loading[hidden] { display: none; }
.controls { display: grid; grid-template-columns: minmax(220px, 1.25fr) auto auto; gap: 12px 24px; align-items: center; padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--rule); }
.controls .group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.controls .small { font-family: "IBM Plex Mono", monospace; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg button { background: transparent; border: 0; padding: 7px 12px; font: inherit; font-size: .84rem; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--rule); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button:disabled { color: var(--rule); cursor: not-allowed; }
.seg button.space-abs[aria-pressed="true"] { background: var(--brick); color: #fff; }
.seg button.space-fab[aria-pressed="true"] { background: var(--steel); color: #fff; }
select.morph { font: inherit; font-size: .9rem; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); color: var(--ink); max-width: 100%; min-width: 0; flex: 1; }
.transport { display: flex; align-items: center; gap: 8px; }
.transport button { font: inherit; font-size: .84rem; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); cursor: pointer; line-height: 1.2; }
.transport button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.transport button.icon { width: 34px; padding: 7px 0; text-align: center; }
input[type=range] { width: 100%; accent-color: var(--orange); margin: 0; }
.controls .wide { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.note { font-size: .8rem; color: var(--muted); }
#viewer-note:empty { display: none; }
.viewer-caption { margin: 12px auto 0; font-size: .82rem; color: var(--muted); text-align: center; }
@media (max-width: 820px) { .controls { grid-template-columns: 1fr 1fr; } .controls .group:first-child { grid-column: 1 / -1; } .readout { display: none; } }
@media (max-width: 520px) { .controls { grid-template-columns: 1fr; } .controls .wide { grid-template-columns: 1fr; } .hint { display: none; } }

/* ---- TL;DR ---- */
.tldr { font-size: clamp(1.1rem, 1rem + .6vw, 1.35rem); line-height: 1.5; font-weight: 450; color: var(--ink); text-align: center; text-wrap: pretty; margin: 0; }
.tldr b { font-weight: 650; }
details.abstract { margin: 22px auto 0; max-width: 72ch; }
details.abstract summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; color: var(--steel); padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px; user-select: none; }
details.abstract summary::-webkit-details-marker { display: none; }
details.abstract summary::before { content: "+"; font-family: "IBM Plex Mono", monospace; font-weight: 500; }
details.abstract[open] summary::before { content: "–"; }
details.abstract summary:hover { border-color: var(--steel); }
details.abstract > div { text-align: center; }
details.abstract p { text-align: left; margin: 18px 0 0; color: var(--ink-2); font-size: .98rem; line-height: 1.65; }

/* ---- key numbers ---- */
.numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 40px auto 0; }
.numbers > div { background: var(--panel); border-radius: 12px; padding: 22px 16px 18px; text-align: center; }
.numbers .v { font-weight: 650; font-size: clamp(1.5rem, 1rem + 1.6vw, 2.25rem); letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.numbers .v.brick { color: var(--brick); } .numbers .v.steel { color: var(--steel); }
.numbers .k { font-size: .82rem; color: var(--muted); margin-top: 8px; line-height: 1.35; text-wrap: balance; }
@media (max-width: 720px) { .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- figures ---- */
figure { margin: 0; }
.figs { display: grid; grid-template-columns: 1fr; gap: 36px; margin-top: 8px; }
.figs.two { grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; }
figure img { width: 100%; height: auto; display: block; background: #fff; border-radius: 8px; }
figure.card-fig img { border: 1px solid var(--rule); padding: 8px; }
figure video { width: 100%; height: auto; display: block; background: #000; border-radius: 8px; }
figure.card-fig video { border: 1px solid var(--rule); }
.figs.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .figs.three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .figs.three { grid-template-columns: 1fr; } }
figcaption { font-size: .86rem; color: var(--muted); margin-top: 12px; text-align: center; text-wrap: pretty; }
figcaption .key { display: block; margin-top: 4px; font-family: "IBM Plex Mono", monospace; font-size: .7rem; letter-spacing: .02em; }
@media (max-width: 720px) { .figs.two { grid-template-columns: 1fr; } }

/* ---- gallery: one card per morphology, abstract -> fabricable pair ---- */
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 12px 12px; display: flex; flex-direction: column; gap: 9px; transition: border-color .15s ease, box-shadow .15s ease; }
.card.active { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.card .lbl { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.card .lbl b { font-weight: 650; font-size: 1.05rem; letter-spacing: -.01em; }
.card .lbl .sp { font-family: "IBM Plex Mono", monospace; font-size: .68rem; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .chip { font-family: "IBM Plex Mono", monospace; font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: var(--panel); color: var(--muted); white-space: nowrap; cursor: help; }
.card .chip.up { color: var(--steel); } .card .chip.down { color: var(--brick); }
.card .pairs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 6px; }
.card .arrow { align-self: center; color: var(--muted); font-size: 1.1rem; }
.card .half { border: 1px solid transparent; background: var(--panel); border-radius: 9px; padding: 0; cursor: pointer; display: flex; flex-direction: column; overflow: hidden; font: inherit; color: var(--ink); text-align: left; min-width: 0; transition: border-color .15s ease, transform .15s ease; }
.card .half:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.card .half.active { border-color: var(--orange); }
.card .thumb { aspect-ratio: 4 / 3; display: block; position: relative; }
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.card .stat { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 5px 9px 7px; font-family: "IBM Plex Mono", monospace; font-size: .74rem; color: var(--muted); border-top: 1px solid var(--rule); }
.card .stat b { font-weight: 500; font-size: .84rem; }
.card .half.abs .stat b { color: var(--brick); } .card .half.fab .stat b { color: var(--steel); }
.card .pairs.stats { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.card .pairs.stats .stat { border-top: 0; background: var(--panel); border-radius: 9px; padding: 6px 9px 7px; cursor: help; }
.card .pairs.stats .stat.abs b { color: var(--brick); } .card .pairs.stats .stat.fab b { color: var(--steel); }
@media (max-width: 960px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .gallery { grid-template-columns: 1fr; } }

/* ---- what changes at realization ---- */
.speclist { margin: 28px auto 0; max-width: 820px; display: grid; gap: 0; }
.speclist > div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 11px 2px; border-bottom: 1px solid var(--rule); align-items: baseline; }
.speclist > div:first-child { border-top: 1px solid var(--rule); }
.speclist dt { font-family: "IBM Plex Mono", monospace; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.speclist dd { margin: 0; font-size: .92rem; color: var(--ink-2); }
.speclist .from { color: var(--brick); } .speclist .to { color: var(--steel); } .speclist .arrow { color: var(--muted); margin: 0 6px; }
.finding { margin: 22px auto 0; max-width: 820px; font-size: .95rem; color: var(--ink-2); text-align: center; text-wrap: pretty; }
@media (max-width: 620px) { .speclist > div { grid-template-columns: 1fr; gap: 3px; } }

/* ---- results table (collapsed) ---- */
details.table { margin-top: 8px; }
details.table summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border: 1px solid var(--rule); border-radius: 12px; font-weight: 500; font-size: .95rem; user-select: none; }
details.table summary::-webkit-details-marker { display: none; }
details.table summary::after { content: "▾"; color: var(--muted); }
details.table[open] summary::after { content: "▴"; }
details.table summary:hover { border-color: var(--ink-2); }
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
th { font-family: "IBM Plex Mono", monospace; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel); }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2), th:nth-child(3), td:nth-child(3) { text-align: left; }
th[aria-sort="descending"]::after { content: " ▾"; } th[aria-sort="ascending"]::after { content: " ▴"; }
td.a { color: var(--brick); } td.f { color: var(--steel); font-weight: 500; }
tbody tr:hover { background: var(--panel); }
.tablenote { font-size: .8rem; color: var(--muted); text-align: center; margin: 12px 0 0; }

/* ---- bibtex ---- */
.bibwrap { position: relative; margin-top: 8px; }
#bibtex h2 { margin-bottom: 14px; }
pre.bib { background: var(--panel); border-radius: 12px; padding: 18px 20px; font-size: .8rem; line-height: 1.55; overflow-x: auto; margin: 0; }
.copy { position: absolute; top: -42px; right: 0; font: inherit; font-size: .78rem; font-weight: 500; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); cursor: pointer; }
.copy:hover { border-color: var(--ink-2); }
footer { padding: 56px 0 56px; color: var(--muted); font-size: .82rem; text-align: center; }
footer p { margin: 4px 0; }

/* gallery halves are not a comparison: neutral colours, no arrow column (2026-09-04) */
.card .pairs, .card .pairs.stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.card .arrow { display: none; }
.card .pairs.stats .stat.abs b, .card .pairs.stats .stat.fab b, .card .half.abs .stat b, .card .half.fab .stat b { color: var(--ink); }
.card .pairs.stats .stat b { white-space: nowrap; }
