/* ============================================================
   Páginas de curso — Brutalismo Refinado (on-brand)
   CSS compartido por courses/{first..fifth}.html
   Fuentes: Bricolage Grotesque (display) + Manrope (body/utilidad)
   Marca: teal #2ee6c5 + lima #b8ff3c sobre carbón #0d0f12
   Tema: data-theme="dark" (def) | "light" — toggle con JS.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Manrope:wght@400;500;600;700&display=swap');

/* ---------- TEMA: oscuro (por defecto) ---------- */
:root,
[data-theme="dark"] {
  --bg:        #0d0f12;     /* carbón de marca */
  --bg-grid:   rgba(244, 247, 245, 0.035);
  --surface:   #16181c;
  --ink:       #f4f7f5;     /* texto + bordes */
  --muted:     #868d89;
  --accent:    #2ee6c5;     /* teal — acento principal */
  --accent-2:  #b8ff3c;     /* lima — acento secundario */
  --accent-ink:#07120f;     /* texto oscuro sobre teal/lima */
  --shadow-col:#b8ff3c;     /* sombra dura neón lima → resultado teal+lima */
  --tag-bg:    transparent;
  --tag-ink:   var(--accent);
  --tag-border:var(--accent);
  color-scheme: dark;
}

/* ---------- TEMA: claro (on-brand) ---------- */
[data-theme="light"] {
  --bg:        #eef2ef;
  --bg-grid:   rgba(13, 15, 18, 0.05);
  --surface:   #ffffff;
  --ink:       #0d0f12;
  --muted:     #5a635f;
  --accent:    #0f9e86;     /* teal oscuro legible en claro */
  --accent-2:  #4fb31f;     /* lima oscuro */
  --accent-ink:#ffffff;
  --shadow-col:#0d0f12;     /* sombra dura oscura — contraste brutalista */
  --tag-bg:    transparent;
  --tag-ink:   var(--ink);
  --tag-border:var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}

/* ===================== TOPBAR ===================== */
.course-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
}

.ct-brand {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 16px 22px;
  border-right: 2px solid var(--ink);
  transition: background .2s ease, color .2s ease;
}
.ct-brand:hover { background: var(--accent); color: var(--accent-ink); }

.ct-right { display: flex; align-items: stretch; }

.ct-back {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: .82rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-left: 2px solid var(--ink);
  transition: background .2s ease, color .2s ease;
}
.ct-back:hover { background: var(--ink); color: var(--bg); }

.theme-toggle {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  border: none;
  border-left: 2px solid var(--ink);
  padding: 0 22px;
  transition: background .2s ease, color .2s ease;
}
.theme-toggle:hover { background: var(--accent); color: var(--accent-ink); }
.theme-toggle .ico-sun { display: none; }
.theme-toggle .ico-moon { display: inline; }
[data-theme="light"] .theme-toggle .ico-sun { display: inline; }
[data-theme="light"] .theme-toggle .ico-moon { display: none; }

/* ===================== PÁGINA ===================== */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) clamp(16px, 5vw, 48px) 96px;
}

/* Título mastodóntico */
.page-title {
  position: relative;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(2.8rem, 11vw, 7.5rem);
  line-height: .9;
  letter-spacing: -.03em;
  text-transform: uppercase;
  margin-bottom: 8px;
  word-break: break-word;
}
.page-title .ttl-index {
  display: inline-block;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: clamp(.7rem, 2vw, 1rem);
  font-weight: 700;
  letter-spacing: .25em;
  vertical-align: super;
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}
.page-title .ttl-stroke {
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
}
.page-sub {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 2px solid var(--ink);
  padding-top: 14px;
  margin-top: 18px;
  margin-bottom: 64px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===================== SEMESTRE ===================== */
.semester { margin-bottom: 80px; }

.sem-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 32px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}
.sem-num {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  line-height: 1;
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}
.sem-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.9rem);
  text-transform: uppercase;
  letter-spacing: -.01em;
}

/* Rejilla de asignaturas */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* ===================== CARD ASIGNATURA ===================== */
.subject-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--shadow-col);
  display: flex;
  flex-direction: column;
  transition: transform .18s cubic-bezier(.22,1,.36,1),
              box-shadow .18s cubic-bezier(.22,1,.36,1);
  /* entrada escalonada */
  opacity: 0;
  transform: translateY(14px);
  animation: cardIn .5s cubic-bezier(.22,1,.36,1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.subject-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 10px 10px 0 var(--shadow-col);
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.subj-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 2px solid var(--ink);
}
.subj-code {
  flex: none;
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .02em;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 5px 9px;
  line-height: 1;
}
.subj-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 1.06rem;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: -.01em;
}

/* Lista de recursos */
.res-list { list-style: none; }

.res-group {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 20px 6px;
  border-top: 2px dashed var(--ink);
}

.res-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  text-decoration: none;
  color: var(--ink);
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  transition: background .15s ease, color .15s ease, padding-left .18s ease;
}
.res-row:first-child { border-top: none; }
.res-row:hover {
  background: var(--accent);
  color: var(--accent-ink);
  padding-left: 26px;
}
.res-arrow {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 700;
  opacity: .5;
  transition: opacity .15s ease, transform .18s ease;
}
.res-row:hover .res-arrow { opacity: 1; transform: translateX(2px); }
.res-name {
  flex: 1;
  font-size: .94rem;
  font-weight: 500;
  line-height: 1.25;
}
.res-tag {
  flex: none;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--tag-ink);
  border: 1.5px solid var(--tag-border);
  padding: 3px 6px;
  line-height: 1;
  transition: border-color .15s ease, color .15s ease;
}
.res-row:hover .res-tag {
  color: var(--accent-ink);
  border-color: var(--accent-ink);
}

.res-empty {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: .8rem;
  color: var(--muted);
  padding: 22px 20px;
  text-align: center;
  letter-spacing: .04em;
}

/* Ítem de texto plano sin enlace (p. ej. títulos de bibliografía) */
.res-note {
  font-size: .9rem;
  line-height: 1.3;
  color: var(--muted);
  padding: 11px 20px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
}
.res-note:first-child { border-top: none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .subject-grid { grid-template-columns: 1fr; gap: 20px; }
  .ct-brand { font-size: .78rem; padding: 14px 16px; }
  .ct-back { padding: 0 14px; font-size: .72rem; }
  .theme-toggle { padding: 0 16px; }
  .page-title .ttl-stroke { -webkit-text-stroke-width: 1.5px; }
}

@media (max-width: 420px) {
  .ct-brand span.brand-long { display: none; }
}

/* ===================== ACCESIBILIDAD ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .subject-card { opacity: 1; transform: none; }
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
