/* Bandera de Balsas: verde, amarillo, azul marino. Tema claro por defecto; oscuro por sistema o por botón. */
:root {
  --green: #2f7d46; --yellow: #f2d84b; --navy: #10215e;
  --bg: #ffffff; --text: #10215e; --muted: #5a6280; --line: #e4e7f2; --card: #f2f4fa; --soft: #93a1b0;
  --btn: #10215e; --btn-text: #ffffff; --btn-hover: #243a8c;
  --glass: rgba(255,255,255,.6); --glass-hover: rgba(255,255,255,.85); --avatar-ring: #ffffff;
  --hero-1: #d6ecd9; --hero-2: #f4efb8; --hero-3: #d3dbf5; --star: rgba(255,255,255,.6);
  --shimmer-a: #eceff8; --shimmer-b: #f7f8fd; --gal-bg: #10215e; --shadow: rgba(16,33,94,.14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #5cc27a;
    --bg: #0b1020; --text: #eef1fb; --muted: #9aa3c4; --line: #232a4a; --card: #151b33; --soft: #6f7aa3;
    --btn: #eef1fb; --btn-text: #10215e; --btn-hover: #ffffff;
    --glass: rgba(255,255,255,.1); --glass-hover: rgba(255,255,255,.18); --avatar-ring: #2a3262;
    --hero-1: #15301f; --hero-2: #2e2c14; --hero-3: #141c48; --star: rgba(255,255,255,.07);
    --shimmer-a: #151b33; --shimmer-b: #1f2748; --gal-bg: #151b33; --shadow: rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --green: #5cc27a;
  --bg: #0b1020; --text: #eef1fb; --muted: #9aa3c4; --line: #232a4a; --card: #151b33; --soft: #6f7aa3;
  --btn: #eef1fb; --btn-text: #10215e; --btn-hover: #ffffff;
  --glass: rgba(255,255,255,.1); --glass-hover: rgba(255,255,255,.18); --avatar-ring: #2a3262;
  --hero-1: #15301f; --hero-2: #2e2c14; --hero-3: #141c48; --star: rgba(255,255,255,.07);
  --shimmer-a: #151b33; --shimmer-b: #1f2748; --gal-bg: #151b33; --shadow: rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
body {
  background: var(--bg); color: var(--text); overflow-x: hidden; transition: background .3s, color .3s;
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.page { max-width: 1280px; margin: 0 auto; padding: 16px 16px 64px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* Cabecera */
.hero {
  position: relative; border-radius: 28px; padding: 20px 20px 0; text-align: center; overflow: hidden;
  background: linear-gradient(180deg, var(--hero-1) 0%, var(--hero-2) 55%, var(--hero-3) 100%);
}
.hero::before {
  content: ""; position: absolute; right: -60px; top: 90px; width: 240px; height: 240px; background: var(--star);
  -webkit-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100'%3E%3Cpath d='M0-48 14-15 49-15 21 6 31 40 0 20-31 40-21 6-49-15-14-15Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100'%3E%3Cpath d='M0-48 14-15 49-15 21 6 31 40 0 20-31 40-21 6-49-15-14-15Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hero::after {
  content: ""; position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 12px;
  background: linear-gradient(90deg, var(--green) 0 33.3%, var(--yellow) 33.3% 66.6%, var(--navy) 66.6%);
}
.hero > * { position: relative; z-index: 1; }
.top { display: flex; align-items: center; justify-content: center; gap: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--avatar-ring); box-shadow: 0 2px 10px var(--shadow); }
.brand { font-weight: 700; letter-spacing: -.02em; }
.theme-btn {
  position: absolute; top: 16px; right: 16px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--glass); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; backdrop-filter: blur(6px);
}
.theme-btn:hover { background: var(--glass-hover); }
.eyebrow { margin-top: 40px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--green); font-weight: 600; }
.big { font-weight: 800; letter-spacing: -.05em; line-height: .95; font-size: clamp(44px, 9vw, 112px); margin: 12px 0 18px; text-wrap: balance; }
.lead { max-width: 560px; margin: 0 auto 24px; }
.cover { display: block; margin: 36px -20px 0; }
.cover img { display: block; width: 100%; height: auto; }
.cover::after { content: ""; position: absolute; inset: auto 0 12px 0; height: 40%; background: linear-gradient(transparent, rgba(16,33,94,.22)); pointer-events: none; }
.cover { position: relative; }

/* Botones de pestañas */
.tabs { display: flex; gap: 4px; background: var(--glass); padding: 4px; border-radius: 99px; backdrop-filter: blur(6px); }
.tabs button { background: none; border: 0; font: inherit; font-size: 14px; padding: 7px 16px; border-radius: 99px; color: var(--text); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--btn); color: var(--btn-text); }
.tabs button[aria-selected="false"]:hover { background: var(--glass-hover); }
.tabs .tab-link { text-decoration: none; font-size: 14px; padding: 7px 16px; border-radius: 99px; color: var(--green); font-weight: 600; white-space: nowrap; }
.tabs .tab-link:hover { background: var(--glass-hover); }
.tabs-lg .tab-link { font-size: 16px; padding: 12px 26px; }
.head .tabs .tab-link { font-size: 13px; padding: 6px 14px; }
.tabs-lg { display: inline-flex; padding: 6px; gap: 6px; box-shadow: 0 6px 24px var(--shadow); }
.tabs-lg button { font-size: 16px; padding: 12px 26px; font-weight: 500; }

/* Galería */
.gallery { border-radius: 28px; padding: 40px 0; margin-top: 16px; transition: background .3s; }
.gallery.dark {
  --text: #fff; --muted: #b3bde6; --soft: #8c97c9; --btn: #fff; --btn-text: #10215e; --btn-hover: #e7ebfb;
  --glass: rgba(255,255,255,.1); --glass-hover: rgba(255,255,255,.2); --card: #1c2a66;
  --shimmer-a: #1a2760; --shimmer-b: #26358a;
  background: var(--gal-bg); color: var(--text); padding: 40px 20px;
}
.head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.head .tabs button { font-size: 13px; padding: 6px 14px; }
h2 { font-weight: 500; letter-spacing: -.04em; line-height: 1; font-size: clamp(34px, 6vw, 64px); }
h2 span { font-size: .4em; color: var(--soft); vertical-align: super; letter-spacing: 0; }
#hint { font-size: 13px; color: var(--muted); max-width: 240px; }
.grid { display: grid; gap: 20px; margin-top: 32px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid[hidden] { display: none; }
.card { min-width: 0; animation: rise .6s both; animation-delay: calc(var(--i, 0) * 45ms); }
.thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 3/4; padding: 0; border: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in;
  background: linear-gradient(110deg, var(--shimmer-a) 30%, var(--shimmer-b) 50%, var(--shimmer-a) 70%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.thumb:has(img.ready) { animation: none; background: var(--card); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb img { opacity: 0; transition: opacity .5s, transform .4s ease; }
.thumb img.ready { opacity: 1; }
.thumb:hover img { transform: scale(1.04); }
.card.video .thumb { cursor: default; background: #000; animation: none; }
.card.video video { object-fit: contain; }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.meta > div { min-width: 0; }
.meta h3 { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.btn { flex: none; background: var(--btn); color: var(--btn-text); text-decoration: none; font-size: 13px; padding: 9px 16px; border-radius: 99px; white-space: nowrap; }
.btn:hover { background: var(--btn-hover); }
.empty { color: var(--muted); margin-top: 32px; }

/* Pie */
.foot { display: grid; justify-items: center; gap: 12px; padding-top: 36px; color: var(--muted); font-size: 13px; }
.who { color: var(--text); font-weight: 600; font-size: 14px; }
.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; }
.stats b { color: var(--green); font-weight: 600; font-size: 15px; }

/* Visor: columna vertical con scroll suave (siempre oscuro) */
.lightbox { position: fixed; inset: 0; z-index: 10; background: #0a1442; color: #fff; }
.lightbox[hidden] { display: none; }
.lb-feed { height: 100%; overflow-y: auto; display: flex; flex-direction: column; padding-block: 10%; scroll-snap-type: y mandatory; scroll-behavior: smooth; overscroll-behavior: contain; outline: 0; scrollbar-width: none; }
.lb-feed::-webkit-scrollbar { display: none; }
.lb-item { flex: 0 0 80%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 12px; margin: 0; filter: blur(7px); opacity: .45; transform: scale(.94); transition: filter .3s, opacity .3s, transform .3s; }
.lb-item.active { filter: none; opacity: 1; transform: none; }
.fit { position: relative; display: flex; max-width: 100%; }
.lb-item img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(80vh - 16px); max-height: calc(80dvh - 16px); object-fit: contain; border-radius: 12px; }
.lb-item figcaption { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 36px 12px 12px; font-size: 13px; border-radius: 0 0 12px 12px; background: linear-gradient(transparent, rgba(8,14,50,.85)); }
.lb-item:not(.active) figcaption { opacity: 0; }
.lb-item figcaption .btn { background: #fff; color: #10215e; }
.lb-item figcaption span { min-width: 0; }
.lb-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; pointer-events: none; font-size: 12px; padding: 6px 14px; border-radius: 99px; background: rgba(255,255,255,.16); backdrop-filter: blur(6px); opacity: 0; transition: opacity .4s; white-space: nowrap; }
.lb-hint span { display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
.lb-hint.show { opacity: 1; }
.lb-hint.gone, .lb-hint.last { opacity: 0; }
.lb-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(255,255,255,.14); border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.lb-close:hover { background: rgba(255,255,255,.25); }

/* Animaciones suaves */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes nudge { 50% { transform: translateY(4px); } }
.hero > .eyebrow, .hero > .big, .hero > .lead, .hero > .tabs-lg, .hero > .cover { animation: rise .7s both; }
.hero > .big { animation-delay: .08s; } .hero > .lead { animation-delay: .16s; } .hero > .tabs-lg { animation-delay: .24s; } .hero > .cover { animation-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .thumb img { opacity: 1; }
}

@media (max-width: 700px) {
  .page { padding: 8px 16px 40px; }
  .hero { border-radius: 22px; padding: 16px 16px 0; }
  .hero::after { height: 10px; }
  .top { justify-content: flex-start; padding-right: 48px; }
  .theme-btn { top: 12px; right: 12px; }
  .eyebrow { margin-top: 28px; font-size: 11px; }
  .big { font-size: clamp(40px, 12.5vw, 60px); }
  .lead { font-size: 14px; margin-bottom: 18px; }
  .tabs-lg { gap: 2px; padding: 5px; }
  .tabs-lg button, .tabs-lg .tab-link { font-size: 12px; padding: 10px 9px; white-space: nowrap; }
  .head .tabs .tab-link { font-size: 12px; padding: 6px 10px; }
  .cover { margin: 28px -16px 0; }
  .cover img { aspect-ratio: 12.4/7.5; object-fit: cover; object-position: right; }
  .gallery { padding: 24px 0 8px; border-radius: 22px; }
  .gallery.dark { padding: 24px 12px; }
  .head { flex-direction: column; align-items: flex-start; }
  .side { align-items: flex-start; width: 100%; }
  h2 { font-size: 30px; }
  #hint { font-size: 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; margin-top: 20px; }
  .thumb { border-radius: 10px; }
  .meta { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 8px; }
  .meta h3 { font-size: 13px; }
  .btn { text-align: center; padding: 8px 10px; font-size: 12px; }
}
