/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --cream: #f6f1ea;
  --cream-2: #efe7db;
  --ink: #241f1a;
  --ink-soft: #55483d;
  --terracotta: #b55a3c;
  --terracotta-deep: #8f4128;
  --line: rgba(36, 31, 26, 0.12);
  --white: #fffdfa;

  --serif: "Fraunces", "Georgia", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 18px;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.05; letter-spacing: -0.01em; font-family: var(--serif); font-weight: 500; }
ul { list-style: none; padding: 0; }
::selection { background: var(--terracotta); color: var(--white); }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: 1180px; margin-inline: auto; padding-inline: var(--gutter); }
.eyebrow {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--terracotta-deep);
  display: inline-flex; align-items: center; gap: 0.5em; margin-bottom: 0.9em;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--terracotta); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: 0.6rem 1rem; background: var(--ink); color: var(--cream);
  border-radius: 8px; font-weight: 500; transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease-soft), transform 0.7s var(--ease-soft); }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* =============================================================
   4. Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 0.55em;
  padding: 0.85em 1.6em; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  transition: transform 0.35s var(--ease-out), background 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -10px rgba(36,31,26,0.45); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--white); transform: translateY(-2px); }

/* =============================================================
   5. Header / nav
   ============================================================= */
.masthead {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem var(--gutter);
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}
.masthead.is-scrolled { border-bottom-color: var(--line); }
.masthead__logo { font-family: var(--serif); font-style: italic; font-size: 1.4rem; }
.masthead__nav { display: none; gap: 2rem; font-size: 0.92rem; }
.masthead__nav a { opacity: 0.8; transition: opacity 0.25s var(--ease-out); }
.masthead__nav a:hover { opacity: 1; }
.masthead__actions { display: flex; align-items: center; gap: 0.75rem; }
.masthead__burger { display: inline-flex; }

@media (min-width: 960px) {
  .masthead__nav { display: flex; }
  .masthead__burger { display: none; }
}

/* =============================================================
   6. Hero
   ============================================================= */
.hero {
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(2.5rem, 6vw, 4rem);
  display: grid; gap: 2.5rem;
}
.hero__headline {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  max-width: 16ch;
}
.hero__headline em { font-style: italic; color: var(--terracotta-deep); }
.hero__sub {
  font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--ink-soft);
  max-width: 46ch; margin-top: 1.1rem;
}
.hero__ctas { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.8rem; }
.hero__media {
  position: relative; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4 / 5; background: linear-gradient(155deg, var(--cream-2), #e3d3c2 60%, var(--terracotta) 140%);
}
.hero__media .img-slot__label { color: rgba(36,31,26,0.55); }

@media (min-width: 960px) {
  .hero { grid-template-columns: 1.1fr 0.9fr; align-items: center; padding-top: clamp(4rem, 10vw, 7rem); }
  .hero__media { aspect-ratio: 3 / 4; }
}

/* =============================================================
   7. Image placeholder slots (used until real photography is added)
   ============================================================= */
.img-slot {
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(155deg, var(--cream-2), #ded0c1);
  color: var(--ink-soft); font-size: 0.78rem; letter-spacing: 0.04em;
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 1rem;
}
.img-slot__label { font-weight: 600; }

/* =============================================================
   8. Trust bar
   ============================================================= */
.trustbar { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.trustbar__row {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem 2rem;
  padding: 2.2rem var(--gutter);
}
.trustbar__item { text-align: center; }
.trustbar__value { font-family: var(--serif); font-size: clamp(1.8rem, 3.4vw, 2.6rem); color: var(--terracotta-deep); }
.trustbar__label { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.2rem; }
.trustbar__demo-note {
  grid-column: 1 / -1; font-size: 0.72rem; color: var(--ink-soft); opacity: 0.7; text-align: center;
}

@media (min-width: 720px) {
  .trustbar__row { grid-template-columns: repeat(3, 1fr); }
}

/* =============================================================
   9. Sections generic
   ============================================================= */
.section { padding: clamp(3.5rem, 8vw, 6.5rem) var(--gutter); }
.section__head { max-width: 60ch; margin-bottom: 2.6rem; }
.section__title { font-size: clamp(1.9rem, 4vw, 2.8rem); }

/* =============================================================
   10. Procedures grid
   ============================================================= */
.procedures { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.procedure-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; display: flex; flex-direction: column; gap: 0.9rem;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}
.procedure-card:hover { transform: translateY(-6px); box-shadow: 0 22px 40px -22px rgba(36,31,26,0.35); }
.procedure-card__img { aspect-ratio: 16 / 10; }
.procedure-card__name { font-size: 1.2rem; }
.procedure-card__summary { color: var(--ink-soft); font-size: 0.92rem; }
.procedure-card__meta {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--line); padding-top: 0.9rem; margin-top: auto;
  font-size: 0.82rem; color: var(--ink-soft);
}
.procedure-card__from { font-family: var(--serif); font-size: 1.05rem; color: var(--terracotta-deep); }

@media (min-width: 720px) { .procedures { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .procedures { grid-template-columns: repeat(3, 1fr); } }

/* =============================================================
   11. Process timeline
   ============================================================= */
.timeline { display: grid; gap: 1.6rem; }
.timeline__item { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; }
.timeline__step {
  font-family: var(--serif); font-size: 1.1rem; color: var(--terracotta-deep);
  width: 3rem; height: 3rem; border: 1px solid var(--line); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--white);
}
.timeline__title { font-size: 1.15rem; margin-bottom: 0.3rem; }
.timeline__desc { color: var(--ink-soft); font-size: 0.92rem; max-width: 52ch; }

@media (min-width: 960px) {
  .timeline { grid-template-columns: repeat(5, 1fr); gap: 1.2rem; }
  .timeline__item { grid-template-columns: 1fr; text-align: left; }
}

/* =============================================================
   12. Testimonials
   ============================================================= */
.testimonials { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.testimonial-card {
  background: var(--cream-2); border-radius: var(--radius); padding: 1.8rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.testimonial-card__quote { font-family: var(--serif); font-style: italic; font-size: 1.08rem; }
.testimonial-card__meta { font-size: 0.85rem; color: var(--ink-soft); }
.demo-flag {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--terracotta-deep); background: rgba(181,90,60,0.12);
  padding: 0.2em 0.6em; border-radius: 999px; width: fit-content;
}

@media (min-width: 720px) { .testimonials { grid-template-columns: repeat(3, 1fr); } }

/* =============================================================
   13. CTA / contact
   ============================================================= */
.cta {
  background: var(--ink); color: var(--cream); border-radius: calc(var(--radius) + 8px);
  margin: 0 var(--gutter) clamp(3rem, 6vw, 5rem); padding: clamp(2.6rem, 6vw, 4.5rem);
  display: grid; gap: 2rem;
}
.cta__title { font-size: clamp(1.9rem, 4vw, 2.6rem); max-width: 20ch; }
.cta__sub { color: rgba(246,241,234,0.72); max-width: 46ch; margin-top: 0.8rem; }
.cta .btn-primary { background: var(--terracotta); color: var(--white); }
.cta .btn-ghost { border-color: rgba(246,241,234,0.35); color: var(--cream); }

.form { display: grid; gap: 0.9rem; }
.form__row { display: grid; gap: 0.9rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.82rem; color: rgba(246,241,234,0.75); }
.field input, .field select {
  background: rgba(246,241,234,0.08); border: 1px solid rgba(246,241,234,0.25);
  border-radius: 10px; padding: 0.75em 0.9em; color: var(--cream); font-size: 0.95rem;
}
.field input::placeholder { color: rgba(246,241,234,0.45); }

@media (min-width: 960px) {
  .cta { grid-template-columns: 1fr 1fr; align-items: center; }
  .form__row--split { grid-template-columns: 1fr 1fr; }
}

/* =============================================================
   14b. Budget calculator
   ============================================================= */
.calculator {
  display: grid; gap: 1.6rem;
  background: var(--cream-2); border-radius: var(--radius); padding: clamp(1.4rem, 3vw, 2.2rem);
}
.calculator__form { display: grid; gap: 1rem; align-items: end; }
.field--checkbox label { display: flex; align-items: center; gap: 0.6em; font-size: 0.92rem; color: var(--ink-soft); }
.field--checkbox input { width: 1.1em; height: 1.1em; }
#calc-procedimiento {
  width: 100%; padding: 0.75em 0.9em; border-radius: 10px; border: 1px solid var(--line);
  background: var(--white); font-size: 0.95rem; color: var(--ink);
}
.calculator__result { border-top: 1px solid var(--line); padding-top: 1.4rem; }
.calculator__total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.9rem; }
.calculator__total-label { font-size: 0.85rem; color: var(--ink-soft); }
.calculator__total-value { font-family: var(--serif); font-size: 2rem; color: var(--terracotta-deep); }
.calculator__breakdown { display: grid; gap: 0.45rem; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.8rem; }
.calculator__breakdown li { display: flex; justify-content: space-between; }
.calculator__disclaimer { font-size: 0.76rem; color: var(--ink-soft); opacity: 0.75; margin-bottom: 1.2rem; }
.calculator__gate-copy { font-size: 0.88rem; color: var(--ink-soft); margin-bottom: 0.6rem; }
.calculator__gate-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.calculator__gate-row input {
  flex: 1 1 200px; padding: 0.7em 0.9em; border-radius: 10px; border: 1px solid var(--line);
  background: var(--white); font-size: 0.92rem;
}
.calculator__gate-sent { font-size: 0.9rem; color: var(--terracotta-deep); font-weight: 600; }

@media (min-width: 720px) {
  .calculator { grid-template-columns: 1fr 1.2fr; }
  .calculator__form { align-content: start; }
}

/* =============================================================
   14c. Chat widget
   ============================================================= */
.chat-widget { position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem); z-index: 200; }
.chat-bubble {
  display: inline-flex; align-items: center; gap: 0.6em;
  background: var(--ink); color: var(--cream); padding: 0.85em 1.3em; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; box-shadow: 0 16px 32px -14px rgba(36,31,26,0.5);
  transition: transform 0.3s var(--ease-out);
}
.chat-bubble:hover { transform: translateY(-2px); }
.chat-bubble__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--terracotta);
  box-shadow: 0 0 0 0 rgba(181,90,60,0.6); animation: chatPulse 2.2s infinite;
}
@keyframes chatPulse {
  0% { box-shadow: 0 0 0 0 rgba(181,90,60,0.55); }
  70% { box-shadow: 0 0 0 8px rgba(181,90,60,0); }
  100% { box-shadow: 0 0 0 0 rgba(181,90,60,0); }
}
@media (prefers-reduced-motion: reduce) { .chat-bubble__dot { animation: none; } }

.chat-panel {
  position: absolute; right: 0; bottom: calc(100% + 0.75rem);
  width: min(340px, 88vw); max-height: 70vh;
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 60px -24px rgba(36,31,26,0.4);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem 1.1rem; background: var(--ink); color: var(--cream); font-weight: 600; font-size: 0.92rem;
}
.chat-panel__head button { font-size: 1.3rem; line-height: 1; color: var(--cream); }
.chat-panel__body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: grid; gap: 0.7rem; font-size: 0.88rem; }
.chat-msg { padding: 0.6em 0.85em; border-radius: 12px; max-width: 88%; line-height: 1.45; }
.chat-msg--bot { background: var(--cream-2); align-self: flex-start; }
.chat-msg--user { background: var(--ink); color: var(--cream); align-self: flex-end; margin-left: auto; }
.chat-panel__form { display: flex; border-top: 1px solid var(--line); }
.chat-panel__form input { flex: 1; padding: 0.8em 1rem; font-size: 0.9rem; border: 0; }
.chat-panel__form button { padding: 0 1.1rem; color: var(--terracotta-deep); font-size: 1.2rem; font-weight: 700; }

/* =============================================================
   14. Footer
   ============================================================= */
.footer { padding: 2.4rem var(--gutter) 3rem; border-top: 1px solid var(--line); }
.footer__row {
  display: flex; flex-direction: column; gap: 1.2rem;
  font-size: 0.85rem; color: var(--ink-soft);
}
.footer__logo { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--ink); }

@media (min-width: 720px) {
  .footer__row { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* =============================================================
   15. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { transition-duration: 0.3s; }
}
.chat-panel[hidden] { display: none; }
