/* =========================================================
   LIBRO DE LOGROS ACADÉMICOS — Hoja de estilos compartida
   Paleta y tipografía inspiradas en el PDF original.
   ========================================================= */

:root {
  --navy:        #1F3864;
  --navy-dark:   #14264A;
  --navy-soft:   #E8EEF7;
  --gold:        #C9A646;
  --gold-soft:   #E5D49C;
  --text:        #2A2A2A;
  --text-muted:  #6E6E6E;
  --label:       #B5B5B5;
  --line:        #E2E2E2;
  --line-soft:   #F0F0F0;
  --bg:          #FFFFFF;
  --bg-soft:     #FAFAFA;

  --font-sans:   'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif:  'Cormorant Garamond', 'Times New Roman', serif;

  --max-width:   900px;
  --side-pad:    clamp(1.25rem, 4vw, 3.5rem);
}

/* ---------- Language switching: ocultar el idioma inactivo ---------- */
html[data-lang="es"] .lang-en,
html[data-lang="en"] .lang-es {
  display: none !important;
}

/* ---------- Reset suave ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* ---------- Layout principal ---------- */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--side-pad);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header tipo PDF (logo + título) ---------- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--line);
}

.top-bar__logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

.top-bar__title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.top-bar .lang-switch {
  margin-left: auto;
}

/* ---------- Page tools (en la portada, sobre la car\u00e1tula) ---------- */
.page-tools {
  display: flex;
  justify-content: flex-end;
  padding: 1.5rem 0 0;
}

/* ---------- Language switch (segmented control) ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg);
}

.lang-switch__btn {
  appearance: none;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-switch__btn:hover {
  color: var(--navy);
}

.lang-switch__btn[aria-pressed="true"] {
  background: var(--navy);
  color: #FFFFFF;
}

.lang-switch__btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Footer estilo PDF ---------- */
.footer {
  margin-top: auto;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer__page b {
  color: var(--navy);
  font-weight: 600;
}

/* ===========================================================
   CARÁTULA (cover)
   =========================================================== */
.cover {
  padding: 4.5rem 0 3rem;
  text-align: center;
  animation: fadeUp 0.8s ease both;
}

.page-tools + .cover {
  padding-top: 2.5rem;
}

.cover__logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 2.5rem;
  object-fit: contain;
}

.cover__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.1rem);
  color: var(--navy);
  letter-spacing: 0.15em;
  margin: 0 auto;
  max-width: 18ch;
  line-height: 1.15;
}

.cover__rule {
  width: 100%;
  max-width: 540px;
  height: 2px;
  background: var(--gold);
  margin: 2.25rem auto 2.5rem;
  border: 0;
}

/* ---------- Datos del estudiante ---------- */
.cover__info {
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
}

.info-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1.5rem;
  align-items: end;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.info-row:last-child { border-bottom: none; }

.info-row__label {
  font-size: 0.72rem;
  color: var(--label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 400;
}

.info-row__value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 400;
  min-height: 1.2em;
}

/* ===========================================================
   ÍNDICE
   =========================================================== */
.toc {
  padding: 4rem 0 3rem;
  animation: fadeUp 1s 0.15s ease both;
  opacity: 0;
}

.toc__eyebrow {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}

.toc__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--navy);
  margin: 0;
  line-height: 1;
}

.toc__rule {
  width: 100%;
  height: 2px;
  background: var(--gold);
  margin: 1.75rem 0 2.5rem;
  border: 0;
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc__item {
  border-bottom: 1px solid var(--line);
}

.toc__item:first-child { border-top: 1px solid var(--line); }

.toc__link {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 0.95rem 0.5rem;
  transition: background-color 0.25s ease, padding 0.25s ease;
  position: relative;
}

.toc__link:hover,
.toc__link:focus-visible {
  background: var(--navy-soft);
  padding-left: 1rem;
  padding-right: 1rem;
  outline: none;
}

.toc__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-style: normal;
  font-size: 1.15rem;
  color: var(--navy);
  background: var(--navy-soft);
  width: 48px;
  height: 36px;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.toc__name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.18rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.toc__leader {
  flex: 1;
  border-bottom: 1px dotted var(--line);
  height: 1px;
  align-self: end;
  margin: 0 0.75rem 0.45rem;
}

.toc__arrow {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--label);
  transition: transform 0.25s ease, color 0.25s ease;
}

.toc__link:hover .toc__arrow,
.toc__link:focus-visible .toc__arrow {
  color: var(--gold);
  transform: translateX(4px);
}

/* En pantallas más anchas: agregamos línea de puntos entre nombre y flecha */
@media (min-width: 720px) {
  .toc__link {
    grid-template-columns: 64px auto 1fr auto;
  }
}

@media (max-width: 719px) {
  .toc__leader { display: none; }
}

/* ===========================================================
   PÁGINAS DE SECCIÓN (vacías)
   =========================================================== */
.section {
  padding: 4.5rem 0 6rem;
  flex: 1;
  animation: fadeUp 0.7s ease both;
}

.section__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}

.section__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--navy);
  background: var(--navy-soft);
  width: 40px;
  height: 30px;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.section__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  color: var(--navy);
  margin: 0;
  line-height: 1.1;
}

.section__rule {
  width: 100%;
  max-width: 280px;
  height: 2px;
  background: var(--gold);
  margin: 1.75rem 0 2.5rem;
  border: 0;
}

.section__placeholder {
  margin-top: 4rem;
  padding: 3.5rem 1.5rem;
  border: 1px dashed var(--line);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  background: var(--bg-soft);
}

.section__placeholder em {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--label);
}

/* ---------- Contenido editorial (prosa, listas, firma) ---------- */
.section__content {
  max-width: 680px;
  margin: 0;
  animation: fadeUp 0.9s 0.1s ease both;
  opacity: 0;
}

.section__lead {
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 2.5rem;
  font-weight: 300;
  letter-spacing: 0.005em;
}

.section__lead + .section__lead {
  margin-top: -1.25rem;
}

.section__h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.55rem, 2.5vw, 1.95rem);
  color: var(--navy);
  margin: 3.5rem 0 1.25rem;
  line-height: 1.2;
  letter-spacing: 0.003em;
}

.section__h2:first-of-type {
  margin-top: 1.25rem;
}

.section__content p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 1.25rem;
  font-weight: 400;
}

.section__content ul {
  list-style: none;
  margin: 0.5rem 0 1.75rem;
  padding: 0;
}

.section__content ul li {
  position: relative;
  padding-left: 1.85rem;
  margin: 0 0 0.65rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.section__content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 18px;
  height: 1.5px;
  background: var(--gold);
}

.section__signature {
  margin-top: 4.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--navy);
  text-align: right;
  letter-spacing: 0.01em;
}

@media (max-width: 600px) {
  .section__content { max-width: 100%; }
  .section__lead { font-size: 1.05rem; }
  .section__h2 { margin: 2.75rem 0 1rem; }
  .section__signature { text-align: left; margin-top: 3.5rem; }
}

/* Navegación entre páginas */
.section-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.section-nav a {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s ease;
  padding: 0.5rem 0;
}

.section-nav a:hover { color: var(--navy); }

.section-nav a.is-home {
  color: var(--navy);
}

.section-nav a.is-home:hover { color: var(--gold); }

/* ===========================================================
   Animaciones sutiles
   =========================================================== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ===========================================================
   Ajustes responsive
   =========================================================== */
@media (max-width: 600px) {
  .cover { padding: 3rem 0 2rem; }
  .page-tools + .cover { padding-top: 1.5rem; }
  .cover__logo { width: 96px; height: 96px; margin-bottom: 1.75rem; }
  .toc { padding: 2.5rem 0 2rem; }
  .info-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: 0.75rem 0;
  }
  .toc__link {
    grid-template-columns: 48px 1fr auto;
    gap: 0.85rem;
    padding: 0.85rem 0.25rem;
  }
  .toc__num { width: 40px; height: 32px; font-size: 1rem; }
  .toc__name { font-size: 1.02rem; }
  .top-bar__title { font-size: 0.68rem; letter-spacing: 0.16em; }
  .section { padding: 3rem 0 4rem; }
  .lang-switch__btn { font-size: 0.66rem; padding: 0.35rem 0.7rem; }
  .top-bar { gap: 0.6rem; flex-wrap: wrap; }
}

/* ===========================================================
   ACTIVIDAD (entrada tipo portfolio del PDF original)
   =========================================================== */
.activity {
  margin-top: 1rem;
  animation: fadeUp 0.7s 0.05s ease both;
  opacity: 0;
}

/* ---- Cabecera con campos: Materia, Título, Fecha, etc. ---- */
.activity-meta {
  border-top: 1px solid var(--line);
  margin: 0 0 3rem;
}

.activity-meta__row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
}

.activity-meta__row--double {
  grid-template-columns: 200px 1fr 200px 1fr;
}

.activity-meta__label {
  font-size: 0.7rem;
  color: var(--label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
}

.activity-meta__value {
  font-size: 0.98rem;
  color: var(--text);
  font-weight: 400;
}

.activity-meta__value--title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.3;
  color: var(--navy);
}

@media (max-width: 720px) {
  .activity-meta__row,
  .activity-meta__row--double {
    grid-template-columns: 1fr;
    gap: 0.3rem;
    padding: 0.85rem 0;
  }
}

/* ---- Cuerpo de la actividad ---- */
.activity__body {
  max-width: 680px;
}

.activity__intro {
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--text);
  font-weight: 300;
  margin: 0 0 2.5rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--gold);
  letter-spacing: 0.005em;
}

.activity__h3 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--navy);
  margin: 3rem 0 1rem;
  line-height: 1.25;
}

.activity__h3:first-child { margin-top: 0; }

.activity__h4 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 2rem 0 0.85rem;
}

.activity__body p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 1.15rem;
}

.activity__body ul {
  list-style: none;
  margin: 0.5rem 0 1.5rem;
  padding: 0;
}

.activity__body ul li {
  position: relative;
  padding-left: 1.85rem;
  margin: 0 0 0.6rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.activity__body ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 18px;
  height: 1.5px;
  background: var(--gold);
}

/* ---- Pasos numerados (procedimiento) ---- */
.activity__steps {
  list-style: none;
  counter-reset: step;
  margin: 0.5rem 0 2rem;
  padding: 0;
}

.activity__steps li {
  counter-increment: step;
  position: relative;
  padding: 0.85rem 0 0.85rem 3.25rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.activity__steps li:last-child { border-bottom: none; }

.activity__steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.95rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}

/* ---- Bloques de matemática ---- */
.math {
  font-family: 'Cambria Math', 'STIX Two Math', Cambria, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.02em;
}

.math-block {
  display: block;
  margin: 1rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--navy-soft);
  border-radius: 4px;
  text-align: center;
  font-family: 'Cambria Math', 'STIX Two Math', Cambria, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--navy);
  line-height: 1.8;
  overflow-x: auto;
  letter-spacing: 0.01em;
}

.math-block .label {
  display: block;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.math-steps {
  display: block;
  margin: 1.25rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-soft);
  border-left: 2px solid var(--gold);
  font-family: 'Cambria Math', 'STIX Two Math', Cambria, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 2;
  overflow-x: auto;
}

.math-steps > span {
  display: block;
}

/* Fracciones inline (numerador / denominador) */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: 0.85em;
  margin: 0 0.15em;
  line-height: 1.1;
}

.frac .num {
  display: block;
  padding: 0 0.35em 0.05em;
  border-bottom: 1px solid currentColor;
}

.frac .den {
  display: block;
  padding: 0.05em 0.35em 0;
}

/* Verificación / resultado destacado */
.activity__result {
  margin: 2rem 0 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  background: #FDFAEF;
}

.activity__result-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.5rem;
}

.activity__result p { margin: 0.25rem 0; }

/* ---- Q&A de cierre ---- */
.activity__qa {
  margin: 2.5rem 0;
}

.activity__qa dt {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--navy);
  margin: 1.5rem 0 0.4rem;
  letter-spacing: 0.005em;
}

.activity__qa dt:first-child { margin-top: 0; }

.activity__qa dd {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
}

/* ===========================================================
   EVIDENCIA (foto del cuaderno con lightbox)
   =========================================================== */
.evidence {
  margin: 4rem 0 2rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.evidence__label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0 0 1.25rem;
}

.evidence__caption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0.85rem 0 0;
}

.evidence__thumb {
  display: inline-block;
  border: 1px solid var(--line);
  padding: 6px;
  background: var(--bg);
  border-radius: 2px;
  cursor: zoom-in;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  max-width: 100%;
}

.evidence__thumb:hover,
.evidence__thumb:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(31, 56, 100, 0.12);
  border-color: var(--gold-soft);
  outline: none;
}

.evidence__thumb img {
  display: block;
  max-width: 320px;
  width: 100%;
  height: auto;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 38, 74, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1000;
  cursor: zoom-out;
  animation: fadeIn 0.25s ease;
}

.lightbox[aria-hidden="false"] {
  display: flex;
}

.lightbox__img {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  cursor: default;
}

.lightbox__close {
  position: absolute;
  top: 1.5rem;
  right: 1.75rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 600px) {
  .activity__intro { font-size: 1rem; padding-left: 1rem; }
  .activity__h3 { font-size: 1.3rem; margin: 2.25rem 0 0.85rem; }
  .math-block { font-size: 1rem; padding: 1rem; }
  .math-steps { font-size: 0.95rem; padding: 1rem; }
  .activity__steps li { padding-left: 2.5rem; }
  .lightbox__close { top: 0.75rem; right: 0.75rem; }
}
