/* ==========================================================
   FORMA CAFÉ — Hoja de estilos principal
   Orden: reset → tokens → base → typography → layout →
   components → header → hero → slider → features → faq →
   gallery → contact → footer → overlays → motion →
   accessibility → responsive
   ========================================================== */

@layer reset, tokens, base, typography, layout, components, header, hero, slider, features, faq, gallery, contact, footer, overlays, motion, accessibility, responsive;

/* ---------------- RESET ---------------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; }
  body { min-height: 100svh; }
  img, video, svg, canvas { display: block; max-width: 100%; }
  img, video { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { background: none; border: 0; padding: 0; cursor: pointer; }
  a { color: inherit; text-decoration: none; }
  ul, ol { list-style: none; padding: 0; }
  p, h1, h2, h3, h4, figure, blockquote, dl, dd { overflow-wrap: break-word; }
  :where([hidden]) { display: none !important; }
}

/* ---------------- TOKENS ---------------- */
@layer tokens {
  :root {
    --color-ink: #17100c;
    --color-espresso: #291710;
    --color-roast: #623824;
    --color-copper: #b9653f;
    --color-crema: #dfbd91;
    --color-milk: #f3ede4;
    --color-paper: #f7f3ec;
    --color-sage: #777d6d;
    --color-line: rgba(23, 16, 12, 0.16);
    --color-line-light: rgba(243, 237, 228, 0.18);

    --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;

    --fs-hero: clamp(4rem, 10vw, 10rem);
    --fs-h2: clamp(2.8rem, 6vw, 6.5rem);
    --fs-h3: clamp(1.8rem, 3vw, 3.5rem);
    --fs-body: clamp(1rem, 1.25vw, 1.2rem);
    --fs-small: clamp(0.75rem, 0.9vw, 0.9rem);

    --container: 1440px;
    --gutter: clamp(1.25rem, 4vw, 4.5rem);
    --space-section: clamp(6rem, 14svh, 12rem);
    --header-h: 88px;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);

    /* Colores dinámicos según tema de la sección activa */
    --ui-fg: var(--color-milk);
    --ui-bg: transparent;
    --ui-line: var(--color-line-light);

    --grain-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  body[data-theme-active="light"] {
    --ui-fg: var(--color-ink);
    --ui-line: var(--color-line);
  }
}

/* ---------------- BASE ---------------- */
@layer base {
  html { scroll-behavior: smooth; }
  html.lenis, html.lenis body { height: auto; }
  .lenis.lenis-smooth { scroll-behavior: auto !important; }

  body {
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: 1.6;
    color: var(--color-ink);
    background-color: var(--color-paper);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
  }

  /* Textura de grano global, muy sutil */
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    background-image: var(--grain-url);
    background-size: 160px 160px;
    opacity: 0.05;
    mix-blend-mode: multiply;
  }

  ::selection {
    background: var(--color-copper);
    color: var(--color-paper);
  }

  :focus-visible {
    outline: 2px solid var(--color-copper);
    outline-offset: 3px;
    border-radius: 2px;
  }

  section { scroll-margin-top: calc(var(--header-h) + 12px); }

  .scroll-locked { overflow: hidden; }
}

/* ---------------- TYPOGRAPHY ---------------- */
@layer typography {
  .h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: var(--fs-h2);
    line-height: 0.94;
    letter-spacing: -0.015em;
    text-wrap: balance;
  }

  .eyebrow {
    font-size: var(--fs-small);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-copper);
    display: flex;
    align-items: center;
    gap: 0.9em;
  }
  .eyebrow::before {
    content: "";
    width: 2.4em;
    height: 1px;
    background: currentColor;
    opacity: 0.7;
  }

  .section-text {
    max-width: 46ch;
    font-size: var(--fs-body);
    line-height: 1.65;
  }

  .link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding-bottom: 2px;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 0.45s var(--ease-out);
  }
  .link:hover, .link:focus-visible { background-size: 100% 1px; }
  .link svg { transition: transform 0.35s var(--ease-out); }
  .link:hover svg, .link:focus-visible svg { transform: translate(2px, -2px); }

  .link-button { text-align: left; }
}

/* ---------------- LAYOUT ---------------- */
@layer layout {
  .container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .section-head {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: clamp(1rem, 2vw, 2rem);
    row-gap: 1.6rem;
    padding-block: var(--space-section) clamp(2.5rem, 6vh, 5rem);
  }
  .section-head .eyebrow { grid-column: 1 / -1; }
  .section-head .h2 { grid-column: 1 / span 7; }
  .section-head .section-text { grid-column: 9 / span 4; align-self: end; }

  [data-theme="dark"] .section-head .h2,
  [data-theme="dark"] .section-head .section-text { color: var(--color-milk); }
}

/* ---------------- COMPONENTS ---------------- */
@layer components {
  .btn {
    --btn-bg: var(--color-copper);
    --btn-fg: var(--color-paper);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    min-height: 52px;
    padding: 0.9em 1.9em;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: var(--btn-fg);
    background: var(--btn-bg);
    transition: background-color 0.45s var(--ease-out), color 0.45s var(--ease-out), border-color 0.45s var(--ease-out), transform 0.3s var(--ease-out);
    will-change: transform;
  }
  .btn .btn-text { display: inline-block; }
  .btn:hover { background: var(--color-roast); }
  .btn:active { transform: scale(0.97); }

  .btn--ghost {
    --btn-bg: transparent;
    --btn-fg: currentColor;
    border: 1px solid currentColor;
  }
  .btn--ghost:hover { background: rgba(223, 189, 145, 0.14); color: inherit; }

  .btn--line {
    --btn-bg: transparent;
    --btn-fg: var(--color-ink);
    border: 1px solid var(--color-line);
    border-radius: 8px;
  }
  .btn--line:hover { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); }

  .btn--small { min-height: 44px; padding: 0.6em 1.4em; font-size: 0.85rem; }

  /* Indicadores de intensidad (slider) */
  .dots { display: inline-flex; gap: 5px; margin-inline: 0.5em; vertical-align: middle; }
  .dots i {
    width: 7px; height: 7px; border-radius: 50%;
    border: 1px solid var(--color-roast);
  }
  .dots i.on { background: var(--color-copper); border-color: var(--color-copper); }

  .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 4000;
    padding: 0.8em 1.4em;
    background: var(--color-ink);
    color: var(--color-paper);
    border-radius: 8px;
    font-weight: 700;
    transform: translateY(-300%);
    transition: transform 0.35s var(--ease-out);
  }
  .skip-link:focus-visible { transform: translateY(0); }
}

/* ---------------- HEADER ---------------- */
@layer header {
  .site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1000;
    padding-top: clamp(0.6rem, 1.6vh, 1.2rem);
    color: var(--ui-fg);
    transition: color 0.6s var(--ease-out), transform 0.5s var(--ease-out);
  }
  .site-header.is-hidden { transform: translateY(-110%); }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    max-width: var(--container);
    margin-inline: auto;
    padding: 0.9rem var(--gutter);
    border: 1px solid transparent;
    border-radius: 14px;
    transition: background-color 0.5s var(--ease-out), border-color 0.5s var(--ease-out), padding 0.4s var(--ease-out), backdrop-filter 0.5s;
  }
  .site-header.is-scrolled .header-inner {
    padding-block: 0.55rem;
    background: color-mix(in srgb, var(--color-ink) 55%, transparent);
    border-color: var(--ui-line);
  }
  body[data-theme-active="light"] .site-header.is-scrolled .header-inner {
    background: color-mix(in srgb, var(--color-paper) 72%, transparent);
  }
  @supports (backdrop-filter: blur(10px)) {
    .site-header.is-scrolled .header-inner {
      background: rgba(23, 16, 12, 0.42);
      -webkit-backdrop-filter: blur(14px);
      backdrop-filter: blur(14px);
    }
    body[data-theme-active="light"] .site-header.is-scrolled .header-inner {
      background: rgba(247, 243, 236, 0.62);
    }
  }

  .brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.32em;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 0.06em;
  }
  .brand-sep { color: var(--color-copper); font-weight: 300; transform: translateY(-1px); }

  .main-nav ul { display: flex; gap: clamp(1.2rem, 2.4vw, 2.4rem); }
  .nav-link {
    position: relative;
    display: inline-block;
    padding: 0.4em 0.1em;
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    opacity: 0.85;
    transition: opacity 0.3s;
  }
  .nav-link::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-copper);
    transform: translateX(-50%) scale(0);
    transition: transform 0.35s var(--ease-out);
  }
  .nav-link:hover { opacity: 1; }
  .nav-link.is-active { opacity: 1; }
  .nav-link.is-active::after { transform: translateX(-50%) scale(1); }

  .header-actions { display: flex; align-items: center; gap: 1rem; }

  .menu-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--ui-line);
    align-items: center;
    justify-content: center;
  }
  .menu-toggle-lines { display: grid; gap: 6px; }
  .menu-toggle-lines span {
    width: 20px; height: 1.6px;
    background: currentColor;
    transition: transform 0.4s var(--ease-out), width 0.3s;
  }
  .menu-toggle[aria-expanded="true"] .menu-toggle-lines span:first-child { transform: translateY(3.8px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-toggle-lines span:last-child { transform: translateY(-3.8px) rotate(-45deg); }

  .mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: var(--color-espresso);
    color: var(--color-milk);
    clip-path: inset(0 0 100% 0);
    visibility: hidden;
  }
  .mobile-menu-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(1.5rem, 4vh, 3rem);
    padding: clamp(2rem, 7vw, 5rem);
  }
  .mobile-menu-eyebrow { font-size: var(--fs-small); letter-spacing: 0.3em; color: var(--color-copper); font-weight: 700; }
  .mobile-nav { display: grid; gap: 0.4rem; }
  .mobile-nav a {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    font-family: var(--font-serif);
    font-size: clamp(2rem, 8vw, 3.4rem);
    line-height: 1.15;
    padding-block: 0.15em;
    transition: color 0.3s, transform 0.4s var(--ease-out);
  }
  .mobile-nav a:hover, .mobile-nav a:focus-visible { color: var(--color-crema); transform: translateX(10px); }
  .mobile-nav-num { font-family: var(--font-sans); font-size: 0.8rem; color: var(--color-copper); font-weight: 700; }
  .mobile-menu-foot { color: rgba(243, 237, 228, 0.55); font-size: var(--fs-small); }
  .mobile-menu-close {
    position: absolute;
    top: 1.4rem;
    right: 1.4rem;
    width: 48px;
    height: 48px;
    border: 1px solid var(--color-line-light);
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--color-milk);
  }

  .page-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1200;
    pointer-events: none;
  }
  .page-progress span {
    display: block;
    height: 100%;
    background: var(--color-copper);
    transform: scaleX(0);
    transform-origin: 0 50%;
  }
}

/* ---------------- HERO ---------------- */
@layer hero {
  .hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: flex-end;
    background: var(--color-ink);
    color: var(--color-milk);
    overflow: clip;
  }

  .hero-media { position: absolute; inset: 0; }
  .hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center;
    background: var(--color-espresso) url("https://images.unsplash.com/photo-1510591509098-f4fdc6d0ff04?q=80&w=1920&h=1080&auto=format&fit=crop") center/cover no-repeat;
  }
  .hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(23, 16, 12, 0.52);
  }
  .hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(200deg, rgba(23,16,12,0) 40%, rgba(23,16,12,0.65) 100%),
                linear-gradient(90deg, rgba(23,16,12,0.5) 0%, rgba(23,16,12,0) 55%);
  }
  .hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--grain-url);
    background-size: 160px;
    opacity: 0.05;
  }

  .hero-three {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
  }
  .hero-three canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

  /* Fallback si WebGL no está disponible */
  .bean-fallback {
    display: none;
    position: absolute;
    right: 8%;
    top: 50%;
    width: clamp(160px, 22vw, 340px);
    aspect-ratio: 0.72;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background:
      radial-gradient(ellipse 30% 70% at 50% 50%, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 52%),
      radial-gradient(ellipse 90% 90% at 35% 25%, #7a4526 0%, #3c2113 55%, #1e100a 100%);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5), inset -18px -22px 60px rgba(0,0,0,0.45);
    transform: translateY(-50%) rotate(14deg);
  }
  .hero-three.no-webgl .bean-fallback { display: block; }

  .hero-content {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: clamp(1rem, 2vw, 2rem);
    padding-top: calc(var(--header-h) + 4vh);
    padding-bottom: clamp(9rem, 20vh, 15rem);
  }
  .hero-eyebrow { grid-column: 1 / -1; margin-bottom: clamp(1.2rem, 3vh, 2.2rem); }

  .hero-title {
    grid-column: 1 / span 7;
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: var(--fs-hero);
    line-height: 0.9;
    letter-spacing: -0.02em;
  }
  .hero-line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
  .hero-line-inner { display: block; }
  .hero-line:last-child .hero-line-inner { font-style: italic; font-weight: 400; color: var(--color-crema); }

  .hero-text {
    grid-column: 1 / span 5;
    margin-top: clamp(1.4rem, 3.5vh, 2.4rem);
    max-width: 44ch;
    color: rgba(243, 237, 228, 0.82);
  }
  .hero-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: clamp(1.6rem, 4vh, 2.6rem);
  }
  .hero-datum {
    position: absolute;
    right: var(--gutter);
    bottom: clamp(6.5rem, 14vh, 10rem);
    font-size: var(--fs-small);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(243, 237, 228, 0.6);
    writing-mode: vertical-rl;
  }

  .scroll-hint {
    position: absolute;
    left: 50%;
    bottom: clamp(4.6rem, 9vh, 6.4rem);
    z-index: 3;
    transform: translateX(-50%);
    display: grid;
    justify-items: center;
    gap: 0.7rem;
    color: rgba(243, 237, 228, 0.7);
  }
  .scroll-hint-text { font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase; }
  .scroll-hint-line { width: 1px; height: 44px; background: rgba(243,237,228,0.25); overflow: hidden; }
  .scroll-hint-line span {
    display: block;
    width: 100%;
    height: 40%;
    background: var(--color-crema);
    animation: hint-drop 2.1s var(--ease-inout) infinite;
  }
  @keyframes hint-drop {
    0% { transform: translateY(-110%); }
    55% { transform: translateY(160%); }
    100% { transform: translateY(160%); }
  }

  .hero-curve {
    position: absolute;
    inset: auto 0 -1px 0;
    z-index: 4;
    line-height: 0;
  }
  .hero-curve svg { width: 100%; height: clamp(46px, 9vw, 120px); }
}

/* ---------------- SLIDER ---------------- */
@layer slider {
  .slider-section {
    position: relative;
    background: var(--color-paper);
    color: var(--color-ink);
  }

  .slider-pin { position: relative; overflow: clip; }

  .slider-viewport { position: relative; }

  .slider-track {
    display: flex;
    align-items: stretch;
    gap: clamp(1.5rem, 3vw, 3rem);
    padding-inline: var(--gutter);
    width: max-content;
  }
  .slider-track:focus-visible { outline-offset: -2px; }

  .coffee-card {
    container-type: inline-size;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: clamp(560px, 66vw, 980px);
    height: clamp(520px, 70svh, 720px);
    background: var(--color-milk);
    border: 1px solid var(--color-line);
    border-radius: 20px;
    overflow: hidden;
    flex-shrink: 0;
    transform-origin: center;
  }
  .coffee-card--b { grid-template-columns: 1.15fr 0.85fr; border-radius: 28px 8px 28px 8px; }
  .coffee-card--c { grid-template-columns: 0.9fr 1.1fr; border-radius: 8px 28px 8px 28px; }
  .coffee-card--b .card-body { order: -1; }

  .card-media { position: relative; min-height: 0; }
  .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: auto;
    background: linear-gradient(160deg, var(--color-roast), var(--color-espresso));
  }
  .coffee-card--b .card-media,
  .coffee-card--c .card-media { aspect-ratio: auto; }

  .card-body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1.4vh, 0.9rem);
    padding: clamp(1.4rem, 3.4vh, 2.6rem);
    overflow: auto;
  }
  .card-num {
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 5vw, 4.2rem);
    line-height: 1;
    color: var(--color-crema);
    -webkit-text-stroke: 1px var(--color-roast);
  }
  .card-name {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(1.9rem, 3.4vw, 3rem);
    line-height: 1;
  }
  .card-phrase { font-style: italic; font-family: var(--font-serif); color: var(--color-roast); font-size: 1.05rem; }

  .card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem 1rem; margin-top: 0.4rem; }
  .card-meta dt { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-sage); font-weight: 700; }
  .card-meta dd { font-size: 0.92rem; font-weight: 600; }

  .card-intensity { font-size: 0.86rem; font-weight: 600; display: flex; align-items: center; }
  .dots-text { color: var(--color-roast); }

  .card-notes { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .card-notes li {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.35em 0.85em;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    color: var(--color-roast);
  }

  .card-cta { align-self: flex-start; margin-top: auto; }
  .card-note { font-size: 0.7rem; color: var(--color-sage); }

  .slider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.4rem;
    padding-block: clamp(1.4rem, 4vh, 2.6rem);
  }
  .slider-arrow {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    color: var(--color-ink);
    transition: background-color 0.35s, color 0.35s, border-color 0.35s, transform 0.2s;
  }
  .slider-arrow:hover { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); }
  .slider-arrow:active { transform: scale(0.94); }
  .slider-arrow:disabled { opacity: 0.35; pointer-events: none; }

  .slider-status { display: flex; align-items: center; gap: 1.2rem; flex: 1; max-width: 460px; }
  .slider-counter { font-family: var(--font-serif); font-size: 1.05rem; white-space: nowrap; }
  .slider-counter span { color: var(--color-copper); }
  .slider-progress {
    flex: 1;
    height: 1px;
    background: var(--color-line);
    overflow: hidden;
  }
  .slider-progress span {
    display: block;
    height: 100%;
    background: var(--color-copper);
    transform: scaleX(0);
    transform-origin: 0 50%;
  }

  .slider-exit-line {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 1px;
    height: 0;
    background: linear-gradient(var(--color-copper), transparent);
    transform: translateX(-50%);
  }

  /* Slider en modo nativo (móvil, movimiento reducido o sin pin) */
  .slider-section.native-x .slider-viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .slider-section.native-x .coffee-card { scroll-snap-align: center; }

  /* Fallbacks sin JavaScript */
  html:not(.js) .slider-viewport { overflow-x: auto; scroll-snap-type: x mandatory; }
  html:not(.js) .coffee-card { scroll-snap-align: center; }
  html:not(.js) .faq-panel { grid-template-rows: 1fr; }
  html:not(.js) .map-fallback[hidden] { display: grid !important; }
  html:not(.js) .page-progress,
  html:not(.js) .cursor { display: none; }
}

/* ---------------- FEATURES ---------------- */
@layer features {
  .features {
    position: relative;
    background: var(--color-milk);
    color: var(--color-ink);
    transition: background-color 1s var(--ease-inout);
    padding-bottom: var(--space-section);
  }
  .features[data-active-coffee="cold-brew"] { background: #e9e4d8; }
  .features[data-active-coffee="latte"],
  .features[data-active-coffee="cappuccino"] { background: var(--color-paper); }

  .features-layout {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: clamp(1rem, 2vw, 2rem);
    align-items: start;
  }

  .features-visual {
    grid-column: 1 / span 5;
    position: sticky;
    top: calc(var(--header-h) + 2vh);
    height: min(86svh, 780px);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cup-stage {
    position: relative;
    width: 100%;
    max-width: 460px;
    display: grid;
    justify-items: center;
    perspective: 1100px;
  }

  .cup-steam {
    width: 120px;
    color: var(--color-roast);
    opacity: 0.75;
    margin-bottom: -8px;
  }

  .cup-scene {
    position: relative;
    width: min(76%, 330px);
    aspect-ratio: 0.86;
    transform-style: preserve-3d;
  }

  .cup {
    position: absolute;
    inset: 0;
    border-radius: 14px 14px 46% 46% / 10px 10px 30% 30%;
    border: 2px solid rgba(23, 16, 12, 0.28);
    border-top-width: 1px;
    background: linear-gradient(105deg, rgba(255,255,255,0.34) 0%, rgba(255,255,255,0.06) 34%, rgba(23,16,12,0.05) 80%);
    box-shadow:
      inset 0 -18px 34px rgba(23, 16, 12, 0.14),
      0 30px 60px rgba(23, 16, 12, 0.22);
    overflow: hidden;
    transform: rotateX(6deg);
    transition: border-radius 0.9s var(--ease-inout);
  }
  .cup-scene.is-glass .cup {
    border-radius: 10px 10px 18px 18px;
  }
  .cup-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(100deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 22%),
                linear-gradient(260deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 18%);
    pointer-events: none;
  }
  .cup-plate {
    position: absolute;
    left: 50%;
    bottom: -7%;
    width: 150%;
    height: 12%;
    border-radius: 50%;
    transform: translateX(-50%) rotateX(64deg);
    background: radial-gradient(ellipse at center, rgba(23,16,12,0.22) 0%, rgba(23,16,12,0.08) 55%, transparent 72%);
  }

  .cup-fill { position: absolute; inset: 6% 5% 5%; }
  .layer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    overflow: hidden;
    transition: none;
  }
  .layer--cafe { background: linear-gradient(180deg, #4a2a17, #2b170d); }
  .layer--agua { background: linear-gradient(180deg, rgba(133, 96, 63, 0.5), rgba(94, 64, 40, 0.62)); }
  .layer--leche { background: linear-gradient(180deg, #e8d5b8, #d9bd96); }
  .layer--espuma { background: linear-gradient(180deg, #f7efe1, #ecdcc2); }
  .layer--crema { background: linear-gradient(180deg, #c89a63, #a9763f); }
  .layer--hielo { background: linear-gradient(180deg, #3a2314, #2b170d); }
  .layer--hielo i {
    position: absolute;
    width: 26%;
    aspect-ratio: 1;
    border-radius: 18%;
    background: linear-gradient(140deg, rgba(255,255,255,0.85), rgba(214,232,238,0.55));
    box-shadow: inset -4px -6px 12px rgba(255,255,255,0.5), 0 4px 10px rgba(0,0,0,0.18);
    opacity: 0.9;
  }
  .layer--hielo i:nth-child(1) { left: 8%; top: 8%; transform: rotate(-12deg); }
  .layer--hielo i:nth-child(2) { left: 42%; top: 22%; transform: rotate(9deg); }
  .layer--hielo i:nth-child(3) { right: 6%; top: 4%; transform: rotate(-4deg); }

  .cup-callouts { position: absolute; inset: 0; pointer-events: none; }
  .callout {
    position: absolute;
    left: calc(100% + 14px);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    white-space: nowrap;
  }
  .callout-line {
    width: clamp(26px, 4vw, 54px);
    height: 1px;
    background: var(--color-roast);
    transform: scaleX(0);
    transform-origin: 0 50%;
  }
  .callout-text { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.03em; color: var(--color-roast); }
  .callout-text b { color: var(--color-ink); margin-left: 0.4em; }

  .cup-status { margin-top: clamp(1rem, 3vh, 2rem); text-align: center; }
  .cup-counter { font-size: var(--fs-small); letter-spacing: 0.22em; color: var(--color-sage); font-weight: 700; }
  .cup-counter span { color: var(--color-copper); }
  .cup-name-mask { overflow: hidden; }
  .cup-name {
    display: inline-block;
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 2.6vw, 2.4rem);
    line-height: 1.1;
  }

  .cup-nav { margin-top: clamp(0.8rem, 2vh, 1.4rem); }
  .cup-nav ul { display: flex; gap: 0.35rem; }
  .cup-nav button {
    min-width: 44px;
    min-height: 44px;
    padding: 0.3em 0.55em;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--color-sage);
    border-bottom: 2px solid transparent;
    transition: color 0.3s, border-color 0.3s;
  }
  .cup-nav button:hover { color: var(--color-ink); }
  .cup-nav button[aria-current="true"] { color: var(--color-copper); border-color: var(--color-copper); }

  .features-chapters {
    grid-column: 7 / span 6;
    display: grid;
    gap: clamp(3rem, 8vh, 6rem);
    padding-bottom: 8svh;
  }

  .chapter {
    min-height: 82svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(0.7rem, 1.8vh, 1.1rem);
    padding: clamp(1.6rem, 3vw, 2.8rem);
    border-top: 1px solid var(--color-line);
    transition: background-color 0.6s var(--ease-out);
  }
  .chapter.is-highlighted {
    background: rgba(185, 101, 63, 0.08);
    animation: chapter-pulse 1.6s var(--ease-out) 1;
  }
  @keyframes chapter-pulse {
    0% { box-shadow: inset 0 0 0 0 rgba(185, 101, 63, 0.35); }
    40% { box-shadow: inset 0 0 0 4px rgba(185, 101, 63, 0.35); }
    100% { box-shadow: inset 0 0 0 0 rgba(185, 101, 63, 0); }
  }

  .chapter-num {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--color-copper);
    letter-spacing: 0.2em;
  }
  .chapter-name {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1;
  }
  .chapter-desc { max-width: 52ch; color: rgba(23, 16, 12, 0.86); }
  .chapter-comp { font-size: 0.95rem; }
  .chapter-facts { display: flex; flex-wrap: wrap; gap: 0.8rem 2.4rem; }
  .chapter-facts dt { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-sage); font-weight: 700; }
  .chapter-facts dd { font-weight: 700; }

  .chapter-meters { display: grid; gap: 0.5rem; margin-block: 0.4rem; }
  .chapter-meters li { display: flex; align-items: center; gap: 0.9rem; }
  .meter-label { width: 5.4em; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-sage); }
  .meter { display: inline-flex; gap: 5px; }
  .meter i {
    width: 22px;
    height: 5px;
    border-radius: 3px;
    background: rgba(23, 16, 12, 0.14);
  }
  .meter i.on { background: var(--color-copper); }
  .meter-num { font-size: 0.82rem; font-weight: 700; color: var(--color-roast); }

  .chapter-texture { font-size: 0.95rem; }
  .chapter-notes { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .chapter-notes li {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.85em;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    color: var(--color-roast);
  }
  .chapter-moment {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--color-roast);
    border-left: 2px solid var(--color-copper);
    padding-left: 0.9em;
  }
}

/* ---------------- FAQ ---------------- */
@layer faq {
  .faq {
    position: relative;
    background: var(--color-paper);
    color: var(--color-ink);
    padding-bottom: var(--space-section);
    overflow: clip;
  }

  .faq-deco {
    position: absolute;
    top: 2%;
    right: -4%;
    font-family: var(--font-serif);
    font-size: clamp(20rem, 42vw, 44rem);
    line-height: 1;
    color: rgba(98, 56, 36, 0.06);
    pointer-events: none;
    user-select: none;
  }

  .faq-layout {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: clamp(1rem, 2vw, 2rem);
    padding-top: var(--space-section);
    align-items: start;
  }
  .faq-head {
    grid-column: 1 / span 5;
    position: sticky;
    top: calc(var(--header-h) + 4vh);
    display: grid;
    gap: 1.4rem;
    padding-bottom: 3rem;
  }

  .faq-list { grid-column: 7 / span 6; }

  .faq-item { border-top: 1px solid var(--color-line); transition: background-color 0.5s var(--ease-out); }
  .faq-item:last-child { border-bottom: 1px solid var(--color-line); }
  .faq-item.is-open { background: rgba(185, 101, 63, 0.05); }
  .faq-item.is-open { border-top-color: var(--color-copper); box-shadow: inset 0 1px 0 var(--color-copper); }

  .faq-q-wrap { font-weight: inherit; }
  .faq-q {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2vw, 1.8rem);
    width: 100%;
    min-height: 44px;
    padding: clamp(1.1rem, 2.6vh, 1.7rem) 0.6rem;
    text-align: left;
  }
  .faq-num {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--color-sage);
    transition: color 0.4s;
  }
  .faq-item.is-open .faq-num { color: var(--color-copper); }
  .faq-q-text {
    flex: 1;
    font-family: var(--font-serif);
    font-size: clamp(1.15rem, 1.9vw, 1.55rem);
    line-height: 1.25;
  }
  .faq-icon {
    position: relative;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    transition: transform 0.5s var(--ease-out), background-color 0.4s, border-color 0.4s;
  }
  .faq-icon i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1.6px;
    background: currentColor;
    transform: translate(-50%, -50%);
    transition: transform 0.5s var(--ease-out);
  }
  .faq-icon i:last-child { transform: translate(-50%, -50%) rotate(90deg); }
  .faq-item.is-open .faq-icon { transform: rotate(180deg); background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
  .faq-item.is-open .faq-icon i:last-child { transform: translate(-50%, -50%) rotate(0deg); }

  .faq-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.55s var(--ease-inout);
  }
  .faq-panel-inner { overflow: hidden; }
  .faq-panel p {
    padding: 0 0.6rem clamp(1.3rem, 3vh, 1.9rem) calc(0.6rem + 2.6rem);
    max-width: 60ch;
    color: rgba(23, 16, 12, 0.8);
  }
  .faq-item.is-open .faq-panel { grid-template-rows: 1fr; }
}

/* ---------------- GALLERY ---------------- */
@layer gallery {
  .gallery {
    position: relative;
    background: var(--color-ink);
    color: var(--color-milk);
    padding-bottom: clamp(7rem, 16vh, 13rem);
  }
  .gallery .eyebrow { color: var(--color-crema); }

  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: clamp(1rem, 2vw, 2rem);
    row-gap: clamp(3rem, 8vh, 6rem);
    align-items: start;
  }

  .g-item { position: relative; }
  .g-item--1 { grid-column: 1 / span 5; }
  .g-item--2 { grid-column: 7 / span 5; margin-top: clamp(2rem, 10vh, 7rem); }
  .g-item--3 { grid-column: 2 / span 4; margin-top: clamp(-3rem, -4vh, -1rem); }
  .g-item--4 { grid-column: 7 / span 6; }
  .g-item--5 { grid-column: 1 / span 4; margin-top: clamp(1rem, 6vh, 4rem); }
  .g-item--6 { grid-column: 6 / span 5; margin-top: clamp(-2rem, -3vh, -0.5rem); }
  .g-item--7 { grid-column: 2 / span 8; }
  .g-item--8 { grid-column: 1 / span 4; margin-top: clamp(-2rem, -4vh, -1rem); }
  .g-item--9 { grid-column: 6 / span 6; margin-top: clamp(1.5rem, 7vh, 5rem); }

  .g-open { display: block; width: 100%; text-align: left; }
  .g-frame {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: var(--color-espresso);
  }
  .g-item--1 .g-frame, .g-item--3 .g-frame, .g-item--5 .g-frame, .g-item--8 .g-frame { aspect-ratio: 4 / 5; }
  .g-item--2 .g-frame, .g-item--4 .g-frame, .g-item--6 .g-frame, .g-item--9 .g-frame { aspect-ratio: 4 / 3; }
  .g-item--7 .g-frame { aspect-ratio: 16 / 9; }

  .g-frame img, .g-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    scale: 1.01;
    transition: scale 0.8s var(--ease-out);
  }
  .g-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(23, 16, 12, 0.22);
    transition: opacity 0.6s var(--ease-out);
  }
  @media (hover: hover) {
    .g-open:hover .g-frame img, .g-open:hover .g-frame video { scale: 1.05; }
    .g-open:hover .g-frame::after { opacity: 0.25; }
  }

  .g-caption {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-top: 0.9rem;
  }
  .g-name { font-family: var(--font-serif); font-size: 1.15rem; color: var(--color-crema); }
  .g-text { font-size: 0.85rem; color: rgba(243, 237, 228, 0.62); }
}

/* ---------------- CONTACT ---------------- */
@layer contact {
  .contact {
    position: relative;
    background: var(--color-paper);
    color: var(--color-ink);
    padding-bottom: var(--space-section);
  }
  .contact-curve { line-height: 0; margin-top: -1px; background: var(--color-ink); }
  .contact-curve svg { width: 100%; height: clamp(40px, 8vw, 110px); display: block; }
  .contact-curve path { fill: var(--color-paper); }

  .contact-layout {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
  }

  .contact-form-col { grid-column: 1 / span 5; }
  .contact-map-col {
    grid-column: 7 / span 6;
    position: sticky;
    top: calc(var(--header-h) + 2vh);
  }

  .contact-form { display: grid; gap: 1.5rem; }

  .field { position: relative; }
  .field-input {
    width: 100%;
    padding: 1.15em 0 0.75em;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--color-line);
    border-radius: 0;
    transition: border-color 0.35s;
  }
  .field-input:hover { border-color: rgba(23, 16, 12, 0.4); }
  .field-input:focus { outline: none; border-color: var(--color-copper); }
  .field-input:focus-visible { outline: none; box-shadow: 0 2px 0 0 var(--color-copper); }

  .field-label {
    position: absolute;
    left: 0;
    top: 1.1em;
    color: var(--color-sage);
    pointer-events: none;
    transform-origin: 0 0;
    transition: transform 0.35s var(--ease-out), color 0.3s;
  }
  .field-input:focus + .field-label,
  .field-input:not(:placeholder-shown) + .field-label,
  .field--select .field-label,
  .field-input:valid + .field-label {
    transform: translateY(-1.55em) scale(0.72);
    color: var(--color-roast);
    letter-spacing: 0.08em;
  }
  .field-label--static { transform: translateY(-1.55em) scale(0.72); color: var(--color-roast); letter-spacing: 0.08em; }

  .field--select select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23623824' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.2em center;
    padding-right: 1.6em;
  }
  .field--select select:invalid { color: var(--color-sage); }

  .field--area textarea { resize: vertical; min-height: 7.5rem; max-height: 18rem; }

  .field.has-error .field-input { border-color: #a03c1e; }
  .field.has-error .field-label { color: #a03c1e; }
  .field.is-valid .field-input { border-color: var(--color-sage); }
  .field.is-disabled .field-input { opacity: 0.5; }

  .field-error {
    margin-top: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #a03c1e;
  }

  .field--check { display: grid; grid-template-columns: 22px 1fr; gap: 0.8rem; align-items: start; }
  .field-check {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    appearance: none;
    border: 1px solid var(--color-line);
    border-radius: 5px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
  }
  .field-check::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid var(--color-paper);
    border-bottom: 2px solid var(--color-paper);
    transform: rotate(-45deg) scale(0);
    transition: transform 0.25s var(--ease-out);
    margin-top: -2px;
  }
  .field-check:checked { background: var(--color-copper); border-color: var(--color-copper); }
  .field-check:checked::after { transform: rotate(-45deg) scale(1); }
  .field-check:focus-visible { outline: 2px solid var(--color-copper); outline-offset: 2px; }
  .field-check-label { font-size: 0.9rem; color: rgba(23, 16, 12, 0.78); }
  .field-check-label .link-button { text-decoration: underline; text-underline-offset: 3px; }
  .field--check .field-error { grid-column: 2; }

  .btn--submit { justify-self: start; min-width: 220px; overflow: hidden; }
  .btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(247, 243, 236, 0.35);
    border-top-color: var(--color-paper);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .btn--submit.is-loading .btn-spinner { display: inline-block; }
  .btn--submit.is-loading { pointer-events: none; opacity: 0.85; }

  .form-status { min-height: 1.5em; font-size: 0.9rem; font-weight: 600; }
  .form-status.is-ok { color: #3d6b35; }
  .form-status.is-error { color: #a03c1e; }

  .contact-data {
    display: grid;
    gap: 0.9rem;
    margin-top: clamp(2.2rem, 5vh, 3.4rem);
    padding-top: 1.8rem;
    border-top: 1px solid var(--color-line);
  }
  .contact-data li { display: flex; gap: 1.2rem; align-items: baseline; }
  .contact-data-label {
    width: 6.5em;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-sage);
  }

  .map-wrap {
    position: relative;
    height: clamp(420px, 78svh, 720px);
    border-radius: 220px 24px 24px 24px;
    overflow: hidden;
    border: 1px solid var(--color-line);
    background: #d8d2c6;
  }
  .map { position: absolute; inset: 0; }
  .map .leaflet-control-attribution { font-size: 0.62rem; }

  .map-marker-bean {
    display: grid;
    place-items: center;
  }
  .map-marker-bean svg { filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)); }
  .map-marker-pulse {
    position: absolute;
    inset: -14px;
    border: 1px solid rgba(223, 189, 145, 0.8);
    border-radius: 50%;
    animation: marker-pulse 2.4s var(--ease-out) infinite;
  }
  @keyframes marker-pulse {
    0% { transform: scale(0.5); opacity: 0; }
    30% { opacity: 0.9; }
    100% { transform: scale(1.5); opacity: 0; }
  }

  .map-enable {
    position: absolute;
    left: 50%;
    bottom: 1.2rem;
    z-index: 500;
    transform: translateX(-50%);
    padding: 0.75em 1.5em;
    min-height: 44px;
    background: var(--color-ink);
    color: var(--color-paper);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(23, 16, 12, 0.35);
    transition: opacity 0.4s, transform 0.4s;
  }
  .map-enable.is-hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(8px); }

  .map-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 2rem;
    text-align: center;
    background: repeating-linear-gradient(-45deg, #e4ded2 0 14px, #ddd6c8 14px 28px);
    color: var(--color-roast);
  }
  .map-links { margin-top: 1rem; font-size: 0.9rem; }

  /* Marcador Leaflet: reposicionar pulso */
  .leaflet-div-icon { background: transparent; border: 0; }
}

/* ---------------- FOOTER ---------------- */
@layer footer {
  .site-footer {
    position: relative;
    background: var(--color-espresso);
    color: var(--color-milk);
    padding-top: clamp(4rem, 10vh, 8rem);
    overflow: clip;
  }

  .footer-marquee {
    border-block: 1px solid var(--color-line-light);
    padding-block: 0.9rem;
    overflow: hidden;
    margin-bottom: clamp(3.5rem, 9vh, 7rem);
  }
  .marquee-track {
    display: flex;
    width: max-content;
    animation: marquee 46s linear infinite;
  }
  .marquee-track span {
    font-family: var(--font-serif);
    font-size: clamp(0.95rem, 1.6vw, 1.3rem);
    letter-spacing: 0.24em;
    color: rgba(223, 189, 145, 0.55);
    white-space: nowrap;
  }
  @keyframes marquee {
    to { transform: translateX(-50%); }
  }

  .footer-claim {
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: clamp(2.6rem, 7vw, 6.8rem);
    line-height: 0.98;
    letter-spacing: -0.015em;
    color: var(--color-crema);
    margin-bottom: clamp(3.5rem, 9vh, 7rem);
    max-width: 16ch;
  }

  .footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: clamp(2rem, 4vw, 4rem);
    padding-bottom: clamp(3rem, 7vh, 5rem);
    border-bottom: 1px solid var(--color-line-light);
  }
  .brand--footer { font-size: 1.6rem; margin-bottom: 0.6rem; }
  .footer-tag { color: rgba(243, 237, 228, 0.55); font-size: 0.9rem; margin-bottom: 1.6rem; max-width: 26ch; }
  .footer-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-copper);
    margin-bottom: 1.1rem;
  }
  .footer-nav ul, .footer-contact ul, .footer-legal ul { display: grid; gap: 0.55rem; }
  .footer-nav a, .footer-contact a, .footer-legal .link { color: rgba(243, 237, 228, 0.8); font-size: 0.95rem; }
  .footer-contact li { color: rgba(243, 237, 228, 0.8); font-size: 0.95rem; }
  .footer-legal .link-button { font-size: 0.95rem; }
  #back-to-top { color: var(--color-crema); }

  .footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.6rem 2rem;
    padding-block: 1.6rem 2.2rem;
    font-size: 0.78rem;
    color: rgba(243, 237, 228, 0.5);
  }
}

/* ---------------- OVERLAYS ---------------- */
@layer overlays {
  /* Preloader */
  .preloader {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--color-espresso);
    color: var(--color-crema);
  }
  .js .preloader { display: flex; }
  .preloader-inner { display: grid; justify-items: center; gap: 1.4rem; }
  .preloader-logo {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    letter-spacing: 0.3em;
    font-weight: 600;
  }
  .preloader-logo span { color: var(--color-copper); margin-inline: 0.3em; font-weight: 300; }
  .preloader-ring { transform: rotate(0deg); }
  .preloader-pct { font-size: 0.8rem; letter-spacing: 0.2em; color: rgba(223, 189, 145, 0.7); }

  /* Cursor personalizado */
  .cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
  }
  .cursor.is-visible { opacity: 1; }
  .cursor-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-copper);
    transform: translate(-50%, -50%);
    transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out), background-color 0.3s, opacity 0.3s;
  }
  .cursor-badge {
    position: absolute;
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--color-crema);
    color: var(--color-ink);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s var(--ease-out);
  }
  .cursor.is-badge .cursor-badge { transform: translate(-50%, -50%) scale(1); }
  .cursor.is-badge .cursor-dot { opacity: 0; }
  .cursor.is-link .cursor-dot { width: 34px; height: 34px; background: rgba(185, 101, 63, 0.28); }

  /* Lightbox */
  .lightbox {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: grid;
    place-items: center;
  }
  .lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 9, 6, 0.92);
  }
  .lightbox-stage {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 1rem;
    max-width: min(1100px, 92vw);
    max-height: 88svh;
  }
  .lightbox-media {
    display: grid;
    place-items: center;
    max-height: 76svh;
    overflow: hidden;
    border-radius: 8px;
  }
  .lightbox-media img, .lightbox-media video {
    max-width: 100%;
    max-height: 76svh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
  }
  .lightbox-caption {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
    color: var(--color-milk);
  }
  .lightbox-name { font-family: var(--font-serif); font-size: 1.3rem; color: var(--color-crema); }
  .lightbox-text { flex: 1; font-size: 0.9rem; color: rgba(243, 237, 228, 0.7); }
  .lightbox-counter { font-size: 0.85rem; color: var(--color-copper); font-weight: 700; white-space: nowrap; }

  .lightbox-btn {
    position: absolute;
    z-index: 2;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid var(--color-line-light);
    border-radius: 50%;
    color: var(--color-milk);
    background: rgba(23, 16, 12, 0.4);
    transition: background-color 0.3s, transform 0.2s;
  }
  .lightbox-btn:hover { background: var(--color-copper); }
  .lightbox-prev { left: clamp(0.8rem, 3vw, 2.5rem); top: 50%; transform: translateY(-50%); }
  .lightbox-next { right: clamp(0.8rem, 3vw, 2.5rem); top: 50%; transform: translateY(-50%); }
  .lightbox-close { top: clamp(0.8rem, 3vh, 2rem); right: clamp(0.8rem, 3vw, 2.5rem); }

  .lightbox-clone {
    position: fixed;
    z-index: 2300;
    object-fit: cover;
    border-radius: 6px;
    pointer-events: none;
  }

  /* Modal legal */
  .legal-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: grid;
    place-items: center;
    padding: 1.2rem;
  }
  .legal-backdrop { position: absolute; inset: 0; background: rgba(15, 9, 6, 0.7); }
  .legal-panel {
    position: relative;
    width: min(640px, 100%);
    max-height: 84svh;
    overflow-y: auto;
    background: var(--color-paper);
    color: var(--color-ink);
    border-radius: 16px 4px 16px 4px;
    padding: clamp(1.8rem, 4vw, 3rem);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.45);
  }
  .legal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    transition: background-color 0.3s, color 0.3s;
  }
  .legal-close:hover { background: var(--color-ink); color: var(--color-paper); }
  .legal-title {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 1.2rem;
    padding-right: 3rem;
  }
  .legal-body { display: grid; gap: 0.9rem; font-size: 0.95rem; color: rgba(23, 16, 12, 0.84); }
  .legal-note {
    margin-top: 1.6rem;
    padding: 0.9em 1.1em;
    border-left: 3px solid var(--color-copper);
    background: rgba(185, 101, 63, 0.08);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-roast);
  }
}

/* ---------------- MOTION ---------------- */
@layer motion {
  /* Estados iniciales controlados desde JS; aquí solo lo imprescindible */
  .hero-line { will-change: transform; }

  @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;
      scroll-behavior: auto !important;
    }
    .marquee-track { animation: none; transform: none; }
    .scroll-hint-line span { animation: none; }
    .map-marker-pulse { animation: none; opacity: 0.4; transform: none; }
    .faq-panel { transition: none; }
    .cursor { display: none !important; }
  }
}

/* ---------------- ACCESSIBILITY ---------------- */
@layer accessibility {
  @media (hover: none), (pointer: coarse) {
    .cursor { display: none !important; }
  }

  /* El menú móvil y los overlays gestionan el foco desde JS */
  .mobile-menu[hidden], .lightbox[hidden], .legal-modal[hidden] { display: none; }
}

/* ---------------- RESPONSIVE ---------------- */
@layer responsive {
  @media (max-width: 1180px) {
    .section-head .h2 { grid-column: 1 / span 8; }
    .section-head .section-text { grid-column: 8 / span 5; }
    .features-visual { grid-column: 1 / span 5; }
    .features-chapters { grid-column: 6 / span 7; }
  }

  @media (max-width: 1023px) {
    :root { --header-h: 72px; }

    .main-nav { display: none; }
    .header-actions .btn { display: none; }
    .menu-toggle { display: flex; }

    .section-head { grid-template-columns: 1fr; }
    .section-head .h2, .section-head .section-text { grid-column: 1 / -1; }

    .hero-content { grid-template-columns: 1fr; align-content: end; }
    .hero-title { grid-column: 1 / -1; max-width: 12ch; }
    .hero-text { grid-column: 1 / -1; }
    .hero-datum { display: none; }

    /* Slider: scroll-snap nativo en vez de pin */
    .slider-viewport { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    .slider-track { width: max-content; padding-bottom: 0.5rem; }
    .coffee-card {
      scroll-snap-align: center;
      width: min(88vw, 620px);
      height: auto;
      min-height: 0;
      grid-template-columns: 1fr;
      grid-template-rows: 240px auto;
    }
    .coffee-card--b .card-body { order: 0; }
    .coffee-card--b, .coffee-card--c { grid-template-columns: 1fr; }
    .card-body { overflow: visible; }
    .card-media { aspect-ratio: 16 / 10; }

    /* Características: visual compacta sticky arriba */
    .features-layout { grid-template-columns: 1fr; }
    .features-visual {
      grid-column: 1 / -1;
      position: sticky;
      top: var(--header-h);
      z-index: 5;
      height: 42svh;
      min-height: 280px;
      background: var(--color-paper);
      border-bottom: 1px solid var(--color-line);
      padding-block: 0.4rem;
      overflow: hidden;
    }
    .cup-stage {
      grid-template-columns: auto 1fr;
      grid-template-rows: 1fr auto;
      align-items: center;
      column-gap: 1rem;
      max-width: 100%;
      height: 100%;
    }
    .cup-steam { display: none; }
    .cup-scene { width: clamp(110px, 26vw, 160px); grid-row: 1 / span 2; align-self: center; }
    .cup-callouts { display: none; }
    .cup-plate { display: none; }
    .cup-status { text-align: left; margin-top: 0; align-self: end; }
    .cup-name { font-size: 1.35rem; }
    .cup-nav { align-self: start; }
    .cup-nav ul { flex-wrap: wrap; }
    .cup-nav button { min-width: 40px; min-height: 40px; }
    .features-chapters { grid-column: 1 / -1; }
    .chapter { min-height: 0; padding-block: 2.4rem; scroll-margin-top: calc(var(--header-h) + 42svh + 8px); }

    /* FAQ a una columna */
    .faq-layout { grid-template-columns: 1fr; }
    .faq-head { grid-column: 1 / -1; position: static; padding-bottom: 1rem; }
    .faq-list { grid-column: 1 / -1; }
    .faq-deco { font-size: 16rem; opacity: 0.7; }

    /* Galería a dos columnas */
    .gallery-grid { grid-template-columns: repeat(2, 1fr); row-gap: 2.4rem; }
    .g-item { grid-column: auto !important; margin-top: 0 !important; }
    .g-item--7 { grid-column: 1 / -1 !important; }

    /* Contacto a una columna */
    .contact-layout { grid-template-columns: 1fr; row-gap: 3rem; }
    .contact-form-col { grid-column: 1 / -1; }
    .contact-map-col { grid-column: 1 / -1; position: static; }
    .map-wrap { height: 60svh; border-radius: 120px 20px 20px 20px; }

    .footer-grid { grid-template-columns: 1fr 1fr; }
  }

  @media (max-width: 640px) {
    .gallery-grid { grid-template-columns: 1fr; }
    .g-item--7 { grid-column: auto !important; }
    .footer-grid { grid-template-columns: 1fr; }
    .hero-actions .btn { width: 100%; }
    .scroll-hint { display: none; }
    .lightbox-caption { flex-wrap: wrap; gap: 0.3rem 1rem; }
    .slider-arrow { width: 48px; height: 48px; }
  }

  @media (min-width: 1024px) {
    .mobile-menu { display: none !important; }
  }
}
