/* ============================================================
   Carro Gambatto — Design System CSS
   Tokens, reset, utilitários globais e componentes base
   ============================================================ */

/* ── 1. Tokens ─────────────────────────────────────────────── */
:root {
  /* Marca */
  --color-brand:       #CC0000;
  --color-brand-dark:  #A30000;
  --color-brand-light: #E60012;
  --color-black:       #111111;
  --color-white:       #FFFFFF;

  /* Neutros */
  --gray-900: #1A1A1A;
  --gray-800: #2E2E2E;
  --gray-700: #4A4A4A;
  --gray-600: #6B6B6B;
  --gray-500: #8C8C8C;
  --gray-400: #B5B5B5;
  --gray-300: #D6D6D6;
  --gray-200: #E8E8E8;
  --gray-100: #F2F2F2;
  --gray-50:  #F8F8F8;

  /* Semânticas */
  --color-whatsapp:      #25D366;
  --color-whatsapp-dark: #1EBE5A;
  --color-success:       #1B8A3A;
  --color-warning:       #E6A700;
  --color-error:         #D32F2F;
  --color-info:          #0B66C3;

  /* Tipografia */
  --font-display: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --font-body:    "Inter",   "Helvetica Neue", Arial, sans-serif;

  /* Espaçamento */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Container */
  --container-max: 1280px;
  --container-pad: 16px;

  /* Raios */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 999px;

  /* Sombras */
  --shadow-xs:         0 1px 2px rgba(17,17,17,.06);
  --shadow-sm:         0 2px 6px rgba(17,17,17,.08);
  --shadow-md:         0 4px 14px rgba(17,17,17,.10);
  --shadow-lg:         0 8px 28px rgba(17,17,17,.14);
  --shadow-card-hover: 0 10px 30px rgba(204,0,0,.12);
  --shadow-float:      0 6px 20px rgba(37,211,102,.35);

  /* Animação */
  --ease-standard: cubic-bezier(.4,0,.2,1);
  --ease-out:      cubic-bezier(0,0,.2,1);
  --dur-fast:  150ms;
  --dur-base:  250ms;
  --dur-slow:  400ms;

  /* Header heights */
  --topbar-h:  0px;
  --navbar-h:  67px;   /* hbar (64px) + accent line (3px) */
  --header-h:  67px;
}

/* ── 2. Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-700);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* trava vazamentos horizontais pontuais (flex/absolute sem contenção) sem afetar overflow-x:auto interno de carrosséis */
}

img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

button { cursor: pointer; font-family: inherit; border: none; background: none; padding: 0; }

ul, ol { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--gray-900);
  margin: 0;
  line-height: 1.2;
}

p { margin: 0; }

/* ── 3. Container ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

@media (min-width: 768px)  { .container { --container-pad: 24px; } }
@media (min-width: 1024px) { .container { --container-pad: 40px; } }

/* ── 4. Tipografia ──────────────────────────────────────────── */
.text-display { font-family: var(--font-display); font-size: 56px; font-weight: 700; line-height: 1.1; }
.text-h1      { font-family: var(--font-display); font-size: 40px; font-weight: 700; }
.text-h2      { font-family: var(--font-display); font-size: 32px; font-weight: 600; }
.text-h3      { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.text-h4      { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.text-lg      { font-size: 18px; }
.text-base    { font-size: 16px; }
.text-sm      { font-size: 14px; }
.text-xs      { font-size: 12px; font-weight: 500; }
.text-price   { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--color-brand); }

@media (max-width: 767px) {
  .text-display { font-size: 36px; }
  .text-h1      { font-size: 28px; }
  .text-h2      { font-size: 24px; }
  .text-h3      { font-size: 20px; }
  .text-price   { font-size: 22px; }
}

.section-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: var(--space-8);
}
.section-title .accent { color: var(--color-brand); }

@media (max-width: 767px) { .section-title { font-size: 22px; } }

/* ── 5. Botões ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-6);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  border: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

.btn-sm  { height: 36px; padding: 0 var(--space-4); font-size: 13px; }
.btn-lg  { height: 52px; padding: 0 var(--space-8); font-size: 17px; }
.btn-rect { border-radius: var(--radius-md); }

/* Primário */
.btn-primary {
  background: var(--color-brand);
  color: var(--color-white);
}
.btn-primary:hover { background: var(--color-brand-dark); box-shadow: var(--shadow-sm); }

/* Secundário (preto) */
.btn-secondary {
  background: var(--color-black);
  color: var(--color-white);
  border-radius: var(--radius-md);
}
.btn-secondary:hover { background: var(--gray-800); box-shadow: var(--shadow-sm); }

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--color-brand);
  border: 1.5px solid var(--color-brand);
}
.btn-outline:hover { background: var(--color-brand); color: var(--color-white); }

/* WhatsApp */
.btn-whatsapp {
  background: var(--color-whatsapp);
  color: var(--color-white);
}
.btn-whatsapp:hover { background: var(--color-whatsapp-dark); }

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--gray-700);
  border-radius: var(--radius-md);
}
.btn-ghost:hover { background: var(--gray-100); }

/* Full width */
.btn-full { width: 100%; }

/* ── 6. Cards ───────────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease-standard),
              box-shadow var(--dur-base) var(--ease-standard);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

/* ── 7. Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.badge-brand   { background: var(--color-brand);   color: white; }
.badge-dark    { background: var(--color-black);   color: white; }
.badge-success { background: var(--color-success); color: white; }
.badge-gray    { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }

/* ── 8. Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: .005em;
}

.form-control {
  height: 46px;
  padding: 0 var(--space-4);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--gray-800);
  background: var(--color-white);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  outline: none;
  width: 100%;
}
.form-control:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(204,0,0,.12);
}
.form-control::placeholder { color: var(--gray-500); }

textarea.form-control {
  height: auto;
  min-height: 120px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-error { font-size: 12px; color: var(--color-error); }
.form-control.is-error { border-color: var(--color-error); }

/* ── 9. Seção padrão ────────────────────────────────────────── */
.section {
  padding-block: var(--space-20);
}
.section-alt { background: var(--gray-50); }

@media (max-width: 767px) { .section { padding-block: var(--space-12); } }

/* ── 10. Carrossel (scroll-snap) ────────────────────────────── */
.scroll-track {
  display: flex;
  gap: var(--space-5);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
  padding-bottom: var(--space-4);
  -webkit-overflow-scrolling: touch;
}
.scroll-track::-webkit-scrollbar { height: 6px; }
.scroll-track::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; }
.scroll-track > * { scroll-snap-align: start; flex-shrink: 0; }

/* ── 11. Utilitários ────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.text-brand  { color: var(--color-brand); }
.text-muted  { color: var(--gray-600); }
.text-center { text-align: center; }
.text-upper  { text-transform: uppercase; letter-spacing: 0.05em; }

.mt-auto { margin-top: auto; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Overlay de modal/drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow);
}
.overlay.is-open { opacity: 1; pointer-events: all; }

/* ── 12. Mobile sticky CTA ──────────────────────────────────── */
.mobile-cta-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 800;
  background: var(--color-white);
  border-top: 1px solid var(--gray-200);
  padding: var(--space-3) var(--space-4);
  gap: var(--space-3);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
@media (max-width: 767px) {
  .mobile-cta-bar { display: flex; align-items: center; }
}

/* ── 13. Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--gray-600);
  padding-block: var(--space-4);
}
.breadcrumb a:hover { color: var(--color-brand); }
.breadcrumb-sep { color: var(--gray-400); }
.breadcrumb-current { color: var(--gray-800); font-weight: 500; }

/* ── 14. Focus global ───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* ── 15. Turbo Drive — barra de progresso + fade sutil ────────
   A progress bar do Turbo injeta seu próprio <style> no topo do <head>
   (document.head.insertBefore(..., head.firstChild)) — qualquer regra
   que apareça depois dela no documento, como esta, já sobrescreve por
   cascata normal. z-index nativo do Turbo já é o máximo possível. */
.turbo-progress-bar {
  height: 2px; /* padrão do Turbo é 3px — mais fina/discreta */
  background-color: var(--color-brand, #CC0000);
}

/* Fade sutil entre páginas (ver public/js/turbo-app.js). */
body {
  transition: opacity .18s ease-out;
}
body.turbo-fade-target {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  body {
    transition: none;
  }
}

/* ── BLOG — cards de listagem (reutilizado em index/categoria/tag/autor) ── */
.blog-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-6)}
@media(max-width:900px){.blog-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:560px){.blog-grid{grid-template-columns:1fr}}
.blog-card{display:flex;flex-direction:column;overflow:hidden}
.blog-card__media{display:block;overflow:hidden;aspect-ratio:16/9;background:var(--color-surface-2)}
.blog-card__media img{width:100%;height:100%;object-fit:cover;transition:transform .35s ease}
.blog-card:hover .blog-card__media img{transform:scale(1.04)}
.blog-card__ph{width:100%;height:100%;min-height:180px;display:flex;align-items:center;justify-content:center;color:var(--color-text-muted)}
.blog-card__ph svg{width:48px;height:48px;stroke-width:1}
.blog-card__body{padding:var(--space-5);display:flex;flex-direction:column;flex:1}
.blog-card__cat{align-self:flex-start;margin-bottom:var(--space-2);font-size:.75rem;text-decoration:none}
.blog-card__title{font-size:1.05rem;font-weight:700;line-height:1.4;margin-bottom:var(--space-2)}
.blog-card__title a{color:var(--color-text-primary);text-decoration:none}
.blog-card__title a:hover{color:var(--color-brand)}
.blog-card__excerpt{color:var(--color-text-secondary);font-size:.9rem;line-height:1.6;margin-bottom:var(--space-3);flex:1}
.blog-card__meta{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);margin-top:auto;padding-top:var(--space-3);border-top:1px solid var(--color-border);font-size:.8rem;color:var(--color-text-muted)}
.blog-card__author{display:flex;align-items:center;gap:6px;min-width:0}
.blog-card__author img,.blog-card__author-ph{width:24px;height:24px;border-radius:50%;object-fit:cover;flex-shrink:0}
.blog-card__author-ph{background:var(--color-brand);color:#fff;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700}
.blog-card__author > span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.blog-card__meta time{flex-shrink:0}
.hover-brand:hover{color:var(--color-brand) !important}
