@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap');

/* ---------- Tokens ---------- */
:root {
    /* Palette */
    --bg: #f9f9f9;
    --ink: #222;
    --muted: #6b7280;
    --white: #fff;

    /* Brand */
    --brand: #00A6CB;
    --focus: #1a73e8;

    /* Section Colors */
    --c-podcast: #00A6CB;
    --c-noticias: #FFD200;
    --c-personajes: #FF4B3E;
    --c-biblio: #7ED957;

    /* Surfaces & UI */
    --card-bg: #ffffff;
    --card-shadow: 0 4px 20px rgba(0,0,0,.08);
    --radius-lg: 16px;
    --radius-md: 12px;

    /* Animation */
    --trans-spring: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    --hover-lift: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    :root { --hover-lift: none; --trans-spring: none; }
}

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

body {
    margin: 0;
    font-family: 'Fredoka', sans-serif;
    font-size: 18px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}

a {
    color: #045b62;
    text-decoration: underline;
    font-weight: 600;
    text-underline-offset: 3px;
}

:is(a, button, audio):focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- Layout & Typography ---------- */
header {
    background: var(--bg);
    border-bottom: 2px solid var(--brand);
    padding: 12px 16px 18px;
    text-align: center;
}
header img { max-width: 500px; height: auto; }

main {
    padding: 24px 16px 64px;
    max-width: 960px;
    margin: 0 auto;
}

h1, h2 {
    color: #053a40;
    line-height: 1.2;
    margin: 0 0 .6rem;
}
h1 { font-size: clamp(1.6rem, 2.4vw + 1rem, 2.2rem); }
h2 { font-size: clamp(1.3rem, 1.6vw + .9rem, 1.6rem); }

footer {
    background: var(--brand);
    color: var(--white);
    text-align: center;
    padding: 20px 16px;
    font-size: .95rem;
}
footer a { color: var(--white); text-decoration: none; }

/* ---------- Interactive (Buttons & Nav) ---------- */
nav {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* Shared styles for Nav Chips and Buttons */
nav a, button {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1rem;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--trans-spring);
    text-decoration: none;
}

nav a:hover, button:hover {
    transform: var(--hover-lift);
    text-decoration: none;
}

nav a:active, button:active {
    transform: scale(0.95) translateY(2px) !important;
    box-shadow: 0 2px 0 rgba(0,0,0,.1) !important;
}

/* Specific Nav Styles */
nav a {
    background: var(--btn-bg, #fff);
    color: var(--btn-fg, #000);
    border: 2px solid black;
    letter-spacing: .2px;
}
nav .btnpodcast    { --btn-bg: var(--c-podcast);    color: #072b1a; }
nav .btnnoticias   { --btn-bg: var(--c-noticias);   color: #3a2500; }
nav .btnpersonajes { --btn-bg: var(--c-personajes); color: #3a0003; }
nav .btnbiblioteca { --btn-bg: var(--c-biblio);     color: #053a37; }

/* Generic Button Styles */
button {
    background: #ffd84d;
    color: #111;
    border: none;
    font-size: 1rem;
    box-shadow: 0 3px 0 rgba(0,0,0,.16), 0 6px 16px rgba(0,0,0,.12);
    margin: .8rem 0;
}
button:hover {
    box-shadow: 0 4px 0 rgba(0,0,0,.16), 0 10px 22px rgba(0,0,0,.14);
    filter: brightness(1.02);
}

/* ---------- Cards / Articles ---------- */
.podcast    { --theme-color: var(--c-podcast);    --theme-bg: oklch(98% .02 180); }
.noticias   { --theme-color: var(--c-noticias);   --theme-bg: oklch(98% .03 95);  }
.personajes { --theme-color: var(--c-personajes); --theme-bg: oklch(98% .03 25);  }
.biblioteca { --theme-color: var(--c-biblio);     --theme-bg: oklch(98% .02 195); }

h1, h2 { color: var(--theme-color, #053a40); }

article {
    background: var(--theme-bg, var(--card-bg));
    border-radius: var(--radius-lg);
    padding: 16px;
    margin: 18px 0;
    box-shadow: var(--card-shadow);
    border: 4px solid color-mix(in oklab, var(--theme-color, transparent) 60%, white);
    overflow: hidden;
}

article .ntitle {
    color: var(--theme-color);
    font-weight: 900;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 0 .4rem;
}

article .nbody { margin: .4rem 0 .6rem; }

article .ninfo {
    background: #FFF4E0;
    padding: .8rem 1rem;
    border-radius: var(--radius-md);
    font-size: .98rem;
}

article .nimage { text-align: center; margin: .8rem 0; }
article .nimage img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

article .ndate {
    font-size: .9rem;
    color: var(--muted);
    text-align: right;
    margin-top: .6rem;
}

/* ---------- Components ---------- */
audio {
    width: 100%;
    display: block;
    margin-top: .6rem;
    border-radius: var(--radius-md);
    background: #f0faf7;
}
audio::-webkit-media-controls-panel {
    background: linear-gradient(180deg, #ffffff, #f6fffb);
}

.small { font-size: .9rem; color: var(--muted); }
.fa { font-size: 1rem; }

/* ---------- Utilities & Adapters ---------- */
@media (max-width: 720px) {
    body { font-size: 17px; }
    header img { max-width: 300px; }
    nav { gap: 8px; }
    main { padding: 18px 12px 56px; }
    article { padding: 14px; }
    button { width: 100%; justify-content: center; }
}

@media (forced-colors: active) {
    nav a, button { border: 2px solid ButtonText; }
    a, a:hover { text-decoration: underline; }
}