/* ==========================================================================
   MAIN — tokens, reset, base, layout, cabecera, navegación, botones, pie
   Proyecto: Cerrajero en Mérida (cerrajeroenmerida.com.mx)
   Orden de carga: main.css -> components.css -> responsive.css
   ========================================================================== */

/* ------------------------------------------------------------- 1. TOKENS */
:root {
  /* Color */
  --c-ink:      #0f172a;
  --c-ink-2:    #1e293b;
  --c-text:     #334155;
  --c-muted:    #64748b;
  --c-line:     #e2e8f0;
  --c-surface:  #f8fafc;
  --c-surface-2:#f1f5f9;
  --c-white:    #ffffff;

  --c-brand:    #0f172a;
  --c-brand-2:  #1e40af;
  --c-accent:   #f59e0b;   /* ámbar: urgencia / llaves */
  --c-accent-2: #b45309;
  --c-wa:       #25d366;
  --c-wa-dark:  #128c3f;
  --c-ok:       #15803d;
  --c-ok-bg:    #f0fdf4;
  --c-err:      #b91c1c;
  --c-err-bg:   #fef2f2;

  /* Tipografía */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-sm:  0.875rem;
  --fs-md:  1rem;
  --fs-lg:  1.125rem;
  --fs-h3:  1.15rem;
  --fs-h2:  clamp(1.4rem, 3.4vw, 1.9rem);
  --fs-h1:  clamp(1.75rem, 5.4vw, 2.9rem);
  --lh:     1.65;

  /* Espaciado */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* Estructura */
  --wrap: 1120px;
  --gutter: 1rem;
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow:    0 6px 18px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, .12);
  --focus: 3px solid var(--c-accent-2);
  --tap: 48px;               /* altura mínima táctil */
  --sticky-h: 60px;
}

/* -------------------------------------------------------------- 2. RESET */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;   /* cabecera fija */
}

body {
  margin: 0;
  background: var(--c-white);
  color: var(--c-text);
  font: var(--fs-md)/var(--lh) var(--font);
  overflow-x: hidden;
  padding-bottom: calc(var(--sticky-h) + env(safe-area-inset-bottom));
}

h1, h2, h3, h4 { margin: 0 0 var(--sp-3); color: var(--c-ink); line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p  { margin: 0 0 var(--sp-4); }
ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.2rem; }
img, svg { max-width: 100%; height: auto; }
img { display: block; }
a { color: var(--c-brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: var(--focus); outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------------------- 3. BASE */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--c-ink); color: var(--c-white); padding: var(--sp-3) var(--sp-4);
  border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

.ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico--brand { width: 26px; height: 26px; color: var(--c-accent); }

.main { display: block; }

/* ------------------------------------------------------------ 4. SECCIONES */
.section { padding: var(--sp-7) 0; }
.section + .section { border-top: 1px solid var(--c-line); }
.section__title { margin-bottom: var(--sp-3); }
.section__intro { color: var(--c-muted); max-width: 62ch; }
.section__note { margin-top: var(--sp-4); font-size: var(--fs-sm); color: var(--c-muted); }

/* --------------------------------------------------------- 5. CABECERA */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-line);
}
.site-header__bar { display: flex; align-items: center; gap: var(--sp-3); min-height: 58px; }

.brand { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--c-ink); font-weight: 800; }
.brand:hover { text-decoration: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-size: 1rem; }
.brand__tag  { font-size: 0.7rem; font-weight: 600; color: var(--c-muted); text-transform: uppercase; letter-spacing: .06em; }

.site-header__actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }

.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: var(--tap); height: var(--tap); padding: 0 12px;
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-sm);
  cursor: pointer;
}
.nav-toggle__bar { display: block; height: 2px; background: var(--c-ink); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-nav { background: var(--c-white); border-bottom: 1px solid var(--c-line); box-shadow: var(--shadow); }
.site-nav[hidden] { display: none; }
.site-nav .wrap { padding-top: var(--sp-3); padding-bottom: var(--sp-4); }

.nav-heading { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-list a { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--r-sm); color: var(--c-ink-2); font-weight: 600; }
.nav-list a:hover { background: var(--c-surface); text-decoration: none; }
.nav-list a[aria-current="page"] { background: var(--c-surface-2); color: var(--c-ink); }
.nav-list--info { border-top: 1px solid var(--c-line); margin-top: var(--sp-4); padding-top: var(--sp-2); display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.nav-list--info a { min-height: 40px; padding: 0 var(--sp-2); font-weight: 500; color: var(--c-muted); }

/* ------------------------------------------------------------- 6. BOTONES */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0.75rem 1.15rem;
  border: 1px solid transparent; border-radius: var(--r);
  font: inherit; font-weight: 700; text-align: center; cursor: pointer;
  transition: transform .06s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--c-ink); color: var(--c-white); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--c-ink-2); }
.btn--whatsapp { background: var(--c-wa); color: #06301a; }
.btn--whatsapp:hover { background: var(--c-wa-dark); color: var(--c-white); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.cta-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin: var(--sp-4) 0 0; }
.cta-actions--stack { flex-direction: column; align-items: stretch; }

/* ---------------------------------------------------------------- 7. PIE */
.site-footer { background: var(--c-ink); color: #cbd5e1; margin-top: var(--sp-7); }
.site-footer a { color: #e2e8f0; }
.site-footer__grid { display: grid; gap: var(--sp-6); padding: var(--sp-7) 0 var(--sp-5); }
.site-footer__brand { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--c-white); font-weight: 800; margin-bottom: var(--sp-3); }
.site-footer__note { color: #94a3b8; font-size: var(--fs-sm); }
.site-footer__title { color: var(--c-white); font-weight: 700; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--sp-3); }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); font-size: var(--fs-sm); }
.footer-contact a { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.site-footer__legal {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4);
  border-top: 1px solid #1e293b; padding: var(--sp-4) 0; margin: 0;
  font-size: var(--fs-sm); color: #94a3b8;
}
.site-footer .btn--primary { background: var(--c-white); color: var(--c-ink); }
.site-footer .btn--primary:hover { background: #e2e8f0; }
