/* ==========================================================================
   Diego Quintana · Broker Hipotecario
   Tokens, base, componentes y secciones. Sin dependencias.
   Para cambiar colores o tipografías, edita solo el bloque :root.
   ========================================================================== */

@font-face {
  font-family: "DM Serif Display";
  src: url("/assets/fonts/dm-serif-display-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #12273e;        /* azul del logotipo */
  --navy-hover: #1d3b5c;
  --ink: #2f3742;         /* texto */
  --muted: #5b6674;       /* texto secundario */
  --line: #dde2e8;
  --mist: #f3f5f7;        /* fondo secundario */
  --white: #ffffff;
  --sand: #b8a47e;        /* acento: solo filetes y detalles */
  --danger: #a4342b;

  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --max: 72rem;
  --header-h: 4.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  font: 400 1.0625rem/1.65 var(--sans);
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  color: var(--navy);
  line-height: 1.08;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.cta :focus-visible, .hero__mark :focus-visible { outline-color: #fff; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 100;
  background: var(--navy); color: #fff; padding: .7rem 1rem; text-decoration: none;
}
.skip-link:focus { top: .75rem; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .95em 1.6em; border: 1px solid var(--navy); border-radius: 2px;
  font: 600 .9375rem/1.2 var(--sans); letter-spacing: .01em; text-decoration: none;
  white-space: nowrap; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s;
}
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { background: var(--mist); }
.btn--light { background: #fff; color: var(--navy); border-color: #fff; }
.btn--light:hover { background: var(--mist); border-color: var(--mist); }
.btn--sm { padding: .7em 1.2em; font-size: .875rem; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--navy); text-decoration: none; }
.brand img { height: 2.3rem; width: auto; }
.brand span { font-weight: 600; font-size: .8125rem; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }

.nav { display: none; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a:not(.btn) { text-decoration: none; font-size: .9375rem; font-weight: 500; color: var(--ink); }
.nav a:not(.btn):hover { color: var(--navy); text-decoration: underline; text-underline-offset: .35em; text-decoration-thickness: 1px; }
.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 2.75rem; height: 2.75rem; padding: 0 .7rem; background: none; border: 0; cursor: pointer;
}
.nav-toggle span { display: block; height: 1.5px; background: var(--navy); transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 899px) {
  .nav.is-open {
    display: block; position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-bottom: 1px solid var(--line); padding: .5rem var(--gutter) 1.5rem;
  }
  .nav li + li { border-top: 1px solid var(--line); }
  .nav a:not(.btn) { display: block; padding: .95rem 0; font-size: 1rem; }
  .nav .btn { width: 100%; margin-top: 1.25rem; }
}
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav { display: block; }
  .nav ul { display: flex; align-items: center; gap: 1.75rem; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .brand span { display: none; }
  .nav ul { gap: 1.25rem; }
}

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(4rem, 8vw, 7rem); }
.hero__grid { display: grid; gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2.5rem, 6.2vw, 4.5rem); max-width: 14em; }
.hero__lead { font-size: clamp(1.125rem, 1.6vw, 1.3125rem); max-width: 33rem; margin: 1.5rem 0 2.25rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .875rem; }
.hero__note { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); max-width: 30rem; font-size: .9375rem; color: var(--muted); }
.hero__mark {
  position: relative; display: grid; place-items: center;
  background: var(--navy); aspect-ratio: 5 / 6; width: 100%; max-width: 26rem;
}
.hero__mark img { width: 72%; height: auto; }
.hero__frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero__frame rect { fill: none; stroke: var(--sand); stroke-width: 1.3; stroke-dasharray: 1; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .hero__frame rect { stroke-dashoffset: 1; animation: draw-frame 2s .35s cubic-bezier(.45, .05, .2, 1) forwards; }
}
@keyframes draw-frame { to { stroke-dashoffset: 0; } }
@media (min-width: 900px) {
  .hero__grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(3rem, 7vw, 6rem); }
  .hero__mark { justify-self: end; max-width: none; }
}

/* ---------- secciones ---------- */
.section { padding: clamp(4.5rem, 9vw, 8rem) 0; }
.section--mist { background: var(--mist); }
h2 { font-size: clamp(2rem, 4.2vw, 3.25rem); }
.section__intro { margin-top: 1.25rem; max-width: 36rem; font-size: 1.125rem; }

/* propuesta de valor */
.values { display: grid; gap: 3rem; }
.values__list { display: grid; gap: 0 3rem; align-content: start; }
.value { border-top: 1px solid var(--navy); padding: 1.5rem 0 2.5rem; }
.value h3 { font-size: 1.625rem; margin-bottom: .75rem; }
.value p { color: var(--muted); }
@media (min-width: 640px) { .values__list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .values { grid-template-columns: 5fr 7fr; gap: clamp(3rem, 7vw, 7rem); } }

/* cómo funciona */
.steps { list-style: none; margin: clamp(3rem, 6vw, 4.5rem) 0 0; padding: 0; display: grid; }
.step { position: relative; padding: 0 0 2.5rem 4.25rem; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 1.4rem; top: 2.8rem; bottom: 0; width: 1px; background: #c4ccd5; }
.step:last-child::before { display: none; }
.step__num {
  position: absolute; left: 0; top: 0; width: 2.8rem; height: 2.8rem; display: grid; place-items: center;
  background: var(--mist); border: 1px solid var(--navy); font: 1.2rem/1 var(--serif); color: var(--navy);
}
.step h3 { font: 700 1.0625rem/1.35 var(--sans); color: var(--navy); letter-spacing: 0; margin: .5rem 0 .5rem; }
.step p { color: var(--muted); font-size: .96875rem; }
@media (min-width: 1000px) {
  .steps { grid-template-columns: repeat(5, 1fr); gap: 0 2rem; }
  .step { padding: 4.5rem 0 0; }
  .step::before { left: 2.8rem; right: -2rem; top: 1.4rem; bottom: auto; width: auto; height: 1px; }
  .step:last-child::before { display: block; right: auto; width: 0; }
  .step h3 { margin-top: 0; }
}

/* tipos de operación */
.types { list-style: none; margin: clamp(2.5rem, 5vw, 3.5rem) 0 0; padding: 0; border-top: 1px solid var(--navy); }
.type { display: grid; gap: .5rem; padding: 1.75rem 0; border-bottom: 1px solid var(--line); }
.type h3 { font-size: 1.625rem; }
.type p { color: var(--muted); max-width: 34rem; }
.types__cta { margin-top: 2.75rem; }
@media (min-width: 800px) { .type { grid-template-columns: 5fr 7fr; gap: 3rem; align-items: baseline; } }

/* sobre mí */
.about { display: grid; gap: 3rem; align-items: center; }
.about__photo {
  position: relative; display: grid; place-items: center; background: var(--navy);
  aspect-ratio: 4 / 5; width: 100%; max-width: 28rem; overflow: hidden;
}
.about__photo > img:not(.about__img) { width: 46%; height: auto; }
.about__photo::after { content: ""; position: absolute; inset: 1rem; border: 1px solid rgba(184, 164, 126, .6); pointer-events: none; }
.about__photo > .about__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.about__text p { margin-top: 1.25rem; max-width: 34rem; }
.about__text h2 { margin-bottom: 1.75rem; }
@media (min-width: 900px) { .about { grid-template-columns: 5fr 6fr; gap: clamp(3rem, 7vw, 7rem); } }

/* preguntas frecuentes */
.faq { display: grid; gap: 2.5rem; }
.faq__list { border-top: 1px solid var(--navy); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem;
  padding: 1.35rem 0; font-weight: 600; color: var(--navy); font-size: 1.0625rem; line-height: 1.4;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: .85rem; height: .85rem; transition: transform .25s;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
}
.faq details[open] summary::after {
  background: linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat;
  transform: rotate(180deg);
}
.faq summary:hover { color: var(--navy-hover); }
.faq__body { padding: 0 2.25rem 1.6rem 0; max-width: 40rem; }
.faq details[open] .faq__body { animation: faq-open .25s ease-out; }
@keyframes faq-open { from { opacity: 0; transform: translateY(-4px); } }
@media (min-width: 900px) { .faq { grid-template-columns: 4fr 8fr; gap: clamp(3rem, 7vw, 7rem); } }

/* llamada final */
.cta { background: var(--navy); color: #fff; padding: clamp(4.5rem, 9vw, 8rem) 0; }
.cta__grid { display: grid; gap: 2.25rem; }
.cta__rule { width: 3rem; height: 1px; background: var(--sand); margin-bottom: 1.75rem; }
.cta h2 { color: #fff; font-size: clamp(3.25rem, 9vw, 6.75rem); line-height: .98; }
.cta__text { color: rgba(255, 255, 255, .88); max-width: 30rem; font-size: 1.125rem; }
.cta .btn { margin-top: 2rem; }
.cta__note { margin-top: 1.25rem; font-size: .9375rem; color: rgba(255, 255, 255, .72); }
@media (min-width: 900px) { .cta__grid { grid-template-columns: 1fr 1fr; gap: 6rem; align-items: end; } }

/* pie */
.site-footer { padding: 3.5rem 0 2.5rem; border-top: 1px solid var(--line); font-size: .9375rem; }
.site-footer__grid { display: grid; gap: 2.5rem; }
.site-footer .brand img { height: 2.6rem; }
.site-footer__who { margin-top: 1rem; color: var(--muted); }
.site-footer__who a { color: var(--navy); text-underline-offset: .25em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.site-footer ul a { text-decoration: none; color: var(--ink); }
.site-footer ul a:hover { text-decoration: underline; text-underline-offset: .3em; }
.site-footer__copy { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
@media (min-width: 700px) { .site-footer__grid { grid-template-columns: 1fr auto; align-items: start; } }
@media (max-width: 899px) { .site-footer { padding-bottom: 6.5rem; } }

/* botón fijo en móvil */
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: .75rem var(--gutter) calc(.75rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
  transform: translateY(110%); visibility: hidden; transition: transform .3s ease, visibility 0s .3s;
}
.sticky-cta.is-visible { transform: none; visibility: visible; transition: transform .3s ease; }
.sticky-cta .btn { width: 100%; }
@media (min-width: 900px) { .sticky-cta { display: none; } }

/* ==========================================================================
   Formulario de estudio
   ========================================================================== */
.form-page { background: var(--mist); padding: clamp(2rem, 5vw, 4rem) 0 6rem; min-height: 70vh; }
.form-shell { max-width: 46rem; }
.form-intro h1 { font-size: clamp(2rem, 5vw, 3rem); }
.form-intro p { margin-top: 1rem; max-width: 36rem; }
.form-intro__note { font-size: .9375rem; color: var(--muted); }
#form-app { margin-top: 2.25rem; background: #fff; border: 1px solid var(--line); padding: clamp(1.5rem, 4vw, 2.75rem); scroll-margin-top: calc(var(--header-h) + .75rem); }

.progress__meta { display: flex; justify-content: space-between; gap: 1rem; font-size: .875rem; color: var(--muted); margin-bottom: .6rem; }
.progress__bar { height: 2px; background: var(--line); }
.progress__bar span { display: block; height: 100%; background: var(--navy); transition: width .35s ease; }
.progress__steps { display: none; list-style: none; margin: .9rem 0 0; padding: 0; justify-content: space-between; font-size: .8125rem; color: var(--muted); }
.progress__steps .is-current { color: var(--navy); font-weight: 700; }
.progress__steps .is-done { color: var(--navy); }
@media (min-width: 640px) { .progress__steps { display: flex; } }

.step-title { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 2.25rem; }
.step-title:focus { outline: none; }
.field { margin-top: 1.75rem; }
.field[hidden] { display: none; }
.field label:not(.option):not(.check), .fieldset legend { display: block; font-weight: 600; color: var(--navy); font-size: .975rem; margin-bottom: .4rem; padding: 0; line-height: 1.4; }
.fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.hint { font-size: .875rem; color: var(--muted); margin: 0 0 .6rem; }

input[type="text"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  padding: .85rem .95rem; border: 1px solid #aab4c0; border-radius: 3px; appearance: none; -webkit-appearance: none;
}
select {
  padding-right: 2.5rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2312273e' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right .95rem center;
}
textarea { resize: vertical; min-height: 6.5rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: 1px; border-color: var(--navy); }
input:disabled { background: var(--mist); color: var(--muted); }
.is-invalid { border-color: var(--danger) !important; }
.error { color: var(--danger); font-size: .875rem; margin-top: .45rem; font-weight: 500; }
.error[hidden], .error-summary[hidden], .form-error[hidden] { display: none; }
.error-summary { margin-top: 1.5rem; padding: .85rem 1rem; border-left: 3px solid var(--danger); background: #fbf1f0; color: #7b2820; font-size: .9375rem; font-weight: 600; }

.money { position: relative; }
.money input { padding-right: 2.5rem; }
.money span { position: absolute; right: .95rem; top: 50%; transform: translateY(-50%); color: var(--muted); }

.options { display: grid; gap: .6rem; margin-top: .6rem; }
.option { display: flex; gap: .85rem; align-items: flex-start; padding: .95rem 1rem; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; background: #fff; transition: border-color .15s, background-color .15s; line-height: 1.4; }
.option:hover { border-color: #aab4c0; }
.option input { appearance: none; -webkit-appearance: none; flex: none; width: 1.2rem; height: 1.2rem; margin: .08rem 0 0; border: 1.5px solid #7d8b9b; border-radius: 50%; display: grid; place-content: center; background: #fff; }
.option input::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--navy); transform: scale(0); transition: transform .15s; }
.option input:checked { border-color: var(--navy); }
.option input:checked::before { transform: scale(1); }
.option:has(input:checked) { border-color: var(--navy); background: #f6f8fb; }
.option:has(input:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }
.option input:focus-visible { outline: none; }

.check { display: flex; gap: .75rem; align-items: flex-start; cursor: pointer; font-size: .9375rem; line-height: 1.5; margin-top: .75rem; }
.field > .check { margin-top: 0; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 1.2rem; height: 1.2rem; margin: .12rem 0 0; border: 1.5px solid #7d8b9b; border-radius: 2px; display: grid; place-content: center; background: #fff; }
.check input::before { content: ""; width: .7rem; height: .7rem; background: var(--navy); transform: scale(0); transition: transform .12s; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); }
.check input:checked { border-color: var(--navy); }
.check input:checked::before { transform: scale(1); }
.check:has(input:focus-visible) input { outline: 2px solid var(--navy); outline-offset: 2px; }
.check--alt { color: var(--muted); font-size: .875rem; }
.check a { color: var(--navy); }

.privacy-box { margin-top: 2rem; padding: 1.25rem; background: var(--mist); border-left: 2px solid var(--sand); font-size: .875rem; }
.privacy-box__title { font-weight: 700; color: var(--navy); margin-bottom: .6rem; }
.privacy-box dl { margin: 0; display: grid; gap: .45rem; }
.privacy-box dt { font-weight: 600; color: var(--navy); }
.privacy-box dd { margin: 0 0 .35rem; }
.privacy-box a { color: var(--navy); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-error { margin-top: 1.75rem; padding: 1rem 1.1rem; border: 1px solid #d9a9a4; background: #fbf1f0; color: #7b2820; font-size: .9375rem; }
.form-actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; }
.form-actions [hidden] { display: none; }
.form-actions .btn--primary { margin-left: auto; min-width: 11rem; }
@media (max-width: 479px) {
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}

.success { padding: 1rem 0; }
.success::before { content: ""; display: block; width: 3rem; height: 1px; background: var(--sand); margin-bottom: 1.75rem; }
.success__title { font-size: clamp(2rem, 5vw, 3rem); }
.success__title:focus { outline: none; }
.success p { margin: 1.25rem 0 2rem; max-width: 32rem; font-size: 1.125rem; }
.noscript-note { padding: 1rem; border-left: 3px solid var(--sand); background: var(--mist); }

/* ==========================================================================
   Páginas legales
   ========================================================================== */
.legal { padding: clamp(2.5rem, 6vw, 5rem) 0 6rem; }
.legal__inner { max-width: 46rem; }
.legal h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); margin-bottom: 1rem; }
.legal h2 { font: 700 1.1875rem/1.35 var(--sans); color: var(--navy); margin: 2.5rem 0 .6rem; }
.legal p, .legal li { margin-top: .75rem; }
.legal ul { padding-left: 1.2rem; }
.legal a { color: var(--navy); }
.legal__lead { color: var(--muted); }
