/* ==========================================================================
   Chapters 06-09: scroll storytelling, everyday UI, modern CSS, accessibility
   ========================================================================== */
:root { --k-scroll: #4cc9f0; --k-ui: #b8e35a; --k-css: #ff8f6b; --k-a11y: var(--ink); --k-design: #2ec4b6; --k-anim: #6c8cff; }
.dot-scroll { background: var(--k-scroll); } .dot-ui { background: var(--k-ui); }
.dot-css { background: var(--k-css); } .dot-a11y { background: var(--k-a11y); }
.demo .tags li.scroll { border-color: color-mix(in oklab, var(--k-scroll) 60%, transparent); color: var(--k-scroll); }
.demo .tags li.ui { border-color: color-mix(in oklab, var(--k-ui) 60%, transparent); color: var(--k-ui); }
.demo .tags li.css { border-color: color-mix(in oklab, var(--k-css) 60%, transparent); color: var(--k-css); }
.demo .tags li.a11y { border-color: var(--line-2); color: var(--ink); }
@media (max-width: 420px) { .nav { gap: 8px; padding-left: 14px; } .nav .logo { font-size: 15px; gap: 8px; } .nav .icon-btn { width: 36px; height: 36px; } }

/* ---------- Global: focus, skip link, paused motion ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 16px; }
#main:focus { outline: none; }
#motion .play { display: none; }
:root[data-motion="paused"] #motion .pause { display: none; }
:root[data-motion="paused"] #motion .play { display: block; }
:root[data-motion="paused"] #motion { background: var(--ink); color: var(--bg); border-color: var(--ink); }
:root[data-motion="paused"] *, :root[data-motion="paused"] *::before, :root[data-motion="paused"] *::after { animation-play-state: paused !important; }
:root[data-motion="paused"] { scroll-behavior: auto; }

/* Shared buttons for the new chapters */
.pill-btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 999px; cursor: pointer; transition: transform .15s, background .2s, color .2s;
}
.pill-btn:hover { transform: translateY(-1px); }
.pill-btn:active { transform: translateY(1px); }
.pill-btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.pill-btn.danger { background: #e5484d; border-color: #e5484d; color: #fff; }
kbd { font-family: var(--mono); font-size: .85em; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--card-2); }

/* Sticky demos need overflow: clip (hidden would create a scroll container and break sticky). */
.demo.tall, .demo.tall > .stage { overflow: clip; }

/* ---------- Scroll-scrubbed video ---------- */
.scrub-track { background: radial-gradient(ellipse at 50% 45%, #e4e1e1, #cfcccd 70%) !important; }
.scrub-sticky { position: sticky; top: 0; height: 100vh; }
.scrub-sticky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.scrub-copy p {
  position: absolute; left: 6%; top: 50%; margin: 0; transform: translateY(-40%); opacity: 0;
  font-family: var(--serif); font-size: clamp(40px, 6vw, 84px); line-height: .95; color: #1d1916; transition: opacity .5s, transform .5s;
}
.scrub-copy p em { color: #b8461a; }
.scrub-copy p.on { opacity: 1; transform: translateY(-50%); }
.scrub-bar { position: absolute; left: 6%; right: 6%; bottom: 28px; height: 3px; border-radius: 3px; background: rgba(0, 0, 0, .12); }
.scrub-bar i { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: #1d1916; }
.scrub-sticky .loading { color: #6f655c; }
@media (max-width: 720px) { .scrub-copy p { top: 18%; } }

/* ---------- Horizontal scroll ---------- */
.hs-sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.hs-head { padding: 0 6%; }
.hs-head .mono { color: var(--k-scroll); }
.hs-head h4 { margin: 6px 0 0; font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 80px); line-height: .95; }
.hs-head h4 em { color: var(--mute); }
.hs-track { display: flex; gap: 22px; padding: 0 6%; will-change: transform; }
.hs-track figure { flex: 0 0 min(68vw, 400px); margin: 0; }
.hs-track img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 16px; }
.hs-track figcaption { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; font-size: 14px; }
.hs-track figcaption span { color: var(--mute); }
.hs-progress { margin: 0 6%; height: 3px; border-radius: 3px; background: var(--line); }
.hs-progress i { display: block; height: 100%; width: var(--p, 0%); background: var(--k-scroll); border-radius: inherit; }

/* ---------- Layered parallax ---------- */
.parallax { background: linear-gradient(#86a2d6, #c99ab8 60%, #f2a66b) !important; }
.px-layer { position: absolute; will-change: transform; }
.px-bg { left: -5%; top: -10%; width: 110%; max-width: none; height: 120%; object-fit: cover; }
.px-mist { left: -10%; right: -10%; bottom: -5%; height: 50%; background: linear-gradient(to top, rgba(236, 232, 255, .85), rgba(236, 232, 255, 0)); pointer-events: none; }
.px-mist.m2 { height: 26%; background: linear-gradient(to top, rgba(250, 244, 255, .95), rgba(250, 244, 255, 0)); }
.px-title { left: 7%; top: 16%; margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(56px, 9vw, 132px); line-height: .88; color: #fff; text-shadow: 0 4px 40px rgba(40, 30, 80, .35); }
.px-title em { color: #ffe1b8; }
.px-fg { right: 5%; bottom: -3%; height: 80%; width: auto; filter: drop-shadow(0 20px 30px rgba(30, 20, 60, .35)); }
@media (max-width: 720px) { .px-fg { height: 58%; right: -6%; } .px-title { top: 10%; } }

/* ---------- Pinned storytelling ---------- */
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 0 40px; }
.steps-visual { position: sticky; top: 90px; align-self: start; padding: 40px 0; }
.steps-visual svg { width: 100%; height: auto; }
.steps-visual .frame { fill: var(--card-2); stroke: var(--line-2); stroke-width: 2; }
.steps-visual g[data-show] { opacity: 0; transform: translateY(12px); transition: opacity .6s, transform .6s; }
.steps-visual g.on { opacity: 1; transform: none; }
.steps-visual .txt { stroke: var(--mute); stroke-width: 7; stroke-linecap: round; fill: none; }
.steps-visual .box { fill: color-mix(in oklab, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 2; }
.steps-visual .b2 { fill: color-mix(in oklab, var(--violet) 22%, transparent); stroke: var(--violet); }
.steps-visual .dot { fill: var(--mint); }
.steps-visual .arrow { stroke: var(--ink); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.steps-visual .wave { stroke: var(--sun); stroke-width: 4; fill: none; stroke-linecap: round; }
.steps-visual .ok { fill: var(--mint); }
.steps-visual .tick { stroke: #0e0c0b; stroke-width: 5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.steps-count { color: var(--mute); }
.steps-text section { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; opacity: .3; transition: opacity .4s; }
.steps-text section.on { opacity: 1; }
.steps-text .mono { color: var(--k-scroll); }
.steps-text h4 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4vw, 52px); line-height: 1; margin: 10px 0; }
.steps-text p { color: var(--mute); font-size: 17px; max-width: 40ch; margin: 0; }
@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr; gap: 0; padding: 0 20px; }
  .steps-visual { top: 70px; z-index: 2; background: var(--bg-2); padding: 16px 0; }
  .steps-text section { min-height: 55vh; }
}

/* ---------- Multi-step form ---------- */
.wizard { padding: 26px; display: flex; flex-direction: column; gap: 18px; min-height: 440px; }
.wz-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; counter-reset: s; }
.wz-steps li { flex: 1; font-size: 12px; color: var(--mute); padding-top: 10px; border-top: 3px solid var(--line-2); counter-increment: s; }
.wz-steps li::before { content: counter(s) " "; font-family: var(--mono); }
.wz-steps li.on { color: var(--ink); border-color: var(--k-ui); }
.wz-steps li.done { color: var(--mute); border-color: color-mix(in oklab, var(--k-ui) 50%, transparent); }
/* Author display rules beat the browser's [hidden] style, so restore it here. */
.wizard [hidden] { display: none !important; }
.wizard fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.wizard legend { font-family: var(--serif); font-size: 32px; padding: 0; margin-bottom: 6px; }
.wizard label:not(.plan) { display: grid; gap: 6px; font-size: 13.5px; color: var(--mute); }
.wizard input:not([type="radio"]) { padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: 15px; }
.wizard input[aria-invalid="true"] { border-color: #ff6b6b; }
.field-msg { color: #ff8a8a; font-size: 12.5px; margin: -2px 0 0; }
.meter { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--s, 0%); background: var(--c, #ff6b6b); transition: width .3s, background .3s; }
.meter-text { margin: -6px 0 0; color: var(--mute); }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plan { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1px solid var(--line-2); cursor: pointer; font-size: 13px; color: var(--mute); }
.plan b { color: var(--ink); font-size: 16px; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan:has(input:checked) { border-color: var(--k-ui); background: color-mix(in oklab, var(--k-ui) 10%, transparent); }
.plan:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 560px) { .plans { grid-template-columns: 1fr; } }
.review { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.review dt { color: var(--mute); }
.review dd { margin: 0; }
.wz-done:focus { outline: none; }
.wz-done { display: flex; flex-direction: column; gap: 6px; padding: 40px 0; text-align: center; }
.wz-done strong { font-family: var(--serif); font-weight: 400; font-size: 56px; color: var(--k-ui); }
.wz-done span { color: var(--mute); }
.wz-error { color: #ff8a8a; min-height: 1.4em; margin: 0; font-size: 14px; }
.wz-nav { display: flex; justify-content: space-between; margin-top: auto; }

/* ---------- Dialog, popover, tooltip ---------- */
.dlg-demo { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 30px 26px; min-height: 220px; align-content: center; }
.dlg-log { width: 100%; color: var(--mute); margin: 8px 0 0; }
.dlg { border: 1px solid var(--line-2); border-radius: 20px; padding: 26px; max-width: min(420px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
.dlg[open] { animation: dlg-in .3s cubic-bezier(.2, 1.2, .4, 1); }
.dlg::backdrop { background: rgba(10, 8, 7, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dlg h4 { margin: 0 0 8px; font-family: var(--serif); font-weight: 400; font-size: 30px; }
.dlg p { color: var(--mute); margin: 0 0 20px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.pop { margin: 0; padding: 6px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .5); }
.pop:popover-open { display: flex; flex-direction: column; min-width: 160px; }
.pop button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.pop button:hover, .pop button:focus-visible { background: var(--card-2); }
.tip-wrap { position: relative; display: inline-flex; }
.tip-wrap .tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; translate: -50% 4px; white-space: nowrap; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 12.5px; opacity: 0; transition: opacity .15s, translate .15s;
}
.tip-wrap:hover .tip, .tip-wrap:focus-within .tip { opacity: 1; translate: -50% 0; }

/* ---------- Command palette ---------- */
.palette-intro { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 26px; text-align: center; min-height: 260px; justify-content: center; }
.palette-intro p { margin: 0; color: var(--mute); max-width: 40ch; }
.kbd-big { font-size: 34px; padding: 10px 22px; border-radius: 16px; display: inline-flex; gap: 6px; }
.cmdk { width: min(640px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-2); border-radius: 18px; background: var(--card); color: var(--ink); margin-top: 12vh; }
.cmdk::backdrop { background: rgba(10, 8, 7, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.cmdk input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 18px 20px; font-size: 18px; outline: none; }
.cmdk ul { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow: auto; }
.cmdk li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.cmdk li[aria-selected="true"] { background: var(--card-2); }
.cmdk li i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cmdk li span.kind { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--mute); text-transform: uppercase; }
.cmdk mark { background: none; color: var(--accent); font-weight: 700; }
.cmdk .empty { color: var(--mute); padding: 14px; }
.cmdk footer { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--mute); font-size: 12px; }

/* ---------- Toasts ---------- */
.toast-demo { display: flex; flex-wrap: wrap; gap: 12px; padding: 30px 26px; align-content: center; min-height: 260px; }
.toast-demo p { width: 100%; color: var(--mute); margin: 6px 0 0; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column-reverse; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  position: relative; overflow: hidden; pointer-events: auto; touch-action: pan-y; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  animation: toast-in .35s cubic-bezier(.2, 1.2, .4, 1);
}
.toast .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; color: #0e0c0b; }
.toast.success .ic { background: var(--mint); } .toast.error .ic { background: #ff6b6b; } .toast.info .ic { background: var(--sun); }
.toast .ic.spin { background: none; border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.toast b { display: block; font-size: 14px; }
.toast small { color: var(--mute); font-size: 12.5px; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px 6px; }
.toast .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); animation: shrink linear forwards; }
.toast.out { animation: toast-out .25s ease-in forwards; }
.toast.held .bar { animation-play-state: paused; }
.demo[tabindex="-1"]:focus, section.chapter[tabindex="-1"]:focus { outline: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes shrink { from { width: 100%; } to { width: 0; } }

/* ---------- Carousel ---------- */
.carousel { padding: 16px 0 20px; }
.car-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.car-track::-webkit-scrollbar { display: none; }
.car-slide { flex: 0 0 100%; scroll-snap-align: center; margin: 0; padding: 30px 40px; box-sizing: border-box; }
.car-slide p { font-family: var(--serif); font-size: clamp(26px, 3vw, 36px); line-height: 1.15; margin: 0 0 18px; }
.car-slide footer { color: var(--mute); font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.car-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
/* 24px hit areas with a small dot drawn inside (WCAG 2.5.8). */
.car-dots { display: flex; gap: 2px; }
.car-dots button { min-width: 24px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.car-dots button::before { content: ""; width: 9px; height: 9px; border-radius: 6px; background: var(--line-2); transition: width .3s, background .3s; }
.car-dots button[aria-current="true"]::before { width: 26px; background: var(--k-ui); }

/* ---------- Pricing ---------- */
.pricing { padding: 26px; display: flex; flex-direction: column; gap: 20px; align-items: center; }
.billing { display: inline-flex; padding: 4px; border-radius: 999px; border: 1px solid var(--line-2); }
.billing button { border: 0; background: none; padding: 7px 16px; border-radius: 999px; cursor: pointer; color: var(--mute); font-size: 13.5px; }
.billing button.on { background: var(--ink); color: var(--bg); }
.billing i { font-style: normal; color: var(--k-ui); font-size: 12px; margin-left: 4px; }
.billing button.on i { color: inherit; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.tier { position: relative; border: 1px solid var(--line-2); border-radius: 16px; padding: 18px 16px; }
.tier.hot { border-color: var(--k-ui); background: color-mix(in oklab, var(--k-ui) 7%, transparent); }
.tier em { position: absolute; top: -10px; right: 12px; font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--k-ui); color: #10140a; font-weight: 600; }
.tier .price { margin: 6px 0 12px; font-family: var(--serif); font-size: 46px; line-height: 1; }
.tier .price span::before { content: "$"; font-size: .55em; vertical-align: .55em; margin-right: 2px; }
.tier .price small { font-family: var(--sans); font-size: 13px; color: var(--mute); }
.tier ul { list-style: none; margin: 0; padding: 0; font-size: 13.5px; color: var(--mute); display: grid; gap: 6px; }
.tier li::before { content: "\2713  "; color: var(--k-ui); }
@media (max-width: 640px) { .tiers { grid-template-columns: 1fr; } }

/* ---------- Data table ---------- */
.dtable { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dt-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dt-tools input { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); min-width: 200px; }
.dt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-chips button { border: 1px solid var(--line-2); background: none; padding: 5px 11px; border-radius: 999px; cursor: pointer; font-size: 12.5px; color: var(--mute); }
.dt-chips button.on { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.dt-count { color: var(--mute); margin-left: auto; }
.dt-scroll { max-height: 440px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.dtable table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable th { position: sticky; top: 0; background: var(--card-2); text-align: left; z-index: 1; }
.dtable th button { border: 0; background: none; padding: 11px 12px; width: 100%; text-align: left; cursor: pointer; font-weight: 600; font-size: 13px; }
.dtable th[aria-sort="ascending"] button::after { content: " \2191"; color: var(--accent); }
.dtable th[aria-sort="descending"] button::after { content: " \2193"; color: var(--accent); }
.dtable td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.dtable td:first-child { font-family: var(--mono); color: var(--mute); width: 50px; }
.dtable td.tags-cell { color: var(--mute); font-size: 12.5px; }
.dtable tbody tr { cursor: pointer; }
.dtable tbody tr:hover, .dtable tbody tr:focus-visible { background: var(--card-2); }
.dtable .chap { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dtable .chap i { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Container queries ---------- */
.cq-wrap { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.cq-box { container-type: inline-size; resize: horizontal; overflow: hidden; width: 100%; min-width: 220px; max-width: 100%; padding: 12px; border: 1px dashed var(--line-2); border-radius: 16px; }
.cq-read { color: var(--mute); margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.cq-read input { accent-color: var(--k-css); width: 160px; }
.cq-card { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--card-2); position: relative; }
.cq-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.cq-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cq-body .mono { color: var(--k-css); }
.cq-body h4 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.05; }
.cq-body p { margin: 0; color: var(--mute); font-size: 14px; }
@container (min-width: 420px) {
  .cq-card { flex-direction: row; }
  .cq-card img { width: 42%; aspect-ratio: auto; }
  .cq-body { justify-content: center; }
}
@container (min-width: 640px) {
  .cq-card { min-height: 320px; }
  .cq-card img { position: absolute; inset: 0; width: 100%; height: 100%; }
  .cq-body { position: relative; margin-top: auto; padding: 26px; background: linear-gradient(transparent, rgba(10, 8, 7, .85)); width: 100%; color: #fff; }
  .cq-body h4 { font-size: 40px; max-width: 14ch; }
  .cq-body p { color: #ddd5cb; }
}

/* ---------- :has() ---------- */
.has-demo { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.todo { counter-reset: done total; border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; transition: border-color .3s, background .3s; }
.todo-head { color: var(--mute); margin: 0 0 2px; }
.todo label { counter-increment: total; display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 15px; transition: color .2s; }
.todo input { accent-color: var(--k-css); width: 17px; height: 17px; }
.todo label:has(input:checked) { counter-increment: total done; color: var(--mute); text-decoration: line-through; }
.todo-sum { margin: 4px 0 0; color: var(--mute); }
.todo-sum::after { content: counter(done) " of " counter(total) " done"; }
.todo:not(:has(input:not(:checked))) { border-color: var(--mint); background: color-mix(in oklab, var(--mint) 8%, transparent); }
.todo:not(:has(input:not(:checked))) .todo-sum::after { content: "All " counter(total) " done. Ship it."; color: var(--mint); }
.has-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.has-gallery img { aspect-ratio: 1; object-fit: cover; border-radius: 10px; transition: opacity .3s, transform .3s, filter .3s; }
.has-gallery:has(img:hover) img:not(:hover) { opacity: .35; filter: grayscale(1); }
.has-gallery img:hover { transform: scale(1.06); }

/* ---------- Anchor positioning ---------- */
.anchor-field { position: absolute; inset: 0; }
.anchor-chip { position: absolute; left: 40%; top: 35%; anchor-name: --chip; padding: 10px 18px; border-radius: 999px; border: 0; background: var(--k-css); color: #1a0d07; font-weight: 700; cursor: grab; touch-action: none; user-select: none; }
.anchor-chip:active { cursor: grabbing; }
.anchor-tip {
  position: absolute; position-anchor: --chip; position-area: bottom center; position-try-fallbacks: flip-block, flip-inline;
  margin: 10px; width: 210px; padding: 10px 12px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 13px; pointer-events: none;
}
.support { top: auto; bottom: 12px; }

/* ---------- View transitions ---------- */
.vt-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px; }
.vt-tile { border: 0; padding: 0; border-radius: 14px; overflow: hidden; cursor: pointer; position: relative; background: var(--card-2); }
.vt-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vt-tile span { position: absolute; left: 10px; bottom: 8px; color: #fff; font-family: var(--serif); font-size: 20px; text-shadow: 0 1px 10px rgba(0, 0, 0, .5); }
.vt-detail { position: absolute; inset: 16px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; border-radius: 16px; background: var(--card-2); overflow: hidden; }
.vt-detail[hidden], .vt-grid[hidden] { display: none; }
.vt-detail img { width: 100%; height: 100%; object-fit: cover; }
.vt-detail div { padding: 20px 20px 20px 0; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.vt-detail h4 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1; }
.vt-detail p { margin: 0; color: var(--mute); font-size: 14px; }
::view-transition-group(vt-img), ::view-transition-group(vt-title) { animation-duration: .5s; animation-timing-function: cubic-bezier(.3, .9, .3, 1); }

/* ---------- oklch color system ---------- */
.oklch { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.ok-controls { display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: 13.5px; color: var(--mute); }
.ok-controls label { display: flex; align-items: center; gap: 10px; }
.ok-controls input { width: 180px; accent-color: var(--k-css); }
.ok-controls output { font-family: var(--mono); color: var(--ink); min-width: 3ch; }
.ok-scale { display: grid; grid-template-columns: repeat(11, 1fr); border-radius: 12px; overflow: hidden; }
.ok-scale div { height: 70px; display: flex; align-items: flex-end; padding: 6px; font-family: var(--mono); font-size: 10px; }
.ok-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ok-card { border-radius: 16px; padding: 22px; background: var(--c-50); color: var(--c-950); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ok-card .mono { color: var(--c-600); }
.ok-card h4 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; }
.ok-card p { margin: 0; color: var(--c-700); font-size: 14px; }
.ok-btn { border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 600; background: var(--c-500); color: var(--c-on-500); cursor: pointer; }
.ok-btn.alt { background: var(--c-100); color: var(--c-800); }
/* Relative color syntax: hover is the same color, a little darker. */
.ok-btn:hover { background: oklch(from var(--c-500) calc(l - 0.08) c h); }
.ok-btn.alt:hover { background: color-mix(in oklch, var(--c-100), var(--c-500) 20%); }
.ok-code { margin: 0; padding: 16px; border-radius: 16px; background: #0b0a09; color: #e9e2d8; font-family: var(--mono); font-size: 12px; line-height: 1.6; overflow: auto; white-space: pre; }
@media (max-width: 760px) { .ok-preview { grid-template-columns: 1fr; } .ok-scale div { height: 46px; font-size: 0; } }

/* ---------- Pause all motion ---------- */
.motion-demo { padding: 30px 26px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; min-height: 330px; justify-content: center; }
.motion-orbit { position: relative; width: 110px; height: 110px; border-radius: 50%; border: 1px dashed var(--line-2); animation: spin 4s linear infinite; }
.motion-orbit i { position: absolute; width: 16px; height: 16px; border-radius: 50%; top: -8px; left: calc(50% - 8px); background: var(--accent); transform-origin: 8px 63px; }
.motion-orbit i:nth-child(2) { transform: rotate(120deg); background: var(--violet); }
.motion-orbit i:nth-child(3) { transform: rotate(240deg); background: var(--mint); }
.motion-state { font-family: var(--serif); font-size: 28px; margin: 0; }
.motion-note { color: var(--mute); margin: 0; max-width: 40ch; }

/* ---------- Keyboard and focus ---------- */
.kb-demo { padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.kb-demo > p { margin: 0; color: var(--mute); }
.kb-readout { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; display: grid; gap: 4px; min-height: 92px; }
.kb-readout .mono { color: var(--mute); }
.kb-readout strong { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; overflow-wrap: anywhere; }
.kb-toolbar { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--line-2); align-self: flex-start; }
.kb-toolbar button { width: 42px; height: 38px; border-radius: 9px; border: 0; background: none; cursor: pointer; font-size: 16px; }
.kb-toolbar button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------- Contrast checker ---------- */
.contrast { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.ct-pick { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--mute); }
.ct-pick label { display: flex; align-items: center; gap: 8px; }
.ct-pick input { width: 44px; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; background: none; padding: 2px; cursor: pointer; }
.ct-sample { border-radius: 14px; padding: 18px; background: var(--ct-bg); color: var(--ct-fg); display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); }
.ct-sample .big { font-family: var(--serif); font-size: 30px; line-height: 1; }
.ct-score { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ct-score strong { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; }
.ct-score span { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.badge.pass { background: color-mix(in oklab, var(--mint) 25%, transparent); color: var(--mint); }
.badge.fail { background: color-mix(in oklab, #ff6b6b 22%, transparent); color: #ff8a8a; }
.ct-page { width: 100%; border-collapse: collapse; font-size: 13px; }
.ct-page caption { text-align: left; color: var(--mute); padding-bottom: 6px; }
.ct-page td { padding: 7px 4px; border-top: 1px solid var(--line); }
.ct-page td:nth-child(2) { font-family: var(--mono); }
.ct-page .sw { display: inline-block; width: 26px; height: 18px; border-radius: 4px; vertical-align: middle; margin-right: 8px; border: 1px solid var(--line); font-size: 11px; text-align: center; line-height: 16px; font-weight: 700; }

/* ---------- Self audit ---------- */
.audit { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.audit-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.audit-head .mono { color: var(--mute); }
.audit-scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.audit-scores div { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; }
.audit-scores b { display: block; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.05; }
.audit-scores span { font-size: 12px; color: var(--mute); }
.audit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; max-height: 330px; overflow: auto; }
.audit-list li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); }
.audit-list li::before { font-weight: 700; }
.audit-list li.pass::before { content: "\2713"; color: var(--mint); }
.audit-list li.warn::before { content: "!"; color: var(--sun); }
.audit-list li.fail::before { content: "\2717"; color: #ff8a8a; }
.audit-list small { display: block; color: var(--mute); }
