/* ============================================================
   Caldesoil.es — Shared Thermal Utility Craft Design Tokens
   Source of truth: DESIGN.md (Option B)
   Link this file after page-specific stylesheets on migrated
   pages so tokens and flat-border craft stay locked sitewide.
   ============================================================ */

:root {
  color-scheme: only light;

  /* Palette — Thermal Utility Craft */
  --surface-canvas: #FFFFFF;
  --surface-card: #FFFFFF;
  --surface-tint: #EAF1F8;
  --surface-dark: #0F2537;

  --ink-primary: #132230;
  --ink-secondary: #475569;
  --ink-muted: #64748B;
  --border-hairline: #CBD5E1;

  --brand-primary: #0F4C81;
  --brand-primary-light: #1D639E;
  --brand-primary-dark: #0A365C;
  --brand-primary-soft: #E8F0F7;

  --accent-urgent: #B4232C;
  --accent-urgent-hover: #911C23;
  --accent-urgent-soft: #FDF2F2;
  --accent-urgent-border: #F3C6CA;

  --status-whatsapp: #15803D;
  --status-whatsapp-hover: #116631;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Geometry */
  --radius-badge: 4px;
  --radius-button: 6px;
  --radius-card: 8px;

  /* Legacy variable aliases so existing component CSS adopts Option B automatically */
  --blue: var(--brand-primary);
  --blue-light: var(--brand-primary-light);
  --blue-soft: var(--brand-primary-soft);
  --blue-dark: var(--surface-dark);
  --red: var(--accent-urgent);
  --red-soft: var(--accent-urgent-soft);
  --green-dark: var(--status-whatsapp);
  --btn-primary: var(--brand-primary);
  --btn-primary-hover: var(--brand-primary-dark);
  --btn-primary-shadow: none;
  --btn-secondary: var(--surface-card);
  --btn-secondary-border: var(--border-hairline);
  --btn-secondary-hover: var(--surface-tint);
  --btn-success: var(--status-whatsapp);
  --btn-success-hover: var(--status-whatsapp-hover);
  --cream: var(--surface-canvas);
  --sand: var(--surface-tint);
  --sand-line: var(--border-hairline);
  --terracotta: var(--brand-primary);
  --terracotta-soft: var(--brand-primary-soft);
  --bg: var(--surface-canvas);
  --white: var(--surface-card);
  --border: var(--border-hairline);
  --text: var(--ink-primary);
  --text-mid: #334155;
  --text-light: var(--ink-secondary);
  --text-muted: var(--ink-muted);
}

/* Base typography & tabular numerals */
body {
  font-family: var(--font-body);
  color: var(--ink-primary);
  background: var(--surface-canvas);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  letter-spacing: -0.015em;
}

/* Header & top bar */
.top-bar {
  background: var(--brand-primary);
}

.header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-hairline);
}

.header-phone {
  color: var(--accent-urgent);
  font-variant-numeric: tabular-nums;
}

.header-phone .icon {
  stroke: var(--accent-urgent);
}

.btn-sm,
.btn,
.btn-submit,
.fidel-cta-btn {
  border-radius: var(--radius-button);
  box-shadow: none;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out, opacity 150ms ease-out;
}

.btn:hover {
  transform: none;
}

.btn-wa-sm,
.btn-green,
.hero-btns .btn-green,
.mobile-bar .mb-wa {
  background: var(--status-whatsapp);
  color: #ffffff;
  box-shadow: none;
}

.btn-wa-sm:hover,
.btn-green:hover,
.hero-btns .btn-green:hover {
  background: var(--status-whatsapp-hover);
}

/* Urgent Call CTA — Single Accent Lock (#C2410C) */
.btn-red-solid,
.hero-btns .btn-red-solid,
[data-booking-hero] .btn-red-solid,
[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-red-solid,
section :is(.hero-btns, .g-hero-btns)[data-booking-hero] .btn-red-solid,
section :is(.hero-btns, .g-hero-btns)[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-red-solid,
.mobile-bar .mb-call {
  background: var(--accent-urgent);
  border: 1.5px solid var(--accent-urgent);
  border-radius: var(--radius-button);
  color: #ffffff;
  box-shadow: none;
}

.btn-red-solid:hover,
.hero-btns .btn-red-solid:hover,
[data-booking-hero] .btn-red-solid:hover,
[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-red-solid:hover,
section :is(.hero-btns, .g-hero-btns)[data-booking-hero] .btn-red-solid:hover,
section :is(.hero-btns, .g-hero-btns)[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-red-solid:hover {
  background: var(--accent-urgent-hover);
  border-color: var(--accent-urgent-hover);
  color: #ffffff;
}

/* Secondary Booking CTA — Trust Blue (flat border, no glowing ring) */
.btn-booking,
[data-booking-hero] .btn.btn-booking[data-booking-open],
[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-booking,
section :is(.hero-btns, .g-hero-btns)[data-booking-hero] .btn,
section :is(.hero-btns, .g-hero-btns)[data-booking-hero] .btn.btn-booking[data-booking-open],
section :is(.hero-btns, .g-hero-btns)[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-booking[data-booking-open] {
  border-radius: var(--radius-button);
}

.btn-booking,
[data-booking-hero] .btn.btn-booking[data-booking-open],
[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-booking,
section :is(.hero-btns, .g-hero-btns)[data-booking-hero] .btn.btn-booking[data-booking-open],
section :is(.hero-btns, .g-hero-btns)[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-booking[data-booking-open] {
  background: var(--brand-primary);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  color: #ffffff;
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-booking:hover,
  [data-booking-hero] .btn.btn-booking[data-booking-open]:hover,
  [data-booking-hero][data-booking-hero-theme="green-blue"] .btn-booking:hover,
  section :is(.hero-btns, .g-hero-btns)[data-booking-hero] .btn.btn-booking[data-booking-open]:hover,
  section :is(.hero-btns, .g-hero-btns)[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-booking[data-booking-open]:hover {
    background: var(--brand-primary-dark);
    border-color: #ffffff;
  }
}

/* Hero surface & headline discipline (no single-word accent highlights) */
.hero:has(.hero-bg),
.g-hero,
.hero-foto {
  background: var(--surface-dark);
  border-bottom: 1px solid var(--border-hairline);
}

.hero-overlay,
.g-hero-overlay {
  background: linear-gradient(
    100deg,
    rgba(15, 37, 55, 0.92) 0%,
    rgba(15, 37, 55, 0.70) 36%,
    rgba(15, 37, 55, 0.36) 64%,
    rgba(15, 37, 55, 0.14) 100%
  );
}

section.g-hero h1 .accent,
section.g-hero h1 span,
section.hero-foto .hero-h1 .accent,
section.hero-foto .hero-h1 span,
section.hero:has(.hero-bg) h1 .accent,
section.hero:has(.hero-bg) h1 span,
.hero:has(.hero-bg) h1 .accent {
  color: #ffffff;
}

/* Light hero on contacto.html */
section.hero-contact {
  background: var(--surface-canvas);
  border-bottom: 1px solid var(--border-hairline);
}

section.hero-contact h1,
section.hero-contact h1 span {
  color: var(--ink-primary);
}

section.hero-contact :is(.hero-btns, .g-hero-btns)[data-booking-hero] .btn.btn-booking[data-booking-open],
section.hero-contact :is(.hero-btns, .g-hero-btns)[data-booking-hero][data-booking-hero-theme="green-blue"] .btn-booking[data-booking-open] {
  border-color: var(--brand-primary);
  box-shadow: none;
}

/* Alternating flat bands & hairline borders (Anti-Card-Soup) */
.hero-brand-marquee {
  background: var(--surface-card);
  border-top: 1px solid var(--border-hairline);
  border-bottom: 1px solid var(--border-hairline);
}

.cats-section {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-hairline);
}

.cats-section .cat-card,
.cat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  box-shadow: none;
}

.cats-section .cat-card:hover,
.cat-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-primary);
  box-shadow: none;
}

.cat-body h3 {
  font-weight: 600 !important;
}

.cat-illus {
  border-bottom: 1px solid var(--border-hairline);
}

/* Nuestros servicios: handmade prints resting on the wavy slate band */
main > .svc-section {
  order: 3;
}

.svc-section {
  --svc-tint: var(--surface-tint);
  --svc-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 72' preserveAspectRatio='none'%3E%3Cpath d='M0,46 C280,4 580,14 880,44 C1120,68 1300,48 1440,28 L1440,72 L0,72 Z'/%3E%3C/svg%3E");
  --svc-wave-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 72' preserveAspectRatio='none'%3E%3Cpath d='M0,0 L1440,0 L1440,32 C1220,66 940,60 620,26 C360,-2 160,18 0,38 Z'/%3E%3C/svg%3E");
  --svc-gap: 1.5rem;
  --svc-col: calc((min(100vw, 1180px) - 3rem - 3 * var(--svc-gap)) / 4);
  position: relative;
  z-index: 2;
  padding: 4.5rem 0 3.5rem;
  background: var(--surface-card);
}

.svc-title {
  text-align: center;
  margin-bottom: 2.5rem;
}

.svc-shelf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem var(--svc-gap);
  position: relative;
  isolation: isolate;
}

.svc-shelf::before,
.svc-shelf::after {
  content: "";
  position: absolute;
  left: calc(50% - 50vw);
  right: calc(50% - 50vw);
  background: var(--svc-tint);
  z-index: -1;
  pointer-events: none;
}

.svc-shelf::before {
  top: calc(var(--svc-col) * 0.62);
  bottom: -3.5rem;
}

.svc-shelf::after {
  top: calc(var(--svc-col) * 0.62 - 43px);
  height: 44px;
  -webkit-mask: var(--svc-wave) 0 0 / 100% 100% no-repeat;
  mask: var(--svc-wave) 0 0 / 100% 100% no-repeat;
}

.svc-section::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -43px;
  height: 44px;
  background: var(--svc-tint);
  -webkit-mask: var(--svc-wave-b) 0 0 / 100% 100% no-repeat;
  mask: var(--svc-wave-b) 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}

.svc-item {
  display: flex;
}

.svc-item a {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  text-align: center;
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

.svc-print {
  display: block;
  width: 100%;
  transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
}

.svc-item:nth-child(odd) .svc-print {
  transform: rotate(-2deg);
}

.svc-item:nth-child(even) .svc-print {
  transform: rotate(1.5deg);
}

.svc-print img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-button);
  border: 1px solid var(--border-hairline);
  box-shadow: 0 1px 0 rgba(15, 37, 55, 0.08), 0 12px 22px -16px rgba(15, 37, 55, 0.38);
}

.svc-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.3;
  transition: color 150ms ease-out;
}

.svc-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.6rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--surface-dark);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(15, 37, 55, 0.35);
  transition: color 150ms ease-out, text-decoration-color 150ms ease-out;
}

.svc-cta .icon {
  transition: transform 150ms ease-out;
}

.svc-desc {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  margin-top: 0.2rem;
}

.svc-item a:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 6px;
  border-radius: var(--radius-card);
}

@media (hover: hover) {
  .svc-item a:hover .svc-print {
    transform: translateY(-8px) rotate(0);
  }
  .svc-item a:hover .svc-name {
    color: var(--surface-dark);
  }
  .svc-item a:hover .svc-cta {
    color: var(--surface-dark);
    text-decoration-color: var(--surface-dark);
  }
  .svc-item a:hover .svc-cta .icon {
    transform: translateX(4px);
  }
}

.svc-section + .founder-section {
  padding-top: 5.5rem;
}

@media (max-width: 860px) {
  .svc-section {
    --svc-gap: 1rem;
    --svc-col: calc((100vw - 3rem - var(--svc-gap)) / 2);
    padding: 3.25rem 0 2.5rem;
  }
  .svc-shelf {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 1.75rem;
  }
  .svc-shelf::before {
    bottom: -2.5rem;
  }
  .svc-name {
    font-size: 1rem;
    margin-top: 0.9rem;
  }
  .svc-cta {
    font-size: 0.85rem;
    padding-top: 0.5rem;
  }
  .svc-desc {
    font-size: 0.82rem;
  }
  .svc-shelf::after,
  .svc-section::after {
    height: 24px;
  }
  .svc-shelf::after {
    top: calc(var(--svc-col) * 0.62 - 23px);
  }
  .svc-section::after {
    bottom: -23px;
  }
  .svc-section + .founder-section {
    padding-top: 4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .svc-print,
  .svc-name,
  .svc-cta,
  .svc-cta .icon {
    transition: none;
  }
}

.founder-section {
  background: var(--surface-canvas);
}

.founder-photo-frame {
  border-radius: var(--radius-card);
  border: 1px solid var(--border-hairline);
  box-shadow: none;
}

.founder-photo-frame::after {
  display: none;
}

.founder-values {
  border-top: 1px solid var(--border-hairline);
}

.founder-value-icon {
  border-radius: var(--radius-badge);
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

/* Keep the wavy testimonials band intact, harmonized to Thermal Utility Craft slate tint */
section.testimonials-section,
.testimonials-section {
  background: var(--surface-tint);
}

section.testimonials-section::before,
section.testimonials-section::after {
  background-color: var(--surface-tint);
}

.testi-card {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  box-shadow: none;
}

.testi-card::before {
  color: var(--brand-primary);
  opacity: 0.12;
}

.journey-section {
  background: var(--surface-canvas);
  border-bottom: 1px solid var(--border-hairline);
}

.journey-photo {
  border-radius: var(--radius-card);
  border: 1px solid var(--border-hairline);
}

.journey-num {
  color: var(--brand-primary);
  border: 1px solid var(--border-hairline);
  box-shadow: none;
}

.faq-section {
  background: var(--surface-canvas);
}

.faq-item {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
}

.faq-item:hover {
  border-color: var(--brand-primary);
}

/* Shared service, pricing, zone & contact surfaces (flat 1px-border-first) */
.section-cream,
.section-alt,
.presupuesto-section {
  background: #F8FAFC;
}

.section-white,
section.founder-section,
section.journey-section {
  background: var(--surface-canvas);
}

.plan-card,
.oneoff-card,
.srv,
.svc-row,
.svc-card,
.type-card,
.sign,
.zone-card,
.contact-card,
.contact-form-card,
.photo-slot {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  box-shadow: none;
}

.plan-card.featured {
  border: 2px solid var(--brand-primary);
  box-shadow: none;
}

.srv:hover,
.svc-card:hover,
.type-card:hover,
.sign:hover,
.zone-card:hover,
.contact-card:hover {
  border-color: var(--brand-primary);
  box-shadow: none;
  transform: none;
}

.plan-card .price,
.oneoff-card .price,
.price,
.plan-price {
  font-family: var(--font-display);
  color: var(--brand-primary);
  font-variant-numeric: tabular-nums;
}

.google-review-number {
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.zone-card .zone-header,
.zone-header {
  background: var(--brand-primary) !important;
}

.zone-card:nth-child(even) .zone-header {
  background: var(--surface-dark) !important;
}

.contact-card.wa-card .card-link {
  color: var(--status-whatsapp);
}

.zone-town {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border-radius: var(--radius-badge);
}

.zone-town:hover {
  background: var(--brand-primary);
  color: #ffffff;
}

.hl-icon,
.srv-icon,
.contact-card-icon.blue {
  background: var(--brand-primary-soft);
  border-radius: var(--radius-button);
}

.hl-icon.red,
.srv-icon.red {
  background: var(--accent-urgent-soft);
}

.hl-icon.red .icon,
.srv-icon.red .icon {
  stroke: var(--accent-urgent);
}

/* Embedded chat widget harmonized to Thermal Utility Craft */
.cw-header {
  background: var(--surface-dark) !important;
}

.cw-popup,
.cw-teaser {
  border: 1px solid var(--border-hairline) !important;
  border-radius: 12px !important;
  color: var(--ink-primary) !important;
}

/* Keep urgency strip light for now (pending separate review) */
.urgencia-cta {
  background: #fef2f2;
  border-top: 1px solid #fecaca;
  border-bottom: 1px solid #fecaca;
}

/* Final CTA banner: calm deep-navy primary + crisp white secondary (no saturated button clash) */
section.final-cta.final-cta-banner {
  background: var(--surface-tint);
  border-top: 1px solid var(--border-hairline);
}

.final-cta-banner h2.final-cta-jumbo {
  color: var(--ink-primary);
}

.final-cta-banner .final-btns .btn {
  border-radius: var(--radius-button);
}

.final-cta-banner .final-btns .btn-red-solid {
  background: var(--surface-dark);
  border: 1.5px solid var(--surface-dark);
  color: #ffffff;
  box-shadow: none;
}

.final-cta-banner .final-btns .btn-red-solid:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.final-cta-banner .final-btns .btn-green {
  background: var(--surface-card);
  border: 1.5px solid #94A3B8;
  color: var(--surface-dark);
  box-shadow: none;
}

.final-cta-banner .final-btns .btn-green:hover {
  background: var(--surface-card);
  border-color: var(--surface-dark);
  color: var(--surface-dark);
}

.final-cta-banner .final-btns .btn-green .icon {
  fill: var(--surface-dark);
}

/* Footer aligned to Deep Boiler Navy (#0F2537) */
footer.site-footer .site-footer-wave {
  color: var(--surface-dark);
}

footer.site-footer .site-footer-main {
  background: var(--surface-dark);
}

footer.site-footer .site-footer-bottom {
  background: var(--surface-card);
  color: var(--ink-primary);
  border-top: 1px solid var(--border-hairline);
}

footer.site-footer .site-footer-bottom-inner,
footer.site-footer .site-footer-copy,
footer.site-footer .legal-links,
footer.site-footer .legal-links a,
footer.site-footer .legal-links button.cd-cookie-link {
  color: var(--ink-secondary);
}

footer.site-footer .legal-links a:hover,
footer.site-footer .legal-links button.cd-cookie-link:hover {
  color: var(--brand-primary);
}

/* Booking modal aligned to Thermal Utility Craft */
.booking-modal {
  --booking-blue: var(--brand-primary);
  --booking-blue-dark: var(--brand-primary-dark);
  --booking-blue-soft: var(--brand-primary-soft);
  --booking-line: var(--border-hairline);
  --booking-ink: var(--ink-primary);
  --booking-muted: var(--ink-secondary);
  --booking-red: var(--accent-urgent);
}

.booking-shell {
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
}

/* Nav dropdown crisp border */
.nav-dropdown-menu {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 24px -12px rgba(15, 37, 55, 0.16);
}

.nav-fuel-group + .nav-fuel-group {
  border-left: 1px solid var(--border-hairline);
}

/* Disable scroll-triggered fade-in-up per DESIGN.md motion_intensity=2 */
.fade-in {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* Mobile header phone pill — restrained crimson, never orange */
@media (max-width: 900px) {
  .header-phone {
    background: var(--accent-urgent-soft);
    color: var(--accent-urgent);
    border: 1px solid var(--accent-urgent-border);
    border-radius: var(--radius-button);
  }

  .header-phone .icon {
    stroke: var(--accent-urgent);
  }
}
