:root {
  --bg-base: #efdecd;
  --bg-page: #faf5ee;
  --surface: #ffffff;
  --text-main: #4a3c2c;
  --text-muted: #9c8b78;
  --connector: #e3d2be;
  --accent: #c9a98a;
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  font-family: "Nunito Sans", system-ui, sans-serif;
}

h1, h4, .modal-title {
  font-family: "Poppins", system-ui, sans-serif;
}

body {
  background:
    radial-gradient(circle at 10% 0%, #f6ecdf 0%, transparent 45%),
    radial-gradient(circle at 90% 10%, #f1e2d0 0%, transparent 40%),
    var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
}

/* ---------- Header ---------- */

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #a98a63;
  background: var(--bg-base);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

header h1 {
  font-weight: 700;
  color: var(--text-main);
}

header .subtitle {
  color: var(--text-muted);
  font-size: 1.02rem;
}

/* ---------- Roadmap trail ---------- */

.roadmap {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 10px 0 30px;
}

.roadmap-row {
  display: flex;
  /* align-items: flex-start (not center): this way the circle always starts at
     the same point, regardless of whether the label below wraps to one or two lines */
  align-items: flex-start;
  /* justify-content: center → the whole row centered in the available width */
  justify-content: center;
  flex-wrap: wrap;
  row-gap: 18px;
  padding: 4px 4px;
  overflow-x: auto;
}

.roadmap-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 112px;
  flex: 0 0 auto;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 6px 0;
}

.roadmap-circle {
  box-sizing: border-box;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: "Poppins", system-ui, sans-serif;
  box-shadow: 0 6px 16px -6px rgba(120, 95, 60, 0.35);
  border: 3px solid var(--surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.roadmap-node:hover .roadmap-circle,
.roadmap-node:focus-visible .roadmap-circle {
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 10px 22px -6px rgba(120, 95, 60, 0.45);
}

.roadmap-node:focus-visible {
  outline: none;
}

.roadmap-node:focus-visible .roadmap-circle {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.roadmap-label {
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.roadmap-connector {
  flex: 0 0 34px;
  height: 3px;
  border-radius: 2px;
  /* node padding-top (6px) + circle radius (30px) − half of this line's
     thickness (1.5px): centers it at the height of the circle, not the block */
  margin-top: 34.5px;
  background: repeating-linear-gradient(
    90deg,
    var(--connector) 0 8px,
    transparent 8px 12px
  );
}

/* Mobile: vertical timeline */
@media (max-width: 820px) {
  .roadmap {
    gap: 10px;
    padding: 0;
  }

  .roadmap-row {
    flex-direction: column;
    align-items: flex-start;
    overflow-x: visible;
    padding-left: 20px;
  }

  .roadmap-node {
    flex-direction: row;
    width: auto;
    text-align: left;
    gap: 16px;
    padding: 8px 0;
  }

  .roadmap-label {
    margin-top: 0;
    font-size: 0.95rem;
  }

  .roadmap-connector {
    flex: 0 0 22px;
    width: 3px;
    height: 22px;
    margin-top: 0;
    margin-left: 29px;
    background: repeating-linear-gradient(
      180deg,
      var(--connector) 0 8px,
      transparent 8px 12px
    );
  }
}

/* ---------- Modal ---------- */

.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 60px -12px rgba(90, 70, 40, 0.35);
}

.modal-header {
  background: color-mix(in srgb, var(--accent) 28%, white);
  border-bottom: none;
  padding: 1.5rem 1.75rem 1.25rem;
  align-items: flex-start;
}

.modal-header .btn-close {
  margin-top: 4px;
}

.modal-title {
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

.modal-body {
  padding: 1.5rem 1.75rem 1.75rem;
  background: var(--surface);
}

#stepSummary {
  color: var(--text-main);
  font-size: 1.02rem;
  line-height: 1.55;
}

#stepWhen {
  background: color-mix(in srgb, var(--accent) 55%, white);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 5px 12px;
}

#toggleDetailBtn {
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 70%, #b08d5f);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 16px;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

#toggleDetailBtn:hover {
  background: color-mix(in srgb, var(--accent) 35%, white);
  color: var(--text-main);
}

/* ---------- Advice tip (always visible, right under the summary) ---------- */

.step-advice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 18%, white);
  border-left: 4px solid var(--accent);
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.5;
}

.step-advice::before {
  content: "💡";
  flex: 0 0 auto;
  font-size: 1.05rem;
  line-height: 1.4;
}

/* ---------- Input / output (always visible, right under the advice tip) ---------- */

.step-io {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 1rem;
}

.step-io-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0;
  font-size: 0.92rem;
  color: #5b4c3a;
  line-height: 1.5;
}

.step-io-label {
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--accent) 55%, white);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

#stepInput,
#stepOutput {
  margin-left: 10px;
}

/* ---------- Sub-roadmap footer (fixed CTA, e.g. Fase 8 → mortgage.html) ---------- */

.modal-footer {
  padding: 14px 1.75rem;
  border-top: 1px solid color-mix(in srgb, var(--accent) 40%, white);
  background: color-mix(in srgb, var(--accent) 14%, white);
}

.sub-roadmap-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
  text-decoration: none;
}

.sub-roadmap-link:hover {
  text-decoration: underline;
}

/* ---------- Modal detail content ---------- */

.detail-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1.1rem;
  margin-bottom: 0.5rem;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
}

.detail-content h4:first-child {
  margin-top: 0;
}

.detail-content p,
.detail-content ul,
.detail-content ol {
  font-size: 0.94rem;
  color: #5b4c3a;
  line-height: 1.55;
}

.detail-content ul,
.detail-content ol {
  padding-left: 1.2rem;
}

.detail-content li {
  margin-bottom: 0.35rem;
}

.detail-content li ul {
  margin-top: 0.35rem;
}

.detail-content strong {
  color: var(--text-main);
}

/* ---------- CTA link inside a detail (e.g. link to the mortgage sub-roadmap) ---------- */

.detail-content .cta-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 8px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 45%, white);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.detail-content .cta-link:hover {
  background: color-mix(in srgb, var(--accent) 65%, white);
  color: var(--text-main);
  transform: translateY(-1px);
}

/* ---------- Back link (sub-roadmap pages) ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text-main);
}

/* ---------- Ads ---------- */
/* Non-intrusive by design: side rails only appear where there's real spare
   room beside the centered container, and there's a single footer slot.
   No ad above the header or inside the roadmap/modal flow. */

.ad-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 6px;
}

.ad-unit {
  min-height: 1px; /* generic fallback; the placements below reserve real space */
}

/* Reserve the actual footprint of the expected ad format so the layout
   doesn't jump (CLS) once a real ad fills the slot — sized to match each
   container: 160px-wide rails fit a 160x600 skyscraper, the full-width
   footer fits a leaderboard-style banner. */
.ad-rail .ad-unit {
  min-height: 600px;
}

footer .ad-unit {
  min-height: 90px;
}

.ad-rail {
  display: none; /* only shown on wide screens, see media query below */
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  z-index: 5;
}

.ad-rail-left {
  left: 16px;
}

.ad-rail-right {
  right: 16px;
}

/* Only enable the rails once there's genuine free space beside the
   centered container — otherwise they'd overlap the content */
@media (min-width: 1440px) {
  .ad-rail {
    display: block;
  }
}

/* ---------- Ad-blocker notice ---------- */
/* A dismissible bar, never a blocking overlay: closing it hides it for good
   (see ads.js), it never covers or gates the actual content. */

.adblock-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--accent) 60%, #b08d5f);
  box-shadow: 0 12px 30px -10px rgba(90, 70, 40, 0.35);
}

.adblock-banner.d-none {
  display: none;
}

.adblock-banner-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-main);
}

.adblock-banner-close {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.adblock-banner-close:hover {
  color: var(--text-main);
}

/* ---------- Footer ---------- */

footer {
  color: var(--text-muted);
  margin-top: 40px;
  padding: 24px 16px 36px;
  text-align: center;
}

footer a {
  color: inherit;
  text-decoration: underline;
}

/* ---------- Página legal (política de privacidad) ---------- */

.legal-wrap {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 24px;
}

.legal-card {
  max-width: 720px;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: 0 20px 45px -20px rgba(120, 95, 60, 0.35);
}

/* En pantallas de escritorio, más ancho que el tope fijo de 720px de móvil:
   ocupa el 80% del contenedor en vez de quedarse en una tarjeta pequeña
   sobre un viewport grande. */
@media (min-width: 821px) {
  .legal-card {
    max-width: none;
    width: 80%;
  }
}

.legal-card h1 {
  font-size: 1.6rem;
  margin: 8px 0 4px;
}

.legal-card h2 {
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 1.1rem;
  margin: 28px 0 8px;
}

.legal-card p {
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 8px;
}

.legal-updated {
  font-size: 0.85rem;
}

.legal-back {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  margin-bottom: 12px;
}
