/* Only approved additions. Search, cards, menus, topbar: production app.css. */
html.catalog-prototype,html.catalog-prototype.desktop-scale-active {--catalog-scene-height:max(960px,100vh);height:auto;overflow-y:auto;overflow-x:hidden;scrollbar-width:none;overflow-anchor:none;}
html.catalog-prototype::-webkit-scrollbar {width:0;height:0;display:none;}
.catalog-prototype body,.catalog-prototype.desktop-scale-active body {height:auto;min-height:1920px;overflow:visible;}
.catalog-prototype .hero {height:100vh;min-height:960px;overflow:visible;z-index:1;}
.catalog-prototype.desktop-scale-active .hero {height:960px;}
.catalog-prototype .hero::after {background:linear-gradient(to bottom,transparent 72%,#000 100%),var(--dim);}
.catalog-prototype .logo {top:calc(var(--topbar-h) + 29px);}
.catalog-prototype .logo .logo-mark {width:66px;height:66px;}
.catalog-prototype .logo-1,.catalog-prototype .logo-2 {font-size:48.4px;}
.catalog-prototype .topbar .home-title {position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);margin:0;max-width:calc(100% - 880px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;}
.catalog-prototype .vehicle-search-mode {top:calc(var(--topbar-h) + 115px);left:calc(50% - 740px);right:auto;}
.catalog-prototype .search-wrap {top:calc(var(--topbar-h) + 152px);}
.catalog-prototype .tools-row {position:absolute;left:0;right:0;top:-30px;z-index:5;}
.catalog-prototype .adv-panel > .sort-row {margin-top:18px;}
.catalog-breadcrumbs {position:absolute;z-index:11;top:calc(var(--topbar-h) + 88px);left:calc(50% - 740px);display:flex;gap:8px;align-items:center;min-height:22px;font:600 13px/1.4 var(--font);color:var(--ink);}
.catalog-breadcrumbs a {color:var(--ink-2);text-decoration:none;}
.catalog-breadcrumbs a:hover {color:var(--amber);}
.catalog-rail {position:absolute;z-index:10;top:calc(var(--topbar-h) + 152px);left:calc(50% + 758px);width:184px;height:722px;display:grid;grid-template-rows:repeat(2,minmax(0,1fr));gap:16px;}
.catalog-panel {position:relative;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:15px 10px 10px;box-shadow:0 10px 26px rgba(0,0,0,.24);}
.catalog-panel h2 {margin:0 0 8px;padding:7px 6px 7px 9px;border-left:3px solid var(--amber);border-radius:5px;background:linear-gradient(90deg,rgba(var(--amber-rgb),.14),rgba(var(--amber-rgb),.025));color:var(--amber);font:800 14px/1.4 var(--font);}
.catalog-panel ul {padding:0;margin:0;list-style:none;}
.catalog-panel > ul {flex:1;min-height:0;overflow-y:auto;scrollbar-width:none;overscroll-behavior:contain;}
.catalog-panel > ul::-webkit-scrollbar {width:0;height:0;display:none;}
.catalog-panel > ul:focus-visible {outline:1px solid var(--amber);outline-offset:3px;border-radius:4px;}
.catalog-panel li a {display:flex;align-items:center;gap:5px;padding:3px 1px;min-height:27px;box-sizing:border-box;color:var(--ink-2);font:600 13px/1.2 var(--font);text-decoration:none;border-bottom:1px solid var(--line);}
.catalog-panel-separator {height:1px;margin:9px 0;background:rgba(var(--amber-rgb),.55);}
.catalog-panel-name {min-width:0;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.catalog-panel-count {flex:0 0 auto;color:var(--ink-3);font:600 12px/1.2 var(--font);font-variant-numeric:tabular-nums;}
.catalog-panel li a:hover,.catalog-panel li a.is-current,.catalog-panel li a.is-current .catalog-panel-count {color:var(--amber);}
.catalog-brand-mark {display:flex;align-items:center;justify-content:center;flex:0 0 29px;width:29px;height:20px;box-sizing:border-box;padding:1px;border-radius:5px;background:#22272d;border:1px solid #42484f;color:#dfe3e8;}
.catalog-brand-generic {display:block;width:25px;height:16px;}
.catalog-brand-mark img {width:25px;height:16px;object-fit:contain;}
.catalog-brand-mark:has(noscript > img) > img[data-icon-src] {display:none;}
.catalog-brand-mark img.catalog-brand-mark--light {background:transparent;padding:0;}
.catalog-logo-filters {position:absolute;pointer-events:none;}
.catalog-brand-mark img.catalog-brand-mark--paper {filter:url("#catalog-logo-paper");}
.catalog-brand-mark img.catalog-brand-mark--inverse {filter:invert(1);}
.catalog-brand-mark img.catalog-brand-mark--paper.catalog-brand-mark--inverse {filter:url("#catalog-logo-paper") invert(1);}
.catalog-prototype .catalog-search-brand {display:flex;align-items:center;gap:8px;}
.catalog-search-brand-name {min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.catalog-prototype .cards-wrap {overflow:visible;}
.catalog-prototype .cards-grid {--catalog-visible-rows:3;--catalog-card-height:calc(100cqh / var(--catalog-visible-rows));grid-template-columns:repeat(auto-fill,minmax(min(156px,100%),1fr));}
.catalog-prototype .cards-wrap .card {display:flex;flex-direction:column;min-width:0;background:#000;}
.catalog-prototype .cards-grid .card {height:var(--catalog-card-height);}
.catalog-prototype .cards-wrap .card__cover {flex:1 1 auto;min-height:0;aspect-ratio:auto;overflow:hidden;}
.catalog-prototype .cards-wrap .card__cap {position:relative;inset:auto;flex:0 0 56px;height:56px;min-width:0;padding:5px 7px;background:#000;}
.catalog-prototype .cards-wrap .card__price {color:#ffb400;text-shadow:none;-webkit-text-stroke:0;}
.catalog-prototype .cards-wrap .card__sub {color:#e8ebf1;}
.catalog-prototype .cards-wrap .card__city {color:#c7ccd6;}
.catalog-prototype .cards-wrap.scroll .cards-scroll {overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;}
.catalog-stream-ready {overflow-anchor:none;}
.catalog-chunk {grid-column:1/-1;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(156px,100%),1fr));align-content:start;overflow-anchor:none;}
.catalog-chunk.is-placeholder {display:block;height:calc(var(--catalog-card-height) * var(--catalog-page-rows));}
/* Choose complete rows from the available window, not from the API page size. */
@container (max-height:479px){.catalog-prototype .cards-grid {--catalog-visible-rows:2;}}
@container (min-height:740px){.catalog-prototype .cards-grid {--catalog-visible-rows:4;}}
@container (min-height:925px){.catalog-prototype .cards-grid {--catalog-visible-rows:5;}}
.catalog-stream-status {margin-top:9px;color:var(--ink-2);font:600 11px/1.5 var(--font);text-align:center;}
.catalog-stream-status button {margin-left:8px;border:1px solid var(--amber);border-radius:12px;background:var(--panel);color:var(--amber);padding:3px 10px;cursor:pointer;}
.catalog-stream-ready .catalog-pagination:not(:focus-within) {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
.catalog-prototype .pager-info {visibility:hidden;}
.catalog-prototype .pager {pointer-events:none;}
.catalog-prototype .pager .save-wrap {pointer-events:auto;}
.catalog-pagination {display:flex;align-items:center;justify-content:center;gap:18px;padding:20px 0;font:700 12px/1 var(--font);}
.catalog-pagination a,.catalog-pagination>span {padding:8px 13px;color:var(--ink);border:1px solid rgba(var(--amber-rgb),.5);border-radius:20px;background:rgba(0,0,0,.45);text-decoration:none;}
.catalog-prototype a.card {text-decoration:none;color:inherit;}
.catalog-prototype .catalog-garage {position:relative;inset:auto;display:block;width:100%;height:960px;min-height:960px;transform:none;visibility:visible;opacity:1;pointer-events:auto;overflow:hidden;isolation:isolate;z-index:0;}
.catalog-garage::after {content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(to bottom,#000,transparent 30%);}
.catalog-garage .deck-bg {position:absolute;}
.catalog-garage .deck-inner {overflow:visible;overscroll-behavior:auto;}
.catalog-prototype .about-service-link {bottom:0;}
@media(min-width:1921px){.catalog-rail{width:min(260px,calc((100vw - 1480px)/2 - 36px));}}
/* The first HTML frame and the interactive catalogue share one CSS layout.
   Do not wait for fitLayout()/catalogue requests to size or place the deck. */
@media(hover:hover) and (pointer:fine){
 /* Add caption space below the unchanged photos. Choose row count from the
    ORIGINAL window (scene - 48px topbar - 359px), not the enlarged scrollport:
    otherwise the extra pixels can cross a container-query breakpoint. */
 html.catalog-prototype {--catalog-desktop-rows:3;--catalog-caption-extra:7px;--catalog-deck-growth:calc(var(--catalog-desktop-rows) * var(--catalog-caption-extra));}
 .catalog-prototype .cards-grid {--catalog-visible-rows:var(--catalog-desktop-rows);--catalog-card-height:calc((100cqh - var(--catalog-deck-growth)) / var(--catalog-visible-rows) + var(--catalog-caption-extra));}
 .catalog-prototype .cards-wrap .card__cap {display:flex;flex-direction:column;justify-content:center;flex-basis:63px;height:63px;padding:5px 7px;}
 /* Panel design contract: docs/HOMEPAGE_UI_RULES.md. Brand list is the baseline;
    all existing and future panel lists share these tokens, never compact rows. */
 .catalog-prototype .catalog-rail {--catalog-panel-row-height:27px;--catalog-panel-label-size:13px;--catalog-panel-count-size:12px;--catalog-panel-title-size:14px;}
 .catalog-prototype .catalog-rail .catalog-panel h2 {font:800 var(--catalog-panel-title-size)/1.4 var(--font);}
 .catalog-prototype .catalog-rail .catalog-panel-list > li > a {min-height:var(--catalog-panel-row-height);padding:3px 1px;font:600 var(--catalog-panel-label-size)/1.2 var(--font);height:var(--catalog-panel-row-height);}
 .catalog-prototype .catalog-rail .catalog-panel-count {font:600 var(--catalog-panel-count-size)/1.2 var(--font);}
 .catalog-prototype .catalog-rail .home-panel-footer,.catalog-prototype .catalog-rail .home-budget-heading {font:600 var(--catalog-panel-label-size)/1.2 var(--font);}
 .catalog-prototype .catalog-rail .home-budget-inputs input,.catalog-prototype .catalog-rail .home-tire-form input,.catalog-prototype .catalog-rail .home-tire-form select {font-size:var(--catalog-panel-label-size);}
 .catalog-prototype .catalog-garage .deck-inner {overflow-y:auto;scrollbar-width:none;}
 .catalog-prototype .catalog-garage .deck-inner::-webkit-scrollbar {display:none;}
 .catalog-prototype .catalog-garage .deck-head,.catalog-prototype .catalog-garage .deck-body {max-width:1480px;margin-left:auto;margin-right:auto;}
 .catalog-prototype .catalog-garage .deck-body {padding-bottom:50px;}
 /* Before enhancement (or if JS fails), show only the plain page number. */
 .catalog-prototype .catalog-pagination {padding:0;margin-top:9px;color:var(--ink-2);font:600 11px/1.5 var(--font);}
 .catalog-prototype .catalog-pagination > a {display:none;}
 .catalog-prototype .catalog-pagination > span {padding:0;border:0;border-radius:0;background:none;color:inherit;}
 /* Desktop-only polish: reserve no extra space inside the catalogue grid. */
 .catalog-prototype .cards-wrap .card:hover {box-shadow:none;}
 .catalog-prototype .cards-wrap .card--preview,.catalog-prototype .cards-wrap .card--preview:hover {box-shadow:0 14px 36px rgba(var(--shadow-rgb),.62);}
 .catalog-prototype .catalog-breadcrumbs {top:calc(var(--topbar-h) + 83px);font:700 15px/20px var(--font);}
 .catalog-prototype .vehicle-search-mode {top:calc(var(--topbar-h) + 117px);height:28px;align-items:center;}
 .catalog-prototype .tools-row {top:-35px;}
 .catalog-prototype .vehicle-search-mode__button {display:inline-flex;align-items:center;height:28px;padding:0;border-bottom:0;font:700 15px/20px var(--font);}
 .catalog-prototype .vehicle-search-mode__button.is-active {box-shadow:inset 0 -1px currentColor;}
 .catalog-prototype .tools-main {height:28px;align-items:center;}
 .catalog-prototype .filters-reset,.catalog-prototype .sites-btn,.catalog-prototype .archive-btn {height:28px;padding:0;font:700 15px/20px var(--font);}
 .catalog-prototype .search-bar {height:76px;flex:0 0 76px;}
 .catalog-prototype .cards-wrap {top:102px;height:calc(var(--catalog-scene-height) - var(--topbar-h) - 291px + var(--catalog-deck-growth));}
 .catalog-prototype .cards-scroll {container-type:size;height:calc(100% - 68px);min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;}
 .catalog-prototype .pager {position:absolute;left:0;right:0;bottom:0;margin-top:0;z-index:5;}
 .catalog-prototype .save-search {height:40px;line-height:20px;}
 /* Keep the footer anchor/geometry; only applied searches can be saved. */
 .catalog-prototype:not(.catalog-filtered) .pager .save-wrap {visibility:hidden;pointer-events:none;}
 .catalog-prototype .catalog-rail {height:calc(var(--catalog-scene-height) - var(--topbar-h) - 189px + var(--catalog-deck-growth));}
}
/* Original 740px / 925px window thresholds, before adding caption space.
   Narrow desktop canvases remain scaled from 1920x960 and keep three rows. */
@media(hover:hover) and (pointer:fine) and (min-width:1920px) and (min-height:1147px){
 html.catalog-prototype {--catalog-desktop-rows:4;}
}
@media(hover:hover) and (pointer:fine) and (min-width:1920px) and (min-height:1332px){
 html.catalog-prototype {--catalog-desktop-rows:5;}
}
/* Width-only canvas scaling also works before scripts (and without JS).
   The boot script retains --desktop-scale for pointer/preview coordinates. */
@media(hover:hover) and (pointer:fine) and (max-width:1919px){
 html.catalog-prototype {--catalog-scene-height:960px;}
 .catalog-prototype body {width:1920px;min-width:1920px;zoom:calc(100vw / 1920px);}
 .catalog-prototype .hero,.catalog-prototype .topbar,.catalog-prototype .deck {width:1920px;min-width:1920px;}
 .catalog-prototype .hero {height:960px;}
 .catalog-prototype .search-wrap {width:1480px;}
}
/* Exhaustive counterpart of desktop, including pen/hybrid pointers. */
@media not all and (hover: hover) and (pointer: fine){
 html.catalog-prototype {--topbar-h:84px;}
 .catalog-prototype .topbar {padding-top:30px;}
 .catalog-prototype .topbar .home-title {top:6px;left:12px;right:12px;max-width:none;transform:none;text-align:center;white-space:nowrap;font-size:11px;line-height:20px;}
 .catalog-prototype body {min-height:200vh;}
 .catalog-prototype .hero {height:auto;min-height:100vh;padding-bottom:20px;}
 .catalog-prototype .logo {position:relative;top:-5px;}
 .catalog-prototype .logo .logo-mark {width:42.9px;height:42.9px;}
 .catalog-prototype .logo-1,.catalog-prototype .logo-2 {font-size:31.9px;}
 .catalog-prototype .about-service-link {bottom:auto;}
 .catalog-prototype .tools-row {position:relative;top:auto;left:auto;right:auto;}
 .catalog-prototype .adv-panel > .sort-row {margin-top:0;}
 .catalog-prototype .hero.msearch-open .search-wrap > .sort-row {display:grid;position:relative;top:auto;}
 .catalog-breadcrumbs {position:relative;left:auto;top:auto;flex-wrap:wrap;margin:10px 16px;font-size:11px;}
 .catalog-prototype .vehicle-search-mode {position:relative;display:flex;left:auto;right:auto;top:auto;justify-content:flex-start;margin:0 16px 8px;}
 .catalog-rail {position:relative;top:auto!important;left:auto;width:auto;height:360px!important;margin:20px 16px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:12px;}
 .catalog-panel li a {padding-top:3px;padding-bottom:3px;}
 .catalog-prototype .cards-wrap.scroll .cards-scroll {overflow:visible;}
 .catalog-prototype .cards-scroll {container-type:inline-size;}
 .catalog-prototype .cards-grid {--catalog-card-height:calc(50cqw + 56px);grid-template-columns:repeat(2,minmax(0,1fr));}
 .catalog-chunk {grid-template-columns:repeat(2,minmax(0,1fr));}
 .catalog-prototype .catalog-garage {height:100vh;min-height:100vh;}
}
