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

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: auto; }
  body { margin: 0; }
  h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
  ul, ol { padding: 0; list-style: none; }
  button, input, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; }
  img, video { max-width: 100%; display: block; }
  a { color: inherit; }
  :focus { outline: none; }
  :focus-visible {
    outline: 2px solid var(--color-copper);
    outline-offset: 3px;
  }
}

@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);
    --font-serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
    --font-sans: "Manrope", "Segoe UI", sans-serif;
    --step-hero: clamp(4rem, 10vw, 10rem);
    --step-h2: clamp(2.8rem, 6vw, 6.5rem);
    --step-h3: clamp(1.8rem, 3vw, 3.5rem);
    --step-body: clamp(1rem, 1.25vw, 1.2rem);
    --step-small: clamp(0.75rem, 0.82vw, 0.9rem);
    --gutter: clamp(1.15rem, 4vw, 4.5rem);
    --header-h: 4.6rem;
    --header-fg: var(--color-milk);
    --header-bg: transparent;
    --header-line: transparent;
    --max: 1440px;
    --ease-out: cubic-bezier(0.16, 0.84, 0.28, 1);
    --cup-bg: #2a1812;
    --cup-rot: -5deg;
  }
}

@layer base {
  html { scrollbar-gutter: stable; }
  body {
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-sans);
    font-size: var(--step-body);
    font-weight: 400;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
  }
  ::selection { background: var(--color-espresso); color: var(--color-milk); }
  img, video { height: auto; }
  .grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 70;
    opacity: 0.05;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
    background-size: 160px;
  }
  .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;
  }
  body.is-locked { overflow: hidden; }
  #preloader.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@layer typography {
  h1, h2, h3, .logo, .preloader-logo, .footer-logo, .footer-phrase, .cup-name-mask p {
    font-family: var(--font-serif);
    font-weight: 500;
    font-optical-sizing: auto;
    letter-spacing: -0.035em;
  }
  h1 { font-size: var(--step-hero); line-height: 0.9; }
  h2 { font-size: var(--step-h2); line-height: 0.92; }
  h3 { font-size: var(--step-h3); line-height: 0.96; }
  .eyebrow {
    font-family: var(--font-sans);
    font-size: var(--step-small);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-roast);
  }
  .fine, figcaption, .card-facts, .chapter-facts {
    font-size: var(--step-small);
    line-height: 1.5;
    color: var(--color-sage);
  }
}

@layer layout {
  .wrap {
    width: min(var(--max), calc(100% - var(--gutter) * 2));
    margin-inline: auto;
  }
  section[id], .chapter[id], #contenido { scroll-margin-top: 5.4rem; }
  .section-intro { padding-block: clamp(4rem, 9vh, 7.5rem) clamp(1.5rem, 4vh, 3rem); }
  .intro-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(1rem, 3vw, 3rem);
    align-items: end;
  }
  .intro-grid h2 { grid-column: 1 / 8; }
  .intro-grid p { grid-column: 8 / 13; max-width: 36ch; }
}

@layer components {
  .btn, .icon-btn, .text-btn, .nav-toggle, .menu-close, .map-activate {
    min-height: 44px;
    min-width: 44px;
  }
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1.3rem;
    border-radius: 2px;
    text-decoration: none;
    line-height: 1;
    transition: transform 0.45s var(--ease-out), background-color 0.35s ease, color 0.35s ease;
  }
  .btn-fill { background: var(--color-espresso); color: var(--color-crema); }
  .btn-line { border: 1px solid currentColor; background: transparent; }
  .btn-header { background: var(--color-crema); color: var(--color-ink); }
  .text-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0;
    min-height: 44px;
    color: var(--color-roast);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-size: 0 1px;
    background-position: 0 100%;
    transition: background-size 0.45s var(--ease-out);
  }
  .text-btn::after { content: "→"; transition: transform 0.45s var(--ease-out); }
  .text-btn:hover, .text-btn:focus-visible { background-size: 100% 1px; }
  .text-btn:hover::after, .text-btn:focus-visible::after { transform: translateX(4px); }
  .icon-btn {
    display: grid;
    place-items: center;
    width: 44px;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    transition: background-color 0.35s ease;
  }
  .icon-btn:hover, .icon-btn:focus-visible { background: rgba(185, 101, 63, 0.12); }
  .notes { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .notes li {
    border: 1px solid var(--color-line);
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    font-size: var(--step-small);
  }
  .dots, .scale { display: inline-flex; align-items: center; gap: 0.28rem; }
  .dots i, .scale {
    --n: 0;
  }
  .dots i {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    border: 1px solid var(--color-roast);
    display: inline-block;
  }
  .dots[aria-label$="5 de 5"] i,
  .dots[aria-label$="4 de 5"] i:nth-child(-n + 4),
  .dots[aria-label$="3 de 5"] i:nth-child(-n + 3),
  .dots[aria-label$="2 de 5"] i:nth-child(-n + 2) {
    background: var(--color-copper);
    border-color: var(--color-copper);
  }
  .metric, .scales p {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: var(--step-small);
  }
  .scale {
    width: 7.5rem;
    height: 0.35rem;
    background: rgba(23, 16, 12, 0.12);
    border-radius: 99px;
    overflow: hidden;
  }
  .scale i {
    display: block;
    height: 100%;
    width: calc(var(--n) / 5 * 100%);
    background: var(--color-roast);
  }
  .page-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 100dvh;
    z-index: 90;
    background: transparent;
    pointer-events: none;
  }
  .page-progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--color-copper);
    transform: scaleY(0);
    transform-origin: top center;
  }
}

@layer header {
  .skip-link {
    position: absolute;
    left: 1rem;
    top: 0;
    transform: translateY(-120%);
    background: var(--color-crema);
    color: var(--color-ink);
    padding: 0.7rem 1rem;
    z-index: 2000;
  }
  .skip-link:focus { transform: none; }
  .site-header {
    position: fixed;
    top: 0.7rem;
    left: var(--gutter);
    right: var(--gutter);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-height: var(--header-h);
    padding: 0.55rem 0.4rem 0.55rem 0.9rem;
    color: var(--header-fg);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-line);
    border-radius: 2px;
    transition: background-color 0.45s ease, min-height 0.45s ease, transform 0.5s var(--ease-out), border-color 0.45s ease, color 0.2s linear;
  }
  body.is-scrolled .site-header { min-height: 3.6rem; top: 0.4rem; }
  body[data-header-theme="dark"] {
    --header-fg: var(--color-milk);
    --header-bg: transparent;
  }
  body[data-header-theme="light"] {
    --header-fg: var(--color-ink);
  }
  body.is-scrolled[data-header-theme="light"] {
    --header-bg: rgba(247, 243, 236, 0.86);
    --header-line: var(--color-line);
  }
  body.is-scrolled[data-header-theme="dark"] {
    --header-bg: rgba(23, 16, 12, 0.78);
    --header-fg: var(--color-milk);
    --header-line: rgba(243, 237, 228, 0.16);
  }
  body.is-scrolled[data-header-theme="light"] .btn-header {
    background: var(--color-espresso);
    color: var(--color-crema);
  }
  @supports (backdrop-filter: blur(14px)) {
    body.is-scrolled .site-header { backdrop-filter: blur(16px) saturate(1.15); }
  }
  body.header-hidden .site-header { transform: translateY(calc(-100% - 1.2rem)); }
  .logo, .preloader-logo, .footer-logo {
    text-decoration: none;
    letter-spacing: 0.08em;
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .logo span, .preloader-logo span, .footer-logo span { color: var(--color-copper); padding-inline: 0.2rem; }
  .desktop-nav { display: flex; gap: 1.2rem; margin-left: auto; }
  .desktop-nav a, .footer-grid a, .legal-links button, .linkish {
    text-decoration: none;
    font-size: var(--step-small);
    letter-spacing: 0.04em;
    position: relative;
  }
  .desktop-nav a::after, .footer-grid nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -0.3rem;
    width: 100%;
    height: 1px;
    background: var(--color-copper);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s var(--ease-out);
  }
  .desktop-nav a:hover::after,
  .desktop-nav a:focus-visible::after,
  .desktop-nav a[aria-current="true"]::after,
  .footer-grid nav a:hover::after,
  .footer-grid nav a:focus-visible::after { transform: scaleX(1); }
  .nav-toggle, .mobile-menu { display: none; }
  .mobile-menu[hidden] { display: none; }
  .nav-toggle span, .nav-toggle span::before { display: block; }
  .nav-toggle { position: relative; width: 44px; }
  .nav-toggle span {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 1px;
    background: currentColor;
  }
  .nav-toggle span:first-of-type { top: 17px; }
  .nav-toggle span:last-of-type { top: 26px; }
}

@layer hero {
  .hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    color: var(--color-milk);
    background: var(--color-espresso);
    overflow: clip;
  }
  .hero-media, .hero-shade, .hero-canvas, .bean-fallback { position: absolute; inset: 0; }
  .hero-media { overflow: hidden; }
  .hero-media-inner { position: absolute; inset: -8%; transform: scale(1.08); }
  .hero-poster, .hero-video { width: 100%; height: 100%; object-fit: cover; }
  .hero-video { position: absolute; inset: 0; }
  .hero-shade {
    background:
      linear-gradient(90deg, rgba(23, 16, 12, 0.78) 0%, rgba(23, 16, 12, 0.42) 48%, rgba(23, 16, 12, 0.28) 100%),
      linear-gradient(180deg, rgba(23, 16, 12, 0.35), transparent 30%, rgba(23, 16, 12, 0.45));
  }
  .hero-canvas {
    z-index: 2;
    pointer-events: none;
    inset: auto 0 8vh auto;
    width: min(50vw, 820px);
    height: 78svh;
  }
  .bean-fallback { z-index: 2; display: grid; place-items: center; pointer-events: none; }
  .bean-fallback[hidden] { display: none; }
  .bean-css {
    width: min(34vw, 280px);
    height: min(48vw, 390px);
    margin-left: 28vw;
    border-radius: 50%;
    background:
      radial-gradient(circle at 35% 30%, rgba(223, 189, 145, 0.35), transparent 28%),
      radial-gradient(closest-side, #3a241c, #1a0e0a 72%);
    box-shadow: inset 0 0 0 1px rgba(223, 189, 145, 0.25), 0 30px 60px rgba(0, 0, 0, 0.35);
    position: relative;
  }
  .bean-css::after {
    content: "";
    position: absolute;
    left: 48%;
    top: 12%;
    bottom: 12%;
    width: 8px;
    border-radius: 99px;
    background: #120b09;
    transform: translateX(-50%);
  }
  .hero-layout {
    position: relative;
    z-index: 3;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    width: min(var(--max), calc(100% - var(--gutter) * 2));
    margin-inline: auto;
    align-items: end;
    padding-bottom: 14vh;
  }
  .hero-copy { grid-column: 1 / 7; }
  .hero-copy h1 { max-width: none; }
  .hero .line { display: block; overflow: hidden; }
  .hero .line-inner { display: block; }
  .hero-lead { max-width: 38ch; margin-top: 1.4rem; color: var(--color-milk); }
  .hero .eyebrow { color: var(--color-crema); }
  .hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.8rem; }
  .hero .btn-fill { background: var(--color-crema); color: var(--color-ink); }
  .hero-note {
    position: absolute;
    z-index: 3;
    right: var(--gutter);
    bottom: 18vh;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: var(--step-small);
  }
  .scroll-hint {
    position: absolute;
    z-index: 3;
    left: var(--gutter);
    bottom: 6.5rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--color-crema);
    text-decoration: none;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.75rem;
    min-height: 44px;
  }
  .scroll-hint-line { width: 1px; height: 3.2rem; background: var(--color-crema); transform-origin: top; }
  .hero-curve { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 4; height: 12vh; }
  .hero-curve svg { width: 100%; height: 100%; display: block; }
}

@layer slider {
  .cafes { background: var(--color-paper); position: relative; }
  .slider-pin {
    height: 100vh;
    height: 100svh;
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: center;
    padding-top: 4.2rem;
  }
  .slider-viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-color: var(--color-copper) transparent;
    padding-bottom: 0.4rem;
  }
  .slider-track {
    display: flex;
    gap: 2.4vw;
    padding-inline: var(--gutter);
    width: max-content;
  }
  .coffee-card {
    flex: 0 0 88vw;
    scroll-snap-align: center;
    height: min(70svh, calc(100svh - 9rem));
    background: var(--color-milk);
    border: 1px solid var(--color-line);
    display: grid;
    position: relative;
    container-type: inline-size;
    overflow: hidden;
    perspective: 900px;
  }
  .card-media { position: relative; overflow: hidden; background: #d9cbb8; min-height: 16rem; }
  .card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease-out); }
  .card-copy { padding: clamp(1rem, 2vw, 2rem); display: flex; flex-direction: column; gap: 0.75rem; position: relative; z-index: 1; }
  .card-index { font-family: var(--font-serif); font-size: clamp(2rem, 4vw, 4rem); line-height: 0.9; color: var(--color-copper); }
  .card-phrase { font-family: var(--font-serif); font-size: clamp(1.4rem, 2vw, 2.1rem); line-height: 1.05; }
  .card-facts { display: grid; gap: 0.45rem; }
  .card-facts div { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--color-line); padding-top: 0.35rem; }
  .card-facts dt { color: var(--color-sage); }
  .card-facts dd { margin: 0; text-align: right; }
  .card-kicker { letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.75rem; color: var(--color-roast); }
  .card-stat { font-family: var(--font-serif); font-size: clamp(2.4rem, 5vw, 4.5rem); line-height: 0.9; }
  .card-a { grid-template-columns: 1fr 1.2fr; }
  .card-b { grid-template-columns: 1.15fr 0.85fr; background: var(--color-espresso); color: var(--color-milk); }
  .card-b .fine, .card-b .card-facts { color: var(--color-crema); }
  .card-b .text-btn { color: var(--color-crema); }
  .card-c { grid-template-rows: 1.15fr 0.85fr; }
  .card-c .card-facts-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-d { grid-template-columns: 0.9fr 1.1fr; }
  .card-tab {
    position: absolute;
    right: 0;
    top: 12%;
    writing-mode: vertical-rl;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
    padding: 0.8rem 0.35rem;
    background: var(--color-espresso);
    color: var(--color-crema);
  }
  .card-e { grid-template-columns: 0.8fr 1.2fr; }
  .card-f { grid-template-columns: 0.7fr 1fr 0.8fr; align-items: center; background: transparent; border: 0; }
  .card-f .card-media { aspect-ratio: 4/5; border: 1px solid var(--color-line); }
  .card-g { color: var(--color-milk); }
  .card-g .card-media { position: absolute; inset: 0; }
  .card-g .card-copy {
    position: relative;
    margin-top: auto;
    background: linear-gradient(transparent, rgba(23, 16, 12, 0.82));
    height: 100%;
    justify-content: flex-end;
  }
  .card-g .fine, .card-g .card-facts { color: var(--color-crema); }
  .card-g .text-btn { color: var(--color-crema); }
  .slider-ui {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.8rem var(--gutter) 1rem;
  }
  .slider-arrows { display: flex; gap: 0.4rem; }
  .slider-count { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; }
  .slider-progress { height: 1px; background: var(--color-line); }
  .slider-progress span { display: block; height: 100%; width: 14%; background: var(--color-copper); transform-origin: left; }
  .slider-dots { display: flex; gap: 0.35rem; }
  .slider-dots button {
    width: 44px;
    height: 44px;
    position: relative;
  }
  .slider-dots button::before {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    top: 21px;
    height: 2px;
    background: var(--color-line);
  }
  .slider-dots button[aria-current="true"]::before { background: var(--color-copper); }
  .slider-handoff {
    display: grid;
    justify-items: center;
    gap: 0.8rem;
    padding: 1.5rem 0 3rem;
  }
  .handoff-line {
    width: 1px;
    height: 12vh;
    background: var(--color-copper);
    transform: scaleY(0.25);
    transform-origin: top;
  }
  html.is-slider-pin .slider-viewport { overflow: hidden; scroll-snap-type: none; }
  html.is-slider-pin .coffee-card { flex-basis: 68vw; opacity: 0.78; transform: scale(0.92); transition: transform 0.55s var(--ease-out), opacity 0.55s ease; }
  html.is-slider-pin .coffee-card.is-active { opacity: 1; transform: none; }
}

@layer features {
  .features { background: var(--color-paper); position: relative; }
  .features-layout {
    display: grid;
    grid-template-columns: minmax(0, 46%) minmax(0, 54%);
    align-items: start;
  }
  .features-visual {
    position: sticky;
    top: 4.6rem;
    height: calc(100svh - 4.6rem);
    background: var(--cup-bg);
    color: var(--color-milk);
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 1.4rem 1.2rem 1rem;
    overflow: hidden;
  }
  .cup-meta { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; }
  .cup-count { writing-mode: vertical-rl; letter-spacing: 0.16em; font-size: 0.78rem; }
  .cup-name-mask { overflow: hidden; flex: 1; }
  .cup-name-mask p { font-size: clamp(2rem, 3vw, 3.2rem); line-height: 0.95; }
  .cup-ratio { font-size: var(--step-small); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-crema); }
  .cup-scene { position: relative; display: grid; place-items: center; perspective: 900px; }
  .cup {
    width: min(250px, 46%);
    height: min(340px, 58%);
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(12deg) rotateY(var(--cup-rot));
  }
  .cup-body {
    position: absolute;
    inset: 8% 10% 16%;
    border-radius: 12px 12px 46% 46% / 10px 10px 16% 16%;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(255,255,255,0.16), transparent 22% 70%, rgba(0,0,0,0.2));
    border: 1px solid rgba(243, 237, 228, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.18);
  }
  .layer-air { flex: 1 1 auto; }
  .layer-foam, .layer-milk, .layer-water, .layer-coffee { width: 100%; flex: 0 0 auto; }
  .layer-foam { background: #e7d2ae; }
  .layer-milk { background: #f3e6d4; }
  .layer-water { background: rgba(214, 196, 176, 0.85); }
  .layer-coffee { background: #3b2419; }
  .cup-rim {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 4%;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(243, 237, 228, 0.55);
    background: rgba(255,255,255,0.06);
  }
  .cup-highlight {
    position: absolute;
    left: 18%;
    top: 14%;
    bottom: 22%;
    width: 10px;
    background: linear-gradient(rgba(255,255,255,0.28), transparent);
    border-radius: 99px;
    pointer-events: none;
  }
  .cup-handle {
    position: absolute;
    right: -6%;
    top: 28%;
    width: 28%;
    height: 32%;
    border: 3px solid rgba(243, 237, 228, 0.55);
    border-left: 0;
    border-radius: 0 40px 40px 0;
  }
  .cup-saucer {
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: 6%;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(243,237,228,0.35), rgba(243,237,228,0.05) 70%);
  }
  .cup-shadow {
    position: absolute;
    left: 5%;
    right: 5%;
    bottom: 0;
    height: 16px;
    border-radius: 50%;
    background: rgba(0,0,0,0.35);
    filter: blur(2px);
  }
  .ice { position: absolute; inset: 18% 16% auto; display: flex; gap: 6px; }
  .ice[hidden] { display: none; }
  .ice span {
    width: 28px;
    height: 22px;
    background: rgba(220, 236, 242, 0.55);
    border: 1px solid rgba(255,255,255,0.7);
    transform: rotate(18deg);
  }
  .is-glass .cup-body { background-color: rgba(255,255,255,0.04); border-color: rgba(210, 230, 236, 0.55); }
  .is-glass .cup-handle { opacity: 0; }
  .steam { position: absolute; width: min(180px, 40%); top: 0; height: 28%; }
  .steam path { fill: none; stroke: rgba(243, 237, 228, 0.55); stroke-width: 1.4; }
  .callouts { position: absolute; inset: 8% 0; width: 100%; height: 80%; pointer-events: none; }
  .callouts path { fill: none; stroke: rgba(223, 189, 145, 0.8); stroke-width: 1; }
  .callout-labels { position: absolute; inset: 0; pointer-events: none; font-size: 0.75rem; }
  .callout-labels li:first-child { position: absolute; right: 6%; top: 22%; }
  .callout-labels li:last-child { position: absolute; left: 6%; bottom: 28%; }
  .callout-labels small { display: block; color: var(--color-crema); }
  .feature-nav { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.2rem; }
  .feature-nav a {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-inline: 0.55rem;
    text-decoration: none;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid transparent;
  }
  .feature-nav a[aria-current="true"] { border-color: var(--color-copper); color: var(--color-crema); }
  .chapters { padding: 0 var(--gutter) 8vh 6vw; }
  .chapter { min-height: 85svh; padding: 8vh 0 12vh; display: grid; align-content: center; gap: 1rem; max-width: 38rem; }
  .chapter-index { font-family: var(--font-serif); font-size: clamp(3rem, 6vw, 5rem); line-height: 0.85; color: transparent; -webkit-text-stroke: 1px var(--color-roast); }
  .chapter-facts { display: grid; gap: 0.55rem; }
  .chapter-facts div { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; border-top: 1px solid var(--color-line); padding-top: 0.45rem; }
  .chapter-facts dt { color: var(--color-sage); font-size: var(--step-small); }
  .chapter-facts dd { margin: 0; }
  .chapter.is-targeted { box-shadow: inset 2px 0 0 var(--color-copper); padding-left: 1rem; }
  .moment { font-family: var(--font-serif); font-style: italic; font-size: 1.35rem; line-height: 1.25; }
  .steam-bridge { height: 28vh; display: grid; place-items: center; margin-top: -8vh; }
  .steam-bridge svg { height: 100%; }
  .steam-bridge path { fill: none; stroke: var(--color-copper); stroke-width: 1.2; opacity: 0.7; }
}

@layer faq {
  .faq { position: relative; background: var(--color-paper); }
  .faq-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(1.5rem, 4vw, 4rem);
    padding-bottom: clamp(4rem, 10vh, 8rem);
    position: relative;
    z-index: 1;
  }
  .faq-intro { position: sticky; top: 6.5rem; align-self: start; }
  .faq-intro h2 { margin-top: 0.6rem; }
  .faq-intro p:last-child { margin-top: 1rem; max-width: 32ch; }
  .mask-title { overflow: hidden; }
  .mask-title span { display: block; }
  .faq-mark {
    position: absolute;
    right: 0;
    top: 6vh;
    font-family: var(--font-serif);
    font-size: min(22vw, 16rem);
    line-height: 0.8;
    color: rgba(185, 101, 63, 0.13);
    z-index: 0;
    pointer-events: none;
  }
  .acc-item { border-top: 1px solid var(--color-line); }
  .acc-item:last-child { border-bottom: 1px solid var(--color-line); }
  .acc-item h3 { font-size: 1.15rem; letter-spacing: 0; font-family: var(--font-sans); font-weight: 500; }
  .acc-item button {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    text-align: left;
    padding: 1.1rem 0.2rem;
    min-height: 64px;
  }
  .acc-num { font-variant-numeric: tabular-nums; color: var(--color-sage); transition: color 0.35s ease; }
  .acc-item.is-open .acc-num { color: var(--color-copper); }
  .acc-item.is-open { background: rgba(185, 101, 63, 0.05); }
  .acc-item.is-open { box-shadow: inset 0 -2px 0 var(--color-roast); }
  .acc-icon { width: 16px; height: 16px; position: relative; }
  .acc-icon::before, .acc-icon::after {
    content: "";
    position: absolute;
    background: currentColor;
    inset: 7px 0 auto;
    height: 1px;
  }
  .acc-icon::after { transform: rotate(90deg); transition: transform 0.45s var(--ease-out); }
  .acc-item.is-open .acc-icon::after { transform: rotate(0deg); }
  .acc-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s var(--ease-out); }
  .acc-panel.is-open { grid-template-rows: 1fr; }
  .acc-panel-inner { overflow: hidden; }
  .acc-panel-inner p { padding: 0 0.2rem 1.3rem 2.6rem; max-width: 62ch; }
  .no-js .acc-panel { grid-template-rows: 1fr; }
}

@layer gallery {
  .gallery { background: var(--color-espresso); color: var(--color-milk); position: relative; }
  .gallery .eyebrow { color: var(--color-crema); }
  .gallery .fine, .gallery figcaption { color: var(--color-crema); }
  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(0.8rem, 1.5vw, 1.4rem);
    padding-bottom: 10vh;
  }
  .g1 { grid-column: 1 / 5; }
  .g2 { grid-column: 5 / 9; align-self: end; }
  .g3 { grid-column: 9 / 13; }
  .g4 { grid-column: 1 / 6; }
  .g5 { grid-column: 6 / 13; margin-top: -6vh; }
  .g6 { grid-column: 2 / 6; }
  .g7 { grid-column: 6 / 9; }
  .g8 { grid-column: 9 / 13; margin-top: 8vh; }
  .g9 { grid-column: 3 / 11; }
  .shot-open { display: block; width: 100%; padding: 0; color: inherit; text-align: left; }
  .shot-mask { display: block; overflow: hidden; background: #3a2a22; width: 100%; }
  .shot-parallax { display: block; height: 114%; }
  .shot-parallax img, .shot-parallax video { width: 100%; height: 100%; object-fit: cover; }
  .g7 video { object-position: 50% 72%; transform: scale(1.25); }
  .shot figcaption { display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.55rem; font-size: 0.8rem; }
  .gallery-curve { height: 14vh; margin-top: -2px; }
  .gallery-curve svg { width: 100%; height: 100%; display: block; }
  @media (hover: hover) and (pointer: fine) {
    .shot-parallax img { transition: transform 0.7s var(--ease-out); }
    .shot:hover img { transform: scale(1.04); }
  }
}

@layer contact {
  .contact {
    position: relative;
    z-index: 2;
    background: var(--color-paper);
    padding-bottom: 12vh;
    box-shadow: 0 28px 50px rgba(23, 16, 12, 0.18);
  }
  .contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: clamp(1.5rem, 4vw, 4rem);
    align-items: start;
  }
  .contact-lead { max-width: 38ch; margin: 1rem 0 1.6rem; }
  .field { position: relative; margin-bottom: 1.15rem; }
  .field input, .field textarea, .field select {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--color-line);
    border-radius: 0;
    padding: 1.35rem 0 0.55rem;
    min-height: 52px;
  }
  .field textarea { min-height: 8.5rem; max-height: 16rem; resize: vertical; }
  .field label {
    position: absolute;
    left: 0;
    top: 1.15rem;
    color: var(--color-sage);
    transition: transform 0.35s var(--ease-out), font-size 0.35s ease;
    pointer-events: none;
  }
  .field:not(.field-check) input:focus + label,
  .field:not(.field-check) input:not(:placeholder-shown) + label,
  .field textarea:focus + label,
  .field textarea:not(:placeholder-shown) + label {
    transform: translateY(-0.95rem);
    font-size: 0.75rem;
  }
  .field-select label { position: static; display: block; margin-bottom: 0.3rem; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
  .field.is-invalid input, .field.is-invalid textarea, .field.is-invalid select { border-bottom-color: #8c2f2f; }
  .field.is-valid input, .field.is-valid textarea, .field.is-valid select { border-bottom-color: var(--color-roast); }
  .field-error { min-height: 1.1em; color: #8c2f2f; font-size: 0.78rem; margin-top: 0.25rem; }
  .field-check { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.7rem; align-items: start; }
  .field-check input { width: 1.15rem; height: 1.15rem; margin-top: 0.25rem; accent-color: var(--color-roast); }
  .field-check label { position: static; pointer-events: auto; }
  .field-check .linkish { grid-column: 2; justify-self: start; padding: 0; min-height: 44px; color: var(--color-roast); text-decoration: underline; text-underline-offset: 0.2em; }
  .field input:disabled, .field textarea:disabled, .field select:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; }
  .form-status { min-height: 1.5em; margin-top: 0.8rem; }
  .btn-submit.is-loading .btn-label { opacity: 0.7; }
  .btn-submit.is-ready { background: var(--color-roast); }
  .contact-meta { display: flex; flex-wrap: wrap; gap: 0.8rem 1.4rem; margin-top: 1.6rem; }
  .contact-meta a { text-underline-offset: 0.2em; }
  .map-column { position: sticky; top: 5.5rem; }
  .map-frame {
    position: relative;
    min-height: 78svh;
    height: 82svh;
    background:
      linear-gradient(160deg, rgba(41, 23, 16, 0.18), transparent 40%),
      var(--color-crema);
    clip-path: polygon(8% 0, 100% 0, 100% 88%, 92% 100%, 0 100%, 0 10%);
  }
  #map { position: absolute; inset: 0; background: #e7dccb; }
  .map-activate {
    position: absolute;
    z-index: 500;
    left: 1rem;
    bottom: 4.8rem;
    background: var(--color-espresso);
    color: var(--color-crema);
    padding: 0.55rem 0.8rem;
    border-radius: 2px;
  }
  .map-card {
    position: absolute;
    z-index: 500;
    left: 1rem;
    top: 1rem;
    max-width: 16rem;
    background: rgba(247, 243, 236, 0.92);
    padding: 0.8rem 0.9rem;
    display: grid;
    gap: 0.25rem;
    font-size: var(--step-small);
  }
  .map-card a { color: var(--color-roast); }
  .leaflet-container { font-family: var(--font-sans); background: #e7dccb; }
  .bean-marker { background: none; border: none; }
  .bean-pin {
    width: 22px;
    height: 30px;
    display: block;
    margin: 4px auto 0;
    border-radius: 50% 50% 50% 50%;
    background: radial-gradient(circle at 35% 30%, #dfbd91, #291710 62%);
    position: relative;
    box-shadow: 0 8px 14px rgba(23, 16, 12, 0.35);
  }
  .bean-pin::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 15%;
    bottom: 15%;
    width: 2px;
    background: #140c09;
    transform: translateX(-50%);
  }
  .bean-pin-pulse {
    position: absolute;
    inset: -8px;
    border: 1px solid var(--color-copper);
    border-radius: 50%;
    animation: pulse 1.4s ease-out 2;
  }
}

@layer footer {
  .site-footer {
    position: relative;
    z-index: 1;
    background: var(--color-espresso);
    color: var(--color-crema);
    margin-top: -8vh;
    padding-top: 16vh;
    padding-bottom: 3rem;
  }
  .marquee { overflow: hidden; border-top: 1px solid rgba(223, 189, 145, 0.25); border-bottom: 1px solid rgba(223, 189, 145, 0.25); }
  .marquee-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
  .marquee span { padding: 0.7rem 0; letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.78rem; white-space: nowrap; }
  .footer-logo { font-size: clamp(3rem, 10vw, 8rem); line-height: 0.9; color: var(--color-milk); margin-top: 1.5rem; }
  .footer-phrase { font-size: clamp(1.8rem, 4vw, 3.4rem); line-height: 1; max-width: 16ch; margin: 1rem 0 2rem; color: var(--color-milk); }
  .footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 1.5rem; align-items: start; padding-top: 1.2rem; border-top: 1px solid rgba(223, 189, 145, 0.25); }
  .footer-grid nav, .legal-links { display: grid; gap: 0.35rem; justify-items: start; }
  .legal-links button { color: var(--color-crema); min-height: 44px; text-align: left; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-color: transparent; transition: text-decoration-color 0.35s ease; }
  .legal-links button:hover, .legal-links button:focus-visible { text-decoration-color: var(--color-copper); }
  .to-top {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(223, 189, 145, 0.4);
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-decoration: none;
    font-size: 1.2rem;
  }
  .footer-copy, .site-footer .fine { margin-top: 1.4rem; color: rgba(223, 189, 145, 0.8); }
  .js .legal-sources { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .no-js .legal-sources { margin-top: 2rem; display: grid; gap: 1rem; }
  .no-js .legal-sources article { border-top: 1px solid rgba(223, 189, 145, 0.3); padding-top: 0.8rem; }
}

@layer overlays {
  #preloader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--color-espresso);
    color: var(--color-milk);
    display: grid;
    place-items: center;
  }
  .preloader-inner { text-align: center; display: grid; justify-items: center; gap: 0.8rem; }
  .preloader-logo { font-size: clamp(1.6rem, 4vw, 2.6rem); letter-spacing: 0.12em; }
  .preloader-ring { width: 84px; height: 84px; }
  .preloader-ring circle {
    fill: none;
    stroke: var(--color-crema);
    stroke-width: 1;
    stroke-dasharray: 176;
    stroke-dashoffset: 176;
    transform-origin: 40px 40px;
    animation: spin 1.6s linear infinite;
  }
  .preloader-percent { font-variant-numeric: tabular-nums; letter-spacing: 0.14em; font-size: 0.78rem; }
  .mobile-menu {
    position: fixed;
    inset: 0;
    background: var(--color-espresso);
    color: var(--color-milk);
    z-index: 180;
    padding: 1.2rem var(--gutter) 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  .mobile-menu[hidden] { display: none; }
  .mobile-menu[hidden] { display: none; }
  .mobile-menu-bar { display: flex; justify-content: space-between; align-items: center; }
  .menu-close { color: var(--color-crema); min-width: 44px; }
  .mobile-menu nav { display: grid; gap: 0.4rem; }
  .mobile-menu nav a {
    font-family: var(--font-serif);
    font-size: clamp(2.2rem, 8vw, 4rem);
    text-decoration: none;
    line-height: 0.95;
    display: flex;
    gap: 0.8rem;
    align-items: baseline;
  }
  .mobile-menu nav span { font-family: var(--font-sans); font-size: 0.8rem; letter-spacing: 0.12em; color: var(--color-crema); }
  .lightbox, .legal-dialog {
    position: fixed;
    inset: 0;
    z-index: 400;
  }
  .legal-dialog { z-index: 460; }
  .lightbox[hidden], .legal-dialog[hidden] { display: none; }
  .lightbox-backdrop, .legal-backdrop { position: absolute; inset: 0; background: rgba(17, 10, 8, 0.86); }
  .lightbox-fly {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2;
    background-size: cover;
    background-position: center;
    pointer-events: none;
  }
  .lightbox-figure {
    position: relative;
    z-index: 3;
    width: min(1100px, calc(100% - 8rem));
    margin: 6vh auto 0;
    color: var(--color-milk);
  }
  .lightbox-figure img, .lightbox-figure video {
    width: 100%;
    max-height: 72svh;
    object-fit: contain;
    margin-inline: auto;
    background: #1a100c;
  }
  .lightbox-figure img[hidden], .lightbox-figure video[hidden] { display: none; }
  .lightbox-figure figcaption { display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.7rem; }
  .lightbox-figure h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); }
  .lightbox-count { position: absolute; left: 1.2rem; bottom: 1.2rem; z-index: 4; letter-spacing: 0.12em; }
  .lightbox-prev, .lightbox-next, .lightbox-close, .legal-panel .icon-btn {
    position: absolute;
    z-index: 5;
    background: var(--color-paper);
    color: var(--color-ink);
  }
  .lightbox-prev { left: 1rem; top: 50%; }
  .lightbox-next { right: 1rem; top: 50%; }
  .lightbox-close { top: 1rem; right: 1rem; }
  .legal-panel {
    position: relative;
    z-index: 2;
    width: min(640px, calc(100% - 2rem));
    max-height: min(80svh, 720px);
    margin: 10vh auto;
    background: var(--color-paper);
    color: var(--color-ink);
    padding: 1.2rem 1.2rem 1.4rem;
    display: grid;
    grid-template-rows: auto 1fr;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  }
  .legal-panel header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
  .legal-panel .icon-btn { position: static; }
  .legal-body { overflow: auto; padding-right: 0.4rem; display: grid; gap: 0.8rem; margin-top: 0.8rem; }
  .cursor {
    position: fixed;
    left: 0;
    top: 0;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 1px solid var(--color-ink);
    border-radius: 50%;
    pointer-events: none;
    z-index: 120;
    display: none;
    mix-blend-mode: difference;
    color: #fff;
    transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out), margin 0.35s var(--ease-out), opacity 0.3s ease;
  }
  .cursor-label {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }
  html.has-cursor .cursor { display: block; }
  html.has-cursor .cursor.is-link { width: 36px; height: 36px; margin: -18px 0 0 -18px; }
  html.has-cursor .cursor.is-open, html.has-cursor .cursor.is-drag { width: 84px; height: 84px; margin: -42px 0 0 -42px; }
  html.has-cursor .cursor.is-off { opacity: 0; }
}

@layer motion {
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes marquee { to { transform: translateX(-50%); } }
  @keyframes pulse {
    from { transform: scale(0.6); opacity: 0.8; }
    to { transform: scale(1.8); opacity: 0; }
  }
  @media (prefers-reduced-motion: no-preference) {
    .scroll-hint-line { animation: hint 1.8s ease-in-out infinite; }
  }
  @keyframes hint {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
  }
}

@layer accessibility {
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .hero-media-inner, .coffee-card, .marquee-track, .bean-pin-pulse, .scroll-hint-line, .preloader-ring circle {
      animation: none !important;
      transform: none;
    }
    .acc-panel, .site-header, .btn, .text-btn::after { transition: none; }
    .handoff-line { transform: none; }
  }
}

@layer responsive {
  @media (max-width: 1023px) {
    .desktop-nav, .btn-header, .page-progress { display: none; }
    .nav-toggle { display: block; margin-left: auto; }
    .features-layout, .faq-layout, .contact-layout, .footer-grid, .intro-grid { grid-template-columns: 1fr; }
    .intro-grid h2, .intro-grid p { grid-column: auto; }
    .features-visual {
      position: sticky;
      top: 4.2rem;
      height: 42svh;
      z-index: 3;
    }
    .chapters { padding: 0 var(--gutter) 4rem; }
    .chapter { min-height: 0; padding: 3.5rem 0; scroll-margin-top: calc(4.5rem + 42svh); }
    .faq-intro { position: static; }
    .map-column { position: static; }
    .map-frame { height: 60svh; min-height: 55svh; clip-path: none; }
    .hero-copy { grid-column: 1 / -1; align-self: start; padding-top: 16vh; }
    .hero-canvas { width: 34vw; height: 22svh; bottom: -1.2rem; right: -8vw; top: auto; }
    .card-a, .card-b, .card-c, .card-d, .card-e, .card-f { grid-template-columns: 1fr; grid-template-rows: auto; }
    .card-f .card-index { grid-row: 1; }
    .card-tab { display: none; }
    html.is-slider-pin .coffee-card, .coffee-card { opacity: 1; transform: none; height: auto; min-height: 0; }
    .card-g { min-height: 72svh; }
    .g5, .g8 { margin-top: 0; }
    .gallery-grid { grid-template-columns: 1fr 1fr; }
    .g1, .g4, .g7, .g9 { grid-column: 1 / -1; }
    .g2, .g3, .g5, .g6, .g8 { grid-column: span 1; }
  }
  @media (max-width: 767px) {
    html { scrollbar-gutter: auto; }
    .hero-note { display: none; }
    .footer-logo { font-size: clamp(2.3rem, 12vw, 4.2rem); letter-spacing: 0.02em; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .card-c .card-facts-row, .chapter-facts div { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .lightbox-figure { width: calc(100% - 1.5rem); margin-top: 12vh; }
    .lightbox-prev { left: 0.4rem; }
    .lightbox-next { right: 0.4rem; }
    .slider-ui { grid-template-columns: auto 1fr auto; }
    .slider-dots { display: none; }
  }
  @media (max-width: 479px) {
    .gallery-grid { grid-template-columns: 1fr; }
    .g1, .g2, .g3, .g4, .g5, .g6, .g7, .g8, .g9 { grid-column: 1 / -1; }
    .coffee-card { flex-basis: 90vw; }
    .cup { width: 150px; height: 210px; }
  }
  @media (min-width: 1024px) {
    .coffee-card { flex-basis: 68vw; }
  }
  @media (min-width: 1440px) {
    .hero { min-height: 108svh; }
    .hero-layout { min-height: 108svh; }
  }
  @container (max-width: 640px) {
    .card-a, .card-b, .card-d, .card-e { grid-template-columns: 1fr; }
    .card-media { min-height: 42cqw; }
  }
}
