/* ============================================
   CSS base para web de cerrajería local
   - Mobile first
   - Sin dependencias externas
   - Enfocado a performance y legibilidad
   Personalizar colores en :root al final
   ============================================ */

/* Reset mínimo */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--c-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover, a:focus {
  color: var(--c-link-hover);
}

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}

/* Layout container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Typography */
h1, h2, h3, h4 {
  line-height: 1.2;
  margin: 0 0 0.75em;
  color: var(--c-heading);
}

h1 { font-size: clamp(1.75rem, 2.5vw + 1rem, 2.5rem); }
h2 { font-size: clamp(1.5rem, 2vw + 0.75rem, 2rem); }
h3 { font-size: clamp(1.25rem, 1.5vw + 0.6rem, 1.5rem); }
p  { margin: 0 0 1rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.site-header .logo img {
  width: auto;
  height: 40px;
}

.main-nav {
  display: none;
}

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

.main-nav a {
  text-decoration: none;
  font-weight: 500;
}

@media (min-width: 768px) {
  .main-nav { display: block; }
}

.phone-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--c-primary);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.phone-cta:hover, .phone-cta:focus {
  background: var(--c-primary-dark);
  color: white;
}

/* Hero */
.hero {
  padding: 3rem 0 2.5rem;
  background: var(--c-hero-bg);
}

.hero .lead {
  font-size: 1.15rem;
  max-width: 60ch;
  color: var(--c-text-soft);
}

.hero .container.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 880px) {
  .hero .container.hero-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

.hero-figure {
  margin: 0;
}

.hero-figure img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  display: block;
}

.ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  min-height: 48px; /* touch target */
  font-size: 1rem;
}

.btn-primary {
  background: var(--c-primary);
  color: white;
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--c-primary-dark);
  color: white;
}

.btn-secondary {
  background: var(--c-whatsapp);
  color: white;
}

.btn-secondary:hover, .btn-secondary:focus {
  background: var(--c-whatsapp-dark);
  color: white;
}

.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  font-size: 0.95rem;
  color: var(--c-text-soft);
}

.trust-bar li::before {
  content: "✓ ";
  color: var(--c-primary);
  font-weight: bold;
}

/* Secciones genéricas */
main > section, main > article > section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--c-border);
}

main > section:last-child, main > article > section:last-child {
  border-bottom: none;
}

/* Grid de servicios */
.servicios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.servicio-card {
  padding: 1.5rem;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: white;
  transition: transform .15s ease, box-shadow .15s ease;
}

.servicio-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.servicio-card h3 {
  margin-top: 0;
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--c-border);
  padding: 1rem 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.5rem 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "−";
}

/* Testimonios */
.testimonio {
  padding: 1.5rem;
  background: var(--c-surface);
  border-left: 4px solid var(--c-primary);
  border-radius: 4px;
  margin-bottom: 1rem;
}

.testimonio-autor {
  font-weight: 600;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--c-text-soft);
}

/* Sticky CTA móvil */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  background: white;
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.sticky-cta a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-decoration: none;
  font-weight: 600;
  color: white;
  min-height: 56px;
}

.btn-sticky-phone { background: var(--c-primary); }
.btn-sticky-whatsapp { background: var(--c-whatsapp); }

@media (min-width: 1024px) {
  .sticky-cta { display: none; }
}

/* Espacio inferior en móvil para compensar sticky */
@media (max-width: 1023px) {
  body { padding-bottom: 56px; }
}

/* Footer */
.site-footer {
  background: var(--c-footer-bg);
  color: var(--c-footer-text);
  padding: 3rem 0 1rem;
  margin-top: 3rem;
}

.site-footer .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.site-footer h3 {
  color: white;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin-bottom: 0.5rem;
}

.site-footer a {
  color: var(--c-footer-link);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2rem;
  padding-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--c-footer-text-soft);
}

/* Migas de pan */
nav[aria-label="Migas de pan"] ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  font-size: 0.9rem;
}

nav[aria-label="Migas de pan"] li + li::before {
  content: "›";
  margin-right: 0.5rem;
  color: var(--c-text-soft);
}

/* Utilidades */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link de accesibilidad */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--c-primary);
  color: white;
  padding: 0.5rem 1rem;
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 6px 0;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 0;
  color: white;
}

/* Estilo para meta-note (legales) */
.meta-note {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c-border);
  color: var(--c-text-soft);
  font-size: 0.9rem;
}

/* Reduce motion para usuarios sensibles */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mejora contrastes para enlaces dentro de prose */
.prose a {
  font-weight: 500;
}

/* Tablas semánticas si aparecen */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
}
th, td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--c-surface);
  font-weight: 600;
}

/* ============================================
   Iconos SVG decorativos en encabezados
   ============================================ */
.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--c-icon-bg);
  color: var(--c-primary);
  margin-right: 0.85rem;
  flex-shrink: 0;
  vertical-align: middle;
}
.section-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Variantes de color para iconos por sección */
.section-icon.icon-blue   { background: #e0f2fe; color: #0369a1; }
.section-icon.icon-green  { background: #dcfce7; color: #15803d; }
.section-icon.icon-amber  { background: #fef3c7; color: #b45309; }
.section-icon.icon-purple { background: #ede9fe; color: #6d28d9; }
.section-icon.icon-pink   { background: #fce7f3; color: #be185d; }
.section-icon.icon-teal   { background: #ccfbf1; color: #0f766e; }
.section-icon.icon-red    { background: #fee2e2; color: #b91c1c; }
.section-icon.icon-slate  { background: #e2e8f0; color: #334155; }

/* Iconos en service cards */
.servicio-card .card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--c-icon-bg);
  color: var(--c-primary);
  margin-bottom: 0.75rem;
}
.servicio-card .card-icon svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Imágenes intercaladas en mitad de página */
.inline-figure {
  margin: 2rem 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,0.10);
}
.inline-figure img {
  width: 100%;
  height: auto;
  display: block;
}
.inline-figure figcaption {
  padding: 0.75rem 1rem;
  background: var(--c-surface);
  font-size: 0.9rem;
  color: var(--c-text-soft);
}

/* Acentos de color por sección — fondos sutiles alternos */
section#urgencias       { background: #fff5f5; }
section#tipos-cerraduras { background: var(--c-surface); }
section#niveles-seguridad { background: #f0f9ff; }
section#por-que         { background: var(--c-surface); }
section#consejos        { background: #fffbeb; }
section#zonas           { background: #f0fdf4; }

section#urgencias > .container,
section#tipos-cerraduras > .container,
section#niveles-seguridad > .container,
section#por-que > .container,
section#consejos > .container,
section#zonas > .container {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

/* ============================================
   Variables de color — personalizar según marca
   ============================================ */
:root {
  --c-primary: #c92a2a;
  --c-primary-dark: #9e1f1f;
  --c-whatsapp: #25d366;
  --c-whatsapp-dark: #1da851;
  --c-text: #1a1a1a;
  --c-text-soft: #555;
  --c-heading: #0f172a;
  --c-link: #1d4ed8;
  --c-link-hover: #1e40af;
  --c-focus: #2563eb;
  --c-bg: #ffffff;
  --c-surface: #f8fafc;
  --c-border: #e2e8f0;
  --c-hero-bg: #fafafa;
  --c-footer-bg: #0f172a;
  --c-footer-text: #cbd5e1;
  --c-footer-text-soft: #94a3b8;
  --c-footer-link: #e2e8f0;
  --c-icon-bg: #fde2e2;
}
