/* Carrada.pt — folha de estilos única, mobile-first, sem web fonts (melhor LCP/CLS) */
:root {
  --navy: #0f2a4a;
  --navy-2: #173a63;
  --orange: #e8590c;
  --orange-d: #c2410c;
  --ink: #1d2433;
  --muted: #5b6475;
  --line: #e3e7ee;
  --bg: #f5f7fa;
  --white: #fff;
  --ok: #157347;
  --err: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy-2); }
a:hover { color: var(--orange-d); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.wrap { width: 100%; max-width: 1680px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 48px); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--white); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Botões */
.btn { display: inline-block; border: 0; border-radius: 8px; background: var(--orange); color: var(--white); font: 600 1rem/1.2 var(--font); padding: 12px 18px; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--orange-d); color: var(--white); }
.btn-ghost { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 2px var(--navy); }
.btn-ghost:hover { background: var(--navy); color: var(--white); }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* Cabeçalho */
.site-header { background: var(--navy); color: var(--white); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.logo img { width: 148px; height: 32px; }
.nav-toggle { background: none; border: 0; padding: 12px; cursor: pointer; }
.burger, .burger::before, .burger::after { display: block; width: 24px; height: 2px; background: var(--white); position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; }
.burger::before { top: -7px; }
.burger::after { top: 7px; }
.nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--navy); padding: 8px 16px 16px; }
.nav.open { display: block; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a { display: block; color: var(--white); text-decoration: none; padding: 10px 0; font-weight: 500; }
.nav a:hover { color: #ffd2b8; }
@media (min-width: 960px) {
  .nav-toggle { display: none; }
  .nav { display: block; position: static; padding: 0; background: none; }
  .nav ul { display: flex; gap: 22px; }
}

/* Breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 0 0; margin: 0; font-size: .85rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.crumbs a { color: var(--muted); }

/* Hero / homepage */
.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: var(--white); padding: 28px 0 24px; }
.hero h1 { font-size: 1.75rem; }
.hero-sub { margin: 0 0 18px; color: #d7e2f0; }
.hero-sub strong { color: var(--white); }
.type-tabs { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; }
.type-tabs a { display: inline-block; color: var(--white); text-decoration: none; background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 6px 14px; font-size: .9rem; }
.type-tabs span { opacity: .75; }
.home-section { margin: clamp(32px, 4vw, 56px) 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.home-about { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
@media (min-width: 760px) { .hero { padding: 48px 0 40px; } .hero h1 { font-size: 2.3rem; } }

/* Filtros */
.filters { display: grid; grid-template-columns: 1fr; gap: 10px; }
.filters-compact { background: var(--white); color: var(--ink); padding: 14px; border-radius: var(--radius); grid-template-columns: 1fr 1fr; }
.filters-compact .field-submit { grid-column: 1 / -1; }
@media (min-width: 760px) { .filters-compact { grid-template-columns: repeat(4, 1fr) auto; align-items: end; } .filters-compact .field-submit { grid-column: auto; } }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.field select, .field input, .field textarea { width: 100%; font: inherit; color: var(--ink); background: var(--white); border: 1px solid #cfd6e0; border-radius: 8px; padding: 10px; min-height: 44px; }
.field textarea { resize: vertical; }
.field-submit .btn { margin-top: 0; }

/* Listagens */
.listing-head { padding: 24px 0 16px; }
.listing-count { color: var(--muted); margin: 0 0 8px; }
.listing-intro { max-width: 1040px; color: #3b4456; }
.listing-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(20px, 2.5vw, 40px); }
.filters-toggle { background: var(--white); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.filters-toggle summary { font-weight: 600; cursor: pointer; }
.filters-toggle[open] summary { margin-bottom: 12px; }
@media (min-width: 1024px) {
  .listing-layout { grid-template-columns: 300px 1fr; align-items: start; }
  .listing-filters { position: sticky; top: 76px; }
  .filters-toggle summary { pointer-events: none; list-style: none; }
}
.grid { display: grid; grid-template-columns: 1fr; gap: clamp(16px, 1.8vw, 28px); }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1500px) { .grid { grid-template-columns: repeat(4, 1fr); } .grid-4 { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 760px) and (max-width: 1199px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .15s; }
.card:hover { box-shadow: 0 6px 18px rgba(16, 24, 40, .12); }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card-media { aspect-ratio: 4 / 3; background: #e9edf3; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px 18px 18px; }
.card-title { font-size: 1rem; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card-specs { font-size: .85rem; color: var(--muted); margin: 0 0 8px; }
.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0; }
.price { color: var(--orange-d); font-size: 1.2rem; }
.card-loc { font-size: .8rem; color: var(--muted); }
.empty { background: var(--white); border-radius: var(--radius); padding: 24px; text-align: center; }

/* Paginação */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 28px 0; }
.pagination ol { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0; }
.pagination a, .pagination span { display: inline-block; min-width: 44px; min-height: 44px; line-height: 44px; text-align: center; border-radius: 8px; background: var(--white); text-decoration: none; padding: 0 12px; box-shadow: var(--shadow); }
.pagination [aria-current] { background: var(--navy); color: var(--white); }
.pagination .gap { line-height: 44px; }

/* Links internos */
.link-blocks { margin: clamp(40px, 4vw, 64px) 0; display: grid; gap: 32px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.chips a { display: inline-block; background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; text-decoration: none; font-size: .9rem; }
.chips a:hover { border-color: var(--orange); }
.chips span { color: var(--muted); font-size: .8rem; }
.chips-lg a { padding: 8px 14px; }
.hub-group { margin: 20px 0; }

/* Ficha de viatura */
.vehicle-head { padding: 14px 0 10px; }
.vehicle-sub { color: var(--muted); margin: 0; }
.vehicle-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(20px, 2.5vw, 40px); }
/* os filhos de grelhas nunca podem alargar a coluna (ex.: faixa de miniaturas em mobile) */
.vehicle-main, .vehicle-side, .listing-results, .listing-filters { min-width: 0; }
@media (min-width: 1024px) {
  .vehicle-layout { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .vehicle-side { position: sticky; top: 76px; }
}
.gallery-main { margin: 0; position: relative; background: #111827; border-radius: var(--radius); overflow: hidden; height: clamp(240px, 56vw, 520px); }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.gallery-open { position: absolute; left: 10px; bottom: 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink); font: 600 .85rem/1 var(--font); padding: 8px 14px; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.gallery-open:hover { background: var(--white); color: var(--orange-d); }
@media (min-width: 1024px) { .gallery-main { height: clamp(320px, 34vw, 520px); } }
.gallery-main figcaption { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .6); color: var(--white); font-size: .8rem; border-radius: 999px; padding: 2px 10px; }
.gallery-thumbs { list-style: none; display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; margin: 0; scroll-snap-type: x mandatory; }
.gallery-thumbs li { flex: 0 0 96px; scroll-snap-align: start; }
.gallery-thumbs a { display: block; border-radius: 6px; overflow: hidden; outline-offset: -2px; }
.gallery-thumbs a[aria-current="true"] { outline: 3px solid var(--orange); }
.gallery-thumbs img { width: 96px; height: 72px; object-fit: cover; }
.vehicle-section { background: var(--white); border-radius: var(--radius); padding: clamp(18px, 2vw, 28px); margin-top: 24px; box-shadow: var(--shadow); }
.specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 20px; margin: 0; }
@media (min-width: 760px) { .specs { grid-template-columns: repeat(3, 1fr); } }
.specs dt { font-size: .8rem; color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; }
.description { white-space: normal; overflow-wrap: anywhere; }
.equipment { columns: 2 220px; padding-left: 18px; margin: 0 0 12px; }
.price-box, .lead-box { background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.lead-box { margin-top: 16px; scroll-margin-top: 80px; }
.price-big { font-size: 2rem; font-weight: 700; color: var(--orange-d); margin: 0 0 8px; }
.seller { margin: 0 0 6px; color: var(--muted); }
.seller strong { color: var(--ink); }
.seller span { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.lead-form .field { margin-bottom: 10px; }
.check { display: flex; gap: 8px; font-size: .85rem; color: var(--muted); align-items: flex-start; }
.check input { margin-top: 4px; }
.hp { position: absolute; left: -9999px; }
.notice { padding: 10px 12px; border-radius: 8px; }
.notice-ok { background: #e7f6ee; color: var(--ok); }
.notice-error { background: #fdecea; color: var(--err); }
.form-msg { min-height: 1.2em; margin: 8px 0 0; font-weight: 600; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }
.related { margin: 32px 0; }
.badge { display: inline-block; background: var(--navy); color: var(--white); border-radius: 999px; font-size: .8rem; padding: 2px 12px; margin: 0 0 8px; }
.unavailable .btn { margin: 4px 6px 4px 0; }

/* Páginas de texto */
.prose { max-width: 820px; background: var(--white); border-radius: var(--radius); padding: 24px; margin-top: 16px; margin-bottom: 32px; box-shadow: var(--shadow); }

/* Rodapé */
.site-footer { background: var(--navy); color: #c9d6e6; margin-top: 48px; padding: 32px 0 16px; font-size: .92rem; }
.site-footer h2 { color: var(--white); font-size: 1rem; }
.site-footer a, .site-footer .linklike { color: #c9d6e6; }
.site-footer a:hover { color: var(--white); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 6px 0; }
.footer-grid { display: grid; gap: 32px; }
.footer-tagline { color: #ffb48a; font-weight: 700; font-size: 1.1rem; margin: 12px 0 4px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1.2fr 1fr; } }
.footer-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 24px; padding-top: 12px; font-size: .8rem; }

/* Barra de cookies */
.cookie-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; background: var(--white); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(16, 24, 40, .25); padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; max-width: 760px; margin: 0 auto; }
.cookie-bar[hidden] { display: none; }
.cookie-bar p { margin: 0; font-size: .9rem; flex: 1 1 320px; }
.cookie-actions { display: flex; gap: 8px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Marcas e modelos mais procurados (homepage) */
.model-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 28px 32px; margin-top: 8px; }
.model-group h3 { font-size: .98rem; margin: 0 0 8px; }
.model-group h3 a { color: var(--orange-d); text-decoration: none; }
.model-group h3 a:hover { text-decoration: underline; }
.model-group ul { list-style: none; margin: 0; padding: 0; }
.model-group li { margin: 0 0 6px; font-size: .92rem; }
.model-group li a { color: #3b4456; }
.model-group li a:hover { color: var(--orange-d); }

/* Resumo e ligações da ficha */
.vehicle-summary { margin: 0 0 18px; color: #3b4456; }
.specs dd a { color: inherit; text-decoration: underline; text-decoration-color: #c9d1dc; text-underline-offset: 3px; }
.specs dd a:hover { color: var(--orange-d); text-decoration-color: currentColor; }

/* Avaliação de preço */
.card-media { position: relative; }
.price-badge { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: #e7f6ee; color: var(--ok); }
.card-media .price-badge { position: absolute; left: 10px; top: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.price-badge-otimo, .price-rating-otimo .price-badge { background: var(--ok); color: var(--white); }
.price-rating { margin: 4px 0 12px; }
.price-rating p { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.price-rating-justo .price-badge { background: #eef1f6; color: var(--navy-2); }
.price-rating-acima .price-badge { background: #fdf0e7; color: var(--orange-d); }

/* Dados de mercado e FAQ (páginas de marca e modelo) */
.market { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(18px, 2.5vw, 32px); margin: clamp(32px, 4vw, 56px) 0; }
.market-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.market-updated { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.table-wrap { overflow-x: auto; margin: 12px 0 24px; }
.market-table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: .92rem; }
.market-table caption { text-align: left; font-weight: 700; margin-bottom: 8px; }
.market-table th, .market-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.market-table th:first-child { text-align: left; }
.market-table thead th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.market-table tbody tr:hover { background: var(--bg); }
.market-splits { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 40px; margin-bottom: 24px; }
.split h3 { font-size: 1rem; margin-bottom: 8px; }
.bar { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; margin: 6px 0; font-size: .9rem; }
.bar progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.bar progress::-webkit-progress-bar { background: #eef1f6; border-radius: 999px; }
.bar progress::-webkit-progress-value { background: var(--orange); border-radius: 999px; }
.bar progress::-moz-progress-bar { background: var(--orange); border-radius: 999px; }
.bar-value { text-align: right; color: var(--muted); }
.faq { border-top: 1px solid var(--line); padding-top: 20px; }
.faq h3 { font-size: 1.02rem; margin: 18px 0 6px; }
.faq p { margin: 0; color: #3b4456; max-width: 920px; }

/* Slideshow de fotografias (ecrã inteiro) */
html.lb-open { overflow: hidden; }
.lightbox { width: 100vw; height: 100vh; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: rgba(8, 12, 20, .97); color: var(--white); }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lightbox::backdrop { background: rgba(8, 12, 20, .9); }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; }
.lb-count { font-size: .95rem; color: #c9d6e6; }
.lb-close { background: none; border: 0; color: var(--white); font-size: 2.2rem; line-height: 1; width: 48px; height: 48px; cursor: pointer; border-radius: 50%; }
.lb-close:hover { background: rgba(255, 255, 255, .12); }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 8px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: var(--white); font-size: 2.2rem; line-height: 1; cursor: pointer; }
.lb-nav:hover { background: rgba(255, 255, 255, .28); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 14px; }
.lb-thumbs button { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; cursor: pointer; opacity: .6; }
.lb-thumbs button.active { border-color: var(--orange); opacity: 1; }
.lb-thumbs img { display: block; width: 80px; height: 60px; object-fit: cover; border-radius: 4px; }
.lb-single .lb-nav, .lb-single .lb-thumbs { display: none; }
@media (max-width: 759px) { .lb-nav { width: 42px; height: 42px; font-size: 1.8rem; } .lb-thumbs img { width: 64px; height: 48px; } }
