/* ============================================================
   COLORES OFICIALES (muestreados de museobolivariano.org.co)
   ============================================================ */
:root {
  --color-primary: #0a2396;       /* azul del museo */
  --color-primary-dark: #071a70;
  --color-accent: #e8b20c;        /* amarillo del logo */
  --color-red: #d6262b;           /* rojo del logo */
  --color-bg: #f3f5fb;
  --color-surface: #ffffff;
  --color-text: #161a2e;
  --color-muted: #5a6180;
  --color-border: #d9deef;
  --color-ok: #2f7d4f;
  --color-locked: #8a8fa6;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(10, 35, 150, .10);
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { line-height: 1.2; color: var(--color-primary-dark); }
h1 { font-size: 1.7rem; margin: 0 0 .6rem; }
h2 { font-size: 1.3rem; margin: 1.4rem 0 .5rem; }
a { color: var(--color-primary); }
img { max-width: 100%; height: auto; }

/* ---------- Encabezado con logos ---------- */
.site-header {
  background: #fff; padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: center; gap: 1.2rem; border-bottom: 1px solid var(--color-border);
}
.site-header img { height: 58px; width: auto; }

/* ---------- Menú inferior (app) / superior (computador) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--color-primary); color: #fff;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar > a, .tabbar > .tab-lessons > button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  min-height: var(--tabbar-h); color: #fff; text-decoration: none; background: transparent; border: 0;
  font: inherit; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer; width: 100%;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar > a.active, .tabbar > .tab-lessons > button.active { background: rgba(255,255,255,.16); box-shadow: inset 0 3px 0 var(--color-accent); }
.tab-lessons { position: relative; display: flex; }
.sheet {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  min-width: 190px; background: #fff; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); padding: .35rem; display: none;
}
.tab-lessons.open .sheet { display: block; }
.sheet a {
  display: block; padding: .85rem 1rem; border-radius: 10px; color: var(--color-primary); text-decoration: none;
  font-weight: 800; text-transform: uppercase; letter-spacing: .04em; min-height: 48px;
}
.sheet a:hover, .sheet a.active { background: #e8ecfb; }

@media (min-width: 820px) and (not (display-mode: standalone)) {
  .tabbar { position: sticky; top: 0; bottom: auto; grid-template-columns: repeat(4, minmax(0, 170px)); justify-content: center; padding-bottom: 0; }
  .tabbar > a, .tabbar > .tab-lessons > button { flex-direction: row; gap: .5rem; min-height: 52px; font-size: .85rem; }
  .tabbar > a.active, .tabbar > .tab-lessons > button.active { box-shadow: inset 0 -3px 0 var(--color-accent); }
  .sheet { bottom: auto; top: calc(100% + 4px); }
  body { padding-bottom: 0 !important; }
}
body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

/* ---------- Contenedores ---------- */
main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 1.1rem 1rem 2rem; outline: none; }
.footer { text-align: center; padding: 1rem; color: var(--color-muted); }
.banner { background: #fff3cd; color: #5c4400; padding: .6rem 1rem; text-align: center; font-size: .95rem; }

.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin: .8rem 0;
}
.card h3 { margin: 0 0 .3rem; }
.card .meta { color: var(--color-muted); font-size: .9rem; margin-bottom: .4rem; }
.card img.cover { border-radius: 10px; margin-bottom: .6rem; }
.pending { border: 2px dashed var(--color-accent); background: #fffbea; }

.btn {
  display: inline-block; background: var(--color-primary); color: #fff; border: 0;
  border-radius: 12px; padding: .75rem 1.2rem; font: inherit; font-weight: 600;
  min-height: 48px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--color-primary-dark); }
.btn.secondary { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Ruta de aprendizaje ---------- */
.progress { background: #dfe4f5; border-radius: 999px; height: 14px; overflow: hidden; margin: .4rem 0 1rem; }
.progress > span { display: block; height: 100%; background: var(--color-accent); transition: width .4s; }

.path { list-style: none; margin: 0; padding: 0; }
.unit {
  display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; margin: .55rem 0;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  text-decoration: none; color: inherit;
}
.unit .num {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: var(--color-primary); color: #fff;
}
.unit.done .num { background: var(--color-ok); }
.unit.locked { opacity: .65; }
.unit.locked .num { background: var(--color-locked); }
.unit .info { flex: 1; min-width: 0; }
.unit .info strong { display: block; }
.unit .info small { color: var(--color-muted); }
.tag { display: inline-block; font-size: .78rem; padding: .1rem .55rem; border-radius: 999px; background: #e8ecfb; color: var(--color-primary-dark); }

.area-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.area-tabs a { padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--color-border); text-decoration: none; background: #fff; }
.area-tabs a.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Formularios ---------- */
form.stack { display: grid; gap: .8rem; max-width: 420px; }
label { display: grid; gap: .3rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password] {
  font: inherit; padding: .75rem; border: 1px solid var(--color-border); border-radius: 10px; min-height: 48px;
}
.msg { padding: .7rem 1rem; border-radius: 10px; margin: .6rem 0; }
.msg.error { background: #fde8e8; color: #7a1c1c; }
.msg.ok { background: #e4f4ea; color: #1d5a35; }

/* ---------- Quiz ---------- */
.options { display: grid; gap: .5rem; margin: .8rem 0; }
.option {
  text-align: left; font: inherit; padding: .8rem 1rem; border-radius: 12px; min-height: 48px;
  background: #fff; border: 2px solid var(--color-border); cursor: pointer;
}
.option.correct { border-color: var(--color-ok); background: #e4f4ea; }
.option.wrong { border-color: #b33a3a; background: #fde8e8; }

.practice-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Panel de administración ---------- */
[hidden] { display: none !important; }

.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-row {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  padding: .7rem .9rem; margin: .5rem 0;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
}
.admin-row .num {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: var(--color-primary); color: #fff;
}
.admin-row .info { flex: 1; min-width: 160px; }
.admin-row .info strong { display: block; }
.admin-row .info small { color: var(--color-muted); }
.row-actions { display: flex; gap: .4rem; }

.btn.small { padding: .4rem .8rem; min-height: 44px; font-size: .95rem; }
.btn.danger { background: #a62d2d; }
.btn.danger:hover { background: #7f2020; }

form.wide { max-width: 640px; }
textarea, select {
  font: inherit; padding: .75rem; border: 1px solid var(--color-border); border-radius: 10px; width: 100%;
  background: #fff;
}
select { min-height: 48px; }
input[type=date] { font: inherit; padding: .75rem; border: 1px solid var(--color-border); border-radius: 10px; min-height: 48px; }
label.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
label.check input { width: 22px; height: 22px; }

.editor-row { display: grid; gap: .4rem; margin: .5rem 0; padding: .6rem; border: 1px solid var(--color-border); border-radius: 12px; background: #fff; }
.q-block { margin: .8rem 0; padding: .8rem; border: 1px solid var(--color-border); border-radius: 12px; background: #fff; display: grid; gap: .5rem; }
.q-block legend { font-weight: 700; padding: 0 .4rem; }
.q-block input[type=text], .editor-row input[type=text] { width: 100%; }
label.opt { display: flex; align-items: center; gap: .6rem; font-weight: 400; }
label.opt input[type=radio] { width: 22px; height: 22px; flex: none; }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--color-border); }
.table th { background: #e8ecfb; }

/* ============ REDISEÑO: Home, slider, lecciones, perfil ============ */
.hero-date { text-align: center; color: var(--color-muted); margin: .2rem 0 .6rem; font-weight: 600; }
.welcome {
  background: var(--color-primary); color: #fff; text-align: center; border-radius: var(--radius);
  padding: 1rem; font-size: 1.6rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase;
}
.welcome small { display: block; font-size: .85rem; font-weight: 600; letter-spacing: .02em; text-transform: none; opacity: .9; margin-top: .15rem; }

.slider { position: relative; margin: 1rem 0; border-radius: var(--radius); overflow: hidden; background: #0e1330; box-shadow: var(--shadow); }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-behavior: smooth; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; position: relative; aspect-ratio: 16 / 9; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6rem 1rem .7rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); font-weight: 700;
}
.slide .cap small { display: block; font-weight: 400; opacity: .9; }
.slide a.cover-link { position: absolute; inset: 0; }
.dots { position: absolute; right: .7rem; top: .6rem; display: flex; gap: .35rem; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.5); }
.dots i.on { background: #fff; }
@media (prefers-reduced-motion: reduce) { .slides { scroll-behavior: auto; } }

.bulletin img.cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
h2.section { text-transform: uppercase; letter-spacing: .06em; font-size: 1.05rem; color: var(--color-primary); border-bottom: 3px solid var(--color-accent); display: inline-block; padding-bottom: .2rem; }

/* Áreas */
.area-cards { display: grid; gap: .8rem; }
.area-card {
  display: flex; align-items: center; gap: 1rem; padding: 1rem; border-radius: var(--radius); text-decoration: none;
  background: var(--color-primary); color: #fff; box-shadow: var(--shadow); min-height: 84px;
}
.area-card svg { width: 44px; height: 44px; flex: none; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.area-card strong { font-size: 1.25rem; text-transform: uppercase; letter-spacing: .06em; display: block; }
.area-card small { opacity: .9; }

/* Lección */
.lesson h2 { color: var(--color-primary); }
.lesson p { margin: .7rem 0; }
.lesson sup a { text-decoration: none; font-weight: 700; padding: 0 .1rem; }
figure.photo { margin: 1rem 0; }
figure.photo img { width: 100%; border-radius: 12px; display: block; background: #e8ecfb; }
figure.photo figcaption { font-size: .85rem; color: var(--color-muted); margin-top: .35rem; }
.sources { font-size: .9rem; color: var(--color-muted); padding-left: 1.4rem; }
.sources li { margin: .35rem 0; overflow-wrap: anywhere; }
.sources li:target { background: #fff3bf; }
.review-note { background: #fff3cd; color: #5c4400; border-radius: 10px; padding: .6rem .9rem; font-size: .9rem; }

/* Insignias y progreso */
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; text-align: center; margin: 1rem 0; }
.badge svg { width: 78px; height: 78px; }
.badge .ring { fill: #e3e6f2; stroke: #c3c8de; stroke-width: 3; }
.badge .glyph { fill: none; stroke: #9aa0bd; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.badge.on .ring { fill: var(--c); stroke: #fff; }
.badge.on .glyph { stroke: #fff; }
.badge b { display: block; text-transform: uppercase; letter-spacing: .05em; font-size: .85rem; }
.badge small { color: var(--color-muted); }
.badge.historia { --c: #0a2396; } .badge.arte { --c: #d6262b; } .badge.jardin { --c: #2f8f4a; }
.area-progress { margin: .7rem 0; }
.area-progress .row { display: flex; justify-content: space-between; font-weight: 700; text-transform: uppercase; font-size: .9rem; letter-spacing: .04em; }

/* Perfil */
.profile-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.avatar { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; background: #dfe4f5; border: 4px solid var(--color-primary); display: grid; place-items: center; overflow: hidden; flex: none; }
.avatar svg { width: 60px; height: 60px; fill: none; stroke: var(--color-primary); stroke-width: 1.6; }
.profile-head dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .1rem .7rem; }
.profile-head dt { color: var(--color-muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.profile-head dd { margin: 0; font-weight: 600; }
.profile-name { font-size: 1.35rem; font-weight: 800; color: var(--color-primary-dark); margin: 0 0 .2rem; }
.link-btn { background: none; border: 0; color: var(--color-primary); font: inherit; text-decoration: underline; cursor: pointer; padding: .6rem 0; min-height: 44px; }
.map-legend { columns: 2; font-size: .92rem; padding-left: 1.2rem; }
.logo-login { display: block; margin: 0 auto 1rem; height: 90px; width: auto; }
