/* Portal de Alumnos IDIP · estilos de la maqueta
   Paleta: verde petróleo, crema y amarillo como acento. Sin dependencias externas. */

:root {
  --petroleo: #0b4f5c;
  --petroleo-900: #06343d;
  --petroleo-700: #0e6273;
  --petroleo-100: #e1eeef;
  --crema: #fbf7ee;
  --crema-200: #f2ead6;
  --crema-300: #e6dbbf;
  --amarillo: #f2b705;
  --amarillo-100: #fff3cc;
  --texto: #1b2a2e;
  --texto-2: #4b5b5f;
  --borde: #ddd3bb;
  --blanco: #ffffff;
  --ok: #1d6b40;
  --ok-100: #e2f2e8;
  --error: #a8261d;
  --error-100: #fbe6e3;
  --warn: #7a5300;
  --warn-100: #fff1cf;
  --blocked: #6b3a2e;
  --blocked-100: #f6e4dc;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(6 52 61 / 6%), 0 6px 20px rgb(6 52 61 / 7%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --focus: 0 0 0 3px var(--amarillo), 0 0 0 5px var(--petroleo-900);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--crema);
  color: var(--texto);
  font: 16px/1.55 var(--font);
}

a { color: var(--petroleo-700); text-underline-offset: 3px; }
a:hover { color: var(--petroleo-900); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

h1, h2 { font-family: var(--font-serif); color: var(--petroleo-900); line-height: 1.2; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.3rem); margin: 0 0 .5rem; letter-spacing: -.01em; }
h1:focus { outline: none; box-shadow: none; }
h2 { font-size: 1.2rem; margin: 0 0 .4rem; }

p { margin: 0 0 1rem; }

code { font-size: .92em; background: var(--crema-200); padding: .05em .35em; border-radius: 5px; }

.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;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--petroleo-900); color: var(--blanco); padding: .6rem 1rem; border-radius: var(--radius-sm);
}
.skip:focus { top: 12px; color: var(--blanco); }

.muted { color: var(--texto-2); font-size: .95rem; }
.eyebrow {
  margin: 0 0 .35rem; font-size: .78rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--petroleo-700);
}

/* ---------- cinta demo ---------- */
.demo-ribbon {
  background: repeating-linear-gradient(-45deg, var(--amarillo) 0 14px, #ffcf3a 14px 28px);
  color: #2b2100; text-align: center; font-weight: 700; font-size: .8rem;
  letter-spacing: .06em; padding: .35rem 1rem; text-transform: uppercase;
}
@media (max-width: 480px) { .demo-ribbon { font-size: .7rem; letter-spacing: .02em; padding-inline: .5rem; } }

/* ---------- barra superior ---------- */
.topbar { background: var(--petroleo); color: var(--crema); }
.topbar__inner {
  max-width: 1120px; margin: 0 auto; padding: .7rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--crema); text-decoration: none; }
.brand:hover { color: var(--blanco); }
.brand__mark {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.05rem; letter-spacing: .06em;
  background: var(--crema); color: var(--petroleo-900); padding: .2rem .5rem; border-radius: 7px;
  border-bottom: 3px solid var(--amarillo);
}
.brand__text { font-weight: 600; }

.nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav[hidden] { display: none; }
.nav a, .nav__salir {
  color: var(--crema); text-decoration: none; padding: .45rem .7rem; border-radius: 8px;
  font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer;
}
.nav a:hover, .nav__salir:hover { background: rgb(255 255 255 / 10%); color: var(--blanco); }
.nav a[aria-current="page"] { background: rgb(255 255 255 / 14%); box-shadow: inset 0 -3px 0 var(--amarillo); }
.nav a[aria-current="page"]:focus-visible { outline:2px solid var(--petroleo-900); outline-offset:3px; box-shadow:var(--focus); }
.nav__salir { border: 1px solid rgb(251 247 238 / 40%); margin-left: .25rem; }

/* ---------- contenido ---------- */
main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 2rem 1rem 3rem; }
main:focus { outline: none; }
.loading { color: var(--texto-2); padding: 3rem 0; text-align: center; }

.card {
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
}
.card--center { text-align: center; }
.card--center .actions { justify-content: center; }

.narrow { max-width: 520px; margin: 0 auto; }
.page__head { margin-bottom: 1.5rem; }

/* ---------- ingreso ---------- */
.auth { display: grid; gap: 1.25rem; max-width: 980px; margin: 0 auto; }
.auth__brand {
  background:
    radial-gradient(circle at 88% 14%, transparent 0 64px, rgb(242 183 5 / 85%) 65px 68px, transparent 69px),
    radial-gradient(circle at 88% 14%, transparent 0 96px, rgb(251 247 238 / 14%) 97px 98px, transparent 99px),
    linear-gradient(160deg, var(--petroleo) 0%, var(--petroleo-900) 100%);
  color: var(--crema); border-radius: var(--radius); padding: 1.5rem;
}
.auth__brand .eyebrow { color: var(--amarillo); }
.auth__claim { font-family: var(--font-serif); font-size: clamp(1.35rem, 1rem + 1.6vw, 2rem); line-height: 1.2; margin-bottom: .6rem; color: var(--blanco); }
.auth__sub { margin: 0; opacity: .92; }
.auth__links { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .5rem; }

@media (min-width: 860px) {
  .auth { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .auth__brand { padding: 2.5rem; display: flex; flex-direction: column; justify-content: flex-end; min-height: 420px; }
}

/* ---------- formularios ---------- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field input {
  width: 100%; font: inherit; color: var(--texto); background: var(--blanco);
  border: 1.5px solid #9fa9a6; border-radius: var(--radius-sm); padding: .7rem .8rem; min-height: 48px;
}
.field input:focus-visible { border-color: var(--petroleo); }
.field input[aria-invalid="true"] { border-color: var(--error); background: #fffafa; }
.field__hint { font-size: .87rem; color: var(--texto-2); margin: .3rem 0 0; }
.field__error { font-size: .9rem; color: var(--error); font-weight: 600; margin: .35rem 0 0; }
.field__error::before { content: "⚠ "; }

.password { position: relative; }
.password input { padding-right: 6rem; }
.password__toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: inherit; font-size: .88rem; font-weight: 600; color: var(--petroleo-700);
  background: var(--petroleo-100); border: 0; border-radius: 7px; padding: .4rem .7rem; cursor: pointer; min-height: 36px;
}

.reqs { list-style: none; padding: 0; margin: .55rem 0 0; display: grid; gap: .2rem; font-size: .88rem; color: var(--texto-2); }
.reqs li::before { content: "○"; display: inline-block; width: 1.3em; color: #8b9693; }
.reqs li.is-ok { color: var(--ok); }
.reqs li.is-ok::before { content: "✓"; color: var(--ok); font-weight: 700; }

/* ---------- botones ---------- */
.btn {
  min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  border-radius: 10px; padding: .7rem 1.15rem; min-height: 46px; border: 1.5px solid transparent;
  transition: background-color .15s, border-color .15s;
}
.btn:disabled { opacity: .65; cursor: progress; }
.btn--primary { background: var(--petroleo); color: var(--blanco); }
.btn--primary:hover:not(:disabled) { background: var(--petroleo-900); color: var(--blanco); }
.btn--secondary { background: var(--blanco); color: var(--petroleo-900); border-color: var(--petroleo); }
.btn--secondary:hover { background: var(--petroleo-100); color: var(--petroleo-900); }
.btn--ghost { background: var(--crema-200); color: var(--petroleo-900); }
.btn--ghost:hover:not(:disabled) { background: var(--crema-300); }
.btn--block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }

/* ---------- avisos ---------- */
.alert { border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1.1rem; font-weight: 500; border-left: 5px solid; }
.alert[hidden] { display: none; }
.alert--error { background: var(--error-100); border-color: var(--error); color: #6e1610; }
.alert--success { background: var(--ok-100); border-color: var(--ok); color: #124a2b; }
.alert--info { background: var(--petroleo-100); border-color: var(--petroleo); color: var(--petroleo-900); }

.demo-box {
  background: var(--amarillo-100); border: 1.5px dashed #c99400; border-radius: var(--radius-sm);
  padding: .8rem 1rem; margin: 0 0 1rem; font-size: .93rem; text-align: left;
}
.demo-box p { margin: 0 0 .3rem; }
.demo-box p:last-child { margin: 0; }

.icon-badge {
  width: 60px; height: 60px; margin: 0 auto 1rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--petroleo-100); color: var(--petroleo);
  font-weight: 800; font-size: 1.6rem;
}
.icon-badge--warn { background: var(--warn-100); color: var(--warn); }
.icon-badge--blocked { background: var(--blocked-100); color: var(--blocked); }

/* ---------- mis cursos ---------- */
.grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.course-card article {
  height: 100%; display: flex; flex-direction: column;
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; border-top: 5px solid var(--petroleo);
}
.course-card--off article { border-top-color: #a79f8c; background: #fdfcf8; }
.course-card__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .7rem; }
.course-card__mod { font-size: .85rem; color: var(--texto-2); }
.course-card__title { font-size: 1.3rem; }
.course-card__meta { font-size: .87rem; color: var(--texto-2); margin-bottom: .8rem; }
.card__note { font-size: .92rem; color: var(--texto-2); }
.course-card__cta { margin-top: auto; align-self: flex-start; }
.course-card__title { margin-bottom:1rem; }

.badge {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .03em;
  padding: .2rem .6rem; border-radius: 999px;
}
.badge--ok { background: var(--ok-100); color: var(--ok); }
.badge--blocked { background: var(--blocked-100); color: var(--blocked); }
.badge--warn { background: var(--warn-100); color: var(--warn); }

.progress { margin: .2rem 0 1rem; }
.progress__label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--texto-2); margin-bottom: .3rem; }
.progress__bar { height: 8px; background: var(--crema-200); border-radius: 999px; overflow: hidden; }
.progress__bar span {
  display: block; height: 100%; border-radius: 999px;
  background: repeating-linear-gradient(-45deg, var(--amarillo) 0 6px, #e0a800 6px 12px);
}
.progress__note { font-size: .78rem; color: var(--texto-2); margin: .3rem 0 0; font-style: italic; }

.empty {
  text-align: center; background: var(--blanco); border: 1.5px dashed var(--borde);
  border-radius: var(--radius); padding: 2.5rem 1.25rem;
}
.empty[hidden] { display: none; }
.empty p { max-width: 46ch; margin: 0 auto; color: var(--texto-2); }

/* ---------- detalle de curso ---------- */
.crumbs ol { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .3rem; font-size: .92rem; }
.crumbs li + li::before { content: "›"; margin-right: .3rem; color: var(--texto-2); }
.crumbs [aria-current] { color: var(--texto-2); }
.course-head { margin-bottom: 1.5rem; }

.units { display: grid; gap: .85rem; }
.unit {
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.unit summary {
  list-style: none; cursor: pointer; display: flex; flex-wrap:wrap; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem; font-weight: 650; min-height: 56px;
}
.unit summary::-webkit-details-marker { display: none; }
.unit summary::after {
  content: ""; width: 10px; height: 10px; flex: none; margin-left: .25rem;
  border-right: 2px solid var(--petroleo); border-bottom: 2px solid var(--petroleo);
  transform: rotate(45deg) translateY(-3px); transition: transform .15s;
}
.unit[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.unit[open] summary { border-bottom: 1px solid var(--crema-200); background: #fefcf7; }
.unit__title { min-width:0; flex:1 1 12rem; overflow-wrap:anywhere; font-family: var(--font-serif); font-size: 1.1rem; color: var(--petroleo-900); }
.unit__count { min-width:0; font-size: .85rem; font-weight: 500; color: var(--texto-2); white-space:normal; overflow-wrap:anywhere; }
.unit__empty { padding: 1rem 1.25rem; margin: 0; }

.materials { list-style: none; margin: 0; padding: .4rem .75rem .75rem; }
.material {
  display: flex; align-items: center; gap: .85rem; padding: .7rem .5rem;
  border-bottom: 1px solid var(--crema-200);
}
.material:last-child { border-bottom: 0; }
.material__icon {
  flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--petroleo-100); color: var(--petroleo);
}
.material__icon--video { background: var(--amarillo-100); color: #7a5300; }
.material__icon--link { background: var(--crema-200); color: var(--petroleo-900); }
.material__info { flex: 1; min-width: 0; display: grid; }
.material__title { font-weight: 600; overflow-wrap: anywhere; }
.material__type { font-size: .82rem; color: var(--texto-2); }
.material__btn { flex: none; min-height: 42px; padding: .5rem .95rem; }

@media (max-width: 480px) {
  .material { flex-wrap: wrap; }
  .material__btn { margin-left: calc(42px + .85rem); width: calc(100% - 42px - .85rem); }
}

/* ---------- mi cuenta ---------- */
.datos { margin: 1rem 0 1.25rem; display: grid; gap: 0; border: 1px solid var(--crema-200); border-radius: var(--radius-sm); }
.datos div { display: grid; grid-template-columns: minmax(0,38%) minmax(0,1fr); gap: 1rem; padding: .75rem 1rem; }
.datos dt, .datos dd { min-width:0; overflow-wrap:anywhere; }
@media (max-width:360px) { .datos div { grid-template-columns:minmax(0,1fr); gap:.35rem; } }
.datos div + div { border-top: 1px solid var(--crema-200); }
.datos dt { color: var(--texto-2); font-size: .92rem; }
.datos dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- diálogo ---------- */
.dialog {
  border: 0; border-radius: var(--radius); padding: 1.5rem; max-width: min(92vw, 440px);
  box-shadow: 0 20px 60px rgb(6 52 61 / 30%); color: var(--texto);
}
.dialog::backdrop { background: rgb(6 52 61 / 45%); }
.dialog__type { display: inline-block; font-size: .8rem; font-weight: 700; background: var(--petroleo-100); color: var(--petroleo-900); padding: .15rem .55rem; border-radius: 999px; }
.dialog form { margin: 0; display: flex; justify-content: flex-end; }

/* ---------- pie ---------- */
.footer { background: var(--crema-200); border-top: 1px solid var(--borde); font-size: .9rem; color: var(--texto-2); }
.footer__inner { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem; }
.footer__inner > p { margin: 0 0 .75rem; }

.demo-panel { border: 1.5px dashed #c99400; background: var(--amarillo-100); border-radius: var(--radius-sm); }
.demo-panel summary { cursor: pointer; padding: .6rem .9rem; font-weight: 700; color: #4d3700; min-height: 44px; display: flex; align-items: center; }
.demo-panel__body { padding: 0 .9rem .9rem; color: var(--texto); }
.demo-panel__body label { display: block; font-weight: 600; margin-bottom: .3rem; }
.demo-panel__body select { font: inherit; padding: .45rem .6rem; border-radius: 8px; border: 1.5px solid #9fa9a6; min-height: 44px; max-width: 100%; }
.demo-panel__links { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }

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