/* Base */
html {
  scroll-behavior: smooth;
}

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background: linear-gradient(180deg, #F8F8F6 0%, #F0F1ED 100%) fixed;
}

/* Subtle dot-grid texture, lifted from the brand deck, faded at the edges.
   Lives on a ::before layer (not the section itself) so the fade mask only
   touches the decorative pattern, never the real content stacked above it. */
.dot-grid {
  position: relative;
}
.dot-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(30, 31, 27, 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 92%);
  mask-image: linear-gradient(to bottom, black 40%, transparent 92%);
}

/* Navbar goes glass once the page scrolls past the hero */
#navbar.scrolled {
  background: rgba(248, 248, 246, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(30, 31, 27, 0.08);
  box-shadow: 0 1px 0 rgba(30, 31, 27, 0.03);
}

::selection {
  background: rgba(78, 174, 82, 0.25);
  color: #17614F;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #F0F1ED;
}

::-webkit-scrollbar-thumb {
  background: rgba(34, 122, 102, 0.3);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 122, 102, 0.5);
}

/* Cursor-reactive glow: heavy damping in JS makes it drift, not snap - the site's "alivio" made literal */
#spotlight {
  position: fixed;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  background: radial-gradient(700px circle at var(--sx, 50%) var(--sy, 20%), rgba(78, 174, 82, 0.12), transparent 70%);
}

/* Ambient blob drift - slow, uneven durations so they never sync up */
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -40px) scale(1.06); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, 45px) scale(1.08); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(35px, 55px) scale(1.04); }
}
.blob-1 { animation: drift1 23s ease-in-out infinite; }
.blob-2 { animation: drift2 29s ease-in-out infinite; }
.blob-3 { animation: drift3 35s ease-in-out infinite; }

/* Scroll-reveal elements: hidden until JS adds .in-view */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Promo video: the clip in a glass frame, between Producto and Vista previa =====
   Same bezel as .stage-frame (glass rim, concentric corners: 16px screen + 6px rim = 22px,
   shadows tinted with the dark green) on its own classes, so the two never affect each other.
   No backdrop effect anywhere and only transform and opacity ever animate, because a video is
   playing inside. Without JS this is a plain video with native controls and its poster:
   js/script.js un-hides .promo-ui and drops the native controls once everything is wired. */
.promo-stage {
  position: relative;
  isolation: isolate;
}
/* Short landscape screens (a phone on its side): a 16:9 frame at full width is taller than what is
   left under the fixed header, so the picture and its controls could never be seen together. Cap the
   width so the whole frame fits: viewport height minus 7rem is the picture's height, and 14px is the
   bezel. An engine without svh or min() drops the declaration and keeps the normal width. */
@media (orientation: landscape) and (max-height: 560px) {
  .promo-stage {
    max-width: min(64rem, calc((100svh - 7rem) * 16 / 9 + 14px));
  }
}

/* Very soft static glow that lifts the frame off the gray page. A plain gradient: no blur layer.
   It only bleeds sideways where the margins are wide enough to hold it, so it can never add a
   sideways scrollbar on narrower screens. */
.promo-stage::before {
  content: "";
  position: absolute;
  inset: -14% 0 -20%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(154, 213, 124, 0.28), rgba(154, 213, 124, 0));
}
@media (min-width: 1280px) {
  .promo-stage::before {
    inset: -14% -8% -20%;
  }
}

.promo-frame {
  position: relative;
  padding: 6px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.46));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(15, 74, 61, 0.06),
    0 3px 6px rgba(15, 74, 61, 0.07),
    0 16px 30px -8px rgba(15, 74, 61, 0.18),
    0 36px 70px -18px rgba(15, 74, 61, 0.3);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
/* The deeper shadow of the hover lift sits on its own layer and only fades in: animating a shadow
   itself would repaint it on every frame. Outer shadows are never drawn inside the border box,
   so the translucent rim shows nothing through. */
.promo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow:
    0 6px 10px rgba(15, 74, 61, 0.06),
    0 24px 44px -8px rgba(15, 74, 61, 0.2),
    0 52px 96px -18px rgba(15, 74, 61, 0.32);
  transition: opacity 0.45s ease;
}

/* The screen clips the video and the controls to the 16px corners (the stacking context keeps Safari
   from letting a playing video poke out of the rounded clip). --promo-edge is the gap between the
   controls and the picture's edge. */
.promo-screen {
  --promo-edge: 14px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 16px;
  background: #0f1411;
  box-shadow: 0 0 0 1px rgba(30, 31, 27, 0.07);
  touch-action: manipulation;
}
/* The 16:9 box is reserved by the width and height attributes and again by aspect-ratio, so
   nothing moves when the poster or the clip arrives. "contain" never crops, whatever the source. */
.promo-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0f1411;
}
.promo.is-live .promo-video {
  cursor: pointer;
}

/* Controls: a solid translucent dark fill behind white icons, so they read over any frame of the
   clip. No backdrop effect: that would be re-blurred on every video frame. Both are 44px or more
   high, the size of a comfortable touch target. */
.promo-btn {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  color: #fff;
  background-color: rgba(13, 21, 17, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 2px 10px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.2s ease;
}
/* Site-green focus ring with a white gap, so it shows on dark and on bright frames alike.
   The outline, not the shadow, is what forced-colors modes still paint. */
.promo-btn:focus-visible {
  outline: 2px solid #359463;
  outline-offset: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 0 2px #fff;
}
.promo-btn:active {
  transform: scale(0.96);
}

.promo-ico {
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
.promo-ico-pause,
.promo-ico-sound-on {
  display: none;
}
.promo[data-state="playing"] .promo-ico-play {
  display: none;
}
.promo[data-state="playing"] .promo-ico-pause {
  display: block;
}

/* Play and pause: bottom left, a 44px disc. Before the clip has ever played (data-state="idle")
   the same button becomes the big centered play button over the poster. The clamp sizes it with
   the screen: 88px on wide ones, smaller on a phone, where the 16:9 picture is only about 170px
   high and the sound pill sits right below the centre. */
.promo-toggle {
  left: var(--promo-edge);
  bottom: var(--promo-edge);
  width: 44px;
  height: 44px;
}
.promo[data-state="idle"] .promo-toggle {
  inset: 0;
  margin: auto;
  width: clamp(56px, 18vw, 88px);
  height: clamp(56px, 18vw, 88px);
  background-color: #17614f;
  background-image: linear-gradient(145deg, #227a66, #0f4a3d);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 14px 36px rgba(0, 0, 0, 0.4);
}
.promo[data-state="idle"] .promo-toggle:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 0 2px #fff;
}
.promo[data-state="idle"] .promo-toggle .promo-ico {
  width: clamp(24px, 7.2vw, 36px);
  height: clamp(24px, 7.2vw, 36px);
  margin-left: 3px;
}

/* Sound: bottom right. While muted it carries a text label, because the clip has a soundtrack
   worth turning on; with sound on it shrinks to a plain 44px disc. */
.promo-sound {
  right: var(--promo-edge);
  bottom: var(--promo-edge);
  min-width: 44px;
  height: 44px;
  gap: 8px;
  padding: 0 16px 0 13px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.promo-sound[data-sound="on"] {
  width: 44px;
  padding: 0;
}
.promo-sound[data-sound="on"] .promo-sound-label {
  display: none;
}
.promo-sound[data-sound="on"] .promo-ico-sound-off {
  display: none;
}
.promo-sound[data-sound="on"] .promo-ico-sound-on {
  display: block;
}
@media (max-width: 479px) {
  .promo-screen {
    --promo-edge: 10px;
  }
  .promo-sound {
    gap: 6px;
    padding: 0 13px 0 10px;
    font-size: 0.75rem;
  }
  /* Before it plays, the big disc sits a little above the centre, so on a narrow picture it never
     touches the sound pill in the lower right corner. */
  .promo[data-state="idle"] .promo-toggle {
    bottom: 20%;
    width: clamp(52px, 15vw, 88px);
    height: clamp(52px, 15vw, 88px);
  }
}

/* Thin progress line along the bottom edge. Decorative (aria-hidden): the fill is a scaleX that
   follows --p, which script.js sets from timeupdate, so no animation frame loop runs while the
   clip plays. */
.promo-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}
.promo-progress i {
  display: block;
  height: 100%;
  background: #9ad57c;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  transition: transform 0.3s linear;
}
.promo-progress i.is-jump {
  transition: none;
}
.promo[data-state="idle"] .promo-progress {
  display: none;
}

/* Buffering ring over the picture, only while the clip is waiting for data (data-buffering is set
   from the waiting event). It fades in after half a second, so a fast connection never flashes it. */
.promo-screen::after {
  content: "";
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 9999px;
  background-color: rgba(13, 21, 17, 0.6);
  pointer-events: none;
}
.promo[data-buffering] .promo-screen::after {
  display: block;
  animation: promo-spin 0.9s linear infinite, promo-fade-in 0.25s ease 0.5s both;
}
@keyframes promo-spin {
  to { transform: rotate(360deg); }
}

/* The play button and progress line fade in when the clip first starts (opacity only). */
@keyframes promo-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.promo:not([data-state="idle"]) .promo-toggle,
.promo:not([data-state="idle"]) .promo-progress {
  animation: promo-fade-in 0.3s ease both;
}

/* Hover polish, only on real hover devices and never with reduced motion. As with the stage
   frames, the lift moves the frame (the child), never the block under the pointer, so the hover
   target stays put and cannot flicker at the edge. */
@media (hover: hover) and (pointer: fine) {
  .promo-btn:hover {
    background-color: rgba(13, 21, 17, 0.9);
  }
  .promo[data-state="idle"] .promo-toggle:hover {
    background-image: linear-gradient(145deg, #2a8a74, #145a49);
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .promo-stage:hover .promo-frame {
    transform: translate3d(0, -4px, 0);
  }
  .promo-stage:hover .promo-frame::after {
    opacity: 1;
  }
  .promo-btn:hover {
    transform: scale(1.06);
  }
  .promo-btn:active {
    transform: scale(0.97);
  }
}

/* ===== Vista previa: two product screens that glide in from the right =====
   The section is full-bleed on purpose: the screens must start at the viewport's own
   edge, and the page must never gain a sideways scrollbar, not even mid-glide.
   "clip" (unlike "hidden") leaves the vertical axis alone, so the soft shadows are
   never cut off; "hidden" first is the fallback for browsers that lack "clip". */
.vista {
  overflow-x: hidden;
  overflow-x: clip;
}

.stage {
  position: relative;
  isolation: isolate;
}
/* On wide screens the stage may reach past the content column toward the viewport edge,
   but never closer than about 2rem to it, so the screens always stay fully on screen. */
@media (min-width: 1280px) {
  .stage {
    margin-right: calc(-1 * clamp(0px, (100vw - 80rem) / 2 - 0.5rem, 5rem));
  }
}

/* Very soft static glow that lifts the white screens off the gray page.
   A plain gradient: no blur layer, no backdrop effect. */
.stage::before {
  content: "";
  position: absolute;
  inset: -12% -12% -14% -8%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(154, 213, 124, 0.3), rgba(154, 213, 124, 0));
}

/* Final composition: AGENDA behind, PLAN in front, lower and further right.
   Plain flow layout: the negative top margin is a percentage of the stage width, so the
   overlap scales with the screens themselves and the stage needs no fixed height. */
.stage-block {
  position: relative;
}
.stage-agenda {
  width: 100%;
  z-index: 1;
}
.stage-plan {
  width: 84%;
  margin: -14% 0 0 auto;
  z-index: 2;
}
@media (min-width: 1024px) {
  .stage-agenda {
    width: 88%;
  }
  .stage-plan {
    width: 60%;
  }
}

/* Entrance. Only a JS-armed stage starts off-screen right; without JS (or without
   IntersectionObserver, or with reduced motion) nobody adds .is-armed and the
   finished composition just shows. The glide itself is a transition on transform
   only, defined on the destination state (.in-view) so arming never animates. */
.stage.is-armed .stage-block {
  will-change: transform;
}
.stage.is-armed:not(.in-view) .stage-block {
  transform: translate3d(100vw, 0, 0);
}
.stage.is-armed.in-view .stage-block {
  transition: transform 1.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.stage.is-armed.in-view .stage-plan {
  transition-delay: 0.2s;
}
.stage.is-settled .stage-block {
  will-change: auto;
}

/* Glass bezel around each screenshot. Concentric corners: 16px image + 6px rim = 22px.
   Shadows are tinted with the dark green, not black. No backdrop effect here: the page's
   blobs animate behind, and wide translucent blur layers cost frames. */
.stage-frame {
  position: relative;
  padding: 6px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.46));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(15, 74, 61, 0.05),
    0 2px 4px rgba(15, 74, 61, 0.05),
    0 10px 20px -6px rgba(15, 74, 61, 0.12),
    0 28px 56px -16px rgba(15, 74, 61, 0.22);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s ease;
}
.stage-plan .stage-frame {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(15, 74, 61, 0.06),
    0 3px 6px rgba(15, 74, 61, 0.07),
    0 16px 30px -8px rgba(15, 74, 61, 0.18),
    0 36px 70px -18px rgba(15, 74, 61, 0.3);
}
.stage-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(30, 31, 27, 0.07);
}

/* Small hover lift, only on real hover devices and never with reduced motion. It moves the
   frame (the child), never the block under the pointer, so the hover target stays put and
   cannot flicker at the edge. The shadow deepens a touch to sell the lift. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .stage-block:hover .stage-frame {
    transform: translate3d(0, -4px, 0);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 0 0 1px rgba(15, 74, 61, 0.07),
      0 4px 8px rgba(15, 74, 61, 0.07),
      0 20px 36px -8px rgba(15, 74, 61, 0.2),
      0 44px 80px -18px rgba(15, 74, 61, 0.32);
  }
}

/* Idle float once the screens have landed: at most 4px, slow, and a different rhythm for
   each screen so they never move in step. Positive delays so nothing jumps when it starts. */
@keyframes stage-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -4px, 0); }
}
.stage.is-settled .stage-agenda .stage-float {
  animation: stage-float 8s ease-in-out infinite;
}
.stage.is-settled .stage-plan .stage-float {
  animation: stage-float 9s ease-in-out 1.5s infinite;
}

/* Numbered mono chip beside each point in the text */
.vista-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 2.25rem;
  height: 1.75rem;
  padding: 0 0.625rem;
  border-radius: 9999px;
  background: #17614f;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
}

/* FAQ accordion: grid-rows animates to the answer's real height,
   so it never clips a longer answer the way a fixed max-height would. */
.faq-item {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.faq-item:hover {
  background-color: rgba(255, 255, 255, 0.75);
  border-color: rgba(30, 31, 27, 0.16);
}

.faq-panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 0.35s ease, visibility 0s linear 0.35s;
}
/* The clipped row must carry no padding: padding can't shrink to 0, so any
   inside this element would peek out while the answer is collapsed. */
.faq-panel-inner {
  overflow: hidden;
}

.faq-item.open .faq-panel {
  grid-template-rows: 1fr;
  visibility: visible;
  transition-delay: 0s;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

/* Form field states, toggled from script.js */
.field-invalid {
  border-color: #dc4c3f !important;
  background-color: rgba(220, 76, 63, 0.04) !important;
}

/* Chrome/Safari force a yellow autofill background by default; repaint it
   with a huge inset shadow so autofilled fields still match the design. */
.field:-webkit-autofill,
.field:-webkit-autofill:hover,
.field:-webkit-autofill:focus {
  -webkit-text-fill-color: #1E1F1B;
  -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.85) inset;
  box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.85) inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* Explicit focus ring: Tailwind's focus:ring/outline-none utilities weren't
   winning against the browser's own default focus outline in testing, so
   this is set directly rather than trusting the generated utility classes. */
.field:focus {
  outline: 2px solid #359463;
  outline-offset: 2px;
  border-color: #359463;
}

/* Honeypot field: parked far off-screen instead of display:none (simple bots
   skip display:none fields). The markup also keeps it out of the tab order
   and the accessibility tree, so only automated form fillers ever reach it. */
.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Submit button: spinner shown only while the request is in flight.
   It sits inside the button, so it is aria-hidden; the label says "Enviando...". */
.btn-spinner {
  display: none;
  flex-shrink: 0;
  width: 1.1em;
  height: 1.1em;
  border-radius: 9999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: btn-spin 0.8s linear infinite;
}
#contact-form[aria-busy="true"] .btn-spinner {
  display: inline-block;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* The success heading takes programmatic focus so screen readers announce it.
   It is not a control, so it gets no focus ring. */
#success-title:focus {
  outline: none;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  /* No spinning: the "Enviando..." label alone carries the loading state */
  .btn-spinner {
    display: none !important;
  }
  .reveal,
  .animate-fade-up,
  .animate-float,
  .blob-1,
  .blob-2,
  .blob-3,
  .stage-block,
  .stage-float,
  .stage-frame,
  .promo-frame,
  .promo-btn,
  .promo-screen::after {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  /* The progress fill is a scaleX that carries the position, and the hover shadow layer has to stay
     off, so neither can take the opacity and transform reset above: they only lose their easing */
  .promo-progress,
  .promo-progress i,
  .promo-frame::after {
    animation: none !important;
    transition: none !important;
  }
  #spotlight {
    display: none;
  }
}
