/* mill-flow.css - the "millflow" block (mill-flow.js): a mill as lanes of raised steps in a walled channel, streams crossing the wall, drawings taped on, a note for the one picked */

.mf {
    max-width: 1120px;
    /* the layout answers to the block's own width, so the sidebar and text size are already counted */
    container: mf / inline-size;
    --mf-ink: var(--paper-ink, #1B1B18);
    --mf-paper: var(--paper, #FBEADC);
    --mf-rule: rgba(27,27,24,0.10);
    /* the four chart series: distinct in every colour-vision mode, and in dark */
    --mf-feed: var(--series-4, #2B2727);
    --mf-water: var(--series-1, #1C7A9C);
    --mf-product: var(--series-2, #87601D);
    --mf-waste: var(--series-3, #5C1F5C);
    --mf-wall: rgba(111,125,101,0.36);
    --mf-spark: rgba(255,255,255,0.95);
    --mf-ease: cubic-bezier(0.45, 0.05, 0.12, 1);
    font-family: 'Quicksand', sans-serif;
}

/* ── the pane: the lanes and their key. --mf-axis tells mill-flow.js which way they run; standing up, the pane hugs them ── */
.mf-pane {
    --pane-radius: var(--radius-card, 30px);
    --mf-axis: y;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 40rem;
    margin-inline: auto;
    padding: clamp(1.1rem, 4.5cqi, 2.2rem);
}

.mf-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.4rem;
}
.mf-head--sys { align-items: center; margin-top: 1.1rem; padding-top: 1.8rem; border-top: 1px solid var(--mf-rule); }
/* a lane's name, set large and heavy; the figure's own headline */
.mf-label {
    margin: 0;
    font-family: 'Quicksand', sans-serif;
    font-size: clamp(1.55rem, calc(3.4cqi * var(--fs-scale, 1)), 2.3rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.045em;
    color: var(--mf-ink);
}
.mf-note-eyebrow {
    margin: 0;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.mf-aside { margin: 0; max-width: 30ch; font-size: 0.85rem; line-height: 1.45; color: var(--text-muted); }
/* the system in one line, under its switch; it swaps with the lane */
.mf-summary { max-width: 56ch; margin: 0.2rem 0 0.6rem; font-size: 1rem; line-height: 1.6; color: var(--text-body); }

/* ── the system switch: a glass track, the ink thumb slides under the chosen name ── */
.mf-switch {
    --count: 2;
    --at: 0;
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--count), minmax(0, 1fr));
    padding: 0.25rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(27,27,24,0.08);
    box-shadow: inset 0 1px 2px rgba(27,27,24,0.06);
}
.mf-switch-thumb {
    position: absolute;
    top: 0.25rem;
    bottom: 0.25rem;
    left: 0.25rem;
    width: calc((100% - 0.5rem) / var(--count));
    border-radius: 999px;
    background: var(--mf-ink);
    box-shadow: 0 6px 16px rgba(27,27,24,0.2);
    transform: translateX(calc(var(--at) * 100%));
    transition: transform 0.55s var(--mf-ease);
}
.mf-switch-btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.62rem 1.3rem;
    border: 0;
    border-radius: 999px;
    background: none;
    font: inherit;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    color: var(--text-body);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.35s ease;
}
.mf-switch-btn[aria-selected="true"] { color: var(--mf-paper); }
.mf-switch-tag { font-family: 'Quicksand', sans-serif; font-size: 0.68rem; font-weight: 600; letter-spacing: 0; opacity: 0.75; }
.mf-switch-btn:focus-visible { outline: 2px solid var(--mf-ink); outline-offset: 3px; }

/* the system lane blurs out and back as it swaps, as the home steps' line does */
.mf-sys { transition: opacity 0.22s ease, filter 0.22s ease, translate 0.35s var(--apple-ease); }
.mf-sys.is-swapping { opacity: 0; filter: blur(6px); translate: 0 6px; }

/* ── a lane, standing up (default): the steps down the left on their band, streams on the right ── */
.mf-lane {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    column-gap: clamp(1.9rem, 8cqi, 2.8rem);
    width: 100%;
    max-width: 30rem;
    margin: 0.5rem auto 0;
}
.mf-wires {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}
/* the mill wall: a sunken channel with two thin lines round it; the steps stand up out of it */
.mf-band {
    z-index: 0;
    grid-column: 1;
    grid-row: var(--br0) / var(--br1);
    margin: -0.85rem -0.65rem;
    border-radius: 1.7rem;
    border: 1.5px solid var(--mf-wall);
    background: linear-gradient(180deg, rgba(111,125,101,0.14), rgba(111,125,101,0.07));
    box-shadow: inset 0 3px 10px rgba(27,27,24,0.09),
                inset 0 0 0 4px rgba(255,255,255,0.35),
                inset 0 0 0 5.5px color-mix(in srgb, var(--mf-wall) 50%, transparent),
                0 1px 0 rgba(255,255,255,0.8);
}
.mf-end,
.mf-link,
.mf-step {
    z-index: 2;
    grid-column: 1;
    grid-row: var(--r) / span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.mf-ins,
.mf-outs {
    z-index: 2;
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    min-width: 0;
}
/* water above the line of the step, waste below it: the node sits between the two */
.mf-ins  { grid-row: var(--r);  align-self: end;   padding-bottom: 0.35rem; }
.mf-outs { grid-row: var(--r1); align-self: start; padding-top: 0.35rem; }
.mf-link { min-height: 1.9rem; }
.mf-link--edge { min-height: 2.7rem; }
/* drawings poke past their cards, so a lane that has them opens its gaps */
.mf-lane.has-pics .mf-link { min-height: 2.8rem; }
.mf-lane.has-pics .mf-link--edge { min-height: 3.4rem; }
.mf-lane.has-pics :is(.mf-ins, .mf-outs) { gap: 1.2rem; }
.mf-lane.has-pics .mf-ins { padding-top: 1.2rem; }

/* what passes from one step to the next, beside its arrow */
.mf-carry {
    --k: var(--mf-feed);
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    max-width: 7.5rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text-strong);
    transform: translateX(calc(50% + 0.6rem));
}
/* the dot keeps to the first line however the words wrap */
.mf-carry::before {
    content: "";
    flex: none;
    width: 0.45rem;
    height: 0.45rem;
    margin-top: 0.22rem;
    border-radius: 50%;
    background: var(--k);
}
.mf-carry--product { --k: var(--mf-product); }
.mf-carry--water   { --k: var(--mf-water); }
.mf-carry--waste   { --k: var(--mf-waste); }

/* ── a step: a raised white card, its name set heavy; the picked one lifts inside an ink ring ── */
.mf-node {
    position: relative;
    width: 100%;
    max-width: 11rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.22rem;
    padding: 0.85rem 0.9rem 0.9rem;
    border-radius: 1.15rem;
    border: 1px solid rgba(255,255,255,0.95);
    background: linear-gradient(165deg, #fff, rgba(255,250,243,0.92));
    box-shadow: inset 0 1px 0 #fff,
                0 1px 1px rgba(27,27,24,0.06),
                0 6px 10px -4px rgba(27,27,24,0.12),
                0 18px 30px -12px rgba(27,27,24,0.22);
    font: inherit;
    color: var(--mf-ink);
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.5s var(--apple-ease), box-shadow 0.4s ease, border-color 0.3s ease;
}
.mf-node-name {
    position: relative;
    z-index: 2;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.035em;
}
.mf-node-sub { position: relative; z-index: 2; font-size: 0.72rem; line-height: 1.3; color: var(--text-muted); }
.mf-node.is-active {
    transform: translateY(-3px);
    box-shadow: 0 0 0 2px var(--mf-ink), 0 22px 36px -12px rgba(27,27,24,0.36);
}
.mf-node.is-linked { border-color: rgba(27,27,24,0.22); }

/* ── a stream: a smaller card, its kind in the border, the glyph and the wire; the figure leads ── */
.mf-chip {
    --k: var(--mf-water);
    position: relative;
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
    max-width: 10rem;
    padding: 0.5rem 0.8rem 0.55rem 0.5rem;
    border-radius: 0.95rem;
    border: 1px solid color-mix(in srgb, var(--k) 42%, transparent);
    background: color-mix(in srgb, var(--k) 6%, rgba(255,255,255,0.9));
    box-shadow: 0 1px 1px rgba(27,27,24,0.05), 0 10px 18px -10px rgba(27,27,24,0.22);
    font: inherit;
    color: var(--text-strong);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.45s var(--apple-ease), box-shadow 0.35s ease, border-color 0.3s ease;
}
.mf-chip--feed    { --k: var(--mf-feed); }
.mf-chip--water   { --k: var(--mf-water); }
.mf-chip--waste   { --k: var(--mf-waste); }
.mf-chip--product { --k: var(--mf-product); }
/* only sometimes: water at malaxation, when the paste is dry */
.mf-chip.is-optional { border-style: dashed; }
.mf-chip--end { padding: 0.6rem 0.9rem 0.65rem 0.55rem; border-radius: 1.05rem; }

.mf-chip-text { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
/* the name small and spaced out above, the figure large and heavy under it */
.mf-chip-label {
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.mf-chip-amount {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    color: var(--mf-ink);
}
.mf-chip--end .mf-chip-amount { font-size: 1.2rem; }
.mf-chip-meta { margin-top: 0.12rem; font-size: 0.68rem; line-height: 1.3; color: var(--text-muted); }
/* no figure to lead, so the name does */
.mf-chip.is-bare .mf-chip-label {
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    letter-spacing: -0.025em;
    text-transform: none;
    color: var(--mf-ink);
}

.mf-chip.is-active {
    border-color: var(--k);
    box-shadow: 0 0 0 1.5px var(--k), 0 14px 26px -10px rgba(27,27,24,0.3);
    transform: translateY(-2px);
}
.mf-chip.is-linked { border-color: color-mix(in srgb, var(--k) 75%, transparent); }

/* the glyphs: a tinted disc; on the picked stream it fills */
.mf-icon {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    color: var(--k);
    background: color-mix(in srgb, var(--k) 14%, transparent);
    transition: background-color 0.3s ease, color 0.3s ease;
}
.mf-icon svg {
    width: 62%;
    height: 62%;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mf-chip .mf-icon { position: relative; z-index: 2; margin-top: 0.02rem; }
.mf-chip.is-active .mf-icon { background: var(--k); color: #fff; }

/* ── drawings, placed two ways so they do not all sit in one spot; the picked one straightens ── */
.mf-pic {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    rotate: var(--tilt, 0deg);
    transition: rotate 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), scale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mf-pic img { display: block; width: 100%; height: 100%; object-fit: contain; }
.is-active > .mf-pic { rotate: 0deg; scale: 1.06; }

/* corner: the drawing on its own, poking out past the card; its shadow follows its shape, not a frame */
.mf-pic--corner {
    width: var(--pic);
    height: var(--pic);
    filter: drop-shadow(0 5px 5px rgba(27,27,24,0.2));
}
/* edge: tucked into the card's lower right corner under the words, cut off by the card's edges */
.mf-pic--edge { width: var(--pic); height: var(--pic); }

/* on a step: corner top left, clear of every wire; edge in the lower right, the name above it */
.mf-node.has-pic { align-items: flex-start; text-align: left; }
.mf-node.pic-corner { padding-top: 2.9rem; }
.mf-node > .mf-pic--corner { --pic: 4.4rem; top: -1.6rem; left: -0.8rem; }
/* clip, not hidden: a hidden overflow would let the card shrink under its own name */
.mf-node.pic-edge { overflow: clip; justify-content: flex-start; padding-bottom: 3.8rem; }
.mf-node > .mf-pic--edge { --pic: 5.1rem; right: -0.9rem; bottom: -1.3rem; }

/* on a stream: corner top right, so the wires at its left and its middle stay clear; edge in the lower right, under the figure */
.mf-chip.pic-corner { padding-right: 1.9rem; }
.mf-chip > .mf-pic--corner { --pic: 2.9rem; top: -1.2rem; right: -1rem; }
.mf-chip.pic-edge { overflow: clip; padding-bottom: 2.7rem; }
.mf-chip > .mf-pic--edge { --pic: 3.6rem; right: -0.6rem; bottom: -0.9rem; }
/* the drawing says what it is, so no glyph and no room kept for one */
.mf-chip.has-pic { padding-left: 0.8rem; }
.mf-chip--end.has-pic { padding-left: 0.9rem; }

@media (hover: hover) {
    .mf-node:not(.is-active):hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 #fff, 0 1px 1px rgba(27,27,24,0.06), 0 8px 12px -4px rgba(27,27,24,0.14), 0 22px 34px -12px rgba(27,27,24,0.26); }
    :is(.mf-node, button.mf-chip):not(.is-active):hover > .mf-pic { rotate: calc(var(--tilt, 0deg) * 0.4); }
    button.mf-chip:not(.is-active):hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--k) 80%, transparent); }
}
.mf-node:active,
button.mf-chip:active { transform: scale(0.97); transition-duration: 0.09s; }
/* a stream with nothing more to read is a label, not a button */
.mf-chip.is-static { cursor: default; }
.mf-node:focus-visible,
.mf-chip:focus-visible { outline: 2px solid var(--mf-ink); outline-offset: 3px; }

/* ── wires: the flow line in the stream's colour; the picked one thickens and carries sparks ── */
.mf-wire          { color: var(--mf-feed); }
.mf-wire--water   { color: var(--mf-water); }
.mf-wire--waste   { color: var(--mf-waste); }
.mf-wire--product { color: var(--mf-product); }
.mf-wire-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    transition: stroke-width 0.3s ease;
}
/* the main line through the mill reads heavier than what joins or leaves it */
.mf-wire--feed .mf-wire-line,
.mf-wire--product .mf-wire-line { stroke-width: 2.5; }
.mf-wire.is-dashed .mf-wire-line { stroke-dasharray: 2 5; }
.mf-wire-head { fill: currentColor; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.mf-wire-spark {
    fill: none;
    stroke: var(--mf-spark);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 0 10;
    opacity: 0;
}
.mf-wire.is-hot .mf-wire-line { stroke-width: 3.6; }
.mf-wire.is-hot .mf-wire-spark { opacity: 1; animation: mf-flow 0.8s linear infinite; }
.mf:not(.is-visible) .mf-wire-spark { animation-play-state: paused; }
@keyframes mf-flow { to { stroke-dashoffset: -20; } }

/* drawn along the flow on arrival and on each switch (mill-flow.js sets --len and --d) */
.mf-lane.is-drawing .mf-wire-line {
    stroke-dasharray: var(--len) var(--len);
    stroke-dashoffset: var(--len);
    animation: mf-draw 0.75s var(--mf-ease) var(--d, 0ms) forwards;
}
.mf-lane.is-drawing .mf-wire-head {
    opacity: 0;
    animation: mf-show 0.25s ease calc(var(--d, 0ms) + 0.55s) forwards;
}
@keyframes mf-draw { to { stroke-dashoffset: 0; } }
@keyframes mf-show { to { opacity: 1; } }

/* ── arrival, once: the steps and streams rise in flow order ── */
.mf.is-waiting :is(.mf-node, .mf-chip, .mf-carry) { opacity: 0; translate: 0 10px; }
.mf.is-waiting .mf-wires { opacity: 0; }
.mf.is-entering :is(.mf-node, .mf-chip, .mf-carry) {
    transition: opacity 0.6s ease calc(var(--o, 0) * 55ms),
                translate 0.9s var(--apple-ease) calc(var(--o, 0) * 55ms);
}

/* ── legend: the four kinds, each with its line and glyph ── */
.mf-legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.4rem;
    margin: 0.7rem 0 0;
    padding: 0;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}
.mf-legend-item { --k: var(--mf-feed); display: inline-flex; align-items: center; gap: 0.4rem; }
.mf-legend-item--water   { --k: var(--mf-water); }
.mf-legend-item--waste   { --k: var(--mf-waste); }
.mf-legend-item--product { --k: var(--mf-product); }
.mf-legend-line { width: 1.1rem; border-top: 2px solid var(--k); border-radius: 2px; }
.mf-legend .mf-icon { width: 1.15rem; height: 1.15rem; }

/* ── the note: opens in the lane under what was picked, its caret pointing back up at it ── */
.mf-note-drawer {
    z-index: 3;
    grid-column: 1 / -1;
    grid-row: var(--dr);
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.45s var(--mf-ease);
}
.mf-note-drawer[hidden] { display: none; }
.mf-note-drawer.is-open { grid-template-rows: 1fr; }
/* the clip has no padding of its own, so 0fr really is nothing; the pad inside leaves room for the caret and the shadow */
.mf-note-clip { min-height: 0; overflow: hidden; margin-inline: -0.75rem; }
/* once open, the clip lets go so the card's shadow is not cut square */
.mf-note-drawer.is-settled .mf-note-clip { overflow: visible; }
.mf-note-pad { padding: 0.85rem 0.75rem 1.3rem; }
.mf-note-card {
    position: relative;
    width: 100%;
    margin-left: var(--dx, 0px);
    padding: 1rem 3.2rem 1.15rem 1.25rem;
    border-radius: 1.15rem;
    background: #FFFDFA;
    border: 1px solid rgba(27,27,24,0.07);
    box-shadow: 0 1px 2px rgba(27,27,24,0.05), 0 10px 24px rgba(27,27,24,0.09);
    opacity: 0;
    translate: 0 -6px;
    transition: opacity 0.3s ease 0.08s, translate 0.45s var(--apple-ease), margin-left 0.45s var(--apple-ease);
}
.mf-note-drawer.is-open .mf-note-card { opacity: 1; translate: 0 0; }
.mf-note-card::before {
    content: "";
    position: absolute;
    top: -7px;
    left: var(--caret, 50%);
    width: 13px;
    height: 13px;
    margin-left: -6.5px;
    border-radius: 3px 0 0 0;
    background: inherit;
    border-top: inherit;
    border-left: inherit;
    transform: rotate(45deg);
}
/* the live note and the unseen ones share one cell, so the tallest sets the card's height */
.mf-note-stack { display: grid; }
.mf-note-stack > * { grid-area: 1 / 1; }
.mf-note-ghost { visibility: hidden; }
.mf-note-inner { display: flex; flex-direction: column; gap: 0.45rem; transition: opacity 0.18s ease, filter 0.18s ease; }
.mf-note-drawer.is-swapping .mf-note-inner { opacity: 0; filter: blur(5px); }
.mf-note-eyebrow { font-size: 0.66rem; }
.mf-note-title {
    margin: 0 0 0.1rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--mf-ink);
}
.mf-note-text {
    max-width: 62ch;
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-body);
}
.mf-note-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}
.mf-note-close svg { width: 0.95rem; height: 0.95rem; }
.mf-note-close:focus-visible { outline: 2px solid var(--mf-ink); outline-offset: 2px; }
@media (hover: hover) {
    .mf-note-close:hover { background: rgba(27,27,24,0.06); color: var(--mf-ink); }
}

.mf-source {
    margin: 0.9rem 0 0;
    padding: 0 0.5rem;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-muted);
}

/* phones: the switch takes the full width under its label */
@container mf (max-width: 26rem) {
    .mf-switch { width: 100%; }
    .mf-switch-btn { padding-inline: 0.6rem; }
}

/* ── wide: each lane runs across, water in from above, waste out below, as the steps are drawn by hand ── */
/* from 64rem: the shared lane's four steps, two ends and five links only fit across from about here */
@container mf (min-width: 64rem) {
    .mf-pane { --mf-axis: x; max-width: none; padding: 1.9rem 1.8rem; }
    .mf-lane {
        /* ends and links take what their words need up to a cap; a step never goes narrower than its longest word */
        grid-template-columns:
            fit-content(9rem)
            repeat(var(--n), fit-content(6.4rem) minmax(min-content, 1fr))
            fit-content(6.4rem)
            fit-content(9rem);
        grid-template-rows: auto auto auto;
        --mf-rg: 1.8rem;
        column-gap: 0;
        row-gap: var(--mf-rg);
        max-width: none;
        margin-top: 0.6rem;
    }
    /* across, a cell's minimum is its content again, so the capped columns can never cut a card */
    .mf-end,
    .mf-link,
    .mf-step { grid-row: 2; grid-column: var(--c); min-width: auto; }
    /* a step's streams stay on one row and may spill past its column, so no wire ever runs through a chip */
    .mf-ins,
    .mf-outs {
        grid-column: var(--c);
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: flex-start;
        justify-self: center;
        padding: 0;
    }
    .mf-ins  { grid-row: 1; align-self: end; }
    .mf-outs { grid-row: 3; align-self: start; }
    .mf-band { grid-column: var(--bc0) / var(--bc1); grid-row: 2; margin: -0.95rem -1.15rem; }
    .mf-link { min-height: 0; min-width: 2.2rem; padding: 0 0.4rem; }
    .mf-link--edge { min-width: 3rem; }
    /* across, the spine meets a step at its left middle, so the taped corner pokes up only, starting inside the left edge */
    .mf-node.pic-corner { padding-top: 2.7rem; }
    .mf-node > .mf-pic--corner { top: -2rem; left: 0.5rem; }
    .mf-carry { max-width: 6.4rem; justify-content: center; text-align: center; text-wrap: balance; transform: translateY(calc(-50% - 0.5rem)); }

    /* across, the note opens under the whole lane; the row gap above it is cancelled so the opening carries it */
    .mf-note-drawer { grid-row: 4; margin-top: calc(-1 * var(--mf-rg)); }
    /* the taped corners poke up into the gaps, so a lane with drawings opens them */
    .mf-lane.has-pics { --mf-rg: 2.6rem; }
    .mf-lane.has-pics .mf-ins { padding-top: 1.2rem; }
    .mf-note-pad { padding-top: 1.35rem; }
    .mf-note-card { width: min(31rem, 100%); }
}

/* ── accessibility panel: solid glass, no motion ── */
html[data-reduce-transparency] .mf-node { background: #fff; }
html[data-reduce-transparency] .mf-chip { background: color-mix(in srgb, var(--k) 6%, #fff); }
html[data-reduce-transparency] .mf-switch { background: #fff; }
html[data-reduce-transparency] .mf-note-card { background: #fff; box-shadow: 0 8px 22px rgba(27,27,24,0.10); }
html[data-reduce-motion] .mf-wire-spark { display: none; }
html[data-reduce-motion] :is(.mf-node, .mf-pic, .mf-chip, .mf-icon, .mf-switch-thumb, .mf-switch-btn, .mf-sys, .mf-note-drawer, .mf-note-card, .mf-note-inner, .mf-wire-line) { transition: none; }
@media (prefers-reduced-motion: reduce) {
    .mf-wire-spark { display: none; }
}

/* ── forced colours: system colours only, the picked one in Highlight ── */
@media (forced-colors: active) {
    .mf-node,
    .mf-chip,
    .mf-switch,
    .mf-note-card { border: 1px solid ButtonText; background: ButtonFace; color: ButtonText; }
    .mf-note-card::before { border: 1px solid ButtonText; border-right: 0; border-bottom: 0; }
    .mf-node.is-active,
    .mf-chip.is-active { outline: 3px solid Highlight; outline-offset: 2px; }
    .mf-band { border: 2px solid CanvasText; background: Canvas; box-shadow: none; }
    .mf-icon { color: CanvasText; background: none; }
    .mf-wire { color: CanvasText; }
    .mf-wire.is-hot { color: Highlight; }
    .mf-wire-spark { display: none; }
    .mf-carry::before,
    .mf-legend-line { background: CanvasText; border-color: CanvasText; }
    .mf-switch-thumb { background: Highlight; }
    .mf-switch-btn[aria-selected="true"] { color: HighlightText; }
}
