/* Mesial · formación y comunidad: reseñas, rutas, insignias y docentes (frente F).
   Mobile first: todo se diseña a 390 px y se amplía con min-width. Solo colores de tokens.css. */

/* Estrellas (indicador en noche: el coral sobre crema no llega a 3:1) */
.stars { position: relative; display: inline-block; line-height: 0; vertical-align: middle; }
.stars-empty, .stars-on { display: inline-flex; gap: 2px; }
.stars svg { width: 16px; height: 16px; flex: none; }
.stars-sm svg { width: 14px; height: 14px; }
.stars-lg svg { width: 22px; height: 22px; }
.stars-empty svg path { fill: var(--linea-fuerte); }
.stars-fill { position: absolute; inset: 0 auto 0 0; display: block; overflow: hidden; white-space: nowrap; }
.stars-on svg path { fill: var(--noche); }

.ev-rating { display: inline-flex; align-items: center; gap: 8px; margin-top: var(--s-3); min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.ev-rating span { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--linea-fuerte); }
.ev-rating:hover span { text-decoration-color: currentColor; }

/* Resumen de calificaciones */
.rating-summary { display: grid; gap: var(--s-5); padding: var(--s-5); background: var(--surface); border: 1px solid var(--linea); border-radius: var(--r-card); }
.rs-big { display: grid; gap: 6px; align-content: start; }
.rs-big b { font-family: var(--font-display); font-size: 3rem; font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.rs-dist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rs-dist li { display: grid; grid-template-columns: 12px 14px 1fr 28px; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-2); }
.rs-star { width: 14px; height: 14px; }
.rs-star path { fill: var(--noche); }
.rs-bar { height: 8px; background: var(--crema-200); border-radius: 8px; overflow: hidden; }
.rs-bar i { display: block; height: 100%; background: var(--noche); border-radius: 8px; transform-origin: left; animation: f-grow 700ms var(--ease) both; }
.rs-c { text-align: right; }
@media (min-width: 640px) { .rating-summary { grid-template-columns: 180px 1fr; align-items: center; } }

.rv-cta { display: grid; gap: var(--s-3); margin-top: var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-card); background: var(--noche-050); }
.rv-cta p { margin-top: 4px; }
@media (min-width: 640px) { .rv-cta { grid-template-columns: 1fr auto; align-items: center; } }
.ev-reviews .notice { margin-top: var(--s-4); }

.rv-form { display: grid; gap: var(--s-4); margin-top: var(--s-4); padding: var(--s-5); border: 1px solid var(--linea-fuerte); border-radius: var(--r-card); background: var(--surface); }
.rv-form h3 { font-size: 1.125rem; }
.star-input { border: 0; margin: 0; padding: 0; }
.star-input .label { font-weight: 500; font-size: 0.9rem; margin-bottom: 6px; padding: 0; }
.star-input-row { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.star-pick { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; }
.star-pick svg { width: 30px; height: 30px; transition: transform 160ms var(--ease); }
.star-pick svg path { fill: var(--surface); stroke: var(--noche); stroke-width: 1.3; stroke-linejoin: round; }
.star-pick.on svg path { fill: var(--noche); }
.star-pick:hover svg { transform: scale(1.08); }
.star-pick:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.star-word { margin-left: var(--s-2); font-weight: 500; color: var(--ink-2); font-size: 0.9rem; }

.rv-mine { margin-top: var(--s-5); }
.rv-mine h3 { font-size: 1rem; margin-bottom: var(--s-2); }
.reviews-list { display: grid; gap: var(--s-3); margin-top: var(--s-5); margin-bottom: var(--s-4); }
@media (min-width: 900px) { .reviews-list { grid-template-columns: 1fr 1fr; } }
.review { display: grid; gap: var(--s-2); align-content: start; padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--linea); border-radius: var(--r-card); }
.review header { display: grid; grid-template-columns: 40px 1fr auto; gap: var(--s-3); align-items: center; }
.review header div { display: grid; min-width: 0; }
.review header b { font-size: 0.95rem; }
.review p { margin: 0; line-height: 1.55; }
.rv-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.rv-initials { display: grid; place-items: center; background: var(--noche-100); color: var(--noche); font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }
.rv-verified { display: inline-flex; align-items: center; gap: 4px; color: var(--exito); font-weight: 500; }
.rv-meta { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.rv-helpful { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border: 1px solid var(--linea-fuerte); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font: inherit; font-size: 0.85rem; cursor: pointer; }
.rv-helpful:hover { border-color: var(--noche); }
.rv-helpful.on { background: var(--noche); border-color: var(--noche); color: var(--blanco); }
.rv-helpful .num { font-weight: 600; }
@media (pointer: coarse) { .rv-helpful { min-height: 44px; } }

/* Insignias de los valores */
.badge-svg { display: block; overflow: visible; }
.bd-track { fill: none; stroke: var(--linea-fuerte); stroke-width: 2; }
.bd-progress { fill: none; stroke: var(--noche); stroke-width: 3; stroke-linecap: round; }
.bd-disc { fill: var(--surface); stroke: var(--linea); stroke-width: 1; }
.bd-fill { fill: var(--noche); opacity: 0.32; }
.bd-line { fill: none; stroke: var(--noche); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0.32; }
.bd-soft { stroke-width: 2; }
.bd-dot { fill: none; stroke: var(--tenue); stroke-width: 1.5; }
.is-earned .bd-track { stroke: var(--noche); }
.is-earned .bd-progress { stroke: var(--noche); }
.is-earned .bd-disc { fill: var(--noche); stroke: var(--noche); }
.is-earned .bd-fill { fill: var(--crema); opacity: 1; }
.is-earned .bd-line { stroke: var(--crema); opacity: 1; }
.is-earned .bd-soft { opacity: 0.45; }
.is-earned .bd-dot { fill: var(--coral); stroke: none; }
.bd-progress { animation: f-ring 900ms var(--ease) both; }

.badge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
@media (min-width: 720px) { .badge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .badge-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.badge-card { display: grid; justify-items: center; align-content: start; gap: 6px; padding: var(--s-5) var(--s-3) var(--s-4); text-align: center; background: var(--surface); border: 1px solid var(--linea); border-radius: var(--r-card); }
.badge-card h3 { margin-top: var(--s-2); font-size: 1.05rem; }
.badge-card p { margin: 0; line-height: 1.4; }
.badge-card .badge-rule { display: none; }
.badge-card.earned { border-color: var(--noche-100); }
@media (min-width: 720px) { .badge-card .badge-rule { display: block; margin-top: 4px; font-size: 0.78rem; } }

/* Mi formación */
.mf-alert { display: grid; gap: var(--s-4); padding: var(--s-5); margin-bottom: var(--s-5); border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--noche-100); }
.mf-alert-head { display: flex; gap: var(--s-3); align-items: flex-start; }
.mf-alert-head .icon-tile { flex: none; }
.mf-alert h2 { font-size: 1.2rem; }
.mf-alert p { color: var(--ink-2); margin-top: 4px; }
.to-review { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 82%); gap: var(--s-3); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
.to-review article { scroll-snap-align: start; display: grid; grid-template-columns: 56px 1fr; gap: var(--s-3); align-items: center; padding: var(--s-3); border: 1px solid var(--linea); border-radius: 14px; background: var(--crema); }
.to-review img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.to-review b { display: block; font-size: 0.9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.to-review .btn { grid-column: 1 / -1; }
@media (min-width: 900px) { .to-review { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; } }

.mf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .mf-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mf-stats .stat b { font-size: 1.75rem; }
.mf-grid { display: grid; gap: var(--s-4); margin-top: var(--s-4); }
@media (min-width: 1024px) { .mf-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.mf-card { padding: var(--s-5); background: var(--surface); border: 1px solid var(--linea); border-radius: var(--r-card); min-width: 0; }
.mf-card h2 { font-size: 1.2rem; }
.mf-card .sub { color: var(--ink-2); font-size: 0.875rem; margin-top: 4px; }
.mf-section { margin-top: var(--s-10); }
.mf-section-head { display: flex; justify-content: space-between; align-items: end; gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap; }
.mf-section-head h2 { font-size: 1.4rem; }
.mf-section-head p { color: var(--ink-2); font-size: 0.9rem; margin-top: 4px; }

.months-chart { display: block; width: 100%; height: auto; margin-top: var(--s-4); }
.mc-bar { fill: var(--noche); transform-box: fill-box; transform-origin: bottom; animation: f-rise 700ms var(--ease) both; }
.mc-empty { fill: var(--linea-fuerte); }
.mc-axis { stroke: var(--linea-fuerte); stroke-width: 1; }
.mc-val { font: 600 11px var(--font-sans); fill: var(--ink); font-variant-numeric: tabular-nums; }
.mc-lab { font: 500 10.5px var(--font-sans); fill: var(--ink-2); }
.mc-now { fill: var(--ink); font-weight: 700; }
.spec-bars { display: grid; gap: 10px; margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--linea); }
.spec-bars h3 { font-size: 0.95rem; }
.spec-bar { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 4px 10px; font-size: 0.85rem; }
.spec-bar .bar { grid-column: 1 / -1; height: 8px; grid-row: 2; }
.spec-bar .bar i { animation: f-grow 700ms var(--ease) both; transform-origin: left; }
.spec-bar b { text-align: right; font-variant-numeric: tabular-nums; }

/* Resumen anual: banda noche */
.year-card { background: var(--noche); color: var(--crema); border-color: var(--noche); display: grid; gap: var(--s-4); align-content: start; }
.year-card h2 { color: var(--blanco); }
.year-card .sub { color: var(--noche-100); }
.year-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-3); margin: 0; }
.year-figs div { display: grid; gap: 2px; }
.year-figs dt { font-size: 0.8rem; color: var(--noche-100); }
.year-figs dd { order: -1; }
.year-figs dd { margin: 0; font-family: var(--font-display); font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; color: var(--blanco); font-variant-numeric: tabular-nums; }
.year-card p { margin: 0; line-height: 1.55; color: var(--crema); }
.year-card p b { color: var(--blanco); }
.year-levels { display: flex; gap: 6px; flex-wrap: wrap; }
.year-levels span { padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid rgba(246, 244, 240, 0.35); font-size: 0.8rem; }

/* Barras de pasos de una ruta */
.path-steps-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.path-steps-bar span { height: 8px; border-radius: 8px; background: var(--crema-200); }
.path-steps-bar .psb-done { background: var(--noche); }
.path-steps-bar .psb-enrolled { background: var(--noche-100); box-shadow: inset 0 0 0 1.5px var(--noche); }

.path-mini-list { display: grid; gap: var(--s-3); }
@media (min-width: 720px) { .path-mini-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .path-mini-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.path-mini { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: var(--s-3) var(--s-4); padding: var(--s-4); background: var(--surface); border: 1px solid var(--linea); border-radius: var(--r-card); transition: box-shadow 200ms var(--ease), border-color 200ms var(--ease); }
.path-mini:hover { border-color: var(--linea-fuerte); box-shadow: var(--shadow-hover); }
.path-mini img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.path-mini h3 { font-size: 1rem; }
.path-mini .small { margin-top: 2px; }
.path-mini .path-steps-bar { grid-column: 1 / -1; }
.path-mini a.stretched { position: absolute; inset: 0; border-radius: inherit; }

/* Catálogo de rutas (/rutas) */
.paths-hero { padding-block: var(--s-10) var(--s-6); display: grid; gap: var(--s-3); }
.paths-hero p { color: var(--ink-2); max-width: 60ch; }
.paths-levels { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.paths-grid { display: grid; gap: var(--s-4); padding-bottom: var(--s-16); }
@media (min-width: 720px) { .paths-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .paths-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.path-card { position: relative; display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--linea); border-radius: var(--r-card); overflow: hidden; transition: box-shadow 220ms var(--ease), transform 220ms var(--ease); }
.path-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.path-card .pc-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--crema-200); }
.path-card .pc-media img { width: 100%; height: 100%; object-fit: cover; }
.path-card .pc-body { display: grid; gap: var(--s-3); padding: var(--s-5); align-content: start; }
.path-card h2 { font-size: 1.2rem; line-height: 1.25; }
.path-card p { color: var(--ink-2); font-size: 0.92rem; margin: 0; }
.pc-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pc-steps li { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center; font-size: 0.88rem; }
.pc-steps .pc-n { font-size: 0.78rem; color: var(--ink-2); text-align: right; white-space: nowrap; }
.pc-node { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--noche); background: var(--surface); justify-self: center; }
.pc-node.done { background: var(--noche); }
.pc-node.enrolled { background: var(--noche-100); }
.pc-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--linea); font-size: 0.88rem; }
.path-card a.stretched { position: absolute; inset: 0; }

/* Detalle de ruta (/rutas/:slug): línea de etapas */
.path-head { display: grid; gap: var(--s-5); padding-block: var(--s-6) var(--s-8); }
.path-head .ph-media { border-radius: var(--r-card); overflow: hidden; aspect-ratio: 16 / 9; background: var(--crema-200); }
.path-head .ph-media img { width: 100%; height: 100%; object-fit: cover; }
.path-head p { color: var(--ink-2); max-width: 62ch; }
.path-head h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.9rem); }
@media (min-width: 960px) { .path-head { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: var(--s-12); } }
.path-progress { display: grid; gap: var(--s-3); padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--linea); border-radius: var(--r-card); }
.path-progress-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.path-progress b.num { font-family: var(--font-display); font-size: 1.6rem; }

.stages { list-style: none; margin: 0; padding: 0 0 var(--s-16); display: grid; }
.stage { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--s-4); padding-bottom: var(--s-10); }
.stage::before { content: ''; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--linea-fuerte); }
.stage:last-child::before { display: none; }
.stage.done::before { background: var(--noche); }
.stage-node { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--noche); color: var(--noche); font-family: var(--font-display); font-weight: 600; }
.stage-node .icon { width: 20px; height: 20px; }
.stage.done .stage-node { background: var(--noche); color: var(--blanco); }
.stage.enrolled .stage-node { background: var(--noche-100); }
.stage.current .stage-node { box-shadow: 0 0 0 5px var(--noche-100); }
.stage-body { display: grid; gap: var(--s-3); min-width: 0; }
.stage-top { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.stage-body h2 { font-size: 1.3rem; }
.stage-body > p { color: var(--ink-2); margin: 0; max-width: 62ch; }
.stage-mine { display: grid; gap: 6px; padding: var(--s-3) var(--s-4); border-radius: 12px; background: var(--noche-050); font-size: 0.9rem; }
.stage-mine a { color: var(--ink); }
.stage-events { display: grid; gap: var(--s-3); }
@media (min-width: 720px) { .stage-events { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .stage-events { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stage-empty { padding: var(--s-4); border: 1px dashed var(--linea-fuerte); border-radius: 14px; color: var(--ink-2); font-size: 0.9rem; }
.other-paths { display: flex; gap: var(--s-2); flex-wrap: wrap; padding-bottom: var(--s-16); }

/* Administración */
.mod-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s-4); }
.mod-list { display: grid; gap: var(--s-3); }
.mod-item { display: grid; gap: var(--s-2); padding: var(--s-4); border: 1px solid var(--linea); border-radius: 14px; background: var(--surface); }
.mod-item header { display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.mod-item p { margin: 0; }
.inst-row { display: grid; grid-template-columns: 48px 1fr; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-top: 1px solid var(--linea); }
.inst-row .inst-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.inst-row .switch-line { grid-column: 2; }
@media (min-width: 720px) { .inst-row { grid-template-columns: 48px 1fr auto; } .inst-row .switch-line { grid-column: auto; } }

@keyframes f-grow { from { transform: scaleX(0); } }
@keyframes f-rise { from { transform: scaleY(0); } }
@keyframes f-ring { from { stroke-dasharray: 0 283; } }
@media (prefers-reduced-motion: reduce) {
  .rs-bar i, .mc-bar, .spec-bar .bar i, .bd-progress { animation: none; }
  .path-card:hover { transform: none; }
}

/* Mi formación (cierre 26-11): inscripciones primero, progreso en su pestaña, botones de 48 px. */
.mf-head .mf-who { display: flex; gap: var(--s-4); align-items: center; min-width: 0; }
.mf-head h1 { font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.6rem); }
.mf-head .link-arrow { min-height: 48px; }
.mf-body { padding: var(--s-6) 0 var(--s-16); }
.mf-h2 { font-size: 1.375rem; margin-bottom: var(--s-4); }
.mf-h2-sep { margin-top: var(--s-10); }
.mf-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 var(--s-6); padding-bottom: var(--s-4); border-bottom: 1px solid var(--linea); color: var(--ink-2); }
.mf-note .link-arrow { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-weight: 600; color: var(--link); }
.mf-row-btn { position: relative; z-index: 1; min-height: 48px; }
.mf-org-ini { width: 44px; height: 44px; flex: none; }
@media (max-width: 760px) {
  .mf-search { width: 100%; min-height: 48px; justify-content: center; }
}
.avatar-lg.avatar-initials { font-size: 1.5rem; }
