/* ============================================================================
   Simulador de Homologación de Reestructuración de Deudas · ILP ABOGADOS
   Estética: editorial-legal refinada.
   Paleta y logo extraídos de www.ilpabogados.com (ver README.md).
   ========================================================================== */

:root {
  /* --- Colores de marca ILP (paleta corporativa azul) --- */
  --brand:        #273457;   /* AZUL CORPORATIVO PRINCIPAL */
  --brand-dark:   #1d2742;   /* azul profundo (hover) — derivado del principal */
  --brand-deep:   #161d31;   /* azul casi negro (titulares sobre claro) */
  --brand-secondary: #334a78;/* AZUL SECUNDARIO (enlaces, acentos) */
  --brand-tint:   #e9edf5;   /* lavado azul muy claro */
  --brand-tint-2: #d3dcee;

  /* --- Neutros (cool, alto contraste para lectura) --- */
  --ink:    #1f2638;   /* texto principal (contraste ~12:1 sobre fondo claro) */
  --muted:  #515a70;   /* texto secundario (contraste ~7:1) */
  --faint:  #818aa0;
  --line:   #d7ddea;   /* filete fino */
  --line-2: #e6eaf3;
  --paper:  #f3f5fa;   /* fondo claro frío */
  --card:   #ffffff;
  --blue:   #334a78;   /* alias del azul secundario */
  --gold:   #a3853f;   /* dorado sobrio para acentos de "concepto" (navy + gold) */

  /* --- Tipografías --- */
  --font-display: "Spectral", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI",
               Roboto, "Noto Sans", "Noto Sans SC", Arial, sans-serif;

  --maxw: 1080px;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(40, 60, 44, .04), 0 12px 32px -18px rgba(40, 60, 44, .28);
}

/* ------------------------------- Base ------------------------------------- */
* { box-sizing: border-box; }
/* El atributo `hidden` SIEMPRE oculta, por encima de cualquier display de clase
   (.modal{display:grid}, .app{display:flex}, .splash{display:grid}, .uses{display:flex}…).
   Sin esto, esas reglas anulan el [hidden] del navegador y el modal/elementos se
   pintan aunque tengan hidden=true. Causa del bug del modal "siempre visible". */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* Textura de papel sutil: dos gradientes radiales muy tenues */
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(39,52,87,.05), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(39,52,87,.04), transparent 55%);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-dark); }
.visually-hidden, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Lenguaje chino: cuerpo y titular con su serif */
html[lang="zh"] { --font-body: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }

/* ------------------------------- Botones ---------------------------------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: .7em 1.4em; letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: .5em;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px -12px rgba(39,52,87,.9); }
.btn--primary:hover { background: var(--brand-dark); }
.btn--primary:disabled { background: #b9c3ba; box-shadow: none; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--brand-dark); border-color: var(--line); }
.btn--ghost:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-tint); }
.btn--ghost:disabled { color: #b7b7b7; border-color: var(--line-2); cursor: not-allowed; }
.btn--lg { padding: .9em 1.9em; font-size: 1.02rem; }
.btn--link { background: none; border: none; color: var(--muted); padding: .4em .2em; font-weight: 500; }
.btn--link:hover { color: var(--brand-dark); }

/* =================== PANTALLA DE SELECCIÓN DE IDIOMA ====================== */
.splash {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 2rem 1.25rem;
  background:
    radial-gradient(1000px 700px at 50% -20%, rgba(39,52,87,.10), transparent 60%),
    linear-gradient(180deg, #fbfcfe 0%, var(--paper) 100%);
}
.splash__inner {
  max-width: 640px; text-align: center;
  animation: rise .8s cubic-bezier(.2,.7,.2,1) both;
}
.splash__logo { width: 220px; margin: 0 auto 2.2rem; }
.splash__eyebrow {
  font-family: var(--font-body); text-transform: uppercase;
  letter-spacing: .32em; font-size: .72rem; color: var(--brand); font-weight: 700;
  margin: 0 0 1rem;
}
.splash__title {
  font-family: var(--font-display); font-weight: 600; line-height: 1.12;
  font-size: clamp(1.8rem, 5vw, 3rem); color: var(--brand-deep); margin: 0 0 1.4rem;
  letter-spacing: -.01em;
}
.splash__lead { color: var(--muted); font-size: 1rem; margin: 0 0 2.4rem; }
.splash__langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin-bottom: 2.4rem; }
.lang-btn {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem .8rem; cursor: pointer; transition: all .2s ease; font: inherit;
  display: flex; flex-direction: column; gap: .25rem; align-items: center;
}
.lang-btn:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-3px); }
.lang-btn__name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--brand-deep); }
.lang-btn__sub { font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.splash__firm { color: var(--muted); font-size: .9rem; letter-spacing: .02em; }
.splash__firm strong { color: var(--brand-dark); letter-spacing: .06em; }

@media (max-width: 520px) {
  .splash__langs { grid-template-columns: 1fr; }
}

/* ============================== APLICACIÓN ================================ */
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* Modo embebido (iframe con auto-ajuste de altura): el contenido manda, sin
   forzar la altura del viewport, para que el iframe encaje sin huecos. */
.drl-embedded .splash { min-height: 0; padding-top: 3.5rem; padding-bottom: 3.5rem; }
.drl-embedded .app { min-height: 0; }
.drl-embedded .topbar { position: static; }   /* evita sticky raro dentro del iframe */

/* ------------------------------- Cabecera --------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(251, 249, 243, .9);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.topbar__logo { width: 130px; flex: none; }
.topbar__titles { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar__kicker { font-size: .64rem; letter-spacing: .26em; text-transform: uppercase; color: var(--brand); font-weight: 700; }
.topbar__name { font-family: var(--font-display); font-size: .95rem; color: var(--brand-deep); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__tools { display: flex; align-items: center; gap: .8rem; flex: none; }
.uses {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1;
  padding: .3rem .7rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card);
}
.uses__label { font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.uses__count { font-size: .92rem; color: var(--ink); }
.uses__count strong { color: var(--brand-dark); font-size: 1.05rem; }
.uses.is-low .uses__count strong { color: #b4632a; }
.uses.is-empty .uses__count strong { color: #b03636; }
.langselect select {
  font: inherit; font-size: .85rem; padding: .45rem 1.8rem .45rem .7rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23273457'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .65rem center;
}

.main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(1.5rem, 4vw, 3.2rem) clamp(1rem, 4vw, 2rem); }

/* --------------------------- Portada del caso ----------------------------- */
.brief__head { max-width: 760px; margin-bottom: 2.4rem; animation: rise .6s ease both; }
.brief__eyebrow, .phase__kicker, .brief__title + * { }
.brief__eyebrow { display: inline-block; font-size: .72rem; letter-spacing: .26em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin-bottom: .8rem; }
.brief__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.9rem, 4.6vw, 2.9rem); line-height: 1.1; color: var(--brand-deep); margin: 0 0 1rem; letter-spacing: -.01em; }
.brief__intro { font-size: 1.08rem; color: var(--ink); margin: 0; }

.brief__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; margin-bottom: 2.4rem; }
.factcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem 1.6rem; box-shadow: var(--shadow); animation: rise .6s ease both;
}
.factcard--wide { grid-column: 1 / -1; }
.factcard--accent { background: linear-gradient(180deg, var(--brand-tint), #fff); border-color: var(--brand-tint-2); }
.factcard h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--brand-deep); margin: 0 0 .7rem; }
.factcard p { margin: 0; color: var(--ink); }
.factcard__total { margin-top: 1rem !important; padding-top: .9rem; border-top: 1px solid var(--line-2); color: var(--muted) !important; }
.factcard__total strong { color: var(--brand-deep); font-size: 1.05rem; }

.debtlist { list-style: none; margin: 0; padding: 0; }
.debtlist li { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem 0; border-bottom: 1px dotted var(--line); }
.debtlist li:last-child { border-bottom: none; }
.debtlist .dl-name { color: var(--ink); }
.debtlist .dl-amt { font-variant-numeric: tabular-nums; color: var(--brand-dark); font-weight: 600; white-space: nowrap; }
.bullets { margin: 0; padding-left: 1.1rem; }
.bullets li { margin-bottom: .5rem; }
.bullets li::marker { color: var(--brand); }

.brief__cta { text-align: center; padding: 1rem 0; }
.brief__note { color: var(--muted); font-size: .85rem; margin-top: .9rem; }

/* ------------------------------- Stepper ---------------------------------- */
.stepper { display: flex; align-items: flex-start; gap: 0; margin: 0 auto 2rem; max-width: 880px; }
.step { flex: 1; position: relative; text-align: center; cursor: pointer; background: none; border: none; font: inherit; padding: 0; color: var(--muted); }
.step::before { /* línea conectora */
  content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0;
}
.step:first-child::before { display: none; }
.step__dot {
  position: relative; z-index: 1; width: 32px; height: 32px; margin: 0 auto .5rem;
  border-radius: 50%; background: var(--card); border: 2px solid var(--line);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: .9rem;
  color: var(--muted); transition: all .25s ease;
}
.step__label { font-size: .72rem; line-height: 1.25; color: var(--muted); display: block; padding: 0 .2rem; }
.step.is-done .step__dot { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-dark); }
.step.is-done::before { background: var(--brand); }
.step.is-active .step__dot { background: var(--brand); border-color: var(--brand); color: #fff; transform: scale(1.12); box-shadow: 0 6px 16px -6px rgba(39,52,87,.8); }
.step.is-active .step__label { color: var(--brand-deep); font-weight: 600; }
.step:hover .step__dot { border-color: var(--brand); }

/* -------------------------------- Fase ------------------------------------ */
.phase {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; animation: rise .45s ease both;
}
.phase__header {
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1.6rem clamp(1.2rem, 3vw, 2.2rem);
  background: linear-gradient(110deg, var(--brand-deep), var(--brand-dark));
  color: #fff;
}
.phase__num {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.45);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
}
.phase__kicker { display: block; font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.72); margin-bottom: .2rem; }
.phase__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.3rem, 3.2vw, 1.8rem); margin: 0; line-height: 1.15; }

.phase__body { padding: clamp(1.3rem, 3vw, 2.2rem); }
.block { margin-bottom: 1.9rem; }
.block__h { font-family: var(--font-display); font-size: 1.18rem; font-weight: 600; color: var(--brand-deep); margin: 0 0 .7rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.block__tag { font-family: var(--font-body); font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-dark); background: var(--brand-tint); padding: .25em .6em; border-radius: 100px; }
.block__tag--gold { color: var(--gold); background: #f3edda; }
.block__text { color: var(--ink); }
.block__text p { margin: 0 0 .8rem; }
.block__text p:last-child { margin-bottom: 0; }
.block__text strong { color: var(--brand-deep); }

/* Conceptos clave */
.concepts { margin-bottom: 1.9rem; }
.concepts__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.concept { border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: 1rem 1.1rem; background: #fbfaf5; }
.concept h4 { font-family: var(--font-display); font-size: 1rem; margin: 0 0 .4rem; color: var(--brand-deep); }
.concept p { margin: 0; font-size: .9rem; color: var(--muted); }

/* Normativa aplicable */
.law { border: 1px solid var(--brand-tint-2); border-radius: var(--radius); background: linear-gradient(180deg, var(--brand-tint), #fff 70%); padding: 1.4rem clamp(1.1rem, 2.5vw, 1.7rem); }
.law__h { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; color: var(--brand-deep); margin: 0 0 1rem; }
.law__icon { width: 22px; height: 22px; fill: var(--brand); flex: none; }
.law__sub { font-family: var(--font-body); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-left: auto; }
.law__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.law__item { display: flex; gap: .9rem; }
.law__art { flex: none; font-family: var(--font-display); font-weight: 600; font-size: .82rem; color: #fff; background: var(--brand); padding: .35em .7em; border-radius: var(--radius); height: fit-content; white-space: nowrap; }
.law__gloss { margin: 0; font-size: .94rem; color: var(--ink); }
.law__gloss strong { color: var(--brand-dark); }

.phase__nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem clamp(1.2rem, 3vw, 2.2rem); border-top: 1px solid var(--line-2); background: #f7f9fd; }
.phase__counter { font-size: .82rem; color: var(--muted); letter-spacing: .04em; }
.restart { text-align: center; margin-top: 1.4rem; }

/* -------------------------------- Pie ------------------------------------- */
.sitefoot { border-top: 1px solid var(--line); background: #e8edf6; margin-top: 2rem; }
.sitefoot__inner { max-width: var(--maxw); margin: 0 auto; padding: 2.2rem clamp(1rem, 4vw, 2rem); display: flex; gap: 2rem; flex-wrap: wrap; align-items: flex-start; }
.sitefoot__logo { width: 140px; opacity: .9; }
.sitefoot__cols { display: flex; gap: 3rem; flex-wrap: wrap; flex: 1; min-width: 240px; }
.sitefoot p { margin: .15rem 0; font-size: .86rem; color: var(--muted); }
.sitefoot__firm { font-family: var(--font-display); font-weight: 600; color: var(--brand-deep) !important; letter-spacing: .06em; font-size: 1rem !important; }
.sitefoot__disc { max-width: 420px; font-size: .78rem !important; color: var(--faint) !important; }
.sitefoot a { color: var(--brand-dark); }

/* ------------------------------ Modal ------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1.25rem; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(22,29,49,.55); backdrop-filter: blur(3px); animation: fade .3s ease both; }
.modal__panel {
  position: relative; z-index: 1; width: min(540px, 100%); background: var(--card);
  border-radius: 6px; padding: clamp(1.6rem, 4vw, 2.6rem); box-shadow: 0 30px 70px -20px rgba(0,0,0,.5);
  animation: rise .4s cubic-bezier(.2,.7,.2,1) both; text-align: center;
}
.modal__x { position: absolute; top: .7rem; right: .9rem; background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.modal__x:hover { color: var(--ink); }
.modal__eyebrow { font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: #b4632a; font-weight: 700; }
.modal__title { font-family: var(--font-display); font-weight: 600; font-size: 1.55rem; color: var(--brand-deep); margin: .6rem 0 1rem; line-height: 1.2; }
.modal__text { color: var(--ink); margin: 0 0 1.3rem; }
.privacy { display: flex; gap: .8rem; text-align: left; background: var(--brand-tint); border: 1px solid var(--brand-tint-2); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.5rem; }
.privacy__icon { width: 30px; height: 30px; fill: var(--brand); flex: none; }
.privacy p { margin: 0; font-size: .86rem; color: var(--brand-deep); }
.modal__cta { width: 100%; justify-content: center; }
.modal__small { font-size: .76rem; color: var(--muted); margin: .9rem 0 0; }

/* ----------------------------- Animaciones -------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Reparto escalonado de las tarjetas del caso */
.factcard:nth-child(1) { animation-delay: .05s; }
.factcard:nth-child(2) { animation-delay: .12s; }
.factcard:nth-child(3) { animation-delay: .19s; }
.factcard:nth-child(4) { animation-delay: .26s; }

/* ------------------------------ Responsive -------------------------------- */
@media (max-width: 760px) {
  .brief__grid { grid-template-columns: 1fr; }
  .concepts__grid { grid-template-columns: 1fr; }
  .topbar__name { display: none; }
  .topbar__logo { width: 110px; }
  .step__label { display: none; }
  .stepper { max-width: 360px; }
  .law__sub { display: none; }
  .uses__label { display: none; }
  .sitefoot__cols { gap: 1.4rem; }
}
@media (max-width: 420px) {
  .phase__header { gap: .8rem; padding: 1.2rem; }
  .phase__num { width: 46px; height: 46px; font-size: 1.2rem; }
  .law__art { font-size: .76rem; }
}
