/* cleoanka: the /lab/ index and the shared parts of every /lab/<slug>/ page
   (the "where next" block). Colours come only from base.css tokens. */

/* ---------- motifs: static drawings from tools/motifs.py ---------- */
.motif { display: block; width: 100%; height: auto; overflow: visible; }
.motif .sa { stroke: var(--gold); } .motif .sb { stroke: var(--blue); } .motif .sr { stroke: var(--rust); } .motif .sh { stroke: var(--heal); }
.motif .fa { fill: var(--gold); } .motif .fb { fill: var(--blue); } .motif .fr { fill: var(--rust); } .motif .fh { fill: var(--heal); }
.motif .fp { fill: var(--panel); } .motif .fg { fill: var(--bg); }

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

/* ---------- where next (end of each lab) ---------- */
.next-up { margin-top: clamp(4rem, 9vh, 5.5rem); padding-top: 1.4rem; border-top: 1px solid var(--edge-soft); }
.nx-h { font-family: var(--mono); font-size: 0.76rem; font-weight: 400; letter-spacing: 0.06em; color: var(--faint); margin: 0 0 0.9rem; }
.nx-rel { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.nx-link {
  display: grid; grid-template-columns: 6.2rem 1fr; gap: 0.9rem; align-items: center; height: 100%;
  border: 1px solid transparent; border-radius: 10px; padding: 0.55rem; color: inherit;
  transition: border-color .15s, background-color .15s;
}
.nx-link:hover { border-color: var(--edge); background: var(--panel); color: inherit; }
.nx-art { display: block; background: var(--panel); border: 1px solid var(--edge-soft); border-radius: 7px; padding: 0.3rem; color: var(--text); }
.nx-link:hover .nx-art { border-color: var(--gold); }
.nx-txt { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.nx-name { font-family: var(--mono); font-size: 0.72rem; color: var(--gold); letter-spacing: 0.03em; }
.nx-title { font-family: var(--display); font-weight: 600; color: var(--bright); font-size: 1.02rem; line-height: 1.3; letter-spacing: -0.01em; }
.nx-why { color: var(--dim); font-size: 0.88rem; line-height: 1.45; }
.nx-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; margin: 1rem 0 0; font-family: var(--mono); font-size: 0.76rem; }
.nx-meta a { border: 0; color: var(--dim); display: inline-flex; align-items: center; gap: 0.4rem; min-height: 32px; }
.nx-meta a:hover { color: var(--gold); }
.nx-hire { margin: 0.5rem 0 0; color: var(--dim); font-size: 0.97rem; }
.nx-also { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.15rem; }
.nx-also a { display: inline-flex; align-items: baseline; gap: 0.55rem; min-height: 32px; padding: 0.25rem 0; border: 0; color: var(--text); font-size: 0.97rem; line-height: 1.4; }
.nx-also a::before { content: '→'; color: var(--faint); }
.nx-also a:hover { color: var(--gold); }
@media (max-width: 40rem) { .nx-rel { grid-template-columns: 1fr; } }

/* ---------- claims and limits on a lab page (phase 2 plan I-7; status colours: base.css --st) ---------- */
.claims-lead { margin-top: clamp(2rem, 5vh, 3rem); }
.lead-h { font-family: var(--mono); font-size: 0.76rem; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 0 0 0.8rem; }
.claims-lead > p, .limits > p { margin: 0.8rem 0; }
.claim-cards { display: grid; gap: 0.8rem; margin: 1.2rem 0; }
.claim-card { border-left: 3px solid var(--st, var(--edge)); min-width: 0; }
.claim-card p { margin: 0; }
.lc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.lc-id { border: 0; font-size: 0.8rem; color: var(--dim); display: inline-flex; align-items: center; min-height: 32px; }
.lc-id:hover { color: var(--gold); }
.lc-val { margin-top: 0.5rem !important; font-family: var(--display); font-weight: 600; font-size: clamp(1.5rem, 4.6vw, 2rem); line-height: 1.15; letter-spacing: -0.02em;
  color: var(--bright); font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.lc-sent { margin-top: 0.45rem !important; color: var(--text); overflow-wrap: anywhere; }
.lc-meta { margin-top: 0.6rem !important; font-family: var(--mono); font-size: 0.74rem; line-height: 1.5; color: var(--faint); overflow-wrap: anywhere; }
.lc-more { margin-top: 0.25rem !important; font-family: var(--mono); font-size: 0.76rem; }
.lc-more a { border: 0; color: var(--dim); display: inline-flex; align-items: center; min-height: 32px; }
.lc-more a:hover { color: var(--gold); }
.lead-note { color: var(--dim); font-size: 0.95rem; }
.limits { margin-top: clamp(3.5rem, 8vh, 5rem); padding-top: 1.4rem; border-top: 1px solid var(--edge-soft); }
.lim-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.lim-link { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.2rem 1rem; align-items: baseline; padding: 0.55rem 0.15rem;
  border: 0; border-bottom: 1px solid var(--edge-soft); color: var(--text); min-height: 44px; }
.lim-link:hover { color: var(--bright); }
.lim-kind { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--rust); }
.lim-link[data-kind="limit"] .lim-kind { color: var(--gold); }
.lim-link[data-kind="open-issue"] .lim-kind { color: var(--blue); }
.lim-link[data-kind="erratum"] .lim-kind { color: var(--heal); }
.lim-title { overflow-wrap: anywhere; }
.lim-link:hover .lim-title { text-decoration: underline; text-underline-offset: 3px; }
.lim-note { margin: 1rem 0 0; color: var(--dim); font-size: 0.92rem; }
.app-link { color: var(--dim); }
@media (max-width: 34rem) { .lim-link { grid-template-columns: 1fr; } }
@media (pointer: coarse) { .lc-id, .lc-more a { min-height: 44px; } }

/* ---------- the lab index ---------- */
.ix-mast .subtitle { max-width: 38rem; }
/* the group links are chips: an outlined pill with the count inside, so they read as buttons */
.ix-toc ol { list-style: none; margin: 1.6rem auto 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em; }
.ix-toc a { color: var(--dim); display: inline-flex; align-items: center; gap: 0.5em; min-height: 36px; padding: 0 0.95rem;
  border: 1px solid var(--edge); border-radius: 999px; background: var(--panel); transition: border-color .15s, color .15s; }
.ix-toc a:hover { color: var(--gold); border-color: var(--gold); }
.ix-n { color: var(--faint); }

.ix { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.ix-group { margin-top: clamp(3.5rem, 8vh, 5rem); scroll-margin-top: 1.5rem; }
.ix-gh-head { display: grid; grid-template-columns: minmax(12rem, 20rem) 1fr; gap: 0.3rem 2rem; align-items: baseline;
  padding-bottom: 1rem; margin-bottom: 1.6rem; border-bottom: 1px solid var(--edge-soft); }
.ix-gh-head h2 { margin: 0; font-size: var(--h2-major); letter-spacing: -0.025em; line-height: 1.2; }
.ix-gh-head p { margin: 0; color: var(--dim); font-size: 0.98rem; max-width: 36rem; }
@media (max-width: 44rem) { .ix-gh-head { grid-template-columns: 1fr; } }

.ix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19.5rem), 1fr)); gap: 2.6rem 2rem; }
.ix-item { display: flex; flex-direction: column; min-width: 0; }
/* three cards a row from tablet width up, so a group of three never breaks 2 + 1 at 768 px */
@media (min-width: 720px) { .ix-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.6rem clamp(1.2rem, 2.4vw, 2rem); } }
.ix-plate {
  position: relative; display: block; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel);
  padding: 1.1rem 1.1rem 1.9rem; color: var(--text); box-shadow: var(--shadow); transition: border-color .2s ease, transform .2s ease;
}
.ix-plate .motif { aspect-ratio: 4 / 3; }
.ix-fig { position: absolute; left: 0.9rem; bottom: 0.55rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--gold); }
.ix-item:hover .ix-plate { border-color: var(--gold); }
.ix-name { display: flex; justify-content: space-between; gap: 1rem; margin: 1rem 0 0.25rem; font-family: var(--mono); font-size: 0.76rem; color: var(--gold); letter-spacing: 0.03em; }
.ix-lang { color: var(--faint); }
.ix-title { margin: 0; font-size: 1.32rem; line-height: 1.22; letter-spacing: -0.02em; }
.ix-title a { border: 0; color: var(--bright); }
.ix-title a:hover, .ix-item:hover .ix-title a { color: var(--gold); }
.ix-pitch { margin: 0.5rem 0 0; color: var(--dim); font-size: 0.97rem; line-height: 1.55; }
.ix-essays { list-style: none; margin: 2.4rem 0 0; padding: 1.4rem 0 0; border-top: 1px solid var(--edge-soft); display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19.5rem), 1fr)); gap: 1.4rem 2rem; }
.ix-essays a { border: 0; color: var(--bright); font-family: var(--display); font-weight: 600; font-size: 1.12rem; letter-spacing: -0.015em; }
.ix-essays a:hover { color: var(--gold); }
.ix-essays p { margin: 0.35rem 0 0; color: var(--dim); font-size: 0.95rem; line-height: 1.55; }
.ix-ch { list-style: none; counter-reset: ch; margin: 0.8rem 0 0; padding: 0.7rem 0 0; border-top: 1px dashed var(--edge); font-size: 0.9rem; color: var(--text); }
.ix-ch li { counter-increment: ch; display: grid; grid-template-columns: 1.6rem 1fr; line-height: 1.5; padding: 0.12rem 0; }
.ix-ch li::before { content: counter(ch); font-family: var(--mono); font-size: 0.76rem; color: var(--faint); padding-top: 0.12rem; }
.ix-foot { margin: auto 0 0; padding-top: 0.8rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1rem;
  font-family: var(--mono); font-size: 0.74rem; color: var(--faint); }
.ix-ext { color: var(--faint); }
.ix-gh { margin-left: auto; border: 0; color: var(--dim); display: inline-flex; align-items: center; gap: 0.35rem; min-height: 32px; }
.ix-gh:hover { color: var(--gold); }

@media (pointer: coarse) {
  .nx-meta a, .nx-also a, .ix-gh { min-height: 44px; }
  .ix-toc a { min-height: 40px; } /* a 44 px pill reads heavy; 40 px stays well above the 32 px floor */
}

/* ---------- figure controls on touch screens: at least 40px to tap ---------- */
@media (pointer: coarse) {
  .fig-ui { gap: 0.6rem 0.9rem; }
  .fig-btn { min-height: 40px; padding: 0.42em 1em; }
  .seg button { min-height: 40px; min-width: 40px; padding: 0.4em 0.8em; }
  .fig-text { min-height: 40px; }
  .fig-ui input[type="range"] { height: 40px; background: transparent; }
  .fig-ui input[type="range"]::-webkit-slider-runnable-track { height: 2px; border-radius: 1px; background: var(--edge); }
  .fig-ui input[type="range"]::-moz-range-track { height: 2px; border-radius: 1px; background: var(--edge); }
  .fig-ui input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -10px; }
  .fig-ui input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; }
  .map dd a { display: inline-block; padding: 0.55rem 0; }
}
