:root {
  --green: #1f6f4a;
  --green-dark: #17573a;
  --amber: #d9a400;
  --amber-light: #ffd65c;
  --paper: #faf8f5;
  --sand: #e6e1d9;
  --ink: #1c1b1a;
  --muted: #6b665f;
  --error: #b3261e;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }
button {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2 { line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.band :focus-visible, .closing :focus-visible { outline-color: var(--amber-light); }

/* viewport-fit=cover: keep content clear of the notch in landscape */
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px)); }
.muted { color: var(--muted); }

/* Buttons */
.cta {
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: 10px;
  background: var(--amber);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 rgb(0 0 0 / 0.18);
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.cta:active { transform: scale(0.97); box-shadow: none; }
.cta:disabled { opacity: 0.7; cursor: progress; }
.cta-small { min-height: 44px; padding: 0.5rem 1rem; font-size: 0.95rem; }
.cta-block { width: 100%; margin-top: 1rem; }

/* Green band: header + hero */
.band { background: var(--green); color: #fff; overflow: hidden; }
.header { display: flex; justify-content: space-between; align-items: center; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.wordmark { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.wordmark span { color: var(--amber-light); }

.hero { display: grid; gap: 2rem; padding-top: 2rem; text-align: center; }
.hero h1 { font-size: clamp(2.1rem, 8vw, 3.6rem); font-weight: 800; }
.hero p { font-size: 1.15rem; opacity: 0.92; max-width: 32rem; margin-inline: auto; margin-bottom: 1.5rem; }

/* Phone frame drawn in CSS */
.phone {
  width: min(16rem, 72vw);
  margin: 0 auto;
  border: 10px solid var(--ink);
  border-radius: 34px;
  overflow: hidden;
  background: var(--sand);
  box-shadow: 0 18px 40px rgb(28 27 26 / 0.22);
}
.phone-peek {
  height: 19rem;
  border-bottom: 0;
  border-radius: 34px 34px 0 0;
  box-shadow: 0 -6px 30px rgb(0 0 0 / 0.25);
}

/* Antes → ahora tour: one sticky phone, steps scroll past it */
.tour {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--sand);
}
/* Grid area = the steps' height, so the sticky phone stops at the end of the tour */
.tour-phone-wrap { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: calc(50svh - 125px); z-index: 1; }
.tour-phone {
  position: relative;
  box-sizing: content-box;
  width: 104px;
  aspect-ratio: 390 / 844;
  margin: 0 0 0 auto;
  border-width: 6px;
  border-radius: 22px;
}
.tour-phone img { position: absolute; inset: 0; width: 100%; height: 100%; }
html:not(.motion) .tour-phone img:not([data-screen="0"]) { display: none; }

.step {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 75svh;
}
.steps { grid-column: 1; grid-row: 1; min-width: 0; }
.step h2 { margin: 0 0 0.3em; font-size: clamp(1.7rem, 7vw, 3rem); font-weight: 850; letter-spacing: -0.03em; color: var(--green); }
.step > p:last-child { margin: 0; font-size: 1.05rem; color: var(--muted); max-width: 28rem; }
.before { margin: 0 0 0.25rem; font-size: 1.05rem; font-weight: 700; color: var(--muted); }
.before s {
  text-decoration: none;
  /* a background line, not a pseudo-element, so the strike follows the text onto a second line */
  background: linear-gradient(var(--error), var(--error)) no-repeat 0 55% / 100% 2px;
}

/* Drawings of the old way, HTML/CSS only */
.old {
  position: relative;
  width: min(170px, 100%);
  margin: 0.4rem 0 1rem;
  rotate: -3deg;
  box-shadow: 0 6px 14px rgb(0 0 0 / 0.12);
}
.old .x { position: absolute; inset: -6px; pointer-events: none; }
.old .x::before, .old .x::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 120%; height: 3px; border-radius: 2px;
  background: var(--error); opacity: 0.85;
  translate: -50% -50%;
}
.old .x::before { rotate: 32deg; }
.old .x::after { rotate: -32deg; }
.old .err { color: var(--error); font-weight: 700; }
.old-papelito, .old-cuaderno { font: 600 1.2rem/1.15 "Caveat", "Comic Sans MS", cursive; color: #2a3b8f; }
.old-papelito {
  padding: 10px 12px 12px;
  background: #fffdf3;
  clip-path: polygon(0 3%, 6% 0, 14% 3%, 22% 0, 30% 2%, 40% 0, 50% 3%, 60% 0, 70% 2%, 80% 0, 90% 3%, 100% 0, 100% 100%, 0 100%);
}
.old-papelito .sum { margin-top: 4px; padding-top: 2px; border-top: 2px solid #2a3b8f; }
.old-excel { overflow: hidden; background: #fff; border: 1px solid #c8c8c8; font-size: 0.68rem; line-height: 1.4; }
.old-excel .bar { padding: 2px 6px; background: #1d6f42; color: #fff; font-weight: 700; }
.old-excel table { width: 100%; border-collapse: collapse; }
.old-excel td, .old-excel th { padding: 2px 4px; border: 1px solid #ddd; text-align: left; white-space: nowrap; }
.old-excel th { background: #f1f1f1; color: #555; font-weight: 600; }
.old-cuaderno {
  padding: 8px 10px 10px 26px;
  background: repeating-linear-gradient(#fffef8 0 21px, #b9d2ee 21px 22px);
  border-left: 2px solid #e88;
  line-height: 22px;
}
.old-cuaderno s { color: #7a86b8; }

/* Tour motion: only with JS (html.motion); the active step draws its X and strike */
.motion .step { transition: opacity 450ms ease; }
.motion .step:not(.is-active) { opacity: 0.3; }
.motion .tour-phone img { opacity: 0; scale: 1.04; transition: opacity 450ms ease, scale 450ms var(--ease-out); }
.motion .tour-phone img.is-active { opacity: 1; scale: 1; }
.motion .old { transition: opacity 500ms var(--ease-out), translate 500ms var(--ease-out); }
.motion .step:not(.is-active) .old { opacity: 0; translate: 0 12px; }
.motion .old .x::before, .motion .old .x::after { transition: scale 400ms var(--ease-out); }
.motion .step:not(.is-active) .old .x::before, .motion .step:not(.is-active) .old .x::after { scale: 0 1; }
.motion .step.is-active .old .x::before { transition-delay: 700ms; }
.motion .step.is-active .old .x::after { transition-delay: 850ms; }
.motion .before s { transition: background-size 500ms var(--ease-out); }
.motion .step:not(.is-active) .before s { background-size: 0 2px; }
.motion .step.is-active .before s { transition-delay: 350ms; }

.kicker {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--sand);
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section { padding-top: 3rem; padding-bottom: 3rem; }
.section + .section { padding-top: 0; }
.section h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 800; color: var(--green); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.card { padding: 1rem 1.1rem; border: 1px solid var(--sand); border-radius: 12px; background: #fff; }
.card h3 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); }
.cards-doubts .card { border-left: 4px solid var(--amber); }

/* Cards rise in once, staggered by --i */
.motion [data-reveal] { transition: opacity 560ms var(--ease-out), translate 560ms var(--ease-out); transition-delay: calc(var(--i, 0) * 60ms); }
.motion [data-reveal]:not(.is-in) { opacity: 0; translate: 0 16px; }

.closing { background: var(--green); color: #fff; text-align: center; padding: 3.5rem 0; }
.closing h2 { font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 800; }
.closing .closing-note { margin: 1rem 0 0; opacity: 0.92; }

.footer { padding-top: 1.5rem; padding-bottom: 1.5rem; color: var(--muted); font-size: 0.9rem; text-align: center; }

/* Contact popup */
dialog {
  width: min(28rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0; /* clicks on padding would count as backdrop clicks */
  border: 0;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
  overscroll-behavior: contain;
  /* Enter 220ms, exit faster; browsers without @starting-style just skip it */
  transition: opacity 150ms ease-out, transform 150ms ease-out, overlay 150ms allow-discrete, display 150ms allow-discrete;
  opacity: 0;
  transform: scale(0.96);
}
dialog[open] {
  opacity: 1;
  transform: none;
  transition-duration: 220ms;
  transition-timing-function: var(--ease-out);
}
@starting-style {
  dialog[open] { opacity: 0; transform: scale(0.96); }
}
dialog::backdrop {
  background: rgb(28 27 26 / 0.55);
  transition: opacity 150ms ease-out, overlay 150ms allow-discrete, display 150ms allow-discrete;
  opacity: 0;
}
dialog[open]::backdrop { opacity: 1; transition-duration: 220ms; }
@starting-style {
  dialog[open]::backdrop { opacity: 0; }
}
.dialog-body { padding: 1.25rem; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--green); }
.close {
  width: 44px; height: 44px;
  margin-right: -0.5rem;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
  font-size: 1.25rem; cursor: pointer;
}
.close:active { background: var(--sand); }

form label { display: block; margin: 0.85rem 0 0.3rem; font-weight: 600; font-size: 0.95rem; }
form input, form textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #bdb6ab;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px avoids iOS zoom on focus */
}
form textarea { resize: vertical; }
form input:focus-visible, form textarea:focus-visible { outline: 3px solid var(--green); outline-offset: 0; border-color: var(--green); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.status { margin: 0.75rem 0 0; font-weight: 600; }
.status:empty { margin: 0; }
.status.is-error { color: var(--error); }
form[hidden] + .status { font-size: 1.15rem; color: var(--green); padding: 1rem 0; }

@media (hover: hover) and (pointer: fine) {
  .cta:hover { background: var(--amber-light); }
  .close:hover { background: var(--sand); }
}

@media (prefers-reduced-motion: reduce) {
  dialog, dialog[open] { transform: none; }
  .cta:active { transform: none; }
  .motion .tour-phone img, .motion .step:not(.is-active) .old, .motion [data-reveal]:not(.is-in) { scale: none; translate: none; }
  .motion .step:not(.is-active) .old .x::before,
  .motion .step:not(.is-active) .old .x::after { scale: none; }
  .motion .step:not(.is-active) .before s { background-size: 100% 2px; }
}

@media (min-width: 48rem) {
  .hero { grid-template-columns: 1.2fr 1fr; align-items: end; text-align: left; padding-top: 3rem; }
  .hero-text { padding-bottom: 4rem; }
  .hero p { margin-inline: 0; }
  .phone-peek { height: 24rem; }
  .tour { grid-template-columns: 1fr 15rem; column-gap: 3rem; }
  /* Phone shrinks on short screens (landscape) so it always fits; top centers it */
  .tour { --pw: min(15rem, calc((100svh - 4rem) * 390 / 844)); }
  .tour-phone-wrap { top: calc(50svh - (var(--pw) * 844 / 390 + 20px) / 2); }
  .tour-phone { width: var(--pw); margin: 0; border-width: 10px; border-radius: 34px; }
  .step { min-height: 85svh; }
  .cards-doubts { grid-template-columns: 1fr 1fr; }
  .old { width: 220px; }
  .old-excel { font-size: 0.8rem; }
}

