/* PREP project page: one centred column, in the manner of academic project pages. Colours are the teaser video's. */

@font-face { font-family: "Bricolage"; src: url("../fonts/Bric-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("../fonts/Bric-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Instrument"; src: url("../fonts/Inst-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument"; src: url("../fonts/Inst-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Instrument"; src: url("../fonts/Inst-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --ink: #2b2e3a;
  --soft: #6a6f80;
  --rule: #dfe2ea;
  --wash: #f5f6f9;
  --blue: #4a58d0;
  --blue-wash: #eceeff;
  --amber: #b86a06;
  --amber-wash: #fff0d6;
  --green: #17806c;
  --red: #c7463c;
  --night: #0f1430;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: #fff; color: var(--ink); text-align: center;
  font: 400 1.0625rem/1.6 "Instrument", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
img, video, canvas { display: block; max-width: 100%; margin: 0 auto; }
sup { line-height: 0; }

.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1.25rem; }
.wrap.narrow { max-width: 46rem; }
section { padding: 3.5rem 0; }
section.band { background: var(--wash); }
.wrap + .wrap { margin-top: 1.5rem; }

/* ---- title ---- */
.hero { padding: 4rem 0 2rem; }
h1 { margin: 0; font: 700 clamp(1.7rem, 4.4vw, 2.75rem)/1.2 "Bricolage", sans-serif; letter-spacing: -0.015em; }
.authors { margin: 1.5rem 0 0; font-size: 1.15rem; }
.authors span, .places span { display: inline-block; margin: 0 0.3rem; white-space: nowrap; }
.authors a { color: var(--blue); text-decoration: none; }
.authors a:hover { text-decoration: underline; }
.places { margin: 0.5rem 0 0; color: var(--soft); }
.logos { margin: 1.4rem 0 0; display: flex; justify-content: center; align-items: center; gap: 2.75rem; }
.logos a { display: block; line-height: 0; }
.logos img { width: auto; }
.l-insait { height: 1.75rem; }
.l-google { height: 2.4rem; position: relative; top: 0.2rem; }
.links { margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.pill { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 1.25rem; border-radius: 99px; background: #363636; color: #fff; font-weight: 500; text-decoration: none; }
a.pill:hover { background: #111; }
.pill.off { background: #e6e7ec; color: var(--soft); }
.pill svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.teaser { padding-top: 0; }
.glance { padding: 1.5rem; border-radius: 12px; background: var(--night); color: #fff; }
.glance h2 { margin-bottom: 0.9rem; font-size: 1.15rem; letter-spacing: 0.02em; color: #8e9bff; }
.tldr { margin: 0 0 1.5rem; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; font-size: 1rem; line-height: 1.45; color: #d5d9ee; }
.tldr b { display: block; margin-bottom: 0.25rem; font: 700 1.2rem/1.25 "Bricolage", sans-serif; color: #fff; }
.glance video { border: 1px solid rgba(255, 255, 255, 0.14); }
.glance .facts { margin-top: 1.5rem; }
.glance .facts b { color: #ffa63d; }
.glance .facts span { color: #b9bfdc; }
@media (max-width: 720px) { .glance { padding: 1.1rem; } .tldr { grid-template-columns: 1fr; gap: 1rem; } }
video { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--night); }

h2 { margin: 0 0 1rem; font: 700 clamp(1.5rem, 3.2vw, 2rem)/1.2 "Bricolage", sans-serif; letter-spacing: -0.01em; }
h3 { margin: 2.5rem 0 0.4rem; font: 700 1.25rem/1.25 "Bricolage", sans-serif; }
p { margin: 0 0 1rem; }
.justify { text-align: justify; }
.hint, .caption, figcaption { color: var(--soft); font-size: 0.93rem; }
.caption, figcaption { margin: 0.8rem auto 0; max-width: 46rem; }
figure { margin: 2.5rem 0 0; }
.todo { background: #fff6a8; text-align: center; }

/* ---- four facts ---- */
.facts { margin: 2rem 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.facts b { display: block; font: 700 2.1rem/1.1 "Bricolage", sans-serif; color: var(--blue); }
.facts span { display: block; margin-top: 0.3rem; color: var(--soft); font-size: 0.95rem; line-height: 1.4; }
@media (max-width: 720px) { .facts { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1rem; } }

/* ---- shared controls ---- */
h2 + .panel, h2 + .grow, h2 + .why { margin-top: 1.5rem; }
.panel { padding: 1.25rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; }
button { font: inherit; cursor: pointer; }
.btn { padding: 0.4rem 1.1rem; border: 1px solid #363636; border-radius: 99px; background: #fff; color: #363636; font-weight: 500; font-size: 0.95rem; }
.btn:hover:not(:disabled) { background: #363636; color: #fff; }
.btn:disabled { border-color: var(--rule); color: var(--soft); cursor: default; }
.btn.main { background: #363636; color: #fff; }
.btn.main:disabled { background: #e6e7ec; border-color: #e6e7ec; color: var(--soft); }
.btn.reset { border-color: var(--blue); color: var(--blue); }
.btn.reset:hover { background: var(--blue); color: #fff; }
.pick { padding: 0.4rem 1rem; border: 1px solid var(--rule); border-radius: 99px; background: #fff; color: var(--soft); font-size: 0.95rem; }
.pick[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-wash); color: var(--blue); font-weight: 600; }
.count { color: var(--soft); font-size: 0.9rem; }

/* ---- one clip of the loop ---- */
.loop-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.5rem; margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: s; color: var(--soft); font-size: 0.93rem; }
.loop-steps li { counter-increment: s; }
.loop-steps li::before { content: counter(s) ". "; }
.loop-steps li.on { color: var(--blue); font-weight: 600; }
.loop-stage { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.25rem; margin: 1rem 0; text-align: left; }
.loop-clip { position: relative; align-self: start; overflow: hidden; border-radius: 6px; background: var(--night); }
.loop-clip img { width: 100%; transition: filter 0.5s ease; }
.loop-clip.hidden img { filter: blur(22px) brightness(0.55); transform: scale(1.1); }
.loop-clip p { position: absolute; inset: auto 0 0 0; margin: 0; padding: 0.5rem 0.75rem; background: rgba(15, 20, 48, 0.78); color: #fff; font-size: 0.88rem; }
.loop-q { padding: 0.6rem 0; border-top: 1px solid var(--rule); }
.loop-q:first-child { border-top: 0; padding-top: 0; }
.loop-q p { margin: 0; }
.loop-q .who { color: var(--soft); font-size: 0.85rem; }
.loop-q .guess, .loop-q .truth { margin-top: 0.3rem; padding-left: 0.75rem; border-left: 3px solid var(--blue); font-size: 0.95rem; }
.loop-q .truth { border-left-color: var(--ink); }
.tag { display: inline-block; margin-left: 0.4rem; padding: 0 0.5rem; border-radius: 99px; font-size: 0.8rem; font-weight: 600; }
.tag.correct { background: #d9f2ec; color: var(--green); }
.tag.wrong { background: #fbe1de; color: var(--red); }
.tag.partial { background: var(--amber-wash); color: var(--amber); }
.loop-end { margin-top: 0.75rem; padding: 0.8rem 0.9rem; background: var(--wash); border-radius: 6px; }
.loop-end p { margin: 0; }
.loop-end .who { margin-bottom: 0.3rem; color: var(--soft); font-size: 0.88rem; }
@media (max-width: 760px) { .loop-stage { grid-template-columns: 1fr; } }

/* ---- how it works: one animated diagram ---- */
.how svg { display: block; width: 100%; height: auto; font-family: inherit; }
.how [data-a] { opacity: 0; transition: opacity 0.6s ease; }
.how [data-a].show { opacity: 1; }
.h-label { font: 600 14px "Instrument", sans-serif; fill: var(--soft); }
.h-note { font: 500 14px "Instrument", sans-serif; fill: var(--ink); }
.h-past image { opacity: 0.35; }
.h-past line { stroke: var(--soft); stroke-width: 1.5; }
.h-past text { font: 13px "Instrument", sans-serif; fill: var(--soft); }
.h-clip { transition: opacity 0.7s ease, transform 0.7s ease; transform-box: fill-box; transform-origin: center; }
.h-clip rect { fill: none; stroke: var(--ink); stroke-width: 2; }
.h-clip image { transition: filter 0.7s ease; }
.h-clip.in { animation: how-in 0.8s ease; }
.h-clip.veil image { filter: url(#how-blur) brightness(0.6); }
.h-clip.out { opacity: 0.12; transform: scale(0.82); }
@keyframes how-in { from { opacity: 0; transform: translateY(-70px) scale(0.5); } }
.h-card { fill: #fff; stroke: var(--rule); stroke-width: 1.5; }
.h-card.on { stroke: var(--blue); fill: var(--blue-wash); }
.h-role { font: 700 14px "Bricolage", sans-serif; fill: var(--ink); }
.h-role.amber, .h-tag.amber { fill: var(--amber); }
.h-role.blue { fill: var(--blue); }
.h-sub { font: 12px "Instrument", sans-serif; fill: var(--soft); }
.h-line { font: 15px "Instrument", sans-serif; fill: var(--ink); }
.h-mark { font: 700 17px "Instrument", sans-serif; }
.h-mark.good { fill: var(--green); }
.h-mark.bad { fill: var(--red); }
.h-wire { fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-dasharray: 5 5; animation: how-flow 1s linear infinite; }
@keyframes how-flow { to { stroke-dashoffset: -10; } }
.h-links line, .h-links path { fill: none; stroke: #c3c8dc; stroke-width: 1.5; transition: stroke 0.4s, stroke-width 0.4s, opacity 0.6s; }
.h-links .dash { stroke: #ffa63d; stroke-dasharray: 3 4; }
.h-links .hi { stroke: var(--blue); stroke-width: 3; }
.h-root { fill: var(--ink); }
.h-days circle { fill: #fff; stroke: var(--ink); stroke-width: 2; transition: fill 0.4s; }
.h-days circle.hi { fill: var(--blue); stroke: var(--blue); }
.h-days text, .h-tag { font: 12px "Instrument", sans-serif; fill: var(--soft); }
.h-leaves circle { fill: #8e9bff; transition: opacity 0.6s; }
.h-leaves circle.hi, .h-general.hi { animation: how-pulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.h-general { fill: #ffa63d; }
@keyframes how-pulse { 50% { transform: scale(1.9); } }
.how-cap { margin: 0.75rem 0 1rem; font: 700 1.25rem/1.3 "Bricolage", sans-serif; }
.how-dots { display: inline-flex; gap: 0.35rem; margin-left: 0.5rem; }
.how-dots i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--rule); }
.how-dots i.on { background: var(--blue); }
.how .hint { margin: 1rem 0 0; }
@media (prefers-reduced-motion: reduce) { .h-wire, .h-clip.in, .h-leaves circle.hi, .h-general.hi { animation: none; } }

/* ---- the memory growing ---- */
.grow { max-width: 44rem; margin: 0 auto; }
.grow-canvas { position: relative; overflow: hidden; background: var(--night); border-radius: 8px; aspect-ratio: 1; }
.zoom { position: absolute; top: 0.75rem; right: 0.75rem; display: flex; gap: 0.4rem; }
.zoom .btn { min-width: 2.3rem; padding: 0.3rem 0.8rem; border-color: #fff; background: #fff; }
.grow .hint { margin: 0.75rem 0 0; }
.grow-canvas canvas { width: 100%; height: 100%; cursor: crosshair; touch-action: pan-y; }
.grow-tip { position: absolute; max-width: 16rem; padding: 0.35rem 0.55rem; background: #fff; border-radius: 4px; color: var(--ink); font-size: 0.82rem; line-height: 1.35; text-align: left; pointer-events: none; transform: translate(12px, 12px); }
.grow-tip i { display: block; color: var(--soft); font-style: normal; }
.grow-ctl { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
input[type="range"] { flex: 1; accent-color: var(--blue); }
.grow-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1.25rem 0 0; }
.grow-stats dt { color: var(--soft); font-size: 0.88rem; }
.grow-stats dd { margin: 0; font: 700 1.3rem/1.2 "Bricolage", sans-serif; font-variant-numeric: tabular-nums; }
.grow-stats dd small { font: 400 0.9rem "Instrument", sans-serif; color: var(--soft); }
.key { margin: 1rem 0 0; color: var(--soft); font-size: 0.9rem; }
.key span { display: inline-block; margin: 0 0.6rem; }
.key i { display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.4rem; border-radius: 50%; }
.key .moment { background: #8e9bff; }
.key .general { background: #ffa63d; }
.key .fresh { background: #fff; border: 1px solid #999; }

/* ---- asking ---- */
.ask-q { margin: 1.25rem 0 0; font: 700 1.3rem/1.3 "Bricolage", sans-serif; }
.ask-when { margin: 0.25rem 0 0; color: var(--soft); font-size: 0.92rem; }
.ask-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin: 0.75rem 0 1rem; padding: 0; list-style: none; }
.ask-opts li { padding: 0.25rem 0.8rem; border: 1px solid var(--rule); border-radius: 99px; font-size: 0.95rem; }
.ask-opts li.right { border-color: var(--green); background: #d9f2ec; color: var(--green); font-weight: 600; }
.ask-step { margin: 0 auto 0.9rem; max-width: 44rem; padding: 0.85rem 1rem; background: var(--wash); border-radius: 6px; text-align: left; }
.ask-step .who { margin: 0 0 0.35rem; color: var(--soft); font-size: 0.88rem; }
.trail { margin: 0 0 0.5rem; padding: 0; list-style: none; font-size: 0.9rem; }
.trail li { padding-left: calc(var(--d) * 1.1rem); color: var(--soft); }
.trail li::before { content: "└ "; color: #b9bdcc; }
.trail li:first-child::before { content: ""; }
.trail li:last-child { color: var(--ink); font-weight: 600; }
.ask-step blockquote { margin: 0; padding-left: 0.75rem; border-left: 3px solid var(--blue); font-size: 0.95rem; }
.ask-list { margin: 0; padding-left: 1.1rem; columns: 2 18rem; font-size: 0.9rem; color: var(--soft); }
.ask-list li.next { color: var(--ink); font-weight: 600; }

/* ---- results as bars ---- */
.scroll { overflow-x: auto; }
.chart { display: grid; grid-template-columns: max-content repeat(5, minmax(5.5rem, 1fr)); gap: 0.5rem 1rem; min-width: 40rem; align-items: center; text-align: left; }
.c-group { padding-bottom: 0.2rem; border-bottom: 1.5px solid var(--rule); color: var(--soft); font-weight: 500; font-size: 0.9rem; }
.c-head { font: 700 1rem/1.25 "Bricolage", sans-serif; }
.c-name { color: var(--soft); font-size: 0.93rem; white-space: nowrap; }
.c-name.ours { color: var(--blue); font-weight: 600; }
.c-cell { position: relative; display: block; height: 1rem; }
.chart .c-cell::before { content: ""; position: absolute; left: var(--zero); top: -0.3rem; bottom: -0.3rem; border-left: 1.5px solid var(--ink); }
.chart .c-bar { position: absolute; }
.chart .c-none { padding-left: calc(var(--zero) + 0.4rem); }
.c-bar { display: block; height: 100%; min-width: 3px; border-radius: 3px; background: #c3c8dc; }
.c-bar.rep { background: repeating-linear-gradient(135deg, #c3c8dc 0 4px, #e9ebf3 4px 8px); }
.c-bar.ours { background: var(--blue); }
.c-none { display: block; white-space: nowrap; color: #a9adbd; font-size: 0.75rem; font-style: normal; line-height: 1rem; }
.key .k-ours, .key .k-other, .key .k-rep { width: 1.4rem; border-radius: 3px; }
.key .k-ours { background: var(--blue); }
.key .k-other { background: #c3c8dc; }
.key .k-rep { background: repeating-linear-gradient(135deg, #c3c8dc 0 4px, #e9ebf3 4px 8px); }
.costs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; margin-top: 1rem; }
.cost { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 0.75rem; align-items: center; text-align: left; }
.cost .c-head { grid-column: span 2; margin-bottom: 0.2rem; }
@media (max-width: 760px) { .costs { grid-template-columns: 1fr; gap: 1.75rem; } }

/* ---- why ---- */
.why { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.why h3 { margin: 0; }
.nw { white-space: nowrap; }
.why b { display: block; margin: 0.5rem 0 0.2rem; font: 700 2.4rem/1.1 "Bricolage", sans-serif; color: var(--blue); }
.why p { margin: 0; color: var(--soft); font-size: 0.98rem; }
@media (max-width: 760px) { .why { grid-template-columns: 1fr; } }

.bib .btn { margin-top: 0.9rem; }
pre { margin: 0; padding: 1rem; overflow-x: auto; background: var(--wash); border-radius: 8px; text-align: left; font: 0.85rem/1.5 ui-monospace, Menlo, Consolas, monospace; }
footer { padding: 2rem 0 3rem; border-top: 1px solid var(--rule); color: var(--soft); font-size: 0.9rem; }
footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .loop-clip img { transition: none; } }
@media (max-width: 720px) { h1 br, .authors br { display: none; } }
