/* =====================================================================
   Recursos Adventistas · sistema de diseño
   Manrope · naranja cálido + azul pizarra · bandas de color y ondas
   ===================================================================== */

/* ============ Tokens ============ */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --peach: #fff4ec;
  --text: #2b3545;
  --muted: #5f6670;
  --ink: #324156;              /* títulos */
  --border: #e6e8ec;
  --orange: #f3793b;           /* decoración (ondas, acentos) */
  --orange-soft: #ffa974;
  --cta: #c24e17;              /* botones: contraste AA con blanco */
  --cta-ink: #ffffff;
  --accent-text: #a9461a;      /* texto naranja sobre blanco (AA) */
  --slate: #324156;
  --slate-deep: #243247;
  --sky: #2a76ab;
  --sky-soft: #5bb0e3;
  --ok: #1f7a46;
  --no: #b0413e;
  --on-dark: #ffffff;
  --on-dark-muted: rgba(255, 255, 255, .78);
  --shadow: 0 1px 2px rgba(36, 50, 71, .06), 0 10px 30px rgba(36, 50, 71, .10);
  --shadow-lg: 0 18px 50px rgba(36, 50, 71, .22);
  --radius: 20px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121821; --surface: #1b2430; --surface-2: #222d3b; --peach: #241f1c;
    --text: #e6eaf0; --muted: #a3adba; --ink: #f2f4f7; --border: #2c3747;
    --cta: #f3793b; --cta-ink: #1a1006; --accent-text: #ffa974;
    --slate: #1b2430; --slate-deep: #0e141c; --sky: #1d4f74;
    --ok: #6cc28f; --no: #e58885;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121821; --surface: #1b2430; --surface-2: #222d3b; --peach: #241f1c;
  --text: #e6eaf0; --muted: #a3adba; --ink: #f2f4f7; --border: #2c3747;
  --cta: #f3793b; --cta-ink: #1a1006; --accent-text: #ffa974;
  --slate: #1b2430; --slate-deep: #0e141c; --sky: #1d4f74;
  --ok: #6cc28f; --no: #e58885;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.3);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { text-wrap: balance; color: var(--ink); font-weight: 800; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -0.03em; }
a { color: var(--accent-text); }
img { max-width: 100%; display: block; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--cta); color: var(--cta-ink); padding: 8px 12px; border-radius: 8px; z-index: 30; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: 13px; font-weight: 700; color: var(--accent-text); margin: 0 0 10px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 32px; }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); }
.section-head p { color: var(--muted); font-size: 17px; margin: 0; }

/* ============ Botones ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: 700 15px/1 var(--font); padding: 14px 22px; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .15s, filter .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--cta); color: var(--cta-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--primary::after, .btn--chev::after { content: "›"; font-size: 22px; line-height: 0; margin-top: -2px; }
.btn--plain::after { content: none; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--cta); }
.btn--light { background: #fff; color: #243247; }
.btn--light:hover { filter: brightness(.96); }
.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn--outline-light:hover { border-color: #fff; }
.btn--block { width: 100%; }

/* ============ Barra superior ============ */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--slate-deep); color: var(--on-dark); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--on-dark); }
.brand__logo { width: 38px; height: 38px; flex: none; }
.brand__name { font-weight: 800; font-size: 18px; letter-spacing: -0.03em; line-height: 1; }
.brand__name small { display: block; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--orange-soft); margin-top: 3px; }
.topnav { display: flex; align-items: center; gap: 22px; }
.topnav a { color: var(--on-dark-muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.topnav a:hover, .topnav a[aria-current="page"] { color: #fff; }
.theme-toggle { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #fff; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 16px; }
@media (max-width: 640px) { .topnav a:not(.topnav__keep) { display: none; } }

/* ============ Portada (hero) ============ */
.hero {
  position: relative; overflow: hidden; color: var(--on-dark);
  background:
    radial-gradient(60% 80% at 85% 20%, rgba(91, 176, 227, .28), transparent 60%),
    radial-gradient(50% 70% at 10% 90%, rgba(243, 121, 59, .30), transparent 60%),
    linear-gradient(160deg, #2d3e57 0%, var(--slate-deep) 70%);
  padding: 64px 0 150px;
}
:root[data-theme="dark"] .hero { background: radial-gradient(60% 80% at 85% 20%, rgba(91,176,227,.18), transparent 60%), radial-gradient(50% 70% at 10% 90%, rgba(243,121,59,.2), transparent 60%), linear-gradient(160deg, #18222f, #0e141c 70%); }
.hero__grid { position: relative; z-index: 2; display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(36px, 5.6vw, 62px); letter-spacing: -0.045em; }
.hero h1 em { font-style: normal; color: var(--orange-soft); }
.hero .eyebrow { color: var(--orange-soft); }
.hero__lead { font-size: 19px; color: var(--on-dark-muted); max-width: 40ch; margin: 0 0 28px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__deco { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.leaf { position: absolute; width: 22px; height: 22px; opacity: .55; animation: float 9s ease-in-out infinite; }
.leaf--1 { left: 6%; top: 18%; } .leaf--2 { left: 46%; top: 12%; animation-delay: -3s; width: 16px; }
.leaf--3 { right: 8%; top: 58%; animation-delay: -5s; } .leaf--4 { left: 38%; bottom: 34%; animation-delay: -1s; width: 14px; }
.leaf--5 { right: 30%; top: 26%; animation-delay: -7s; width: 18px; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-14px) rotate(14deg); } }
.wave { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 1; width: 100%; height: 120px; display: block; }
.wave .w-band { fill: var(--orange); }
.wave .w-base { fill: var(--bg); }

.steps { list-style: none; margin: 0; padding: 22px; display: grid; gap: 14px; border-radius: var(--radius);
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(6px); }
.steps li { display: flex; gap: 14px; align-items: center; color: var(--on-dark-muted); }
.steps strong { color: #fff; }
.steps span { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: #241406; font-weight: 800; }
@media (max-width: 860px) { .hero__grid { grid-template-columns: 1fr; gap: 28px; } .hero { padding: 44px 0 130px; } }

/* ============ Tarjetas que suben sobre la onda ============ */
.tiles { position: relative; z-index: 3; margin-top: -110px; margin-bottom: 64px; }
.tiles__label { color: #fff; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; margin: 0 0 12px; text-shadow: 0 1px 8px rgba(0,0,0,.25); }
.tiles__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tile { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; text-decoration: none; background: var(--slate); box-shadow: var(--shadow-lg); transition: transform .2s; }
.tile:hover { transform: translateY(-6px); }
.tile__img { aspect-ratio: 4 / 3; display: grid; place-items: center; position: relative; overflow: hidden; }
.tile__img img { width: 58%; aspect-ratio: 1; border-radius: 18px; box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.tile__img::after { content: ""; position: absolute; left: -5%; right: -5%; bottom: -40px; height: 70px; background: var(--slate); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.tile__body { padding: 4px 16px 16px; color: #fff; position: relative; z-index: 1; }
.tile__body strong { display: block; font-size: 17px; letter-spacing: -0.02em; }
.tile__body span { color: rgba(255,255,255,.72); font-size: 14px; }
.t-peach { background: #fff1e6; } .t-sky { background: #dff0fa; } .t-sand { background: #f6efe6; } .t-mint { background: #e3f4ea; }
@media (max-width: 900px) { .tiles__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .tiles__grid { gap: 12px; } .tile__body strong { font-size: 15px; } }

/* ============ Biblioteca ============ */
.library { padding: 8px 0 72px; scroll-margin-top: 80px; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; }
.search { flex: 1 1 280px; position: relative; }
.search svg { position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
input, select { font: inherit; color: var(--text); }
.search input, .selects select { width: 100%; height: 50px; border: 2px solid var(--border); border-radius: 999px; background: var(--surface); }
.search input { padding: 0 18px 0 46px; }
.search input:focus, .selects select:focus { border-color: var(--orange); outline: none; }
.selects { display: flex; gap: 12px; flex: 1 1 320px; }
.selects label { flex: 1; }
.selects select { padding: 0 16px; cursor: pointer; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.chip { font: 700 14px var(--font); padding: 9px 16px; border-radius: 999px; cursor: pointer; border: 2px solid var(--border); background: var(--surface); color: var(--ink); }
.chip:hover { border-color: var(--orange); }
.chip[aria-pressed="true"] { background: var(--slate); color: #fff; border-color: var(--slate); }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--cta); color: var(--cta-ink); border-color: var(--cta); }
.count { color: var(--muted); font-size: 14px; margin: 8px 0 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card.is-target { outline: 3px solid var(--orange); }
.cover { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover--auto { display: grid; place-items: center; }
.cover--auto .cover__icon { font-size: 56px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.15)); }
.cover--auto .cover__fmt { position: absolute; right: 14px; bottom: 10px; font: 800 13px var(--font); letter-spacing: .1em; color: rgba(255,255,255,.85); }
.cat-escuela { background: linear-gradient(135deg, #324156, #f3793b); }
.cat-biblia  { background: linear-gradient(135deg, #7a3b17, #f3793b); }
.cat-ninos   { background: linear-gradient(135deg, #2a76ab, #5bb0e3); }
.cat-ia      { background: linear-gradient(135deg, #3d3a8c, #8f6fd8); }
.cat-datos   { background: linear-gradient(135deg, #243247, #4e8ac9); }
.cat-huerto  { background: linear-gradient(135deg, #2f6b2a, #8cc65a); }
.cat-otros   { background: linear-gradient(135deg, #4a4f58, #8b93a1); }
.badges { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font: 800 11px/1 var(--font); letter-spacing: .05em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.94); color: #243247; }
.badge--gratis { background: #e3f4e9; color: #1b6338; }
.badge--premium { background: #fbeed6; color: #7d4f0e; }
.badge--dest { background: #243247; color: #fff; }
.badge--new { background: #c24e17; color: #fff; }
.card__body { display: flex; flex-direction: column; gap: 8px; padding: 20px 20px 22px; flex: 1; }
.card__cat { font-size: 12px; font-weight: 800; color: var(--accent-text); text-transform: uppercase; letter-spacing: .08em; }
.card h3 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; font-weight: 600; }
.meta span + span::before { content: "·"; margin-right: 6px; }
.card__actions { display: flex; gap: 8px; margin-top: 10px; }
.card__actions .btn { flex: 1; }
.card__actions .btn::after { content: none; }
.btn--icon { flex: 0 0 auto !important; width: 48px; padding: 0; }
.empty { text-align: center; padding: 48px 16px; border: 2px dashed var(--border); border-radius: var(--radius); }
.more { display: flex; justify-content: center; margin-top: 28px; }

/* ============ Banda azul con nubes ============ */
.band-sky { position: relative; overflow: hidden; background: var(--sky); color: #fff; padding: 72px 0; }
.band-sky h2, .band-sky .section-head p { color: #fff; }
.band-sky .section-head p { opacity: .9; }
.cloud { position: absolute; background: rgba(255,255,255,.12); border-radius: 999px; pointer-events: none; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.cloud--1 { width: 260px; height: 80px; left: -60px; top: 40px; }
.cloud--1::before { width: 130px; height: 130px; left: 40px; top: -60px; } .cloud--1::after { width: 100px; height: 100px; left: 130px; top: -40px; }
.cloud--2 { width: 200px; height: 60px; right: 6%; bottom: 50px; }
.cloud--2::before { width: 90px; height: 90px; left: 30px; top: -45px; } .cloud--2::after { width: 70px; height: 70px; left: 100px; top: -30px; }
.cloud--3 { width: 120px; height: 40px; right: 24%; top: 60px; background: rgba(255,255,255,.18); }
.cloud--3::before { width: 56px; height: 56px; left: 20px; top: -28px; } .cloud--3::after { width: 44px; height: 44px; left: 60px; top: -20px; }
.rules { position: relative; list-style: none; padding: 0; margin: 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 860px; }
.rules li { background: var(--surface); color: var(--text); border-radius: 16px; padding: 16px 18px 16px 52px; position: relative; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.rules li::before { position: absolute; left: 16px; top: 14px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.rules .ok::before { content: "✓"; background: var(--ok); }
.rules .no::before { content: "✕"; background: var(--no); }
@media (max-width: 680px) { .rules { grid-template-columns: 1fr; } }

/* ============ Banda melocotón ============ */
.band-peach { background: var(--peach); padding: 64px 0; }

/* ============ Pie ============ */
.footer { background: var(--slate-deep); color: var(--on-dark-muted); padding: 40px 0; font-size: 14px; }
.footer strong { color: #fff; }
.footer a { color: var(--orange-soft); }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer p { margin: 4px 0 0; }
.footer .muted { color: var(--on-dark-muted); }
.social { display: flex; gap: 10px; flex-wrap: wrap; }
.social a { text-decoration: none; padding: 8px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; color: #fff; font-weight: 600; }
.social a:hover { border-color: var(--orange); }

/* ============ Modal ============ */
.modal { width: min(440px, 100% - 32px); border: 0; border-radius: 24px; padding: 30px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(14, 20, 28, .6); }
.modal h2 { font-size: 24px; }
.modal__close { position: absolute; right: 12px; top: 12px; }
.modal__close button { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); padding: 6px; }
.field { display: grid; gap: 6px; margin: 16px 0 12px; font-size: 14px; font-weight: 700; }
.field input { height: 50px; border: 2px solid var(--border); border-radius: 14px; padding: 0 14px; background: var(--bg); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.check input { margin-top: 3px; }
.form-error { color: var(--no); font-size: 14px; }

/* ============ Aviso ============ */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--slate-deep); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 40; box-shadow: var(--shadow-lg); }

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