/* LuigiVelo.ch — CORE CSS (v2.7)
   - Header centrado (verde), Nav verde oscuro
   - Footer TOP gris-verdoso claro con texto negro + hovers verdes (A/B)
   - Footer BOTTOM verde oscuro (C)
   - @layer, utilities, container queries
*/

/* Orden de capas global para toda la web */
@layer base, components, utilities, pages;

/* =======================
   BASE
======================= */
@layer base {
  :root {
    /* Marca */
    --brand-500: #0aa34f;
    --brand-600: #078a42;
    --brand-700: #056c33;

    /* Enlaces globales (solo fuera del footer-top) */
    --accent-500: #1f6feb;
    --accent-600: #1b5fcc;

    /* Superficies */
    --surface: #ffffff;
    --surface-2: #f6f8fa;
    /* Gris-verdoso suave que armoniza con el verde de marca (A) */
    --footer-top-bg: color-mix(in srgb, var(--brand-500) 10%, white);

    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #4b5563;

    /* Tipografía fluida */
    --step--1: clamp(0.88rem, 0.84rem + 0.1vw, 0.95rem);
    --step-0: clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
    --step-1: clamp(1.125rem, 1.05rem + 0.8vw, 1.375rem);
    --step-2: clamp(1.375rem, 1.2rem + 1.2vw, 1.75rem);

    --radius: 12px;
    --radius-lg: 16px;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  html {
    color-scheme: light;
  }

  body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
      "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    font-size: var(--step-0);
    line-height: var(--leading);
    font-variation-settings: "wght" 450;
    -webkit-font-smoothing: antialiased;
  }

  img,
  svg,
  video,
  canvas,
  audio,
  iframe,
  embed,
  object {
    display: block;
    max-width: 100%;
  }

  h1,
  h2,
  h3 {
    line-height: 1.2;
    margin: 0 0 0.5em;
  }
  h1 {
    font-size: var(--step-2);
  }
  h2 {
    font-size: var(--step-1);
  }
  p {
    margin: 0 0 1rem;
    color: var(--text);
  }
  small,
  .tiny {
    font-size: var(--step--1);
    color: var(--text-muted);
  }

  a {
    color: var(--accent-500);
    text-decoration: none;
  }
  a:hover {
    color: var(--accent-600);
    text-decoration: underline;
  }

  .container {
    width: min(1100px, 92vw);
    margin-inline: auto;
    padding-inline: 0;
  }

  :focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent-500) 60%, white);
    outline-offset: 2px;
    border-radius: 6px;
  }
}

/* =======================
   COMPONENTS
======================= */
@layer components {
  /* Botones */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-1);
    transition: transform 0.12s ease, box-shadow 0.12s ease,
      background 0.12s ease;
  }
  .btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
  }
  .btn-prim {
    background: var(--brand-500);
    border-color: color-mix(in srgb, var(--brand-600) 55%, white);
    color: #fff;
  }
  .btn-prim:hover {
    background: var(--brand-600);
  }
  .btn-sec {
    background: var(--surface);
    color: var(--text);
  }
  .btn-maps {
    background: #e8f1ff;
    border-color: #cfe1ff;
    color: #0a3d91;
  }

  /* Header centrado + Nav */
  .header {
    background: var(--brand-500);
    color: #fff;
    text-align: center;
  }
  .header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
    gap: 0.5rem;
  }
  .header .logo {
    width: 120px;
    height: auto;
  }
  .header-subtitle {
    margin: 0;
    color: #fff;
    font-weight: 600;
  }

  .nav {
    background: var(--brand-600);
    .container {
      display: flex;
      gap: 1.2rem;
      justify-content: center;
      flex-wrap: wrap;
      padding: 0.75rem 0;
    }
    a {
      color: #fff;
      font-weight: 700;
    }
    a:hover {
      color: #e3ffe3;
      text-decoration: none;
    }
  }

  /* Tarjeta genérica */
  .card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    padding: 1rem;
  }

  /* Cajas de servicio con container queries */
  .service-box {
    container-type: inline-size;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  .service-box ul {
    margin: 0;
    padding-left: 1.1rem;
  }
  @container (width > 520px) {
    .service-box ul {
      columns: 2;
      column-gap: 1.25rem;
    }
  }

  /* =======================
     FOOTER
     - Top (A/B): fondo claro y texto negro
     - Bottom (C): verde oscuro
  ======================= */
  .footer-top {
    background: var(--footer-top-bg);
    color: #111;
  }
  .footer-top .footer-grid {
    display: grid;
    gap: 1.25rem;
    padding: 1.6rem 0 1.2rem;
    grid-template-columns: 1fr;
    align-items: center;
  }
  @media (min-width: 720px) {
    .footer-top .footer-grid {
      grid-template-columns: 1.1fr 0.9fr 0.9fr;
      column-gap: 2rem;
      align-items: start;
    }
  }
  .footer-logo-only {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
  }
  .footer-logo-only img {
    width: 140px;
    height: auto;
  }

  .footer-top .footer-col h3 {
    margin: 0 0 0.5rem;
    font-size: var(--step-1);
    color: #111;
  }
  .footer-top .footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.45rem;
  }
  .footer-top .footer-nav a {
    color: #111;
    text-decoration: none;
  }
  .footer-top .footer-nav a:hover {
    color: var(--brand-700);
    text-decoration: underline;
  }

  .footer-top a {
    color: #111;
    text-decoration: none;
    text-underline-offset: 2px;
  }
  .footer-top a:hover {
    color: var(--brand-700);
    text-decoration: underline;
  }

  .footer-bottom {
    background: var(--brand-600);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.9rem 0;
    text-align: center;
    color: #e9ffef;
  }
  .footer-bottom .fine {
    color: #d1fae5;
  }
}

/* =======================
   UTILITIES
======================= */
@layer utilities {
  .mt-0 {
    margin-top: 0 !important;
  }
  .mt-1 {
    margin-top: 0.5rem !important;
  }
  .mt-2 {
    margin-top: 1rem !important;
  }
  .mt-3 {
    margin-top: 1.5rem !important;
  }
  .mb-0 {
    margin-bottom: 0 !important;
  }
  .mb-1 {
    margin-bottom: 0.5rem !important;
  }
  .mb-2 {
    margin-bottom: 1rem !important;
  }
  .py-4 {
    padding-block: 2rem !important;
  } /* util nueva */

  .text-center {
    text-align: center !important;
  }
  .visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
  }
  @media (prefers-reduced-motion: reduce) {
    * {
      animation: none !important;
      transition: none !important;
    }
  }
}
/* === Global top spacing under header/nav === */
@layer components {
  /* Token global (ajusta el valor a tu gusto) */
  :root {
    --top-gap: 4rem;
  } /* 4rem ≈ 64px */

  /* Caso 1: el primer bloque es un hijo con .content-block */
  main.container > .content-block:first-child {
    margin-top: var(--top-gap);
  }

  /* Caso 2: el propio <main> tiene .content-block */
  main.container.content-block:first-child {
    margin-top: var(--top-gap);
  }

  /* Opcional: más aire en escritorio grande */
  @media (min-width: 992px) {
    :root {
      --top-gap: 5rem;
    } /* ≈ 80px en desktop */
  }
}

/* =======================
   PAGES (reservado para overrides por página)
   - contenido específico va en assets/css/pages/*.css
======================= */
@layer pages {
  /* vacío aquí a propósito */
}
html,
body {
  margin: 0;
  padding: 0;
}

/* ===== HERO (video en index, imagen en páginas internas) ===== */
.header.hero {
  --hero-height: clamp(340px, 46vh, 560px);
  position: relative;
  background: var(--brand-500);
  overflow: hidden;
}

/* Video de fondo */
.header.hero .hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Tinte para legibilidad de textos sobre video/imagen */
.header.hero .hero-tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.28) 0%,
    rgba(0, 0, 0, 0.12) 60%,
    rgba(0, 0, 0, 0.28) 100%
  );
  z-index: 1;
}

/* Contenido (logo, títulos) siempre por delante */
.header.hero .hero-content {
  position: relative;
  z-index: 2;
  min-height: var(--hero-height);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2.2rem 0;
  color: #fff;
}

.header.hero .hero-title {
  margin: 0.5rem 0 0;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  font-weight: 800;
}
.header.hero .hero-subtitle {
  margin: 0.35rem 0 0;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  opacity: 0.95;
}

/* Imagen de fondo para páginas internas */
.header.hero.has-hero-image {
  --hero-height: clamp(320px, 44vh, 520px);
  background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.28) 0%,
      rgba(0, 0, 0, 0.12) 60%,
      rgba(0, 0, 0, 0.28) 100%
    ),
    var(--hero-image) center/cover no-repeat;
}

/* Asegurar contraste de la nav debajo del header */
.nav {
  position: relative;
  z-index: 3;
}
