/* ==========================================================================
   Páginas interiores · diseño "Órbita grafito" (T-56, fase 2).
   Se carga en todas las páginas después de styles.css y chrome.css.
   Solo tokens semánticos de :root (cambian solos con tema y .tone-*); ningún hex.
   Catálogo: docs/01-diseno/DISENO.md §2.3 y §2.6.
   ========================================================================== */

/* ---------- Héroe interior (.phero, includes/page-hero.php) ---------- */
.phero { position: relative; overflow: hidden; isolation: isolate; background: var(--bg); color: var(--text); }
.phero__bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.phero__glow { position: absolute; right: -8rem; top: 45%; width: 40rem; height: 40rem; border-radius: 50%; background: radial-gradient(circle, var(--glow) 0%, transparent 68%); transform: translateY(-50%); opacity: .7; }
.phero__ring { position: absolute; right: 12%; top: 50%; border-radius: 50%; border: 1px solid var(--line); transform: translate(50%, -50%); }
.phero__ring--1 { width: 22rem; height: 22rem; }
.phero__ring--2 { width: 38rem; height: 38rem; border-style: dashed; }
.phero__ring--3 { width: 56rem; height: 56rem; }
.phero__dot { position: absolute; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent-fill); transform: translate(-50%, -50%); }
.phero__dot:nth-child(1) { left: 3.81%; top: 30.87%; }
.phero__dot:nth-child(2) { left: 30.87%; top: 96.19%; background: var(--line-strong); }
.phero__dot:nth-child(3) { left: 14.6%; top: 85.4%; }
.phero__in { position: relative; padding-top: calc(var(--header-h) + clamp(1rem, 4vw, 3.5rem)); padding-bottom: clamp(3.5rem, 7vw, 6rem); }
.phero--compact .phero__in { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.phero .badge-dot { margin-top: var(--sp-2); }
.phero__title { margin-top: var(--sp-5); max-width: 22ch; font-size: var(--fs-4xl); line-height: 1.08; text-wrap: balance; overflow-wrap: break-word; }
.phero__title em { font-style: normal; color: var(--accent); }
.phero__lead { margin-top: var(--sp-5); max-width: 40rem; font-size: var(--fs-lg); line-height: 1.6; color: var(--text-muted); }
.phero__ctas { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-8); }
.phero__note { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); font-size: var(--fs-sm); color: var(--text-muted); }
.phero__note .icon { color: var(--accent); width: 1.125rem; height: 1.125rem; }
.phero__slot { margin-top: var(--sp-6); max-width: 46rem; }
/* El héroe se apoya sobre una línea de acento que lo separa del contenido */
.phero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--accent-line), var(--line) 50%, transparent); }

/* Migas */
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-2); margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-muted); }
.crumbs li { display: inline-flex; align-items: center; min-height: var(--tap); }
.crumbs li:not(:last-child)::after { content: "\203A"; margin-left: var(--sp-2); color: var(--text-dim); }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--text-muted); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: color var(--dur-fast) ease, text-decoration-color var(--dur-fast) ease; }
.crumbs a:hover { color: var(--text-strong); text-decoration-color: var(--accent); }
.crumbs [aria-current] { color: var(--text-strong); font-weight: var(--fw-semibold); }

@media (max-width: 600px) {
    .phero__in { padding-top: var(--header-h); }
    .phero .badge-dot { margin-top: 0; }
    .phero__title { font-size: clamp(1.875rem, 1.3rem + 3vw, 2.5rem); max-width: none; margin-top: var(--sp-3); }
    .phero__lead { margin-top: var(--sp-3); font-size: var(--fs-base); line-height: 1.55; }
    .phero__ctas { margin-top: var(--sp-5); }
    .phero__ctas .btn { width: 100%; white-space: normal; text-align: center; }
    .phero__glow { right: -16rem; width: 28rem; height: 28rem; }
    .phero__ring { right: -10%; }
}
@media (max-width: 400px) {
    .phero__lead { font-size: 1.0625rem; } /* 17 px: el CTA cabe en el primer pantallazo de 360×640 */
}

/* ---------- Secciones interiores ---------- */
.sec-title--md { font-size: var(--fs-3xl); line-height: 1.12; }
.sec-head + * { margin-top: clamp(var(--sp-8), 4vw, var(--sp-12)); }
.sec--tight { padding-block: calc(var(--section-y) * .7); }

/* Dos columnas: intro fija a la izquierda y contenido a la derecha */
.split { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(var(--sp-8), 6vw, 5.5rem); align-items: start; }
.split__intro { position: sticky; top: calc(var(--header-h) + var(--sp-6)); }
.split__intro .link-line { margin-top: var(--sp-5); }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } .split__intro { position: static; } }

/* Rejilla de tarjetas */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: var(--sp-5); margin: 0; padding: 0; list-style: none; }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }

/* Tarjeta con icono o número */
.icard { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.icard__ic { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.icard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.icard__n { font-size: clamp(2.5rem, 2rem + 1.6vw, 3.5rem); }
.icard h3 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: 1.2; color: var(--text-strong); }
.icard p { color: var(--text-muted); line-height: 1.6; }
.icard p strong { color: var(--text-strong); }
.icard .link-line { margin-top: auto; padding-top: var(--sp-2); align-self: flex-start; }

/* Pasos numerados en tarjetas */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--sp-5); margin: 0; padding: 0; list-style: none; counter-reset: paso; }
.steps > li { counter-increment: paso; position: relative; display: grid; gap: var(--sp-2); align-content: start; }
.steps > li::before { content: counter(paso, decimal-leading-zero); font-family: var(--font-display); font-size: clamp(2.5rem, 2rem + 1.6vw, 3.5rem); font-weight: var(--fw-medium); line-height: .95; color: var(--accent); }
.steps strong { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text-strong); line-height: 1.2; }
.steps span { color: var(--text-muted); line-height: 1.6; overflow-wrap: anywhere; }

/* Lista de comprobación en tarjetas */
.checks { display: grid; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: var(--sp-4); align-items: flex-start; padding: 1.125rem 1.375rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text); line-height: 1.6; min-width: 0; }
.checks li > .icon { flex: none; width: 1.5rem; height: 1.5rem; margin-top: .1rem; color: var(--accent); }
.checks li > span { min-width: 0; overflow-wrap: anywhere; }
.checks strong { color: var(--text-strong); }

/* Aviso destacado */
.callout { display: flex; gap: var(--sp-4); align-items: flex-start; padding: var(--sp-5) var(--sp-6); border-radius: var(--r-lg); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text); line-height: 1.6; }
.callout > .icon { flex: none; width: 1.5rem; height: 1.5rem; margin-top: .125rem; color: var(--accent); }
.callout strong { color: var(--text-strong); }

/* Píldoras de navegación interna (índice de la página, grupos de servicios) */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.chips a { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: .5rem 1.125rem; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); color: var(--text-strong); font-size: var(--fs-sm); font-weight: var(--fw-semibold); text-decoration: none; transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease; }
.chips a:hover { border-color: var(--accent); background: var(--accent-soft); }
.page-index { margin-top: var(--sp-6); }
.page-index:first-child { margin-top: 0; }
.svc-group:first-of-type { margin-top: clamp(var(--sp-10), 5vw, var(--sp-16)); }
.chips__n { display: inline-grid; place-items: center; min-width: 1.75rem; height: 1.75rem; padding-inline: .375rem; border-radius: var(--r-pill); background: var(--accent-fill); color: var(--on-accent); font-size: var(--fs-xs); font-weight: var(--fw-bold); }

/* ---------- Documento: texto largo con barra lateral ---------- */
.doc { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: clamp(var(--sp-10), 6vw, 5rem); align-items: start; }
.doc__aside { position: sticky; top: calc(var(--header-h) + var(--sp-4)); display: grid; gap: var(--sp-4); }
.doc__aside h2 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: 1.2; }
.doc__aside p { color: var(--text-muted); }
.doc__aside .btn { width: 100%; white-space: normal; }
@media (max-width: 980px) { .doc { grid-template-columns: minmax(0, 1fr); } .doc__aside { position: static; } }

.prose { max-width: 70ch; font-size: var(--fs-base); line-height: 1.75; color: var(--text); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.2em; font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: var(--fw-semibold); line-height: 1.2; color: var(--text-strong); scroll-margin-top: calc(var(--header-h) + var(--sp-4)); }
.prose h3 { margin-top: 1.6em; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text-strong); }
.prose > :first-child { margin-top: 0; }
.prose > .callout + h2 { margin-top: 1.6em; }
.prose ul { list-style: none; padding-left: 0; }
.prose ul li { position: relative; padding-left: 1.5rem; }
.prose ul li + li, .prose ol li + li { margin-top: .5em; }
.prose ul li::before { content: ""; position: absolute; left: .25rem; top: .7em; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent-fill); }
.prose ol { padding-left: 1.5em; }
.prose ol li { padding-left: .375rem; }
.prose ol li::marker { color: var(--accent); font-weight: var(--fw-bold); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--text-strong); }
.prose strong { color: var(--text-strong); font-weight: var(--fw-bold); }
.disclaimer { margin-top: var(--sp-8); padding-top: var(--sp-5); border-top: 1px solid var(--line); font-size: var(--fs-sm); line-height: 1.6; color: var(--text-muted); }
.prose .disclaimer { margin-top: 2.5em; }

/* Tabla (sanciones) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.table { width: 100%; min-width: 40rem; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: var(--sp-4) var(--sp-5); text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table th { background: var(--surface-2); color: var(--text-strong); font-weight: var(--fw-semibold); }
.table td { color: var(--text); white-space: nowrap; }
.table td:first-child { font-weight: var(--fw-semibold); color: var(--text-strong); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--accent-soft); }
.table .num { font-variant-numeric: tabular-nums; }
.table-note { margin-top: var(--sp-4); max-width: 70ch; font-size: var(--fs-sm); line-height: 1.6; color: var(--text-muted); }

/* ---------- Servicios ---------- */
.svc-group + .svc-group { margin-top: clamp(var(--sp-12), 6vw, var(--sp-20)); }
.svc-group__title { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-6); font-size: var(--fs-2xl); scroll-margin-top: calc(var(--header-h) + var(--sp-4)); }
.svc-group__title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--accent-line), transparent); }
.svc { scroll-margin-top: calc(var(--header-h) + var(--sp-4)); }
.svc__sub { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.tags li { padding: .25rem .75rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--bg); color: var(--text-muted); font-size: var(--fs-xs); }

/* ---------- Guías ---------- */
.guide { display: flex; flex-direction: column; gap: var(--sp-3); height: 100%; color: inherit; text-decoration: none; min-width: 0; }
.guide__meta { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }
.guide h2 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: 1.22; color: var(--text-strong); }
.guide p { color: var(--text-muted); line-height: 1.6; }
.guide__go { display: inline-flex; align-items: center; gap: var(--sp-2); margin-top: auto; padding-top: var(--sp-3); color: var(--accent); font-weight: var(--fw-semibold); }
.guide__go .icon { transition: transform var(--dur-fast) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .guide:hover .guide__go .icon { transform: translateX(3px); } }
.guide:focus-visible { outline-offset: 4px; }
.empty-state { display: grid; gap: var(--sp-4); }

/* ---------- Consulta por WhatsApp (includes/consulta-whatsapp.php) ---------- */
.consulta { position: relative; overflow: hidden; isolation: isolate; display: grid; gap: var(--sp-5); padding: clamp(var(--sp-6), 4vw, 3rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2xl); scroll-margin-top: calc(var(--header-h) + var(--sp-4)); }
.consulta::before { content: ""; position: absolute; z-index: -1; right: -10rem; top: -10rem; width: 26rem; height: 26rem; border-radius: 50%; background: radial-gradient(circle, var(--glow), transparent 68%); opacity: .8; }
.consulta__title { font-size: var(--fs-3xl); line-height: 1.1; }
.consulta__text { max-width: 52ch; color: var(--text-muted); line-height: 1.6; }
.consulta__steps { display: grid; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.consulta__steps li { display: flex; align-items: center; gap: var(--sp-3); color: var(--text); font-weight: var(--fw-semibold); }
.consulta__steps .icon { flex: none; width: 2.5rem; height: 2.5rem; padding: .5625rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.consulta__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.consulta__note { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.consulta__note .icon { color: var(--accent); }

/* Canales de contacto */
.channels { display: grid; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.channel { display: flex; align-items: center; gap: var(--sp-4); min-height: var(--tap-lg); padding: var(--sp-4) var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); color: inherit; text-decoration: none; }
.channel__ic { flex: none; display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.channel__txt { display: grid; min-width: 0; }
.channel__txt strong { color: var(--text-strong); font-weight: var(--fw-bold); overflow-wrap: anywhere; }
.channel__txt span { font-size: var(--fs-sm); color: var(--text-muted); }
.channel > .icon:last-child { margin-left: auto; flex: none; color: var(--accent); }

/* Sedes con mapa (includes/sedes-mapa.php) */
.sedes { display: grid; gap: var(--sp-5); }
.sede { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--sp-6); align-items: stretch; padding: var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2xl); }
.sede__info { display: grid; gap: var(--sp-3); align-content: start; padding: var(--sp-2); }
.sede__city { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-2xl); }
.sede__city .icon { color: var(--accent); }
.sede__address { font-size: var(--fs-lg); color: var(--text); }
.sede__meta { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.sede__meta .icon { color: var(--accent); }
.sede__info .btn { justify-self: start; margin-top: var(--sp-2); }
.sede__map { min-height: 18rem; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.sede__map iframe { display: block; width: 100%; height: 100%; min-height: 18rem; border: 0; }
.sede__map--empty { display: grid; place-items: center; padding: var(--sp-6); text-align: center; color: var(--text-muted); }
.sede__map--empty p { display: flex; gap: var(--sp-2); align-items: flex-start; max-width: 32ch; }
.sede__map--empty .icon { flex: none; color: var(--accent); }
@media (max-width: 760px) { .sede { grid-template-columns: minmax(0, 1fr); } .sede__info .btn { justify-self: stretch; } }

/* ---------- Buscador y 404 ---------- */
.search-page__form { display: flex; gap: var(--sp-2); max-width: 44rem; padding: var(--sp-2); border-radius: var(--r-pill); }
.search-page__form input { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 var(--sp-4); border: 0; background: transparent; color: var(--text-strong); font-size: var(--fs-base); }
.search-page__form input::placeholder { color: var(--text-dim); opacity: 1; }
.search-page__form input:focus-visible { outline: none; }
.search-page__form:focus-within { border-color: var(--accent); outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.search-page__count { margin-bottom: var(--sp-5); font-weight: var(--fw-semibold); color: var(--text-strong); }
.search-results { display: grid; gap: var(--sp-3); max-width: 52rem; margin: 0; padding: 0; list-style: none; }
.search-results .search-result { display: grid; gap: var(--sp-1); padding: var(--sp-5) var(--sp-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); text-decoration: none; }
.search-results .search-result__titulo { font-family: var(--font-display); font-size: var(--fs-lg); }
@media (max-width: 600px) {
    .search-page__form { flex-direction: column; border-radius: var(--r-xl); }
    .search-page__form .btn { width: 100%; }
}
.notfound-code { font-family: var(--font-display); font-size: clamp(4.5rem, 3rem + 8vw, 9rem); font-weight: var(--fw-medium); line-height: .9; color: var(--numeral); }
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.quick-links a { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--tap-lg); padding: var(--sp-4) var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); color: var(--text-strong); font-weight: var(--fw-semibold); text-decoration: none; }
.quick-links .icon { flex: none; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-8); }
@media (max-width: 600px) { .actions .btn, .consulta__actions .btn { width: 100%; white-space: normal; text-align: center; } }

/* ---------- Respuesta al pasar el mouse (tarjetas enlazadas) ---------- */
.channel, .quick-links a, .search-results .search-result { transition: transform .3s var(--ease-out), border-color .3s ease, box-shadow .3s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
    .channel:hover, .quick-links a:hover, .search-results .search-result:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow-hover); }
}
@media (prefers-reduced-motion: reduce) {
    .channel, .quick-links a, .search-results .search-result, .chips a, .lift { transition: none; }
    .lift:hover, .channel:hover, .quick-links a:hover, .search-results .search-result:hover { transform: none; }
}
