/* =============================================================================
   BIG DATA LAB — DESIGN SYSTEM (v1.3.1)
   WillEdTech visual identity + Pedagogical UX components (Home, Weeks 01–08).
   Vanilla CSS only. No external fonts/CDN — local-first font stacks.
   ============================================================================= */

:root {
  /* ---- Typography -------------------------------------------------------- */
  --font-heading: "Merriweather Sans", "Segoe UI", Georgia, "Noto Sans", sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ---- WillEdTech brand (official kit + WCAG-safe derivatives) ------------- */
  --brand-primary: #5464BF;
  --brand-primary-strong: #3E4B9D;
  --brand-primary-soft: #6675CA;
  --brand-secondary: #B3B3B3;
  --brand-secondary-soft: #E8E8E8;
  --accent-achievement: #F2E205;
  --accent-achievement-ink: #332B00;
  --accent-action: #F27405;
  --accent-action-ink: #FFFFFF;
  --accent-focus: #F27405;
  --accent-warning: #AC5100;
  --accent-warning-soft: #FCEEE0;

  /* ---- Surfaces ------------------------------------------------------------ */
  --surface: #FFFFFF;
  --surface-alt: #F4F5FB;
  --surface-dark: #12142B;
  --surface-dark-alt: #1C1F3D;

  /* ---- Text ------------------------------------------------------------- */
  --text: #000000;
  --text-muted: #565A72;
  --text-on-dark: #F3F4FB;
  --text-on-dark-muted: #C7CAE3;

  /* ---- Semantic states ---------------------------------------------------- */
  --success: #157A38; /* darkened from #157F3C: 4.49:1 on --success-soft missed WCAG AA by a hair */
  --success-soft: #E4F5EA;
  --warning: #92600A;
  --warning-soft: #FBF0DA;
  --danger: #B42318;
  --danger-soft: #FBE7E5;

  /* ---- Structure ---------------------------------------------------------- */
  --border: #B3B3B3;
  --border-dark: #33375C;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 16px 40px rgba(19, 22, 56, .10);
  --shadow-sm: 0 6px 16px rgba(19, 22, 56, .08);
  --max-width: 1240px;

  /* ---- On-dark semantic tokens (v1.1C contrast fix) -----------------------
     Single source of truth for text/surface color on any dark institutional
     surface (hero, topbar, sticky journey, privacy disclosure). Values alias
     the existing on-dark palette above — no new colors invented. */
  --on-dark-heading: #FFFFFF;
  --on-dark-text: var(--text-on-dark);
  --on-dark-muted: var(--text-on-dark-muted);
  --on-dark-border: var(--border-dark);
  --on-dark-surface: rgba(255, 255, 255, .06);
  --on-dark-surface-hover: rgba(255, 255, 255, .10);
  --on-dark-surface-subtle: rgba(255, 255, 255, .03);

  /* ---- Hero / section title tokens (v1.1C, refined v1.1C.1) ---------------- */
  --hero-eyebrow-color: var(--accent-achievement);
  --hero-title-color: #F4F6FF;
  --hero-subtitle-color: #D8DDF2;
  --section-title-color: var(--brand-primary);

  /* ---- Sticky header stack (v1.1C.1) ----------------------------------------
     assets/js/sticky-header.js measures the real rendered heights of .topbar
     and .journey-bar and overwrites these on load/resize; the values below
     are only the pre-JS fallback so the first paint doesn't jump. */
  --topbar-height: 62px;
  --sticky-offset: 108px;
}

/* ---- Base ----------------------------------------------------------------- */
.app-shell, .app-shell * { box-sizing: border-box; }
.app-shell {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface-alt);
  line-height: 1.6;
}
.app-shell h1, .app-shell h2, .app-shell h3, .app-shell h4 {
  font-family: var(--font-heading);
  color: var(--brand-primary-strong);
  line-height: 1.2;
}
.app-shell h2 { color: var(--section-title-color); }
.app-shell a { color: var(--brand-primary); }
.app-shell button, .app-shell input, .app-shell select, .app-shell textarea { font: inherit; }
.app-shell button { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .app-shell *, .app-shell *::before, .app-shell *::after {
    scroll-behavior: auto !important; transition: none !important; animation: none !important;
  }
}
.app-shell :focus-visible {
  outline: 3px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--text); padding: .7rem 1rem; z-index: 50;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; top: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Topbar ----------------------------------------------------------------
   Persistent, minimal wayfinding strip: brand + secondary brand mark. */
.topbar {
  background: var(--surface-dark);
  color: var(--text-on-dark);
  border-bottom: 3px solid var(--brand-primary);
}
.topbar__inner {
  max-width: var(--max-width); margin: 0 auto; padding: .7rem clamp(1rem, 3vw, 2rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
/* `a.topbar__brand` (element+class): .app-shell a is also element+class and
   declared earlier, so a bare `.topbar__brand` class selector loses the
   specificity tie and the link (and its brand-name span, via inheritance)
   falls back to the low-contrast indigo link color on the dark topbar. */
a.topbar__brand { display: flex; align-items: baseline; gap: .5rem; text-decoration: none; color: var(--text-on-dark); }
.topbar__brand-name { font-family: var(--font-heading); font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; }
.topbar__sub { font-size: .72rem; color: var(--text-on-dark-muted); font-weight: 600; }
.topbar__nav { display: flex; gap: 1.1rem; align-items: center; font-size: .88rem; }
.topbar__nav a { color: var(--text-on-dark-muted); text-decoration: none; font-weight: 700; }
.topbar__nav a:hover, .topbar__nav a[aria-current] { color: var(--text-on-dark); }

/* ---- Course progress ------------------------------------------------------- */
.course-progress { display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--text-on-dark-muted); }
.course-progress__bar { width: 120px; height: 8px; border-radius: 999px; background: rgba(255,255,255,.16); overflow: hidden; }
.course-progress__fill { height: 100%; background: var(--brand-primary); border-radius: inherit; }

/* ---- Topbar meta group (course progress + week pager) -----------------------
   Groups course-progress and .week-pager so .topbar__inner keeps exactly two
   flex children (brand | meta) and wraps cleanly at narrow widths. */
.topbar__meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ---- Week pager (previous/current/next) --------------------------------------
   Compact wayfinding control added to every week page (Semana 01-08), living
   next to course progress in the topbar. Not a replacement for the sticky
   instructional journey (.journey-bar) — this is week-to-week, that is
   step-to-step within one week. */
.week-pager { display: flex; align-items: center; gap: .4rem; font-size: .82rem; }
/* `a.week-pager__link` (element+class): needed to out-specificity
   `.app-shell a`, same fix as `a.topbar__brand` above — otherwise the link
   (and its label span, via inheritance) falls back to the low-contrast
   indigo link color on the dark topbar. */
a.week-pager__link {
  display: inline-flex; align-items: center; gap: .3rem; text-decoration: none;
  color: var(--on-dark-muted); font-weight: 700; padding: .3rem .55rem; border-radius: 999px;
}
a.week-pager__link:hover, a.week-pager__link:focus-visible { color: var(--on-dark-heading); background: var(--on-dark-surface); }
.week-pager__link--disabled {
  display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .55rem;
  color: rgba(255,255,255,.28); font-weight: 700; cursor: not-allowed;
}
.week-pager__arrow { flex: none; }
.week-pager__current { color: var(--on-dark-heading); font-weight: 800; white-space: nowrap; }

@media (max-width: 480px) {
  .week-pager { gap: .2rem; }
  .week-pager__label { display: none; }
  .week-pager__link, .week-pager__link--disabled { padding: .3rem .4rem; font-size: .95rem; }
  .week-pager__current { font-size: .78rem; }
}

/* ---- Week hero -------------------------------------------------------------- */
.week-hero {
  background: linear-gradient(135deg, var(--surface-dark), var(--brand-primary-strong));
  color: var(--text-on-dark);
  padding: clamp(1.6rem, 4vw, 3rem) clamp(1rem, 4vw, 2.4rem);
}
.week-hero__inner { max-width: var(--max-width); margin: 0 auto; }
.week-hero__eyebrow {
  text-transform: uppercase; letter-spacing: .13em; font-size: .78rem;
  color: var(--hero-eyebrow-color); font-weight: 800;
}
.week-hero h1 { font-size: clamp(1.9rem, 4vw, 3.2rem); margin: .4rem 0 .7rem; color: var(--hero-title-color); }
.week-hero p { max-width: 850px; color: var(--hero-subtitle-color); margin: 0; font-size: 1.02rem; }

/* ---- Journey nav (pedagogical wayfinding) ----------------------------------- */
.journey-nav { max-width: var(--max-width); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.4rem); }
.journey-nav__list {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .5rem;
}
/* `a.journey-nav__item` (element+class): same `.app-shell a` specificity fix
   as `a.topbar__brand` / `a.week-pager__link` above. */
a.journey-nav__item {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 700; color: var(--text-on-dark-muted);
  padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--border-dark);
  text-decoration: none;
}
.journey-nav__item::before {
  content: attr(data-index);
  display: grid; place-items: center;
  width: 1.3rem; height: 1.3rem; border-radius: 999px;
  background: rgba(255,255,255,.12); color: var(--text-on-dark-muted);
  font-size: .72rem;
}
/* is-visited = the student scrolled past this step's position; it is NOT
   pedagogical completion (that lives in each lab's own state-derived progress
   panel, e.g. semana-01's "Tu progreso"). Deliberately muted, no checkmark and
   no success color, so scroll position can't be mistaken for "done". */
.journey-nav__item.is-visited { color: var(--text-on-dark); border-color: var(--border-dark); }
.journey-nav__item.is-visited::before { background: rgba(255,255,255,.28); color: var(--text-on-dark); }
.journey-nav__item.is-current { color: var(--surface-dark); background: var(--accent-achievement); border-color: var(--accent-achievement); }
.journey-nav__item.is-current::before { background: var(--accent-achievement-ink); color: var(--accent-achievement); }

/* ---- Lab shell / grid -------------------------------------------------------- */
.lab-shell { max-width: var(--max-width); margin: 1.4rem auto 4rem; padding: 0 clamp(1rem, 4vw, 1.5rem); display: grid; gap: 1.1rem; }
.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: minmax(260px, .78fr) minmax(0, 1.7fr); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > * { min-width: 0; }

@media (max-width: 880px) {
  .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Generic surface card ---------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem; box-shadow: var(--shadow);
}
.card h2 { font-size: 1.15rem; margin-top: 0; }
.card h3 { font-size: 1rem; margin-top: 0; }

/* ---- Pedagogical block cards --------------------------------------------------
   Each maps to one step of the CONTEXTO → EVIDENCIA journey. They share the
   .card shell and add a left accent bar + small kicker label for identity. */
.learning-card, .concept-card, .mission-card, .observation-card,
.reflection-card, .result-explanation, .decision-card, .evidence-card,
.challenge-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--brand-secondary-soft);
}
.mission-card__kicker,
.reflection-card__kicker, .result-explanation__kicker,
.decision-card__kicker, .challenge-card__kicker {
  display: block; text-transform: uppercase; letter-spacing: .09em; font-size: .74rem;
  font-weight: 800; color: var(--brand-secondary); margin-bottom: .3rem;
}
.learning-card__kicker, .concept-card__kicker, .observation-card__kicker, .evidence-card__kicker {
  display: block; text-transform: uppercase; letter-spacing: .09em; font-size: .74rem;
  font-weight: 800; color: var(--text-muted); margin-bottom: .3rem;
}
.challenge-card { border-left-color: var(--accent-warning); }
.challenge-card__kicker { color: var(--accent-warning); }
.challenge-card dl { display: grid; gap: .5rem; margin: .6rem 0 0; }
.challenge-card dt { font-weight: 800; color: var(--brand-primary-strong); }
.challenge-card dd { margin: 0; color: var(--text); }
.learning-card { border-left-color: var(--brand-primary); }
.concept-card { border-left-color: var(--brand-primary); background: var(--surface-alt); }
.mission-card { border-left-color: var(--brand-primary); }
.mission-card__kicker { color: var(--accent-warning); }
.observation-card { border-left-color: var(--brand-secondary); }
.reflection-card { border-left-color: var(--accent-warning); background: var(--accent-warning-soft); }
.reflection-card__kicker { color: var(--accent-warning); }
.result-explanation { border-left-color: var(--success); }
.result-explanation__kicker { color: var(--success); }
.decision-card { border-left-color: var(--danger); }
.decision-card__kicker { color: var(--danger); }
.evidence-card { border-left-color: var(--brand-primary-strong); }

.mission-card ol { margin: .4rem 0 0; padding-left: 1.3rem; display: grid; gap: .4rem; }
.learning-card ul { margin: .4rem 0 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.result-explanation-stack { display: grid; gap: .8rem; }
.concept-list { display: grid; gap: .8rem; margin: .6rem 0 0; }
.concept-item { border-top: 1px dashed var(--border); padding-top: .7rem; }
.concept-item:first-child { border-top: 0; padding-top: 0; }
.concept-item dt { font-weight: 800; color: var(--brand-primary-strong); }
.concept-item dd { margin: .2rem 0 0; color: var(--text); }
.concept-item small { display: block; color: var(--text-muted); margin-top: .2rem; }

/* ---- Metric card -------------------------------------------------------------- */
.metric-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px; padding: .8rem; }
.metric-card__label { color: var(--text-muted); font-size: .78rem; font-weight: 700; }
.metric-card__value { display: block; color: var(--brand-primary-strong); font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.metric-card__hint { color: var(--text-muted); font-size: .76rem; }

/* ---- Callout ------------------------------------------------------------------ */
.callout {
  border-left: 5px solid var(--accent-action); background: var(--accent-warning-soft);
  padding: .9rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.callout strong { color: var(--accent-warning); }
.callout--info { border-left-color: var(--brand-primary); background: #EAECFA; }
.callout--info strong { color: var(--brand-primary-strong); }
.callout--good { border-left-color: var(--success); background: var(--success-soft); }
.callout--good strong { color: var(--success); }

/* ---- Tags ---------------------------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px;
  padding: .18rem .6rem; background: #EAECFA; color: var(--brand-primary-strong);
  font-size: .76rem; font-weight: 800;
}
.tag--good { background: var(--success-soft); color: var(--success); }
.tag--warn { background: var(--warning-soft); color: var(--warning); }
.tag--bad { background: var(--danger-soft); color: var(--danger); }

/* ---- Buttons -------------------------------------------------------------------- */
.btn {
  border: 0; border-radius: 12px; padding: .72rem 1.05rem; font-weight: 800;
  background: var(--brand-primary); color: white; box-shadow: 0 7px 18px rgba(38,47,102,.22);
  display: inline-flex; align-items: center; gap: .4rem; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn--accent { background: var(--accent-achievement); color: var(--accent-achievement-ink); }
.app-shell a.btn--accent { color: var(--accent-achievement-ink); }
.btn--ghost { background: #EAECFA; color: var(--brand-primary-strong); box-shadow: none; }
.btn--danger { background: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }

/* ---- Previous/next navigation ---------------------------------------------------- */
.footer-nav { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: 1.4rem; flex-wrap: wrap; }
.footer-nav a { text-decoration: none; font-weight: 800; color: var(--brand-primary); }

/* ---- Responsive guardrails -------------------------------------------------------- */
@media (max-width: 480px) {
  .topbar__nav { display: none; }
}

/* =============================================================================
   v1.1A.1 — UX PASS
   Site header, sticky learning journey, progressive disclosure and learning
   dialogs. Scoped to Home + Semana 1.
   ============================================================================= */

/* ---- Site header -------------------------------------------------------------
   v1.3.1: official WillEdTech horizontal lockup (reverse on dark topbar) + Big Data Lab. */
.topbar__brand-group { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.topbar__org-logo {
  display: block; height: 1.65rem; width: auto; max-width: min(9.5rem, 42vw);
  flex: none; object-fit: contain; object-position: left center;
}
@media (min-width: 700px) {
  .topbar__org-logo { height: 1.9rem; max-width: 10.5rem; }
}
.topbar__sep { width: 1px; height: 22px; background: var(--border-dark); flex: none; }
a.topbar__brand { display: flex; align-items: baseline; gap: .5rem; text-decoration: none; color: var(--text-on-dark); min-width: 0; }
.topbar__product-tag { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-on-dark-muted); }

/* ---- Sticky learning journey bar --------------------------------------------
   Detached from .week-hero so it can stick independently while the hero
   scrolls away. Horizontal on desktop; becomes a horizontal-scroll chip
   rail on narrow viewports instead of wrapping (spec: no wrap on mobile). */
.journey-bar {
  position: sticky; top: var(--topbar-height); z-index: 30;
  background: var(--surface-dark);
  border-bottom: 1px solid var(--border-dark);
  box-shadow: var(--shadow-sm);
}
.journey-nav { padding: 0; }
.journey-nav__list {
  overflow-x: auto; flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: .55rem clamp(1rem, 4vw, 2.4rem);
  margin: 0;
}
.journey-nav__item { flex: none; white-space: nowrap; }

/* ---- Progressive disclosure: <details> accordion ----------------------------
   Generic reusable accordion for secondary/theory content. Reto, Qué
   aprenderás, Tu misión e Hipótesis stay outside this component (always
   visible); everything a student can defer until needed uses it. */
details.disclosure {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-top: .9rem; padding: 0 1rem;
}
details.disclosure[open] { padding-bottom: .95rem; }
details.disclosure > summary {
  cursor: pointer; font-weight: 800; color: var(--brand-primary-strong);
  padding: .8rem 0; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after {
  content: "+"; font-size: 1.25rem; line-height: 1; color: var(--brand-secondary);
  flex: none;
}
details.disclosure[open] > summary::after { content: "\2013"; }
details.disclosure > summary:hover { color: var(--brand-primary); }
details.disclosure > summary .disclosure__hint { font-weight: 600; font-size: .82rem; color: var(--text-muted); }
details.disclosure .disclosure__body { padding-top: .1rem; }

/* ---- Contextual help trigger + learning dialog -------------------------------
   Small inline "¿Qué significa?" affordance that opens a native <dialog>. */
.help-trigger {
  border: 1px dashed var(--brand-secondary); background: transparent; color: var(--brand-primary);
  font-size: .78rem; font-weight: 800; padding: .18rem .55rem; border-radius: 999px;
  display: inline-flex; align-items: center; gap: .3rem; cursor: pointer;
}
.help-trigger::before { content: "?"; display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 999px; background: var(--brand-primary); color: white; font-size: .68rem; }
.help-trigger:hover { background: var(--surface-alt); }

dialog.learning-dialog {
  border: 0; border-radius: var(--radius); padding: 0; max-width: 460px; width: calc(100% - 2rem);
  color: var(--text); background: var(--surface); box-shadow: var(--shadow);
}
dialog.learning-dialog::backdrop { background: rgba(18, 20, 43, .55); }
.learning-dialog__inner { padding: 1.2rem 1.3rem 1.35rem; }
/* .learning-dialog__head layout handled by Tailwind utilities on the element */
.learning-dialog__kicker { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 800; color: var(--brand-secondary); }
.learning-dialog__title { margin: .25rem 0 .6rem; font-family: var(--font-heading); color: var(--brand-primary-strong); font-size: 1.15rem; }
.learning-dialog__close {
  border: 0; background: var(--surface-alt); color: var(--text-muted); width: 1.9rem; height: 1.9rem;
  border-radius: 999px; font-size: 1rem; line-height: 1; cursor: pointer; flex: none;
}
.learning-dialog__body p { margin: 0 0 .6rem; }
.learning-dialog__body p:last-child { margin-bottom: 0; }

/* ---- Shared pedagogical interaction contract (Semanas 01-08) -------------- */
.pedagogy-overview {
  max-width: var(--max-width); margin: 1rem auto 0; padding: 0 clamp(1rem, 3vw, 2rem);
  display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: .8rem;
}
.pedagogy-overview > * { margin: 0; }
.pedagogy-overview__learning p, .pedagogy-overview__mission p { margin: .35rem 0 0; }
.guided-experiment {
  grid-column: 1 / -1; padding: .75rem 1rem; border: 1px solid var(--border);
  border-left: 4px solid var(--brand-secondary); border-radius: var(--radius-md); background: var(--surface);
}
.guided-experiment__title { margin: 0 0 .55rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-primary-strong); }
.guided-experiment dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.25fr); gap: .3rem .55rem; align-items: start; }
.guided-experiment dt { font-size: .76rem; font-weight: 900; text-transform: uppercase; color: var(--brand-primary-strong); }
.guided-experiment dd { margin: 0; font-size: .85rem; color: var(--text-muted); }
.pedagogy-overview__help { margin-top: .65rem; display: flex; justify-content: flex-end; align-items: center; gap: .55rem; flex-wrap: wrap; }
.pedagogy-overview__help--standalone { justify-content: flex-start; }
.pedagogy-help-trigger { font-size: .84rem; }
.student-guide-link { font-size: .84rem; font-weight: 800; }
.pedagogy-help { display: grid; gap: .75rem; }
.pedagogy-help section { padding-bottom: .65rem; border-bottom: 1px solid var(--border); }
.pedagogy-help section:last-child { padding-bottom: 0; border-bottom: 0; }
.pedagogy-help h3 { margin: 0 0 .2rem; font-size: .95rem; color: var(--brand-primary-strong); }
.pedagogy-help p { margin: 0; }
.pedagogy-progress {
  max-width: var(--max-width); margin: 0 auto; padding: .7rem clamp(1rem, 3vw, 2rem);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.pedagogy-progress__head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .45rem; }
.pedagogy-progress__head .progress-panel__title { margin: 0; }
.pedagogy-state { padding: .2rem .5rem; border: 1px solid var(--border); border-radius: 999px; font-size: .7rem; font-weight: 900; letter-spacing: .04em; color: var(--brand-primary-strong); background: var(--surface-alt); }
.pedagogy-state--running, .pedagogy-state--recovering { border-color: var(--brand-secondary); }
.pedagogy-state--incident, .pedagogy-state--error { color: var(--danger); border-color: var(--danger); }
.pedagogy-state--changes-pending, .pedagogy-state--paused { color: var(--warning); border-color: var(--warning); }
.pedagogy-state--result { color: var(--success); border-color: var(--success); }
.pedagogy-state-sequence { margin: 0 0 .45rem; font-size: .7rem; color: var(--text-muted); }
.pedagogy-stale-notice { margin: .55rem 0 0; padding: .45rem .6rem; border-left: 3px solid var(--warning); background: var(--surface-alt); color: var(--text); font-size: .82rem; }
.results-stale { position: relative; }
.results-stale::before { content: "Resultado anterior · cambios pendientes"; display: block; margin: 0 0 .65rem; padding: .45rem .65rem; border: 1px solid var(--warning); border-radius: var(--radius-sm); color: var(--warning); background: var(--surface); font-size: .8rem; font-weight: 800; }
.pedagogy-progress .progress-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem .85rem; }
.pedagogy-progress .progress-item { display: flex; gap: .35rem; align-items: center; color: var(--text-muted); font-size: .8rem; font-weight: 700; }
.pedagogy-progress .progress-item::before { content: "○"; }
.pedagogy-progress .progress-item.is-done { color: var(--success); }
.pedagogy-progress .progress-item.is-done::before { content: "✓"; }
.pedagogy-progress .progress-panel__next { margin: .5rem 0 0; font-size: .84rem; font-weight: 700; color: var(--brand-primary-strong); }

/* One coherent progress aid: it starts in normal reading flow and the same
   DOM node moves into this support rail only after #experimento is reached.
   The rail is available only where the remaining reading column is still
   comfortable; tablet/mobile always keep the inline flow. */
.pedagogy-progress-origin { max-width: var(--max-width); margin: 0 auto; }
.lab-workspace-layout {
  max-width: var(--max-width); margin: 0 auto 4rem; padding: 0 clamp(1rem, 4vw, 1.5rem);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start;
}
.lab-workspace-layout > .lab-shell { width: 100%; max-width: none; margin: 1.4rem 0 0; padding: 0; }
.lab-progress-rail { display: none; min-width: 0; align-self: stretch; }

@media (min-width: 1200px) {
  .lab-workspace-layout { grid-template-columns: minmax(0, 1fr) minmax(260px, 288px); }
  .lab-progress-rail { display: block; margin-top: 1.4rem; }
  .lab-progress-rail > .progress-panel {
    position: sticky; top: calc(var(--sticky-offset) + 1rem);
    width: 100%; max-width: none; margin: 0; padding: .9rem;
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  }
  .lab-progress-rail .progress-checklist { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .lab-progress-rail .progress-item { align-items: flex-start; }
  .lab-workspace-layout .pipeline { gap: .35rem; }
  .lab-workspace-layout .pipeline__node { min-width: 105px; padding: .7rem .5rem; }
}

@media (max-width: 768px) {
  .pedagogy-overview { grid-template-columns: 1fr; }
  .guided-experiment { grid-column: auto; }
  .guided-experiment dl { grid-template-columns: auto minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .pedagogy-overview { margin-top: .65rem; gap: .55rem; }
  .pedagogy-overview .learning-card, .pedagogy-overview .mission-card, .guided-experiment { padding: .65rem .75rem; }
  .pedagogy-overview__learning p, .pedagogy-overview__mission p, .guided-experiment dd { font-size: .8rem; line-height: 1.35; }
  .guided-experiment dl { gap: .22rem .45rem; }
  .pedagogy-overview__help { margin-top: .45rem; justify-content: flex-start; }
  .pedagogy-progress__head { align-items: flex-start; }
  .pedagogy-progress .progress-checklist { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .55rem; }
  .pedagogy-progress .progress-item { font-size: .75rem; align-items: flex-start; }
  .pedagogy-state-sequence { line-height: 1.35; }
  .week-page .learning-card { padding: .75rem; }
  .week-page .learning-card h2 { margin: .15rem 0 .35rem; font-size: 1.05rem; line-height: 1.25; }
  .week-page .learning-card p { margin: 0; line-height: 1.4; }
}

/* ---- Home: 8-week learning journey path --------------------------------------
   v1.1A.2: replaced the horizontal-scroll carousel (it clipped cards on
   desktop) with a responsive grid — 1 column under 768px, 2 columns from
   768-1199px, 4x2 from 1200px up. The numbered badge on each card (01..08)
   carries the "route" sense at every width; connector arrows are dropped
   because they can't be drawn correctly across a grid that reflows between
   column counts (an arrow pointing right at 4 columns would need to point
   down at 1 column, mid-card, without a way to detect that in pure CSS). */
.journey-path {
  list-style: none; margin: 0; padding: 0 0 0 26px; position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem;
}
.journey-path::before {
  content: ""; position: absolute; left: 21px; top: 22px; bottom: 22px; width: 2px;
  background: var(--border);
}
.journey-path__item { position: relative; display: block; min-width: 0; padding: .5rem 0; }
.journey-path .week-card {
  height: 100%; min-width: 0; flex-direction: row; flex-wrap: wrap;
  align-items: flex-start; column-gap: .9rem; row-gap: .15rem;
}
.journey-path .week-card__num { flex: 0 0 auto; margin-bottom: 0; margin-left: -47px; background: var(--accent-achievement); }
.journey-path .week-card__title,
.journey-path .week-card__desc,
.journey-path .week-card__track { flex: 1 1 100%; }
.journey-path .week-card__track { margin-top: .3rem; padding-top: 0; }

@media (min-width: 768px) {
  .journey-path { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; padding-left: 0; }
  .journey-path::before { display: none; }
  .journey-path__item { padding: 0; }
  .journey-path .week-card { flex-direction: column; column-gap: 0; row-gap: 0; }
  .journey-path .week-card__num { margin-left: 0; margin-bottom: .7rem; }
  .journey-path .week-card__title,
  .journey-path .week-card__desc,
  .journey-path .week-card__track { flex: initial; }
  .journey-path .week-card__track { margin-top: auto; padding-top: .8rem; }
}

@media (min-width: 1200px) {
  .journey-path { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- Optional detail block (Home hero) ----------------------------------------
   Needs `details.disclosure.privacy-disclosure` (not bare `.privacy-disclosure`)
   to out-specificity the base `details.disclosure` rules above (element+class
   beats class-only at equal class count) — otherwise the base rule's dark
   heading color / opaque surface wins and the light-on-dark summary text
   loses almost all contrast against the navy hero.
   v1.1C fix: the background/border override below was already correctly
   scoped this way, but the summary TEXT color and :hover state were not
   (`.privacy-disclosure > summary` / `:hover` — one class, element+element in
   the base rule beats it at equal class count) — that was the actual bug
   behind the "text disappears on navy" report: the closed-state summary fell
   back to --brand-primary-strong (dark indigo) instead of an on-dark token.
   Every override below is now written at the same element.class > element
   specificity as the base rule (or higher), for every state. */
details.disclosure.privacy-disclosure {
  max-width: 780px;
  background: transparent;
  border-color: var(--on-dark-border);
}
details.disclosure.privacy-disclosure > summary { color: var(--on-dark-heading); }
details.disclosure.privacy-disclosure > summary:hover,
details.disclosure.privacy-disclosure > summary:focus-visible { color: var(--hero-eyebrow-color); }
details.disclosure.privacy-disclosure > summary::after { color: var(--on-dark-muted); }
details.disclosure.privacy-disclosure[open] { background: var(--on-dark-surface); }
details.disclosure.privacy-disclosure[open] > summary:hover,
details.disclosure.privacy-disclosure[open] > summary:focus-visible { background: var(--on-dark-surface-hover); }
details.disclosure.privacy-disclosure .disclosure__body > p { color: var(--on-dark-text); margin: 0 0 .6rem; }
details.disclosure.privacy-disclosure .disclosure__body > p:last-child { margin-bottom: 0; }

/* Nested secondary disclosure ("Detalles técnicos") inside the privacy block —
   reuses .disclosure but recolored/tightened for nesting on the dark surface.
   Scoped as `details.disclosure.privacy-disclosure details.disclosure` (two
   classes + two elements) so it always beats the base rule regardless of how
   the base selector evolves, matching the outer-block fix above. */
details.disclosure.privacy-disclosure details.disclosure {
  margin-top: .85rem;
  background: var(--on-dark-surface-subtle);
  border-color: var(--on-dark-border);
}
details.disclosure.privacy-disclosure details.disclosure > summary { color: var(--on-dark-muted); font-size: .88rem; padding: .6rem 0; }
details.disclosure.privacy-disclosure details.disclosure > summary:hover,
details.disclosure.privacy-disclosure details.disclosure > summary:focus-visible { color: var(--on-dark-heading); }
details.disclosure.privacy-disclosure details.disclosure > summary::after { color: var(--on-dark-muted); }
details.disclosure.privacy-disclosure details.disclosure[open] { background: var(--on-dark-surface); }
details.disclosure.privacy-disclosure details.disclosure .disclosure__body p { color: var(--on-dark-muted); font-size: .88rem; }

/* =============================================================================
   v1.1C.1 — STICKY HEADER / JOURNEY REFINEMENT
   The week hero is never sticky — it scrolls away in normal document flow.
   .topbar and .journey-bar stick together underneath it: topbar at top:0,
   journey-bar right below at top:var(--topbar-height). Scoped to week pages
   only (body.week-page) so Home's topbar stays static, as before.
   assets/js/sticky-header.js measures the real rendered stack height into
   --topbar-height/--sticky-offset (the :root fallbacks above avoid a jump
   before it runs) and toggles body.is-journey-stuck once the hero has fully
   scrolled past the stack, for the compact stuck-state padding below.
   ============================================================================= */
body.week-page .topbar {
  position: sticky;
  top: 0;
  z-index: 40;
}

body.is-journey-stuck .topbar__inner { padding-block: .55rem; }
body.is-journey-stuck .journey-nav__list { padding-block: .4rem; }

/* Shared anchor-scroll offset for every instructional section, replacing the
   hardcoded per-week `scroll-margin-top: 4.5rem` rules — this tracks the real
   sticky-stack height instead of a guessed constant. */
.lab-shell > section[id] { scroll-margin-top: var(--sticky-offset); }

/* ---- Journey label responsiveness ------------------------------------------
   Desktop (>=1200px): full "1 Reto" labels. Medium (640-1199px): same labels,
   tighter spacing. Narrow (<640px): numbers only (.journey-nav__label
   hidden) — the horizontal-scroll chip rail from v1.1A.1 still applies, and
   each item keeps its accessible name via aria-label/title on the <a> even
   though the visible text is gone, so screen readers lose nothing. */
@media (min-width: 1200px) {
  .journey-nav__list { gap: .55rem; }
}
@media (min-width: 640px) and (max-width: 1199px) {
  .journey-nav__list { gap: .35rem; padding-top: .45rem; padding-bottom: .45rem; }
  .journey-nav__item { padding: .3rem .55rem; font-size: .78rem; }
}
@media (max-width: 639px) {
  .journey-nav__list { gap: .3rem; }
  .journey-nav__item { padding: .35rem .5rem; }
  .journey-nav__label { display: none; }
}

/* ---- Student guide --------------------------------------------------------- */
.guide-main { max-width: 920px; margin: 2rem auto 4rem; padding: 0 clamp(1rem, 4vw, 1.5rem); }
.guide-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.25rem; }
.guide-index {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1rem 1.1rem; margin-bottom: 1.5rem;
}
.guide-index h2 { margin: 0 0 .7rem; font-size: 1.05rem; }
.guide-index ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .8rem; margin: 0; padding-left: 1.35rem; }
.guide-index a { font-weight: 750; text-decoration-thickness: .08em; text-underline-offset: .16em; }
.guide-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1rem, 4vw, 2.2rem); overflow-wrap: anywhere; }
.guide-article h1 { margin-top: 0; font-size: clamp(1.8rem, 5vw, 2.6rem); }
.guide-article h2 { margin-top: 2.3rem; padding-top: .45rem; border-top: 1px solid var(--border); }
.guide-article h3 { margin-top: 2rem; color: var(--brand-primary-strong); }
.guide-article h4 { margin: 1.35rem 0 .35rem; color: var(--text); font-size: 1rem; }
.guide-article p, .guide-article li { line-height: 1.7; }
.guide-article ul, .guide-article ol { padding-left: 1.4rem; }
.guide-article code { background: var(--surface-alt); border-radius: 4px; padding: .1em .3em; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .guide-index ol { grid-template-columns: minmax(0, 1fr); }
  .guide-actions .btn { width: 100%; justify-content: center; }
}
@media print {
  .guide-page .topbar, .guide-page .skip-link, .guide-actions { display: none !important; }
  .guide-main { max-width: none; margin: 0; padding: 0; }
  .guide-index, .guide-article { border: 0; box-shadow: none; padding: 0; }
  .guide-article h2, .guide-article h3 { break-after: avoid; }
}

/* ---- Standard bottom navigation ------------------------------------------ */
.lab-pagination {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem;
  margin-top: 1.6rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.lab-pagination--edge { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lab-pagination__link {
  min-width: 0; min-height: 64px; display: flex; flex-direction: column; justify-content: center;
  gap: .18rem; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--brand-primary-strong); text-decoration: none; box-shadow: var(--shadow-sm);
}
.lab-pagination__link:hover { border-color: var(--brand-secondary); background: var(--surface-alt); }
.lab-pagination__link--all { align-items: center; text-align: center; font-weight: 850; }
.lab-pagination__link--next { align-items: flex-end; text-align: right; }
.lab-pagination__direction { font-size: .78rem; font-weight: 800; color: var(--text-muted); }
.lab-pagination__destination { font-weight: 850; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .lab-pagination, .lab-pagination--edge { grid-template-columns: minmax(0, 1fr); }
  .lab-pagination__link { min-height: 52px; }
  .lab-pagination__link--all { align-items: flex-start; text-align: left; }
}
