/* Rocapia — /eficiencia-operativa
   Estilos exclusivos de esta página. Se cargan después de styles.css y son
   puramente aditivos: no redefinen tokens ni componentes globales, solo los
   reutilizan (rc-eyebrow, rc-btn-primary/secondary, rc-tabs/rc-tab-btn,
   rc-sistema/rc-fugas/rc-fuga, rc-metodo, rc-cta-final, wrap, reveal...).

   Los 4 mockups en design/mockups/ definían su propio lenguaje visual
   (fondo papel + ruido + blobs, paleta esmeralda/arcilla propia, JetBrains
   Mono). Aquí se reconstruye su lógica de interacción — nodos, tarjeta de
   detalle Hoy/Con Rocapia, selector de vertical, simulador — sobre el
   sistema de diseño real del sitio. Ver css/tokens/colors.css para el único
   color nuevo introducido (--color-clay-600), justificado como extensión
   puntual para la columna "Hoy" de las comparativas. */

:root {
  --ep-clay: var(--color-clay-600);
  --ep-clay-soft: var(--color-clay-100);
  --ep-nav-h: 69px; /* altura real de .rc-nav, para el offset de la sub-nav pegajosa */
}

/* ---------- Hero ---------- */
.rc-ep-hero { max-width: 900px; margin: 0 auto; padding: 88px 40px 64px; text-align: center; }
.rc-ep-hero .rc-hero-badge { margin-left: auto; margin-right: auto; }
.rc-ep-hero h1 { font-size: clamp(34px, 4.4vw, 54px); line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; }
.rc-ep-hero .rc-hero-lead { max-width: 640px; margin-left: auto; margin-right: auto; }
.rc-ep-hero .rc-hero-actions { justify-content: center; }
.rc-ep-hero .rc-hero-footnote { text-align: center; }

/* ---------- El problema (condensado, 4 tarjetas — una por ciclo) ---------- */
.rc-ep-problema .rc-fugas { grid-template-columns: repeat(4, 1fr); }

/* ---------- Sección 3: el ciclo completo ---------- */
.rc-ep-ciclos-intro { max-width: 1200px; margin: 0 auto; padding: 96px 40px 0; }
.rc-ep-ciclos-intro-inner { max-width: 720px; }

.rc-ep-subnav {
  position: sticky; top: var(--ep-nav-h); z-index: 40;
  background: rgba(242,244,247,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  margin-top: 40px;
}
.rc-ep-subnav-inner { max-width: 1200px; margin: 0 auto; padding: 14px 40px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.rc-ep-subnav-inner::-webkit-scrollbar { display: none; }
.rc-ep-subnav-link {
  flex: none; border: none; background: transparent; color: var(--muted);
  padding: 9px 18px; border-radius: var(--radius-pill); font-size: 14.5px; font-weight: 600;
  font-family: var(--font-display); text-decoration: none; cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.rc-ep-subnav-link:hover { color: var(--ink); }
.rc-ep-subnav-link.is-active { background: var(--ink); color: var(--white); }
.rc-ep-subnav-link-more { color: var(--accent); border: 1px dashed var(--line); }

.rc-ep-cycle { max-width: 1200px; margin: 0 auto; padding: 72px 40px; scroll-margin-top: calc(var(--ep-nav-h) + 64px); }
.rc-ep-cycle:nth-child(even) { background: var(--white); }
.rc-ep-cycle-head { max-width: 760px; margin: 0 auto 44px; text-align: center; }
.rc-ep-cycle-head h3 { font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 3vw, 36px); line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 14px; }
.rc-ep-cycle-head h3 em { font-style: normal; color: var(--accent); }
.rc-ep-cycle-head p { font-size: 16px; line-height: 1.6; color: var(--muted); }

/* Selector de vertical (ciclo 1) / simulador (ciclo 3) — reutiliza rc-tabs */
.rc-ep-simulator { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 32px; }
.rc-ep-simulator-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-d); }
.rc-ep-simulator .rc-tabs { margin-bottom: 0; }
.rc-ep-cycle-head .rc-tabs { justify-content: center; margin: 0 auto 4px; }
.rc-ep-tabs-wrap { display: flex; justify-content: center; margin-bottom: 8px; }

/* Layout: dos columnas con card estrecha a la derecha (Expediente / Tesorería,
   diagramas verticalish) o con card estrecha pero diagrama ancho a la
   izquierda (Compras / Activos, diagramas horizontales de 5 nodos) */
.rc-ep-stage { display: grid; grid-template-columns: minmax(300px, 460px) 1fr; gap: 40px; align-items: start; }
.rc-ep-stage.is-full { display: flex; flex-direction: column; gap: 32px; align-items: stretch; }
.rc-ep-stage.is-reverse { grid-template-columns: 1fr minmax(300px, 460px); }
/* Los hijos son items de grid/flex y por defecto llevan min-width:auto, que les
   impide encogerse por debajo de su contenido: como los diagramas llevan un
   min-width propio (520–600px), el bloque reventaba el ancho en móvil y el
   overflow-x:clip del body recortaba los últimos pasos, dejándolos
   inalcanzables. Con min-width:0 el contenedor sí encoge y el scroll lateral
   pasa a ocurrir dentro del propio diagrama, que es lo que se pretendía. */
.rc-ep-stage > * { min-width: 0; }

/* ---------- Nodo compartido por los 4 diagramas ---------- */
.rc-ep-node {
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center;
  cursor: pointer; background: none; border: none; font-family: inherit; padding: 0;
}
.rc-ep-node-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 13px;
  color: var(--muted-d); margin-bottom: 10px;
  transition: all .25s var(--ease-standard);
}
.rc-ep-node:hover .rc-ep-node-circle { border-color: var(--accent); color: var(--accent-primary-hover); transform: translateY(-2px); }
.rc-ep-node.is-seen .rc-ep-node-circle { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-primary-hover); }
.rc-ep-node.is-active .rc-ep-node-circle {
  background: var(--ink); border-color: var(--ink); color: var(--white);
  transform: translateY(-2px) scale(1.08); box-shadow: var(--shadow-lg);
}
.rc-ep-node-label { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--muted); max-width: 92px; line-height: 1.3; transition: color .2s ease; }
.rc-ep-node.is-active .rc-ep-node-label, .rc-ep-node:hover .rc-ep-node-label { color: var(--ink); }
.rc-ep-node.is-dim { opacity: .4; }

.rc-ep-hint { font-family: var(--font-mono); font-size: 12px; color: var(--muted-d); letter-spacing: .02em; margin: 10px 2px 0; text-align: center; }

/* ---------- Tarjeta de detalle (Hoy / Con Rocapia) ---------- */
.rc-ep-detail {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 32px; min-height: 320px;
}
.rc-ep-detail-head { margin-bottom: 8px; }
.rc-ep-detail-num { font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--accent-primary-hover); }
.rc-ep-detail-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.rc-ep-detail-sentence { font-size: 15px; color: var(--muted); line-height: 1.55; margin-bottom: 22px; }

.rc-ep-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rc-ep-compare-col { border-radius: var(--radius-md); padding: 18px; }
.rc-ep-compare-col.is-before { background: var(--ep-clay-soft); }
.rc-ep-compare-col.is-after { background: var(--accent-soft); }
.rc-ep-compare-label { font-family: var(--font-mono); display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 8px; }
.rc-ep-compare-col.is-before .rc-ep-compare-label { color: var(--ep-clay); }
.rc-ep-compare-col.is-after .rc-ep-compare-label { color: var(--accent-primary-hover); }
.rc-ep-compare-col p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); }

@keyframes rc-ep-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.rc-ep-detail-title, .rc-ep-detail-sentence, .rc-ep-compare-col { animation: rc-ep-fade-up .3s var(--ease-standard) both; }
.rc-ep-compare-col.is-after { animation-delay: .05s; }

/* ---------- Ciclo 1 · Expediente — línea de tiempo horizontal ---------- */
.rc-ep-timeline-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding: 26px 4px 6px; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.rc-ep-timeline-scroll::-webkit-scrollbar { height: 6px; }
.rc-ep-timeline-scroll::-webkit-scrollbar-track { background: var(--line); border-radius: 10px; }
.rc-ep-timeline-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }
.rc-ep-timeline { position: relative; display: flex; min-width: 620px; }
.rc-ep-thread { position: absolute; top: 22px; left: 0; width: 100%; height: 44px; z-index: 0; overflow: visible; }
.rc-ep-thread path { fill: none; }
.rc-ep-thread-bg { stroke: var(--line); stroke-width: 2; stroke-dasharray: 1 9; stroke-linecap: round; }
.rc-ep-thread-fill { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 1 9; stroke-linecap: round; transition: stroke-dashoffset .5s var(--ease-standard); }
.rc-ep-timeline .rc-ep-node { flex: 1; padding: 0 3px; }

/* ---------- Ciclo 2 · Tesorería — bucle con punto orbitando ---------- */
.rc-ep-loop-wrap { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1/1; margin: 0 auto; }
.rc-ep-loop-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rc-ep-loop-thread-bg { fill: none; stroke: var(--line); stroke-width: 2.5; stroke-dasharray: 1 6; vector-effect: non-scaling-stroke; }
.rc-ep-orbit-dot { fill: var(--accent); }
.rc-ep-orbit-group { transform-origin: 50% 50%; animation: rc-ep-spin 16s linear infinite; }
@keyframes rc-ep-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.rc-ep-loop-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 120px; }
.rc-ep-loop-center .rc-ep-tag { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-d); }
.rc-ep-loop-center .rc-ep-big { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); margin-top: 4px; line-height: 1.3; }
.rc-ep-loop-wrap .rc-ep-node { position: absolute; transform: translate(-50%, -50%); }

/* ---------- Ciclo 3 · Compras — three-way match ---------- */
/* El padding inferior deja sitio a la etiqueta del nodo más bajo, que cae por
   debajo del wrap y con overflow-y:hidden se recortaría contra el borde. */
.rc-ep-diagram-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding: 8px 4px 42px; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.rc-ep-diagram-scroll::-webkit-scrollbar { height: 6px; }
.rc-ep-diagram-scroll::-webkit-scrollbar-track { background: var(--line); border-radius: 10px; }
.rc-ep-diagram-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

.rc-ep-converge-wrap { position: relative; width: 100%; min-width: 600px; aspect-ratio: 900/460; }
.rc-ep-converge-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rc-ep-thread2 { fill: none; stroke: var(--line); stroke-width: 2.5; stroke-dasharray: 1 6; vector-effect: non-scaling-stroke; }
.rc-ep-thread2.is-pago { transition: stroke .3s ease, opacity .3s ease; }
.rc-ep-warn { transform-origin: 650px 230px; transition: opacity .25s ease, transform .25s ease; }
.rc-ep-warn.is-hidden { opacity: 0; transform: scale(.6); pointer-events: none; }
.rc-ep-warn circle { fill: var(--ep-clay-soft); stroke: var(--ep-clay); stroke-width: 2; }
.rc-ep-warn text { fill: var(--ep-clay); font-family: var(--font-mono); font-weight: 700; font-size: 16px; text-anchor: middle; }
@keyframes rc-ep-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.rc-ep-warn:not(.is-hidden) { animation: rc-ep-pulse 1.6s ease-in-out infinite; }
.rc-ep-converge-wrap .rc-ep-node { position: absolute; transform: translate(-50%, -50%); }

/* ---------- Ciclo 4 · Activos — línea → bucle → línea ---------- */
.rc-ep-circuit-wrap { position: relative; width: 100%; min-width: 600px; aspect-ratio: 900/420; }
.rc-ep-circuit-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rc-ep-loop-thread2 { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 1 6; vector-effect: non-scaling-stroke; opacity: .55; }
.rc-ep-circuit-wrap .rc-ep-orbit-group { transform-origin: 450px 250px; animation: rc-ep-spin 12s linear infinite; }
.rc-ep-circuit-wrap .rc-ep-orbit-dot { r: 6; }
/* El texto vive dentro del círculo (≈152px de diámetro al ancho mínimo), así
   que va estrecho y en dos líneas cortas: si crece, choca con los nodos 03/04
   que se apoyan en el borde inferior del bucle. */
.rc-ep-circuit-loop-center { position: absolute; left: 50%; top: 59.5%; transform: translate(-50%, -50%); text-align: center; width: 128px; z-index: 1; }
.rc-ep-circuit-loop-center .rc-ep-tag { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-d); line-height: 1.2; }
.rc-ep-circuit-loop-center .rc-ep-big { font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--ink); margin-top: 2px; line-height: 1.2; }
.rc-ep-circuit-wrap .rc-ep-node { position: absolute; transform: translate(-50%, -50%); }

/* ---------- Sección 5: casos ilustrativos (sin clientes reales todavía) ---------- */
.rc-ep-casos { max-width: 1200px; margin: 0 auto; padding: 96px 40px; }
.rc-ep-casos-intro { max-width: 720px; margin: 0 auto 40px; text-align: center; }
.rc-ep-casos-note {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-d);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 7px 14px; margin-top: 16px;
}
.rc-ep-casos-note i { color: var(--accent); font-size: 14px; }
.rc-ep-casos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.rc-ep-caso { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.rc-ep-caso-badge { display: inline-flex; align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-d); background: var(--paper); border-radius: var(--radius-pill); padding: 5px 11px; }
.rc-ep-caso h4 { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--ink); }
.rc-ep-caso p { font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.rc-ep-caso-result { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--accent-primary-hover); margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.rc-ep-caso-result i { font-size: 15px; }

/* ---------- Catálogo ampliado: otros ciclos sin diagrama propio ---------- */
.rc-ep-catalogo { max-width: 1200px; margin: 0 auto; padding: 96px 40px; background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rc-ep-catalogo-intro { max-width: 640px; margin: 0 auto 44px; text-align: center; }
.rc-ep-catalogo-intro p { font-size: 15.5px; line-height: 1.6; color: var(--muted); margin-top: 14px; }
.rc-ep-catalogo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.rc-ep-catalogo-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.rc-ep-catalogo-card i { font-size: 20px; color: var(--accent); margin-bottom: 4px; }
.rc-ep-catalogo-card h4 { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; color: var(--ink); }
.rc-ep-catalogo-card p { font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.rc-ep-catalogo-tag { font-size: 12px; color: var(--muted-d); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.rc-ep-catalogo-cta { text-align: center; margin-top: 40px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .rc-ep-stage, .rc-ep-stage.is-reverse { grid-template-columns: 1fr; }
  .rc-ep-casos-grid { grid-template-columns: 1fr; }
  .rc-ep-catalogo-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .rc-ep-hero { padding: 64px 24px 48px; }
  .rc-ep-cycle { padding: 56px 24px; }
  .rc-ep-compare { grid-template-columns: 1fr; }
  .rc-ep-detail { padding: 24px; }
  .rc-ep-node-label { display: none; }
  .rc-ep-timeline { min-width: 520px; }
  .rc-ep-catalogo { padding: 56px 24px; }
  .rc-ep-catalogo-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .rc-ep-orbit-group { animation: none; }
  .rc-ep-warn:not(.is-hidden) { animation: none; }
  .rc-ep-detail-title, .rc-ep-detail-sentence, .rc-ep-compare-col { animation: none; opacity: 1; transform: none; }
  .rc-ep-node, .rc-ep-node-circle, .rc-ep-thread-fill, .rc-ep-thread2, .rc-ep-warn { transition: none; }
}
