/* ============================================================
   Clave — component primitives (static reproduction of the
   design-system bundle's React components, on the brand tokens).
   Plus static-build helpers (icon class, drawer + FAQ toggles).
   ============================================================ */

/* ---- inline-SVG icon class (sprite via <use>) ---- */
.ic { display: inline-block; vertical-align: middle; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-sans); font-weight: var(--fw-semibold); font-size: var(--text-base);
  line-height: 1; border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 12px 19px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard); }
.btn--primary { background: var(--brand-primary); color: #fff; }
.btn--primary:hover { background: var(--brand-primary-hover); }
.btn--primary:active { background: var(--brand-primary-active); }
.btn--secondary { background: var(--surface-card); color: var(--text-strong); border-color: var(--border-default); }
.btn--secondary:hover { background: var(--surface-muted); }
.btn--accent { background: var(--brand-accent); color: var(--brand-accent-ink); }
.btn--accent:hover { background: var(--brand-accent-hover); }
.btn--lg { font-size: var(--text-md); padding: 15px 26px; }
.btn--sm { font-size: var(--text-sm); padding: 9px 15px; }
.btn--block { width: 100%; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(43,96,168,0.35); }

/* ---- Icon button (outline) ---- */
.icon-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--radius-md);
  border: 1px solid var(--border-default); background: var(--surface-card);
  color: var(--text-strong); cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard); }
.icon-btn:hover { background: var(--surface-muted); }

/* ---- Avatar ---- */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; background: var(--navy-100); color: var(--navy-700);
  font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: -0.01em; }
.avatar--md { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar--lg { width: 46px; height: 46px; font-size: var(--text-md); }

/* ---- Badge ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-2xs);
  font-weight: var(--fw-semibold); padding: 3px 9px; border-radius: var(--radius-full); white-space: nowrap; }
.badge--accent { background: var(--lime-100); color: var(--lime-800); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--clave-lime); flex: none; }

/* ============================================================
   Static-build interaction helpers
   ============================================================ */

/* Mobile drawer: hidden until JS adds .is-open (overrides site.css) */
@media (max-width: 920px) {
  .mk-nav__mobile { display: none !important; }
  .mk-nav__mobile.is-open { display: block !important; }
}

/* FAQ: CSS-driven open state (no inline max-height needed) */
.mk-faq__a { max-height: 0; overflow: hidden; transition: max-height var(--duration-base) var(--ease-standard); }
.mk-faq__item.is-open .mk-faq__a { max-height: 360px; }

/* icon-swap pairs (burger + FAQ): default visibility */
.is-x, .is-minus { display: none; }

/* ============================================================
   Journey stepper (.jny) — need-driven flows, shown not told.
   Left: the steps (the needs). Right: the product screen that
   answers each one, inside the mk-mock browser chrome.
   Markup contract: [data-jny] > .jny__steps (role=tablist) +
   .jny__art > .mk-mock > .jny__screens > .jny__screen (tabpanels).
   Behavior in app.js; safe without JS (step 1 visible).
   ============================================================ */
.jny { display: grid; grid-template-columns: 0.95fr 1.05fr; gap: clamp(28px, 4vw, 56px);
  align-items: center; max-width: var(--container-max); margin: 0 auto; }
.jny--rev .jny__art { order: -1; }

/* The steps (needs) */
.jny__steps { display: flex; flex-direction: column; gap: 8px; }
.jny__step { display: block; width: 100%; text-align: left; background: none; border: none;
  font-family: var(--font-sans); cursor: pointer; position: relative;
  border-left: 3px solid var(--border-subtle); border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 13px 16px 13px 18px;
  transition: background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard); }
.jny__step:hover { background: var(--surface-muted); }
.jny__step:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(43,96,168,0.35); }
.jny__step.is-on { background: var(--surface-card); border-left-color: var(--clave-lime);
  box-shadow: var(--shadow-md); }
.jny__k { display: block; font-size: var(--text-2xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); }
.jny__step.is-on .jny__k { color: var(--brand-primary); }
.jny__t { display: block; font-size: var(--text-lg); font-weight: var(--fw-semibold);
  color: var(--text-strong); margin-top: 4px; letter-spacing: var(--tracking-snug); }
.jny__bw { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--duration-base) var(--ease-standard); }
.jny__step.is-on .jny__bw { grid-template-rows: 1fr; }
.jny__b { overflow: hidden; font-size: var(--text-base); color: var(--text-muted);
  line-height: var(--leading-relaxed); }
.jny__step.is-on .jny__b { margin-top: 6px; }

/* The screen panel */
.jny__art { perspective: 1600px; min-width: 0; }
.jny__screens { position: relative; padding: 0; background: var(--surface-muted);
  min-height: clamp(280px, 26vw, 330px); display: flex; }
.jny__screen { display: none; flex: 1; flex-direction: column; gap: 10px; justify-content: center; }
.jny__screen.is-on { display: flex; }
@keyframes jny-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.jny__screen.is-on > * { animation: jny-in 0.45s var(--ease-standard) both; }
.jny__screen.is-on > *:nth-child(2) { animation-delay: 0.09s; }
.jny__screen.is-on > *:nth-child(3) { animation-delay: 0.18s; }
.jny__screen.is-on > *:nth-child(4) { animation-delay: 0.27s; }
.jny__screen.is-on > *:nth-child(5) { animation-delay: 0.36s; }

/* Deep links under the stepper */
.jny__links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; margin-top: 14px; }

/* ---- Screen primitives (compose with .mk-mini) ---- */
/* KPI tiles (panels: operación, cartera) */
.jny-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.jny-kpi--2 { grid-template-columns: repeat(2, 1fr); }
.jny-kpi__tile { background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 10px 12px; min-width: 0; }
.jny-kpi__l { font-size: var(--text-2xs); font-weight: var(--fw-semibold); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--tracking-wide); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jny-kpi__v { font-size: var(--text-lg); font-weight: var(--fw-semibold); color: var(--text-strong); margin-top: 3px; display: block; }
.jny-kpi__d { font-size: var(--text-2xs); color: var(--success-600); font-weight: var(--fw-medium); }

/* Timeline (expediente) */
.jny-tl { display: flex; flex-direction: column; }
.jny-tl__item { position: relative; padding: 0 0 14px 22px; }
.jny-tl__item::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--ink-200); }
.jny-tl__item:last-child::before { display: none; }
.jny-tl__item::after { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface-card); border: 3px solid var(--navy-400); }
.jny-tl__item--now::after { border-color: var(--clave-lime); }
.jny-tl__date { font-size: var(--text-2xs); font-weight: var(--fw-semibold); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.jny-tl__t { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); margin-top: 1px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.jny-tl__b { font-size: var(--text-2xs); color: var(--text-muted); margin-top: 1px; }

/* Phone frame (canales digitales / WhatsApp) */
.jny-ph { width: min(240px, 100%); margin: 0 auto; background: var(--surface-card);
  border: 1px solid var(--border-default); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; }
.jny-ph__bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--surface-inverse); color: #fff; font-size: var(--text-2xs); font-weight: var(--fw-semibold); }
.jny-ph__bar .avatar { width: 22px; height: 22px; font-size: 9px; background: var(--navy-600); color: #fff; }
.jny-ph__body { padding: 12px 10px; display: flex; flex-direction: column; gap: 7px; background: var(--surface-muted); min-height: 170px; }
.jny-ph__msg { max-width: 88%; font-size: var(--text-2xs); line-height: var(--leading-normal);
  padding: 7px 10px; border-radius: var(--radius-md); color: var(--text-body);
  background: var(--surface-card); border: 1px solid var(--border-subtle); align-self: flex-start; }
.jny-ph__msg--out { align-self: flex-end; background: var(--lime-100); border-color: var(--lime-200); color: var(--lime-800); }
.jny-ph__msg b { color: var(--text-strong); }
.jny-ph__msg--doc { display: flex; align-items: center; gap: 7px; font-weight: var(--fw-medium); }
.jny-ph__msg--doc svg { color: var(--navy-600); }
.jny-ph__time { align-self: center; font-size: 9px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: var(--tracking-wide); }

/* Status rows (radicación / cartera aging) */
.jny-row { display: flex; align-items: center; gap: 10px; background: var(--surface-card);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 8px 11px; }
.jny-row__t { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-body); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jny-row__v { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); white-space: nowrap; }

/* Sync card (contabilidad externa) */
.jny-sync { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px 0; }
.jny-sync__node { display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: var(--text-2xs); font-weight: var(--fw-semibold); color: var(--text-strong); text-align: center; }
.jny-sync__icon { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--navy-100);
  color: var(--navy-700); display: inline-flex; align-items: center; justify-content: center; }
.jny-sync__flow { display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-muted); font-size: var(--text-2xs); }
.jny-sync__flow svg { color: var(--success-500); }

/* ---- Chapter rail (cómo funciona): sticky in-page nav with scrollspy ---- */
.jrail { position: sticky; top: var(--nav-h, 96px); z-index: 40;
  background: rgba(255, 255, 255, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle); }
.jrail__track { max-width: var(--container-max); margin: 0 auto; padding: 10px var(--container-pad);
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.jrail__track::-webkit-scrollbar { display: none; }
.jrail__chip { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-muted);
  padding: 7px 14px; border-radius: var(--radius-full); border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  transition: background var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard); }
.jrail__chip b { font-weight: var(--fw-semibold); color: var(--text-subtle); font-size: var(--text-2xs); }
.jrail__chip:hover { color: var(--text-strong); border-color: var(--border-default); }
.jrail__chip.is-on { background: var(--surface-inverse); color: #fff; border-color: var(--surface-inverse); }
.jrail__chip.is-on b { color: var(--clave-lime); }
/* chapters scroll below the sticky nav + rail */
.jch { scroll-margin-top: calc(var(--nav-h, 96px) + 70px); }
.jch__foot { display: flex; justify-content: center; margin-top: 26px; }

/* ---- Dual value: Para médicos / Para tu IPS (guidelines §5.4/§6) ---- */
.mk-dual { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 1040px; margin: 0 auto; }
.mk-dual__col { display: flex; flex-direction: column; gap: 18px; background: var(--surface-card);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); padding: 30px 28px;
  box-shadow: var(--shadow-sm); }
.mk-dual__tag { align-self: flex-start; font-size: var(--text-2xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--navy-700);
  background: var(--navy-100); padding: 6px 12px; border-radius: var(--radius-full); }
.mk-dual__items { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.mk-dual__jump { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-link);
  display: inline-flex; align-items: center; gap: 6px; }
.mk-dual__cta { margin-top: 4px; }

/* ---- CTA risk-reducer note ---- */
.mk-cta__note { margin-top: 14px; font-size: var(--text-sm); color: var(--navy-200); }

/* ---- Responsive + motion ---- */
@media (max-width: 860px) {
  .mk-dual { grid-template-columns: 1fr; }
  .jny { grid-template-columns: 1fr; gap: 22px; }
  .jny__art, .jny--rev .jny__art { order: -1; max-width: 560px; width: 100%; margin: 0 auto; }
  .jny__screens { min-height: 300px; }
  .jny__step { padding: 11px 12px 11px 14px; }
  .jny__t { font-size: var(--text-md); }
}
@media (prefers-reduced-motion: reduce) {
  .jny__screen.is-on > * { animation: none; }
  .jny__bw { transition: none; }
}
