/* ===========================================================================
   style.css — Hoja de estilos única del proyecto
   PLANTILLA. Adaptar cambiando los tokens :root (colores de estado-proyecto.md §2)
   y los ajustes visuales. No reescribir la estructura.

   Se carga desde head-common.php con versionado por filemtime:
     <link rel="stylesheet" href="/css/style.css?v=<?= @filemtime(...) ?>">

   ORDEN: 1 tokens · 2 reset/base · 3 layout · 4 componentes · 5 utilidades · 6 media queries
   Regla: los colores NUNCA en hexadecimal dentro de los componentes → var(--color-*)
   Ver: guia-construccion-web.md 1.3.2 · reglas-proyecto.md R10
   =========================================================================== */

/* ── 1. TOKENS ─────────────────────────────────────────────────────────── */
:root {
  /* Colores del proyecto — Persitarra Persianas Tarragona */
  --color-primary:       #1E5FA8;
  --color-primary-dark:  #164A85;
  --color-primary-rgb:   30, 95, 168;
  --color-secondary:     #FF8A00;
  --color-secondary-rgb: 255, 138, 0;
  /* Variante oscurecida del naranja para texto/iconos sobre fondo claro:
     #FF8A00 da solo 2.36:1 sobre blanco (falla WCAG). Esta da 5.31:1. */
  --color-secondary-text: #A65600;

  /* Neutros */
  --color-dark:     #1a1a1a;
  --color-text:     #333;
  --color-muted:    #6b6b6b;
  --color-bg:       #fff;
  --color-bg-alt:   #f7f5f2;
  --color-border:   #e2ddd7;
  --white:          #fff;

  /* Medidas */
  --radius:      8px;
  --radius-lg:   14px;
  --max-width:   1180px;
  --gutter:      20px;
  --shadow-sm:   0 2px 8px rgba(0, 0, 0, .06);
  --shadow-md:   0 6px 24px rgba(0, 0, 0, .10);

  /* Tipografía */
  --font-body:    system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: var(--font-body);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 130px; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.25;
  color: var(--color-dark);
  margin: 0 0 16px;
}
h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 800; }
h2 { font-size: clamp(24px, 3.6vw, 34px); font-weight: 700; }
h3 { font-size: clamp(18px, 2.4vw, 22px); font-weight: 700; }

p { margin: 0 0 16px; }
/* Medida de línea legible en párrafos sueltos de cuerpo (fuera de grids/tarjetas,
   que ya son suficientemente estrechos por sí mismos) */
.container > p { max-width: 75ch; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 8px; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--color-dark); color: var(--white); padding: 12px 20px;
}
.skip-link:focus { left: 0; }

/* ── 3. LAYOUT ─────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section { padding: 64px 0; }
.section-alt { background: var(--color-bg-alt); }
.section-dark { background: var(--color-dark); color: rgba(255, 255, 255, .88); }
.section-dark h2, .section-dark h3 { color: var(--white); }

.section-label {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--color-secondary-text);
  margin-bottom: 10px;
}

.section-header { text-align: center; max-width: 760px; margin: 0 auto 40px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── 4. COMPONENTES ────────────────────────────────────────────────────── */

/* 4.1 Botones */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--color-primary-dark); color: var(--white); text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover { background: var(--color-primary); color: var(--white); text-decoration: none; }

/* R10 — botones secundarios sobre fondo oscuro: una sola regla, no repetir por sección */
.hero .btn-secondary,
.process .btn-secondary,
.cta-final .btn-secondary,
.service-cta .btn-secondary,
.zones .btn-secondary,
.section-dark .btn-secondary { color: var(--white); border-color: rgba(255, 255, 255, .5); }
.hero .btn-secondary:hover,
.process .btn-secondary:hover,
.cta-final .btn-secondary:hover,
.service-cta .btn-secondary:hover,
.zones .btn-secondary:hover,
.section-dark .btn-secondary:hover { background: rgba(255, 255, 255, .12); color: var(--white); }

/* 4.2 Header */
.header-top {
  background: var(--color-dark);
  color: rgba(255, 255, 255, .9);
  font-size: 14px;
  text-align: center;
  padding: 7px var(--gutter);
}
.header-top a { color: var(--white); font-weight: 600; }

.site-header { position: sticky; top: 0; z-index: 100; background: var(--white); box-shadow: var(--shadow-sm); }

.header-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo { display: flex; align-items: center; font-weight: 800; font-size: 20px; color: var(--color-dark); }
.logo img { max-height: 44px; width: auto; }

.header-main nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.header-main nav > a, .nav-link {
  color: var(--color-text);
  font-weight: 600;
  font-size: 15px;
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  font-family: inherit;
}
.header-main nav a:hover, .nav-link:hover { color: var(--color-primary); text-decoration: none; }
.header-main nav a[aria-current="page"] { color: var(--color-primary); border-bottom: 2px solid var(--color-primary); }

/* Dropdown de servicios */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 0; min-width: 240px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 8px 0;
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .nav-dropdown:hover .nav-dropdown-menu { display: block; }
}
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: 10px 18px; font-size: 15px; color: var(--color-text); }
.nav-dropdown-menu a:hover { background: var(--color-bg-alt); color: var(--color-primary); text-decoration: none; }

.header-cta { padding: 10px 20px; font-size: 15px; }

/* Burger */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: none; border: 0; cursor: pointer;
  margin-left: auto;
}
.burger span { display: block; height: 3px; width: 26px; background: var(--color-dark); border-radius: 2px; transition: transform .2s; }

/* Menú móvil */
.mobile-nav { display: none; flex-direction: column; padding: 12px var(--gutter) 20px; border-top: 1px solid var(--color-border); background: var(--white); }
.mobile-nav.open { display: flex; }
.mobile-nav a { padding: 12px 0; font-weight: 600; color: var(--color-text); border-bottom: 1px solid var(--color-border); }
.mobile-dropdown-toggle {
  width: 100%; text-align: left; padding: 12px 0;
  background: none; border: 0; border-bottom: 1px solid var(--color-border);
  font: inherit; font-weight: 600; color: var(--color-text); cursor: pointer;
}
.mobile-dropdown-menu { display: none; padding-left: 14px; }
.mobile-dropdown-menu.open { display: block; }
.mobile-cta { margin-top: 16px; border-bottom: 0 !important; color: var(--white) !important; }

/* 4.3 Hero */
.hero {
  position: relative;
  background: var(--color-dark);
  color: rgba(255, 255, 255, .92);
  padding: 76px 0;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(0, 0, 0, .78) 40%, rgba(0, 0, 0, .35));
  z-index: 1;
}
.hero > .container { position: relative; z-index: 2; max-width: 800px; }
.hero h1 { color: var(--white); }
.hero p { font-size: 18px; margin-bottom: 28px; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 30px; font-size: 15px; font-weight: 600; }

/* 4.4 Tarjetas de servicio */
.card {
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.card-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin-bottom: 10px; }
.card-body p { color: var(--color-muted); font-size: 15px; flex: 1; }
.card-link { font-weight: 700; color: var(--color-primary); }

/* 4.5 Proceso / pasos */
.process { background: var(--color-dark); color: rgba(255, 255, 255, .88); }
.process h2, .process h3 { color: var(--white); }
.step { text-align: center; padding: 10px; }
.step-num {
  width: 46px; height: 46px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--color-secondary);
  color: var(--color-dark);
  font-weight: 800; font-size: 18px;
}

/* 4.6 Reseñas */
.review-card {
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.review-stars { color: var(--color-secondary-text); font-size: 17px; letter-spacing: 2px; margin-bottom: 10px; }
.review-text { font-size: 15px; color: var(--color-text); }
.review-author { font-weight: 700; font-size: 14px; margin: 0; }
.review-date { font-size: 13px; color: var(--color-muted); }

/* 4.7 FAQ acordeón */
.faq-item { border-bottom: 1px solid var(--color-border); }
.faq-question {
  width: 100%; text-align: left;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 0;
  background: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 17px; color: var(--color-dark);
}
.faq-question .chevron { transition: transform .2s ease; color: var(--color-primary); }
.faq-question[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.faq-answer { display: none; padding: 0 0 18px; color: var(--color-muted); }
.faq-answer.open { display: block; }

/* 4.8 Zonas de cobertura */
.zones { background: var(--color-dark); color: rgba(255, 255, 255, .88); }
.zones h2 { color: var(--white); }
.zones-list { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; }
.zones-list li {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 100px;
  padding: 7px 16px;
  font-size: 15px;
  margin: 0;
}

/* 4.9 Breadcrumb */
.breadcrumb { padding: 14px 0; font-size: 14px; color: var(--color-muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: '›'; margin-right: 8px; color: var(--color-muted); }

/* 4.10 CTA final */
.cta-final { background: var(--color-primary); color: var(--white); text-align: center; }
.cta-final h2 { color: var(--white); }
.cta-final .btn-primary { background: var(--white); color: var(--color-primary); }
.cta-final .btn-primary:hover { background: rgba(255, 255, 255, .9); color: var(--color-primary); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 24px; }

/* 4.11 Sección de contacto compartida (includes/contact-section.php) */
.contact-section { background: var(--color-bg-alt); padding: 60px 0; }
.contact-header { text-align: center; margin-bottom: 40px; }
.contact-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 40px; align-items: start; }

.contact-form-wrap {
  background: var(--white);
  padding: 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-weight: 600; font-size: 14px;
  margin-bottom: 6px; color: var(--color-text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  background: var(--white);
  transition: border-color .2s;
  box-sizing: border-box;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .1);
}
.form-group textarea { resize: vertical; min-height: 110px; }

/* Checkbox RGPD — nativo oculto con opacity (no display:none) para no perder accesibilidad */
.form-checkbox { margin-bottom: 24px; }
.checkbox-label {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; font-weight: 400; line-height: 1.4;
}
.checkbox-label input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-custom {
  flex-shrink: 0; width: 20px; height: 20px;
  border: 2px solid var(--color-border);
  border-radius: 4px; margin-top: 2px;
  transition: all .15s ease;
  position: relative; background: var(--white);
}
.checkbox-custom::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid var(--white); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s ease;
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--color-primary); border-color: var(--color-primary);
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after { transform: rotate(45deg) scale(1); }
.checkbox-label input[type="checkbox"]:focus-visible + .checkbox-custom {
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .3);
}
.checkbox-text { font-size: 13px; color: var(--color-muted); }
.checkbox-text a { color: var(--color-primary); text-decoration: underline; }

.btn-submit {
  width: 100%; padding: 14px 24px;
  font-size: 16px; font-weight: 600;
  cursor: pointer; border: none; border-radius: var(--radius);
}
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

.form-message {
  margin-top: 12px; padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
}

.contact-info-wrap { display: flex; flex-direction: column; gap: 20px; }
.contact-info-card {
  background: var(--white); padding: 24px;
  border-radius: 12px; box-shadow: var(--shadow-sm);
}
.contact-info-card h3 {
  font-size: 14px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--color-muted); margin: 0 0 12px;
}
.contact-phone {
  font-size: 24px; font-weight: 700;
  color: var(--color-primary); text-decoration: none; display: block;
}
.contact-schedule { font-size: 14px; color: var(--color-muted); margin: 8px 0 0; }
.contact-nap { font-style: normal; line-height: 1.6; font-size: 15px; }
.contact-nap strong { font-weight: 600; }
.contact-nap a { color: var(--color-primary); text-decoration: none; }

/* 4.12 Footer */
.site-footer { background: var(--color-dark); color: rgba(255, 255, 255, .75); padding: 52px 0 24px; }
.site-footer h3 { color: var(--white); font-size: 15px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.2fr; gap: 32px; }
.footer-col { display: flex; flex-direction: column; gap: 9px; }
.footer-col a, .footer-email { color: rgba(255, 255, 255, .75); font-size: 15px; }
.footer-col a:hover { color: var(--white); }
.footer-logo img { max-height: 46px; width: auto; }
.footer-nap { font-style: normal; font-size: 15px; line-height: 1.65; }
.footer-nap strong { color: var(--white); }
.footer-nap a { color: rgba(255, 255, 255, .75); }
.footer-bottom {
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  text-align: center; font-size: 14px;
}
.footer-bottom p { margin: 0; }

/* Contenedores de imagen dentro del cuerpo de texto (subpáginas de servicio) */
.img-cover-container { margin: 12px 0 18px; border-radius: var(--radius); overflow: hidden; height: 260px; }
.img-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cover--top  { object-position: center 30%; }
.img-cover--mid  { object-position: center 60%; }
.img-cover--low  { object-position: center 40%; }
.img-cover--high { object-position: center 20%; }

/* 4.13 Cookie banner — reserva de espacio para no provocar CLS */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: var(--color-dark); color: rgba(255, 255, 255, .9);
  padding: 16px var(--gutter);
  transform: translateY(100%);
  transition: transform .25s ease;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, .25);
}
.cookie-banner.show { transform: translateY(0); }
.cookie-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  font-size: 14px;
}
.cookie-inner p { margin: 0; flex: 1; min-width: 240px; }
.cookie-inner a { color: var(--color-secondary); }
.cookie-actions { display: flex; gap: 10px; }
.cookie-actions button {
  padding: 9px 18px; border-radius: var(--radius);
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid rgba(255, 255, 255, .4);
  background: transparent; color: var(--white);
}
.cookie-actions .cookie-accept { background: var(--color-primary); border-color: var(--color-primary); }

/* ── 5. UTILIDADES ─────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.lead { font-size: 18px; color: var(--color-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── 6. MEDIA QUERIES ──────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .header-main nav, .header-cta { display: none; }
  .burger { display: flex; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; gap: 24px; }
  section { padding: 48px 0; }
  .hero { padding: 56px 0; }
}

@media (max-width: 768px) {
  .contact-grid { grid-template-columns: 1fr; gap: 32px; }
  .contact-form-wrap { padding: 24px; }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-actions .btn-primary, .hero-actions .btn-secondary { width: 100%; }
  .cookie-actions { width: 100%; }
  .cookie-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
