/* AirPods 5 vs Pro 3 article. Scoped to .article-body.ap so nothing leaks
   into other pages. Two product colours ride on existing theme tokens:
   open fit = --accent (teal), sealed fit = --visited (amber). */

.ap {
    --ap-open: var(--accent);
    --ap-sealed: var(--visited);
    --ap-miss: var(--error);
    --ap-jump-h: 48px;
    --ap-ink-on: var(--bg);
    counter-reset: apsec;
}

.ap > h2 {
    counter-increment: apsec;
    scroll-margin-top: calc(var(--ap-jump-h) + 12px);
    margin-top: 2.4em;
    font-size: 1.5rem;
}
.ap > h2::before {
    content: counter(apsec, decimal-leading-zero) " //";
    display: block;
    font-size: 0.6em;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 2px;
}
.ap > h3 { scroll-margin-top: calc(var(--ap-jump-h) + 12px); }

/* ---------- Retro window shell (mirrors .tool-panel) ---------- */
.ap-win {
    --c: var(--ap-open);
    border: 1px solid var(--c);
    background-color: var(--bg);
    color: var(--fg);
    box-shadow: 5px 5px 0 var(--c);
    margin: 1.4em 0;
}
.ap-win--sealed { --c: var(--ap-sealed); }
.ap-win-title {
    background-color: var(--c);
    color: var(--ap-ink-on);
    padding: 4px 12px;
    font-family: var(--font-heading);
    font-size: 0.85em;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
}
.ap-win-title::before {
    flex: none;
    content: "● ● ●";
    letter-spacing: 0.15em;
    font-size: 0.75em;
    opacity: 0.6;
}
.ap-win-body { padding: 14px 16px; }

/* ---------- Hero ---------- */
.ap-hero {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin: 0.4em 0 1.6em;
}
.ap-hero .ap-win { margin: 0; height: 100%; display: flex; flex-direction: column; }
.ap-hero .ap-win-body { display: flex; flex-direction: column; flex: 1; }
.ap-hero-name {
    font-family: var(--font-heading);
    font-weight: bold;
    color: var(--c);
    font-size: 0.95em;
}
.ap-price {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 7vw, 3rem);
    font-weight: bold;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-top: 4px;
}
.ap-price-alt {
    font-size: 0.8em;
    color: var(--muted);
    margin-bottom: 10px;
}
.ap-hero-facts {
    list-style: none;
    padding: 10px 0 0;
    margin: auto 0 0;
    border-top: 1px dashed var(--c);
    font-size: 0.85em;
}
.ap-hero-facts li { margin: 0; padding-left: 1.2em; position: relative; }
.ap-hero-facts li + li { margin-top: 3px; }
.ap-hero-facts li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--c);
}
.ap-vs {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--ap-ink-on);
    background: var(--fg);
    width: 2.6em;
    height: 2.6em;
    display: grid;
    place-items: center;
    border-radius: 50%;
    text-transform: uppercase;
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--fg);
}
@media (max-width: 560px) {
    .ap-hero { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
    .ap-vs { display: none; }
    .ap-win-body { padding: 12px; }
    .ap-hero-facts { font-size: 0.78em; }
    .ap-hero .ap-win-title::before { display: none; }
}

/* ---------- TL;DR ---------- */
.ap-tldr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    color: var(--surface-fg);
    margin: 1.6em 0;
}
.ap-tldr-col { padding: 12px 16px 14px; }
.ap-tldr-col + .ap-tldr-col { border-left: 1px dashed var(--surface-border); }
.ap-tldr-head {
    font-family: var(--font-heading);
    font-weight: bold;
    margin: 0 0 6px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ap-tldr-head::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--c);
    box-shadow: 2px 2px 0 var(--surface-fg);
}
.ap-tldr-col--open { --c: var(--ap-open); }
.ap-tldr-col--sealed { --c: var(--ap-sealed); }
.ap-tldr ul { margin: 0; padding-left: 1.1em; font-size: 0.92em; }
.ap-tldr li::marker { color: var(--c); }
@media (max-width: 560px) {
    .ap-tldr { grid-template-columns: 1fr; }
    .ap-tldr-col + .ap-tldr-col { border-left: 0; border-top: 1px dashed var(--surface-border); }
}

/* ---------- Sticky jump nav ---------- */
.ap-jump {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 2px solid var(--accent);
    margin: 0 -4px;
    padding: 0 4px;
}
.ap-jump ul {
    list-style: none;
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 8px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.ap-jump ul::-webkit-scrollbar { display: none; }
.ap-jump li { margin: 0 !important; flex: none; }
.ap-jump a {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.82em;
    padding: 4px 10px;
    text-decoration: none;
    white-space: nowrap;
    color: var(--surface-fg);
    background: var(--surface);
    border: 1px solid var(--surface-border);
    transition: background-color 0.12s, color 0.12s, transform 0.08s, box-shadow 0.08s;
}
.ap-jump a:visited { color: var(--surface-fg); }
.ap-jump a:hover,
.ap-jump a:focus-visible { box-shadow: 2px 2px 0 var(--accent); transform: translate(-1px, -1px); outline: none; }
.ap-jump a[aria-current="true"] {
    background: var(--accent);
    color: var(--ap-ink-on);
    border-color: var(--accent);
}

/* ---------- Shared controls ---------- */
.ap-seg {
    display: flex;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    padding: 3px;
    gap: 3px;
    margin: 0.8em 0;
}
.ap-seg button {
    flex: 1;
    min-height: 42px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: transparent;
    color: var(--surface-fg);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.ap-seg button:hover { border-color: var(--surface-border); }
.ap-seg button[aria-pressed="true"] {
    background: var(--ap-open);
    color: var(--ap-ink-on);
    border-color: var(--fg);
    box-shadow: 2px 2px 0 var(--fg);
}
.ap-seg button[aria-pressed="true"][data-v="pro"] { background: var(--ap-sealed); }
.ap-seg button:focus-visible,
.ap-chips button:focus-visible,
.ap-lack summary:focus-visible,
.ap-more summary:focus-visible {
    outline: 2px dashed var(--fg);
    outline-offset: 2px;
}

.ap-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}
.ap-chips button {
    flex: none;
    min-height: 38px;
    font-family: var(--font-mono);
    font-size: 0.82em;
    padding: 4px 12px;
    background: var(--bg);
    color: var(--fg);
    border: 1px dashed var(--muted);
    cursor: pointer;
}
.ap-chips button[aria-pressed="true"] {
    background: var(--fg);
    color: var(--bg);
    border-style: solid;
    border-color: var(--fg);
}

/* Retro toggle switch: real checkbox, visually hidden, drives a fake track. */
.ap-toggle,
.ap-q {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: 0;
}
.ap-toggle input,
.ap-q input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.ap-toggle-ui {
    flex: none;
    width: 46px;
    height: 24px;
    border: 1px solid var(--fg);
    background: var(--surface);
    position: relative;
    transition: background-color 0.15s;
}
.ap-toggle-ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--fg);
    transition: transform 0.15s;
}
input:checked + .ap-toggle-ui { background: var(--accent); }
input:checked + .ap-toggle-ui::after { transform: translateX(22px); background: var(--bg); }
input:focus-visible + .ap-toggle-ui { outline: 2px dashed var(--fg); outline-offset: 3px; }

/* ---------- Noise room ---------- */
.js .ap-needs-js { display: block; }
.ap-needs-js { display: none; }
.js .ap-seg.ap-needs-js { display: flex; }

.ap-crt {
    position: relative;
    height: 180px;
    background:
        linear-gradient(rgba(95, 209, 209, 0.07) 1px, transparent 1px) 0 0 / 100% 30px,
        linear-gradient(90deg, rgba(95, 209, 209, 0.07) 1px, transparent 1px) 0 0 / 30px 100%,
        radial-gradient(ellipse at center, #141a33 0%, #070914 100%);
    border: 2px solid var(--fg);
    border-radius: 10px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}
.ap-crt::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}
.ap-crt canvas { display: block; width: 100%; height: 100%; }
.ap-crt-tag {
    position: absolute;
    top: 8px;
    right: 10px;
    font-family: var(--font-mono);
    font-size: 0.7em;
    letter-spacing: 0.12em;
    color: #a6e22e;
    text-shadow: 0 0 6px rgba(166, 226, 46, 0.7);
}
.ap-crt-tag[data-off] { color: #ff7070; text-shadow: 0 0 6px rgba(255, 112, 112, 0.7); }

.ap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 0.8em;
    color: var(--muted);
    margin: 8px 2px 0;
}
.ap-key {
    display: inline-block;
    width: 18px;
    height: 3px;
    vertical-align: middle;
    margin-right: 6px;
}
.ap-key--noise { background: #5a6488; }
.ap-key--out { background: var(--ap-open); box-shadow: 0 0 4px var(--ap-open); }
.ap-room[data-bud="pro"] .ap-key--out { background: var(--ap-sealed); box-shadow: 0 0 4px var(--ap-sealed); }

.ap-meter {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: 0.85em;
}
.ap-meter-label { font-family: var(--font-mono); }
.ap-leds {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 2px;
    height: 16px;
}
.ap-leds i {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--surface-border) 50%, transparent);
    transition: background-color 0.25s, box-shadow 0.25s;
}
.ap-leds i.on { background: var(--ap-open); border-color: var(--ap-open); }
.ap-room[data-bud="pro"] .ap-leds i.on { background: var(--ap-sealed); border-color: var(--ap-sealed); }
.ap-meter-out {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1.35em;
    min-width: 4ch;
    text-align: right;
    color: var(--ap-open);
}
.ap-room[data-bud="pro"] .ap-meter-out { color: var(--ap-sealed); }
.ap-room-note {
    margin: 12px 0 !important;
    min-height: 3.2em;
    font-size: 0.95em;
    border-left: 3px solid var(--ap-open);
    padding-left: 10px;
}
.ap-room[data-bud="pro"] .ap-room-note { border-left-color: var(--ap-sealed); }
.ap-room .ap-toggle {
    padding-top: 12px;
    border-top: 1px dashed var(--muted);
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* Collapsible numbers table */
.ap-more {
    border: 1px dashed var(--muted);
    padding: 0 12px;
    margin: 1em 0;
    font-size: 0.92em;
}
.ap-more summary {
    cursor: pointer;
    padding: 8px 0;
    font-family: var(--font-mono);
    color: var(--accent);
    list-style: none;
}
.ap-more summary::-webkit-details-marker { display: none; }
.ap-more summary::before { content: "▸ "; }
.ap-more[open] summary::before { content: "▾ "; }
.ap-more table { margin-bottom: 12px; }

/* ---------- Tables (numbers + specs) ---------- */
.ap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86em;
    line-height: 1.35;
}
.ap th,
.ap td {
    text-align: left;
    padding: 7px 8px;
    border-bottom: 1px solid color-mix(in srgb, var(--surface-border) 45%, transparent);
    vertical-align: top;
}
.ap thead th {
    font-family: var(--font-heading);
    border-bottom: 2px solid var(--fg);
}
.ap tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface) 35%, transparent); }

.ap-specs table { table-layout: fixed; }
.ap-specs thead th {
    position: sticky;
    top: var(--ap-jump-h);
    z-index: 5;
    background: var(--bg);
}
.ap-specs thead th:nth-child(2),
.ap-specs thead th:nth-child(3) { color: var(--ap-open); }
.ap-specs thead th:nth-child(4) { color: var(--ap-sealed); }
.ap-specs td:first-child { color: var(--muted); font-size: 0.92em; }
.ap-specs td:nth-child(4) { border-left: 2px solid var(--ap-sealed); font-weight: bold; }
.ap-specs th:nth-child(4) { border-left: 2px solid var(--ap-sealed); }
.ap-specs td.ap-no { color: var(--muted); }
.ap-specs td.ap-no::before { content: "✕ "; color: var(--ap-miss); }
@media (max-width: 560px) {
    .ap-specs table { font-size: 0.76em; }
    .ap-specs th, .ap-specs td { padding: 6px 4px; }
}

/* ---------- Comfort cards ---------- */
.ap-fit {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin: 1.2em 0;
}
@media (max-width: 640px) { .ap-fit { grid-template-columns: 1fr; } }
.ap-card {
    --c: var(--ap-open);
    border: 1px solid var(--c);
    border-top: 6px solid var(--c);
    background: color-mix(in srgb, var(--c) 7%, var(--bg));
    padding: 12px 16px 6px;
    box-shadow: 4px 4px 0 var(--c);
}
.ap-card--sealed { --c: var(--ap-sealed); }
.ap-card h3 { margin: 4px 0 0 !important; color: var(--c); }
.ap-card h3 a.header-anchor { display: none; }
.ap-card h3 + p { margin: 2px 0 10px; color: var(--muted); font-size: 0.9em; }
.ap-card p > strong:only-child {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.78em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 0.6em;
}
.ap-card p:has(> strong:only-child) { margin: 0.6em 0 0.2em; }
.ap-card ul { list-style: none; padding: 0; margin: 0 0 0.6em; font-size: 0.9em; }
.ap-card li {
    position: relative;
    padding: 5px 0 5px 22px;
    border-top: 1px dashed color-mix(in srgb, var(--fg) 20%, transparent);
    margin: 0 !important;
}
.ap-card li::before {
    position: absolute;
    left: 2px;
    top: 4px;
    font-family: var(--font-mono);
    font-weight: bold;
}
.ap-card ul:first-of-type li::before { content: "+"; color: var(--c); }
.ap-card ul:last-of-type li::before { content: "−"; color: var(--ap-miss); }

.ap-fig { width: 100%; height: auto; display: block; margin: 2px 0 6px; }
.ap-fig-ear { fill: none; stroke: currentColor; stroke-opacity: 0.3; stroke-width: 3; }
.ap-fig-bud { fill: var(--c); }
.ap-fig-tip { fill: var(--c); fill-opacity: 0.5; }
.ap-fig-wall { stroke: var(--c); stroke-width: 4; }
.ap-fig-air {
    fill: none;
    stroke: var(--c);
    stroke-width: 2.5;
    stroke-dasharray: 4 6;
    animation: ap-flow 1.6s linear infinite;
}
@keyframes ap-flow { to { stroke-dashoffset: -20; } }

.ap-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 1em 0;
}
.ap-stat {
    border-left: 4px solid var(--c);
    padding: 6px 12px;
    background: var(--surface);
    color: var(--surface-fg);
}
.ap-stat--open { --c: var(--ap-open); }
.ap-stat--sealed { --c: var(--ap-sealed); }
.ap-stat b { display: block; font-family: var(--font-heading); font-size: 1.4em; }
.ap-stat span { font-size: 0.8em; }

/* ---------- What's missing ---------- */
.ap-lack { border-top: 2px solid var(--fg); margin: 0.6em 0 1.2em; }
.ap-lack details { border-bottom: 1px dashed var(--muted); }
.ap-lack details[hidden] { display: none; }
.ap-lack summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: 26px 1fr 18px;
    align-items: center;
    gap: 10px;
    padding: 11px 2px;
    min-height: 48px;
}
.ap-lack summary::-webkit-details-marker { display: none; }
.ap-lack summary:hover { background: color-mix(in srgb, var(--surface) 40%, transparent); }
.ap-x {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    font-size: 0.75em;
    font-weight: bold;
    color: var(--ap-miss);
    border: 1px solid var(--ap-miss);
}
.ap-lack summary em {
    display: block;
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 0.72em;
    color: var(--muted);
}
.ap-chev {
    font-family: var(--font-mono);
    font-size: 1.2em;
    color: var(--muted);
    transition: transform 0.2s;
}
.ap-lack details[open] .ap-chev { transform: rotate(90deg); }
.ap-lack details p {
    margin: 0 0 14px 36px !important;
    font-size: 0.93em;
    color: var(--muted);
    border-left: 2px solid var(--ap-sealed);
    padding-left: 10px;
}

.ap-keep {
    border: 1px solid var(--ap-open);
    box-shadow: 4px 4px 0 var(--ap-open);
    padding: 12px 16px;
    margin: 1.4em 0;
}
.ap-keep-head { margin: 0 0 8px !important; font-family: var(--font-heading); font-weight: bold; }
.ap-keep ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.ap-keep li {
    margin: 0 !important;
    font-size: 0.82em;
    padding: 2px 8px;
    border: 1px solid var(--ap-open);
    background: color-mix(in srgb, var(--ap-open) 12%, var(--bg));
}
.ap-keep li::before { content: "✓ "; color: var(--ap-open); font-weight: bold; }

/* ---------- Battery ---------- */
.ap-bars { margin: 0.8em 0 1.2em; }
.ap-bars-head {
    font-family: var(--font-heading);
    font-weight: bold;
    margin: 1em 0 6px !important;
    font-size: 0.95em;
}
.ap-bar {
    --c: var(--ap-open);
    display: grid;
    grid-template-columns: 9.5em 1fr 3.2em;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    font-size: 0.86em;
}
.ap-bar--sealed { --c: var(--ap-sealed); }
.ap-bar b { font-family: var(--font-heading); text-align: right; color: var(--c); font-size: 1.1em; }
.ap-bar-track {
    height: 26px;
    border: 1px solid var(--fg);
    background: var(--surface);
    padding: 2px;
    display: block;
}
.ap-bar-fill {
    display: block;
    height: 100%;
    width: var(--w);
    background: repeating-linear-gradient(90deg, var(--c) 0 9px, transparent 9px 12px);
    transition: width 1.1s steps(18, end);
}
.js .ap-bars:not(.is-in) .ap-bar-fill,
.js .ap-bands:not(.is-in) .ap-band-fill { width: 0; }
.ap-bar--sealed .ap-bar-fill { filter: drop-shadow(0 0 3px var(--c)); }
@media (max-width: 480px) {
    .ap-bar { grid-template-columns: 1fr 3em; gap: 2px 8px; }
    .ap-bar-name { grid-column: 1 / -1; }
}

/* ---------- Decide ---------- */
.ap-quiz { margin: 0.8em 0; }
.ap-q {
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    color: var(--surface-fg);
    margin-bottom: 8px;
    transition: box-shadow 0.12s, transform 0.12s;
}
.ap-q:hover { box-shadow: 3px 3px 0 var(--accent); transform: translate(-1px, -1px); }
.ap-q:has(input:checked) { box-shadow: 3px 3px 0 var(--accent-2); border-color: var(--accent-2); }

.ap-result { --c: var(--fg); transition: box-shadow 0.3s; }
.ap-result[data-pick="open"] { --c: var(--ap-open); }
.ap-result[data-pick="sealed"] { --c: var(--ap-sealed); }
.ap-result .ap-win-body {
    background: color-mix(in srgb, var(--c) 10%, var(--bg));
    transition: background-color 0.3s;
}
.ap-result-title {
    display: block;
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 5vw, 1.9rem);
    line-height: 1.1;
    color: var(--c);
    margin-bottom: 6px;
}
.ap-result-text { margin: 0 !important; }
.ap-result.ap-pop .ap-result-title { animation: ap-pop 0.35s ease-out; }
@keyframes ap-pop {
    0% { transform: translateY(6px); opacity: 0; }
    100% { transform: none; opacity: 1; }
}

/* ---------- Looking ahead ---------- */
.ap-ahead { counter-reset: apahead; display: grid; gap: 4px; }
.ap-ahead h3 {
    counter-increment: apahead;
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 1em 0 0 !important;
    padding-top: 12px;
    border-top: 1px dashed var(--muted);
}
.ap-ahead h3::before {
    content: counter(apahead, decimal-leading-zero);
    font-size: 1.5em;
    color: var(--accent);
    line-height: 1;
}
.ap-ahead h3 a.header-anchor { display: none; }
.ap-ahead p { margin: 0.3em 0 0 !important; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    .ap-fig-air { animation: none; }
    .ap-bar-fill,
    .ap-band-fill,
    .ap-leds i,
    .ap-chev { transition: none; }
    .ap-result.ap-pop .ap-result-title { animation: none; }
}

/* ---------- Data provenance badges ---------- */
.ap-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    padding: 3px 5px;
    border: 1px solid currentColor;
    vertical-align: middle;
    white-space: nowrap;
}
.ap-badge[data-kind="lab"] { color: var(--accent-2); }
.ap-badge[data-kind="est"] { color: var(--visited); border-style: dashed; }
.ap-badge[data-kind="apple"] { color: var(--muted); }
.ap-legend-key {
    font-size: 0.85em;
    color: var(--muted);
    line-height: 2;
}
.ap-fine { font-size: 0.8em; color: var(--muted); margin: 12px 0 0 !important; }

/* ---------- Lab tiles ---------- */
.ap-lab {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 1.2em 0;
}
@media (max-width: 560px) { .ap-lab { grid-template-columns: 1fr 1fr; } .ap-lab > :last-child { grid-column: 1 / -1; } }
.ap-labtile {
    --c: var(--ap-open);
    position: relative;
    border: 1px solid var(--c);
    border-top: 5px solid var(--c);
    padding: 10px 12px;
    background: color-mix(in srgb, var(--c) 7%, var(--bg));
}
.ap-labtile--sealed { --c: var(--ap-sealed); }
.ap-labtile .ap-badge { position: absolute; top: 8px; right: 8px; }
.ap-labtile b {
    display: block;
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 5vw, 2.1rem);
    line-height: 1.1;
    color: var(--c);
    letter-spacing: -0.03em;
    margin-top: 4px;
}
.ap-labtile span:last-child { display: block; font-size: 0.8em; margin-top: 4px; }

/* ---------- Isolation by band chart ---------- */
.ap-bands-sub { margin: 0 0 6px !important; font-size: 0.85em; color: var(--muted); }
.ap-bands-group {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 0.9em;
    margin: 12px 0 4px !important;
    padding-top: 8px;
    border-top: 1px dashed color-mix(in srgb, var(--fg) 25%, transparent);
}
.ap-bands-group:first-child { border-top: 0; padding-top: 0; }
.ap-bands-group span { font-family: var(--font-body); font-weight: normal; color: var(--muted); font-size: 0.85em; margin-left: 6px; }
.ap-band {
    --c: var(--ap-open);
    display: grid;
    grid-template-columns: 6.5em 1fr 6.6em 6.8em;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-size: 0.85em;
}
.ap-band--sealed { --c: var(--ap-sealed); }
.ap-band b { font-family: var(--font-heading); color: var(--c); text-align: right; white-space: nowrap; }
.ap-band .ap-badge { justify-self: start; }
.ap-band-track { display: block; height: 18px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--fg) 40%, transparent); }
.ap-band-fill {
    display: block;
    height: 100%;
    width: var(--w);
    background: var(--c);
    transition: width 0.9s cubic-bezier(.2, .8, .2, 1);
}
/* Estimates get a hatched fill so they never read as measurements. */
.ap-band--est .ap-band-fill {
    background: repeating-linear-gradient(135deg, var(--c) 0 4px, transparent 4px 7px);
    outline: 1px dashed var(--c);
    outline-offset: -1px;
}
@media (max-width: 560px) {
    .ap-band { grid-template-columns: 1fr auto; gap: 2px 8px; }
    .ap-band-name { grid-column: 1; }
    .ap-band .ap-badge { grid-column: 2; grid-row: 1; justify-self: end; }
    .ap-band-track { grid-column: 1; }
    .ap-band b { grid-column: 2; grid-row: 2; }
}

/* ---------- Battery: Apple rating vs lab ---------- */
.ap-bar-name .ap-badge { margin-left: 4px; font-size: 0.6rem; }
.ap-bar--rated .ap-bar-fill { opacity: 0.4; }
.ap-bar--rated b { opacity: 0.7; }
.ap-bar--rated + .ap-bar:not(.ap-bar--rated) { margin-top: 2px; }
.ap-bar-empty {
    display: flex;
    align-items: center;
    height: 100%;
    padding-left: 8px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--muted);
    background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--muted) 18%, transparent) 6px 8px);
}
@media (min-width: 481px) { .ap-bar { grid-template-columns: 15.5em 1fr 4em; } }
.ap-bar b, .ap-bar-name { white-space: nowrap; }

/* ---------- Noise room readout ---------- */
.ap-readout {
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.75em;
    color: var(--muted);
}

/* Wide data tables scroll sideways on phones instead of pushing the page. */
@media (max-width: 560px) {
    .ap > table { display: block; overflow-x: auto; font-size: 0.78em; }
    .ap > table td:last-child { min-width: 14em; }
    .ap > pre { font-size: 0.78em; }
}
