/*
Theme Name: Magic Bedtime Stories
Version: 1.0.4
Requires PHP: 8.1
Text Domain: magic-bedtime-stories
*/

:root {
    --ink: #261b37;
    --cream: #faf7ee;
    --muted: #5f4f6e;
    --purple: #35234e;
    --lavender: #eee8f6;
    --orange: #ff916c;
    --yellow: #ffdb78;
    --display: Fredoka, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 1rem/1.6 'Nunito Sans', system-ui, sans-serif; background: var(--cream); color: var(--ink); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .2em; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
.skip-link { position: absolute; top: .5rem; left: .5rem; padding: .5rem 1rem; background: var(--cream); transform: translateY(-160%); z-index: 1; }
.skip-link:focus { transform: none; }
.wrap { width: min(100% - 2rem, 74rem); margin-inline: auto; }
h1, h2, .brand { font-family: Fredoka, system-ui, sans-serif; font-weight: 500; line-height: 1.06; }
h1, h2 { margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6vw, 5.2rem); }
h2 { font-size: clamp(2rem, 4vw, 3.3rem); }
p { max-width: 64ch; }
.masthead, .hero, .club, .footer { background: var(--purple); color: var(--cream); }
.header-inner, .section-title { display: flex; justify-content: space-between; align-items: center; gap: .6rem 2rem; flex-wrap: wrap; }
.header-inner { min-height: 76px; padding-block: .65rem; }
.brand { font-size: clamp(1.35rem, 3vw, 1.65rem); text-decoration: none; }
.masthead nav, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1rem; }
.masthead nav a { display: grid; align-items: center; min-height: 44px; font-weight: 700; }
.hero, .section { padding-block: clamp(2.75rem, 7vw, 6rem); }
.hero h1 span, .club h2 { color: var(--yellow); }
.hero p, .welcome p, .club p { font-size: clamp(1.05rem, 2vw, 1.2rem); }
.split { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(1.5rem, 5vw, 4rem); }
.split img { border-radius: clamp(1.1rem, 3vw, 2rem); }
.welcome { background: var(--lavender); }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: .55rem 1.1rem; border: 1px solid transparent; border-radius: .8rem; background: var(--orange); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button.outline { background: transparent; border-color: var(--cream); color: var(--cream); }
.episode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .9rem; padding: 0; list-style: none; }
.episode-card { border: 1px solid #ded4e8; border-radius: .95rem; background: white; }
.episode-card a { display: block; height: 100%; text-decoration: none; }
.episode-card a:hover strong { text-decoration: underline; }
.episode-card img { border-radius: .9rem .9rem 0 0; width: 100%; aspect-ratio: 1; object-fit: cover; }
.episode-card-text { display: grid; gap: .3rem; padding: .8rem; }
.episode-card time { color: var(--muted); font-size: .9rem; }
.club-label { color: var(--purple); background: var(--lavender); border-radius: .4rem; padding: .15rem .45rem; width: fit-content; font-size: .88rem; font-weight: 700; }
.detail { max-width: 54rem; }
.detail-cover { border-radius: 1rem; max-width: min(100%, 240px); margin-block: 1rem; }
.detail audio { width: 100%; }
.search { margin-block: 1.75rem; }
.search label { display: block; margin-bottom: .35rem; font-weight: 700; }
.search input { min-width: 12rem; min-height: 46px; max-width: 100%; padding: .55rem .8rem; border: 1px solid #b7a7c9; border-radius: .65rem; background: white; color: inherit; font: inherit; }
.pagination, .platforms { margin-top: 1.8rem; }
.page-numbers { display: inline-block; padding: .45rem .6rem; }
.footer, .footer .actions { text-align: center; justify-content: center; }
.footer .actions { margin-top: .8rem; }
.footer a { display: inline-flex; align-items: center; min-height: 44px; }
.footer .footer-secondary { margin: .35rem auto 0; padding-top: .55rem; border-top: 1px solid #ffffff45; width: fit-content; }
.wish-form { padding: clamp(1rem, 4vw, 2.25rem); border: 1px solid #ded4e8; border-radius: 1.25rem; background: white; max-width: 49rem; }
.wish-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.wish-wide { grid-column: 1 / -1; }
.wish-fields label { display: grid; align-content: start; gap: .3rem; min-width: 0; font-weight: 700; }
.wish-fields input:not([type="file"]), .wish-fields textarea { min-height: 44px; max-width: 100%; padding: .55rem .8rem; border: 1px solid #b7a7c9; border-radius: .65rem; background: white; color: inherit; font: inherit; font-weight: 400; }
.voice-fields { margin: 0; min-width: 0; }
.voice-fields summary { min-height: 44px; padding-block: .4rem; color: var(--purple); font-weight: 800; cursor: pointer; }
.voice-fields summary span { margin-inline-start: .35rem; color: var(--muted); font-size: .85rem; font-weight: 400; }
.voice-fields .mgs-recorder { margin: .35rem 0 0; }
.voice-fields .upload-button:focus-within { outline: 3px solid #76529e; outline-offset: 3px; }
.voice-fields .upload-button:has(:disabled) { opacity: .6; cursor: wait; }
.wish-native-audio { padding: .5rem 1rem 1rem; }
.wish-form [hidden], .mgs-delivery-dialog [hidden] { display: none; }
.voice-fields audio { display: block; width: min(100%, 28rem); margin-block: .75rem; }
.wish-note { color: var(--muted); font-size: .9rem; }
.wish-note:empty { display: none; }
.wish-check { display: flex; align-items: flex-start; gap: .6rem; margin-block: 1rem; min-height: 44px; }
.wish-check input { margin-top: .35em; accent-color: var(--purple); }
.button.secondary { background: white; border-color: #b7a7c9; }
.wish-form button:disabled { cursor: wait; opacity: .6; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
    .split { grid-template-columns: 1fr; }
    .header-inner { align-items: flex-start; }
    .episode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wish-fields { grid-template-columns: 1fr; }
}
