/* =========================================================
   MiniGarage — Design Tokens
   Concept: garaje clásico + vitrina de coleccionista.
   Navy/teal profundo (confianza, taller) + terracota/óxido cálido
   (herencia, artesanía, calor humano). Serif editorial (Boska) para
   titulares con carácter de placa/manual antiguo + sans limpia
   (General Sans) para lectura cómoda.
   ========================================================= */

:root,
[data-theme='light'] {
  /* Surfaces — crema cálido, como papel de manual de taller */
  --color-bg: #f6f1e7;
  --color-surface: #fbf8f1;
  --color-surface-2: #ffffff;
  --color-surface-offset: #efe7d6;
  --color-surface-offset-2: #e6dcc6;
  --color-surface-dynamic: #dfd4b9;
  --color-divider: #e0d5bd;
  --color-border: #d3c5a4;

  /* Text — carbón azulado, no negro puro */
  --color-text: #16241f;
  --color-text-muted: #5b6a60;
  --color-text-faint: #9aa79c;
  --color-text-inverse: #f6f1e7;

  /* Primary Accent — Navy/Teal profundo (marca, CTA secundario, estructura) */
  --color-primary: #11302c;
  --color-primary-hover: #0a201d;
  --color-primary-active: #061412;
  --color-primary-highlight: #d7e2de;

  /* Warm Accent — Terracota/óxido (CTA principal, calidez, coleccionismo) */
  --color-warning: #c9703f;
  --color-warning-hover: #b25c2d;
  --color-warning-active: #94491f;
  --color-warning-highlight: #ecd6c4;

  --color-error: #a13d3d;
  --color-error-hover: #7d2e2e;
  --color-error-active: #591f1f;
  --color-error-highlight: #e3cfcb;

  --color-notification: #a13d3d;
  --color-notification-hover: #7d2e2e;
  --color-notification-active: #591f1f;
  --color-notification-highlight: #e3cfcb;

  --color-orange: #c9703f;
  --color-orange-hover: #b25c2d;
  --color-orange-active: #94491f;
  --color-orange-highlight: #ecd6c4;

  --color-gold: #b5872c;
  --color-gold-hover: #93701f;
  --color-gold-active: #6f5716;
  --color-gold-highlight: #e6d9b8;

  --color-success: #4d7a3f;
  --color-success-hover: #396029;
  --color-success-active: #29451c;
  --color-success-highlight: #d3ddc9;

  --color-blue: #2c5f6f;
  --color-blue-hover: #1f4854;
  --color-blue-active: #16333c;
  --color-blue-highlight: #c9dce0;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 150 / 0.08);
  --shadow-md: 0 4px 14px oklch(0.2 0.02 150 / 0.12);
  --shadow-lg: 0 16px 40px oklch(0.15 0.02 150 / 0.18);

  --content-narrow: 640px;
  --content-default: 980px;
  --content-wide: 1220px;
  --content-full: 100%;

  --font-display: 'Boska', 'Georgia', serif;
  --font-body: 'General Sans', 'Helvetica Neue', sans-serif;

  /* Brand-fill navy — constant deep garage-navy used for dark hero cards,
     the feature card and the final CTA. Stays the same across light/dark
     mode so the brand ink doesn't invert to a bright teal in dark mode. */
  --color-ink: #11302c;
  --color-ink-2: #0a201d;
  --color-on-ink: #f6f1e7;
}

/* DARK MODE — taller nocturno: navy profundo con la misma calidez terracota */
[data-theme='dark'] {
  --color-bg: #0e1a17;
  --color-surface: #13221d;
  --color-surface-2: #172822;
  --color-surface-offset: #1a2b25;
  --color-surface-offset-2: #20342c;
  --color-surface-dynamic: #294238;
  --color-divider: #24382f;
  --color-border: #35493e;

  --color-text: #ece5d4;
  --color-text-muted: #a3b0a5;
  --color-text-faint: #6c7d70;
  --color-text-inverse: #16241f;

  --color-primary: #7fb3a6;
  --color-primary-hover: #9bc7bc;
  --color-primary-active: #5c9b8c;
  --color-primary-highlight: #24403a;

  --color-warning: #e08a53;
  --color-warning-hover: #eba071;
  --color-warning-active: #f3b78f;
  --color-warning-highlight: #3d2c1f;

  --color-error: #c9736c;
  --color-error-hover: #d68f89;
  --color-error-active: #e3aba6;
  --color-error-highlight: #3a2422;

  --color-notification: #c9736c;
  --color-notification-hover: #d68f89;
  --color-notification-active: #e3aba6;
  --color-notification-highlight: #3a2422;

  --color-orange: #e08a53;
  --color-orange-hover: #eba071;
  --color-orange-active: #f3b78f;
  --color-orange-highlight: #3d2c1f;

  --color-gold: #d3ab5c;
  --color-gold-hover: #ddbc7c;
  --color-gold-active: #e7cd9c;
  --color-gold-highlight: #3a2f1a;

  --color-success: #8bb579;
  --color-success-hover: #a4c790;
  --color-success-active: #bdd8ac;
  --color-success-highlight: #26331f;

  --color-blue: #6ea3b3;
  --color-blue-hover: #8fb9c6;
  --color-blue-active: #b0d0d9;
  --color-blue-highlight: #1f3338;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 20px 48px oklch(0 0 0 / 0.5);
}

/* =========================================================
   Type Scale
   ========================================================= */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 4.5rem);
  --text-hero: clamp(2.75rem, 0.8rem + 6vw, 6rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
}

/* =========================================================
   Layout primitives
   ========================================================= */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-ink);
  color: var(--color-on-ink);
  padding: var(--space-3) var(--space-4);
  z-index: 100;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-warning);
}
.eyebrow--inverse {
  color: var(--color-warning);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-3);
  letter-spacing: -0.01em;
}

.section-lede {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-top: var(--space-4);
  max-width: 56ch;
}

.section-head {
  margin-bottom: var(--space-12);
}

.section {
  padding-block: clamp(var(--space-16), 9vw, var(--space-24));
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: var(--space-8);
}
.site-nav a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
}
.site-nav a:hover {
  color: var(--color-primary);
}
[data-theme='dark'] .site-nav a:hover {
  color: var(--color-primary);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
}
.theme-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

@media (max-width: 720px) {
  .site-nav {
    display: none;
  }
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(var(--space-16), 12vw, var(--space-32));
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 50% at 85% 0%, oklch(from var(--color-warning) l c h / 0.14), transparent 70%),
    radial-gradient(ellipse 50% 60% at 10% 100%, oklch(from var(--color-primary) l c h / 0.1), transparent 70%);
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    115deg,
    oklch(from var(--color-text) l c h / 0.025) 0px,
    oklch(from var(--color-text) l c h / 0.025) 1px,
    transparent 1px,
    transparent 64px
  );
}

.hero-inner {
  max-width: 760px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-top: var(--space-5);
  color: var(--color-text);
}
.hero-title em {
  font-style: italic;
  color: var(--color-warning);
}

.hero-lede {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-top: var(--space-6);
  max-width: 52ch;
}

/* Signup form */
.signup-form {
  margin-top: var(--space-10);
  max-width: 480px;
}
.signup-row {
  display: flex;
  gap: var(--space-3);
}
.signup-row input {
  flex: 1;
  min-width: 0;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  font-size: var(--text-base);
  color: var(--color-text);
}
.signup-row input::placeholder {
  color: var(--color-text-faint);
}
.signup-row input:focus-visible {
  border-color: var(--color-primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: center;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  min-height: 44px;
}
.btn-primary {
  background: var(--color-warning);
  color: #fff9f2;
}
.btn-primary:hover {
  background: var(--color-warning-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active {
  background: var(--color-warning-active);
  transform: translateY(0);
}
.btn-accent {
  background: var(--color-warning);
  color: #fff9f2;
}
.btn-accent:hover {
  background: var(--color-warning-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-accent:active {
  transform: translateY(0);
}

.signup-note {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.signup-note--inverse {
  color: oklch(from var(--color-text-inverse) l c h / 0.65);
}
.signup-note.is-success {
  color: var(--color-success);
  font-weight: 600;
}
[data-theme='dark'] .signup-note.is-success {
  color: var(--color-success);
}

.hero-stats {
  display: flex;
  gap: var(--space-10);
  margin-top: var(--space-16);
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-inline-start: var(--space-4);
  border-inline-start: 2px solid oklch(from var(--color-warning) l c h / 0.4);
}
.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}
.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .signup-row {
    flex-direction: column;
  }
  .hero-stats {
    gap: var(--space-6);
  }
}

/* =========================================================
   Por qué MiniGarage
   ========================================================= */
.why {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto;
  gap: var(--space-6);
}
.why-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}
.why-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-top: var(--space-3);
}
.why-card p {
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}
.why-index {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--color-warning);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Feature card overrides — must come after .why-card to win the cascade */
.why-card.why-card--feature {
  grid-column: span 2;
  grid-row: span 1;
  background: var(--color-ink);
  border-color: transparent;
  color: var(--color-on-ink);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
}
.why-card.why-card--feature h3 {
  color: var(--color-on-ink);
}
.why-card.why-card--feature p {
  color: oklch(from var(--color-on-ink) l c h / 0.78);
  font-size: var(--text-base);
}
.why-card.why-card--feature .why-index {
  color: var(--color-warning);
}

@media (max-width: 900px) {
  .why-grid {
    grid-template-columns: 1fr;
  }
  .why-card--feature {
    grid-column: span 1;
  }
}

/* =========================================================
   Categorías
   ========================================================= */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

.cat-card {
  position: relative;
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-lg);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  color: var(--color-on-ink);
  overflow: hidden;
}
.cat-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-top: var(--space-10);
}
.cat-card p {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: oklch(from var(--color-on-ink) l c h / 0.8);
}
.cat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cat-scale {
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: oklch(from var(--color-on-ink) l c h / 0.7);
  font-weight: 600;
}
.cat-number {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: oklch(from var(--color-on-ink) l c h / 0.35);
  font-weight: 600;
}

.cat-card--clasicos {
  background: linear-gradient(160deg, #2c4b44, #11302c);
}
.cat-card--deportivos {
  background: linear-gradient(160deg, #c9703f, #94491f);
}
.cat-card--rally {
  background: linear-gradient(160deg, #16241f, #0a1512);
}
.cat-card--proximamente {
  background: repeating-linear-gradient(
      135deg,
      oklch(from var(--color-on-ink) l c h / 0.05) 0px,
      oklch(from var(--color-on-ink) l c h / 0.05) 2px,
      transparent 2px,
      transparent 14px
    ),
    linear-gradient(160deg, #5b6a60, #2f3a35);
}

@media (max-width: 1000px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .cat-grid {
    grid-template-columns: 1fr;
  }
  .cat-card {
    min-height: 200px;
  }
}

/* =========================================================
   Cómo funciona
   ========================================================= */
.how {
  background: var(--color-surface-offset);
}
.how-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: var(--space-16);
  align-items: start;
}
.how-intro {
  position: sticky;
  top: calc(var(--space-16) + 60px);
}

.how-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}
.how-step {
  display: flex;
  gap: var(--space-6);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-divider);
}
.how-step:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.how-step-num {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-warning);
  font-weight: 600;
  flex-shrink: 0;
  width: 2.5ch;
}
.how-step h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}
.how-step p {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

@media (max-width: 900px) {
  .how-grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }
  .how-intro {
    position: static;
  }
}

/* =========================================================
   CTA final
   ========================================================= */
.signup-final {
  background: var(--color-ink);
  color: var(--color-on-ink);
  position: relative;
  overflow: hidden;
}
.signup-final::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, oklch(from var(--color-warning) l c h / 0.22), transparent 70%);
  pointer-events: none;
}
.signup-final-inner {
  position: relative;
  max-width: 640px;
  text-align: left;
}
.signup-final-title {
  color: var(--color-on-ink);
}
.signup-final-lede {
  color: oklch(from var(--color-on-ink) l c h / 0.72);
}

.signup-form--dark input {
  background: oklch(from var(--color-on-ink) l c h / 0.08);
  border-color: oklch(from var(--color-on-ink) l c h / 0.22);
  color: var(--color-on-ink);
}
.signup-form--dark input::placeholder {
  color: oklch(from var(--color-on-ink) l c h / 0.45);
}

.social-row {
  margin-top: var(--space-16);
  padding-top: var(--space-8);
  border-top: 1px solid oklch(from var(--color-on-ink) l c h / 0.15);
}
.social-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: oklch(from var(--color-on-ink) l c h / 0.55);
  font-weight: 600;
}
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-4);
}
.social-links a {
  font-size: var(--text-sm);
  color: var(--color-on-ink);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid oklch(from var(--color-on-ink) l c h / 0.3);
  padding-bottom: 2px;
}
.social-links a:hover {
  border-color: var(--color-warning);
  color: var(--color-warning);
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  padding-block: var(--space-8);
  border-top: 1px solid var(--color-divider);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
}
.footer-brand .brand-mark {
  width: 26px;
  height: 26px;
}
.footer-copy {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* =========================================================
   Scroll reveals (opacity only — no CLS)
   IntersectionObserver-driven for cross-browser reliability.
   ========================================================= */
.reveal {
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
  }
}

/* =========================================================
   Responsive base adjustments
   ========================================================= */
@media (max-width: 640px) {
  .section {
    padding-block: var(--space-12);
  }
  .section-head {
    margin-bottom: var(--space-8);
  }
}
