/* a post: the OpenWorld news layout (a side list, numbered sections and figures, code blocks) in the shared tokens;
   its figures the pieces' films, round and round; tables of results added */
/* a piece: the 16:9 film and, under it, a 36px strip for its play button and progress bar (pieces/embed.js) */
.piece { position: relative; height: 0; padding-top: calc(56.25% + 36px); border-radius: var(--radius); overflow: hidden; background: var(--piece-bg); }
.piece.diagram { padding-top: 56.25%; }
.piece iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.cover .piece { box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 24px 60px rgba(0,0,0,.10); }
body { counter-reset: figure table; }
.post-hero { background: var(--bg-alt); padding: calc(var(--nav-h) + 4.5rem) 0 3.5rem; }
.post-hero .container { max-width: 980px; }
.post-hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; color: var(--ink-strong); margin: 0.75rem 0 1rem; }
.post-hero .dek { font-size: 1.3rem; color: var(--muted); max-width: 46ch; line-height: 1.5; }
.byline { display: flex; flex-wrap: wrap; gap: 0.5rem 2.5rem; margin-top: 2rem; }
.byline .fact dd { font-size: 1rem; }
.cover { max-width: 980px; margin: -0.5rem auto 0; padding: 0 2rem; }
.cover .caption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--faint); }

.content { display: flex; align-items: flex-start; max-width: 1200px; margin: 0 auto; padding: 4rem 2rem 2rem; }
.context-bar { position: sticky; top: calc(var(--nav-h) + 2.5rem); width: 240px; flex-shrink: 0; padding-right: 2.5rem; }
.context-bar .label { margin-bottom: 0.75rem; }
.context-bar ol { list-style: none; border-left: 1px solid var(--line); }
.context-bar a { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.4rem 0 0.4rem 1rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); font-size: 0.95rem; transition: color 0.2s ease, border-color 0.2s ease; }
.context-bar .n { font-size: 0.8rem; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.context-bar a:hover { color: var(--ink-strong); }
.context-bar a.active { color: var(--ink-strong); font-weight: 600; border-left-color: var(--accent); }
.context-bar a.active .n { color: var(--accent); }
.context-bar .lang { margin-top: 1.5rem; font-size: 0.9rem; }

article { flex: 1; min-width: 0; max-width: 760px; }
article section { margin-bottom: 3.5rem; }
article h2 { font-size: 1.9rem; line-height: 1.25; letter-spacing: -0.02em; color: var(--ink-strong); margin-bottom: 1rem; }
article h2 .n { color: var(--faint); font-weight: 600; font-size: 0.75em; margin-right: 0.6rem; font-variant-numeric: tabular-nums; }
article h3 { font-size: 1.2rem; color: var(--ink-strong); margin: 2rem 0 0.75rem; letter-spacing: -0.01em; }
article p { font-size: 1.15rem; line-height: 1.8; margin-bottom: 1.25rem; }
article p.lede { font-size: 1.3rem; line-height: 1.7; color: var(--ink-strong); }
article ul { margin: 0 0 1.25rem 1.25rem; font-size: 1.1rem; line-height: 1.75; }
article li { margin-bottom: 0.35rem; }
article code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-alt); padding: 0.1em 0.35em; border-radius: 4px; }
/* a display equation: on its own line, centred, numbered at the right */
.eq { display: flex; align-items: center; gap: 1rem; margin: -0.25rem 0 1.5rem; }
.eq-body { flex: 1; min-width: 0; text-align: center; overflow-x: auto; white-space: nowrap; font-size: 1.1rem; color: var(--ink-strong); }
.eq-body mjx-container[display="true"] { margin: 0.4em 0 !important; }
.eq-n { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.figure { margin: 2rem 0; }
.figure .caption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--faint); }
.figure .caption::before { counter-increment: figure; content: var(--fig-word, "Figure ") counter(figure) ": "; font-weight: 500; color: var(--muted); white-space: nowrap; }
.block { background: var(--bg-alt); border-radius: var(--radius); padding: 1.1rem 1.3rem; overflow-x: auto; }
.block .code { font-size: 0.85rem; }
.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 1rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.75rem 0; font-size: 1.05rem; }
.note b { color: var(--ink-strong); }
.note ul { margin: 0.5rem 0 0 1.1rem; font-size: 1.02rem; }
.note.amber { border-left-color: var(--amber); background: var(--amber-soft); }

/* the recall chart: three series in the page's validated order (ours blue, full attention green, linear orange),
   direct labels in ink, recessive grid */
:root { --s-fa: #2563eb; --s-tf: #1baf7a; --s-gdn: #eb6834; --grid: #edf0f3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --grid: #262c34; } }
:root[data-theme="dark"] { --grid: #262c34; }
.chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 0.6rem; overflow-x: auto; }
.chart svg { width: 100%; min-width: 560px; height: auto; display: block; font-family: inherit; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-size: 0.85rem; color: var(--ink); margin-bottom: 0.6rem; }
.chart .legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.chart .legend em { font-style: normal; color: var(--faint); }
.chart .sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart .sw.fa { background: var(--s-fa); } .chart .sw.tf { background: var(--s-tf); } .chart .sw.gdn { background: var(--s-gdn); }
.chart .ct { font-size: 14px; font-weight: 600; fill: var(--ink-strong); }
.chart .tick { font-size: 11px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.chart .xl { font-size: 12px; fill: var(--muted); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .ref { stroke: var(--s-tf); stroke-width: 1.5; stroke-dasharray: 6 5; opacity: 0.8; }
.chart .refl { font-size: 12px; fill: var(--muted); }
.chart .base { stroke: var(--line-strong); stroke-width: 1.2; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .s { stroke-width: 2.5; stroke-linecap: round; fill: none; }
.chart .s.fa { stroke: var(--s-fa); stroke-width: 3; } .chart .s.tf { stroke: var(--s-tf); } .chart .s.gdn { stroke: var(--s-gdn); }
.chart .d { stroke: var(--card); stroke-width: 2; } .chart .d.fa { fill: var(--s-fa); } .chart .d.tf { fill: var(--s-tf); } .chart .d.gdn { fill: var(--s-gdn); }
.chart .hit { fill: transparent; cursor: default; }
.chart .pt:hover .d { r: 7; }
.chart .lab { font-size: 13px; fill: var(--ink); }
.chart .gain { font-size: 12px; fill: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .v { font-size: 13px; fill: var(--ink-strong); font-weight: 600; font-variant-numeric: tabular-nums; }

/* tables of results: small, tabular figures, this method's rows marked, the best in bold */
.table { margin: 2rem 0; overflow-x: auto; }
.table table { width: 100%; border-collapse: collapse; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 0.42rem 0.32rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table thead th { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 600; border-bottom: 1.5px solid var(--line-strong); }
.table tr.group td { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding-top: 0.9rem; border-bottom: 0; }
.table tr.ours td { background: var(--accent-soft); color: var(--ink-strong); }
.table tr.ours td:first-child { font-weight: 600; }
.table td b { color: var(--ink-strong); }
.table td u { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.table td.wrap { white-space: normal; text-align: left; color: var(--muted); }
.table .caption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--faint); }
.table .caption::before { counter-increment: table; content: var(--tab-word, "Table ") counter(table) ": "; font-weight: 500; color: var(--muted); white-space: nowrap; }

.cite { margin: 3rem 0 1rem; padding: 1.5rem 1.75rem; border-radius: var(--radius); background: var(--bg-alt); }
.cite-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.cite h3 { font-size: 1.5rem; letter-spacing: -0.02em; color: var(--ink-strong); line-height: 1.25; margin: 0; }
.cite .copy { font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--accent); background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.3rem 0.9rem; cursor: pointer; }
.cite .copy:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.cite pre { margin: 0; overflow-x: auto; }
.cite code { font-family: var(--mono); font-size: 0.85rem; line-height: 1.65; color: var(--ink); background: none; padding: 0; }

/* T3: two bars a layer (answer positions, other positions); a layer still to run is a dashed slot */
.chart .bar.ans { fill: var(--amber); } .chart .bar.other { fill: var(--faint); }
.chart .slot { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .pending { font-size: 14px; fill: var(--faint); font-weight: 600; letter-spacing: 0.08em; }
.chart .sw.ans { background: var(--amber); height: 10px; } .chart .sw.other { background: var(--faint); height: 10px; }
details.more { margin-top: 0.6rem; font-size: 0.9rem; color: var(--muted); }
details.more summary { cursor: pointer; color: var(--accent); }
details.more .table { margin: 0.75rem 0 0; }

/* the slider (lambda.js): a formula, a slider from the linear end to full attention, one row per past position */
.lam { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 1.25rem 1.4rem 1.1rem; }
.lam-eq { font-size: 1.1rem; color: var(--ink-strong); text-align: center; line-height: 1.7; }
.lam-eq .f { display: inline-block; padding: 0 0.35em; border-radius: 6px; transition: opacity .2s ease; font-family: 'Times New Roman', serif; font-style: italic; font-size: 1.12em; line-height: 1.6; vertical-align: middle; }
.lam-eq > .m { font-size: 1.12em; vertical-align: middle; }
.lam .m { font-family: 'Times New Roman', serif; font-style: italic; font-size: 1.1em; }
.lam .m sup { margin-left: 0.06em; }
.lam .nw { white-space: nowrap; }
.lam .lam-eq sup, .lam .lam-eq sub, .lam .m sup, .lam .m sub, .lam .lam-say sup, .lam .lam-exact sup { line-height: 0; }
.lam-eq .f1, .lam-eq .f3 { background: var(--amber-soft); } .lam-eq .f2 { background: var(--accent-soft); }
.lam-eq .f.gone { opacity: 0.25; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.lam-eq .op { margin: 0 0.2em; color: var(--muted); }
article .lam-say { text-align: center; font-size: 0.95rem; line-height: 1.6; color: var(--muted); min-height: 3.2em; margin: 0.4rem 0 0.6rem; }
.lam-slider { margin-top: 0.2rem; }
.lam-ends { display: flex; justify-content: space-between; gap: 1rem; }
.lam-slider .end { font: inherit; font-size: 0.85rem; color: var(--muted); background: none; border: 0; padding: 0.15rem 0; cursor: pointer; white-space: nowrap; }
.lam-slider .end b { color: var(--ink-strong); font-weight: 600; white-space: nowrap; }
.lam-slider .end:hover b { color: var(--accent); }
.lam-slider input { display: block; width: 100%; margin: 0.2rem 0 0; accent-color: var(--accent); height: 28px; }
.lam-p { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1rem; font-size: 0.9rem; color: var(--muted); margin: 0.5rem 0 1rem; font-variant-numeric: tabular-nums; }
.lam-p b { color: var(--ink-strong); }
.lam-gap b { color: var(--accent); }
.lam-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1rem; font-size: 0.82rem; color: var(--muted); padding-bottom: 0.4rem; border-bottom: 1px solid var(--line); }
.lam-head .key { display: inline-flex; align-items: center; gap: 0.4rem; }
.lam-head .sw { display: inline-block; width: 16px; height: 9px; border-radius: 2px; margin-left: 0.4rem; }
.lam-head .sw.o { border: 1.5px solid var(--ink-strong); } .lam-head .sw.s { background: var(--accent); }
.lam-rows { display: grid; gap: 1px; margin-top: 0.4rem; }
.lam-row { font: inherit; display: grid; grid-template-columns: 5.2em 1fr 4.2em; align-items: center; gap: 0.6rem; width: 100%; padding: 0.12rem 0.3rem; border: 0; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; text-align: left; }
.lam-row:hover { background: var(--bg-alt); }
.lam-row.on { background: var(--amber-soft); }
.lam-row .w { font-size: 0.85rem; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lam-row.ans .w { font-weight: 700; color: var(--ink-strong); }
.lam-row .track { position: relative; height: 14px; }
.lam-row .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; max-width: 100%; }
.lam-row .track .s { background: var(--accent); opacity: 0.85; top: 2px; bottom: 2px; }
.lam-row .track .o { border: 1.5px solid var(--ink-strong); min-width: 2px; }
.lam-row .v { font-size: 0.78rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.lam-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.8rem 1.5rem; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.lam-fac { font-size: 0.85rem; }
.lam-fac .who { color: var(--muted); margin-bottom: 0.3rem; }
.lam-fac .who b { color: var(--ink-strong); font-family: var(--mono); }
.lam-fac dl { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; }
.lam-fac dt { font-size: 0.8rem; color: var(--muted); }
.lam-fac dd { font-variant-numeric: tabular-nums; color: var(--ink-strong); font-weight: 600; }
.lam-fac dd span { color: var(--muted); font-weight: 400; }
.lam-exact { font-size: 0.85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.lam-exact input { accent-color: var(--accent); }

@media (max-width: 1100px) { .context-bar { display: none; } article { margin: 0 auto; } }
@media (max-width: 760px) {
    .post-hero { padding: calc(var(--nav-h) + 2.5rem) 0 2.5rem; }
    .post-hero .dek { font-size: 1.1rem; }
    .cover { padding: 0 1rem; }
    .content { padding: 2.5rem 1rem 1rem; }
    article h2 { font-size: 1.5rem; }
    article p { font-size: 1.05rem; }
    article p.lede { font-size: 1.15rem; }
    .cite { padding: 1.25rem; }
    .lam { padding: 1rem 0.75rem; }
    .lam-row { grid-template-columns: 4.4em 1fr 3.7em; gap: 0.4rem; }
    .lam-slider .end { font-size: 0.78rem; white-space: normal; max-width: 48%; text-align: left; }
    .lam-ends .end:last-child { text-align: right; }
    .lam-eq { font-size: 1rem; }
    .lam-fac { flex: 1 1 100%; }
    .lam-fac dl { display: grid; gap: 0.25rem; }
    .lam-fac dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
}

/* enlarge (post.js): a button at each figure's top right; the figure lifted to the middle of the window, larger */
.lam, .chart { position: relative; }
.zoom-btn { position: absolute; top: 10px; right: 10px; z-index: 3; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--card); color: var(--muted); cursor: pointer; display: grid; place-items: center; opacity: 0.85; transition: opacity .15s ease, color .15s ease; }
.zoom-btn:hover { opacity: 1; color: var(--accent); }
.zoom-btn svg { width: 14px; height: 14px; min-width: 0; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.zoom-shade { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 12, 16, 0.6); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.zoom-shade.on { opacity: 1; pointer-events: auto; }
body.zooming { overflow: hidden; }
.zoomed { position: fixed !important; z-index: 2001; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); }
/* a film: 16:9 plus its 36px control strip, as large as fits in 94% of the width and 90% of the height */
.piece.zoomed { --zw: min(94vw, calc((90vh - 36px) * 16 / 9)); width: var(--zw); height: calc(var(--zw) * 0.5625 + 36px); padding-top: 0; }
.piece.diagram.zoomed { --zw: min(94vw, calc(90vh * 16 / 9)); height: calc(var(--zw) * 0.5625); }
/* the slider and the chart: the same layout, drawn larger */
.lam.zoomed, .chart.zoomed { zoom: 1.35; width: min(calc(94vw / 1.35), 760px); max-height: calc(90vh / 1.35); overflow: auto; }
/* on a phone held upright, an enlarged film turns on its side to use the long side of the screen */
@media (orientation: portrait) and (max-width: 760px) {
    .piece.zoomed { --zw: min(94vh, calc((94vw - 36px) * 16 / 9)); transform: translate(-50%, -50%) rotate(90deg); }
    .piece.diagram.zoomed { --zw: min(94vh, calc(94vw * 16 / 9)); }
}
