/* Side by side. Loaded only on /compare/, so the page-local overrides below stay off every other page.
   Colours come from the tier tokens --t0 to --t3: a mouse keeps the same colour in its picker slot, its
   outline, its legend pill and its table column, which is the only thing tying the drawing to the numbers. */

.cmp-intro{margin:0 0 22px}

/* ---------- Picker ----------
   Four slots, always. A filled one is the same tile the table columns use; a free one shows what is left
   to spend and hands the focus to the search field below. */
.cmp-picker{margin:0}
.cmp-slots{list-style:none;padding:0!important;margin:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(150px,auto);gap:12px}
.cmp-slot{max-width:none;position:relative;min-width:0}
.cmp-slot.is-filled{background:var(--surface);border:1px solid var(--line);border-radius:12px;overflow:hidden;padding-bottom:13px}
.cmp-slot.is-filled::before{content:"";display:block;height:3px;background:var(--c)}
.cmp-plate{display:grid;place-items:center;background:var(--photo);overflow:hidden;padding:10px}
.cmp-plate img{width:100%;object-fit:contain}
.cmp-plate .monogram{font-size:20px}
.cmp-slot .cmp-plate{height:84px}
.cmp-slot .cmp-plate img{max-height:64px}
.cmp-slot-brand{font-size:12px;color:var(--muted);line-height:1.2;margin:10px 0 0;padding:0 13px}
.cmp-slot-name{font-family:var(--display);font-size:20px;font-weight:700;line-height:1.1;margin:2px 0 0;padding:0 13px;overflow-wrap:anywhere}
.cmp-slot-remove{position:absolute;top:11px;right:9px;width:27px;height:27px;display:grid;place-items:center;border-radius:50%;color:var(--muted);background:color-mix(in srgb,var(--surface) 82%,transparent);box-shadow:inset 0 0 0 1px var(--line-strong);transition:background .15s,color .15s}
.cmp-slot-remove:hover{background:var(--surface-2);color:var(--ink)}
.cmp-slot-remove .ui-icon{width:13px;height:13px;flex-basis:13px;vertical-align:0}
.cmp-add{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;border-radius:12px;border:1.5px dashed var(--line-strong);color:var(--muted);font-size:13px;font-weight:500;transition:border-color .15s,color .15s,background .15s}
.cmp-add:hover{border-color:var(--ink);color:var(--ink);background:var(--surface)}
.cmp-add .ui-icon{width:18px;height:18px;flex-basis:18px;vertical-align:0}

.cmp-field{position:relative;max-width:520px;margin:14px 0 0}
.cmp-field input{width:100%;min-width:0;padding-left:38px}
.cmp-field-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);display:grid;color:var(--muted);pointer-events:none}
.cmp-field-icon .ui-icon{width:17px;height:17px;flex-basis:17px;vertical-align:0}
.cmp-results{position:absolute;z-index:5;top:calc(100% + 6px);left:0;right:0;list-style:none;margin:0;padding:6px!important;background:var(--surface);border-radius:var(--radius);box-shadow:var(--shadow),inset 0 0 0 1px var(--line-strong);max-height:min(46vh,340px);overflow-y:auto}
.cmp-results li{max-width:none}
.cmp-results button{display:block;width:100%;text-align:left;padding:8px 10px;border-radius:var(--radius-s);font-size:14px;font-weight:500;line-height:1.35}
.cmp-results button:hover{background:var(--surface-2)}
.cmp-results button span{display:block;font-size:12px;font-weight:400;color:var(--muted)}
.cmp-no-results{padding:9px 10px;font-size:14px;color:var(--muted)}
.cmp-hint{font-size:13px;color:var(--muted);margin:10px 0 0}
.cmp-hint:empty{display:none}

/* ---------- Sections ---------- */
.cmp-section{margin:32px 0 0}
.cmp-section>h2{margin:0 0 14px}
.cmp-note,.cmp-source-note,.cmp-foot{font-size:13px;color:var(--muted);margin:12px 0 0;max-width:80ch}

/* ---------- Shape ----------
   One SVG holds both panels so they share a millimetre scale; compare.js swaps between a row and a column
   layout at the same breakpoint as the media query below. The viewBox is in millimetres, so every length
   here, stroke widths and font sizes included, is a real millimetre on the drawing. compare.js sets the
   inline max-width that caps the drawing's height, which is what keeps it a figure instead of the page. */
.cmp-figure{margin:0;padding:14px 16px 16px;background:var(--surface);border:1px solid var(--line);border-radius:14px}
.cmp-figure-head{display:flex;align-items:center;flex-wrap:wrap;gap:10px 16px;margin:0 0 14px}
.cmp-svg{display:block;width:100%;height:auto;margin-inline:auto}
.cmp-svg text{font-family:var(--body);fill:var(--muted)}
.cmp-board{fill:var(--ground);stroke:var(--line);stroke-width:.3}
.cmp-grid{fill:none;stroke:var(--line);stroke-width:.25}
.cmp-guide{fill:none;stroke:var(--line-strong);stroke-width:.3;stroke-dasharray:2 2}
.cmp-outline{fill:color-mix(in srgb,var(--c) 20%,transparent);stroke:var(--c);stroke-width:.8;stroke-linejoin:round}
.cmp-hand-line{fill:none;stroke:var(--ink);stroke-width:.4;stroke-dasharray:2.5 2}
.cmp-hand-label{font-size:4.6px}
.cmp-panel-label{font-size:5.4px;font-weight:600}
.cmp-bar{fill:none;stroke:var(--muted);stroke-width:.4}
.cmp-bar-label{font-size:4.6px}
.cmp-figure figcaption{font-size:12.5px;color:var(--muted);margin:14px 0 0;max-width:80ch}

/* Legend pills carry the mouse colour and its dimensions source; the source is the only link here. */
.cmp-legend{list-style:none;padding:0!important;margin:0;display:flex;flex-wrap:wrap;gap:7px}
.cmp-legend li{max-width:none;display:inline-flex;align-items:center;gap:7px;padding:5px 9px 5px 10px;border-radius:999px;background:var(--ground);box-shadow:inset 0 0 0 1px var(--line);font-size:12.5px;font-weight:500;line-height:1.25}
.document-page .cmp-legend a{display:inline-grid;place-items:center;color:var(--muted);border-radius:4px;transition:color .15s}
.document-page .cmp-legend a:hover{color:var(--ink)}
.cmp-legend .ui-icon{width:13px;height:13px;flex-basis:13px;vertical-align:0}
.cmp-swatch{width:11px;height:11px;flex:0 0 11px;border-radius:3px;background:color-mix(in srgb,var(--c) 35%,transparent);box-shadow:inset 0 0 0 1.5px var(--c)}

.cmp-hand{display:inline-flex;align-items:center;gap:8px;margin-left:auto;font-size:12.5px;color:var(--muted)}
.cmp-hand-input{position:relative;display:inline-flex;align-items:center}
.cmp-hand-input input{width:86px;min-height:34px;padding:5px 32px 5px 11px;font-size:14px;color:var(--ink);background:var(--ground);border:1px solid var(--line-strong);border-radius:var(--radius-s);appearance:textfield;-moz-appearance:textfield}
.cmp-hand-input input::-webkit-outer-spin-button,.cmp-hand-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.cmp-hand-input>span{position:absolute;right:11px;font-size:12px;color:var(--muted);pointer-events:none}
.cmp-hand-clear{width:28px;height:28px;display:grid;place-items:center;border-radius:50%;color:var(--muted);transition:background .15s,color .15s}
.cmp-hand-clear:hover{background:var(--surface-2);color:var(--ink)}
.cmp-hand-clear .ui-icon{width:13px;height:13px;flex-basis:13px;vertical-align:0}

/* ---------- Table ----------
   The row labels stay put while the mouse columns scroll, which is the only way four columns fit a phone.
   Nothing is tinted: a row every mouse agrees on is dimmed, a value outside the majority takes weight and
   a bar in its column colour, and the single best number in a row with a direction gets a check. */
.cmp-table-scroll{overflow-x:auto;max-width:100%;overscroll-behavior-x:contain;scrollbar-width:thin;scrollbar-color:var(--line-strong) transparent}
.cmp-table{border-collapse:collapse;width:100%}
/* A single mouse is a spec sheet, not a comparison: the table stops stretching one column across the page. */
.cmp-table.is-solo{width:auto;min-width:min(100%,460px)}
.cmp-table th,.cmp-table td{padding:9px 12px;text-align:left;border-bottom:1px solid var(--line);font-size:14px}
.cmp-table th[scope=row]{position:sticky;left:0;z-index:1;background:var(--ground);font-family:var(--body);font-size:12px;font-weight:500;white-space:nowrap;width:1%}
.cmp-corner{position:sticky;left:0;z-index:1;background:var(--ground);border-bottom:1px solid var(--line-strong);padding:0}
/* Relative so the screen-reader text on a best-value mark is contained by the scroller, not the page. */
.cmp-table td{position:relative;font-weight:500;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.cmp-table td.is-none{color:var(--muted);font-weight:400}
.cmp-table tr.is-same th[scope=row],.cmp-table tr.is-same td{color:var(--muted);font-weight:400}
.cmp-table td.is-diff{font-weight:600;box-shadow:inset 3px 0 0 var(--c)}
.cmp-best{width:13px;height:13px;flex-basis:13px;color:var(--accent);margin-right:5px;vertical-align:-2px}

.cmp-group th{position:static;background:none;border-bottom:1px solid var(--line-strong);padding:20px 0 5px}
.cmp-group span{position:sticky;left:0;display:inline-block;font-size:12px;font-weight:600;color:var(--ink);background:var(--ground);padding-right:12px}
.cmp-table tbody:first-of-type .cmp-group th{padding-top:12px}

.cmp-col{min-width:200px;vertical-align:top;padding:0 12px 13px;border-top:3px solid var(--c);border-bottom:1px solid var(--line-strong)}
.cmp-col .cmp-plate{height:88px;margin:11px 0 0;border-radius:10px;box-shadow:inset 0 0 0 1px var(--line)}
.cmp-col .cmp-plate img{max-height:66px}
.cmp-col-brand{font-size:12px;color:var(--muted);margin:10px 0 0;line-height:1.2}
.cmp-col-name{font-family:var(--display);font-size:20px;font-weight:700;line-height:1.1;margin:2px 0 0;overflow-wrap:anywhere}
.cmp-col-actions{display:flex;flex-wrap:wrap;gap:6px;margin:11px 0 0}
.cmp-col-actions .button{flex:1 1 calc(50% - 3px);min-width:0;min-height:31px;padding:0 9px;gap:5px;font-size:12.5px;text-decoration:none}
.cmp-col-actions .cmp-shop{flex-basis:100%}
.cmp-col-actions .ui-icon{width:13px;height:13px;flex-basis:13px;vertical-align:0}
.cmp-rating-value{margin-left:7px;font-weight:400;color:var(--muted)}
.cmp-table .star{width:14px;height:14px;flex-basis:14px}

/* ---------- Empty state ---------- */
.cmp-empty{margin:32px 0 0}
.cmp-empty>p{max-width:70ch;margin:0 0 26px}
.cmp-empty>h2{margin:0 0 14px}
.cmp-suggestions{list-style:none;padding:0!important;margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.cmp-suggestions li{max-width:none}
.cmp-suggestions button{display:block;width:100%;text-align:left;border-radius:14px;background:var(--surface);border:1px solid var(--line);overflow:hidden;transition:border-color .15s,box-shadow .15s,transform .15s var(--ease-out)}
.cmp-suggestions button:hover{border-color:var(--line-strong);box-shadow:0 6px 18px rgba(20,22,26,.09);transform:translateY(-2px)}
.cmp-pair-photos{display:grid;grid-template-columns:1fr 1fr;gap:1px;background:var(--line)}
.cmp-suggestions .cmp-plate{height:104px}
.cmp-suggestions .cmp-plate img{max-height:82px}
.cmp-pair-label{display:block;font-family:var(--display);font-size:21px;font-weight:700;line-height:1.15;padding:13px 16px 0}
.cmp-pair-names{display:block;font-size:13px;color:var(--muted);line-height:1.45;padding:3px 16px 15px}

@media (max-width:760px){
 .cmp-slots{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(136px,auto)}
 .cmp-field{max-width:none}
 .cmp-hand{margin-left:0}
 .cmp-suggestions{grid-template-columns:1fr}
 .cmp-suggestions .cmp-plate{height:92px}
 .cmp-col{min-width:168px;padding:0 10px 12px}
 .cmp-col .cmp-plate{height:74px}
 .cmp-col .cmp-plate img{max-height:56px}
 .cmp-col-name{font-size:18px}
 .cmp-table th,.cmp-table td{padding:8px 10px;font-size:13.5px}
}
@media (prefers-reduced-motion:reduce){
 .cmp-suggestions button:hover{transform:none}
}

#compare{min-width:0;max-width:100%}
