/* Feb's Fables — site styles.
   Standard CSS, no framework, no build step. MOBILE-FIRST: base rules target
   small screens; min-width media queries layer on enhancements for wider ones. */

/* Self-hosted title font (no external CDN). File in public/assets/fonts/. */
@font-face {
    font-family: 'IM Fell English SC';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/im-fell-english-sc.woff2') format('woff2');
}

:root {
    --bg: #faf6ef;
    --ink: #2b2118;
    --muted: #7a6f63;
    --accent: #b5651d;
    --accent-dark: #6b3e12;
    --card: #fffdf9;
    --border: #e7ddcd;
    --shadow: 0 10px 30px rgba(43, 33, 24, 0.10);
    --maxw: 70rem;
    /* Title display font — self-hosted (see @font-face above). */
    --font-title: 'IM Fell English SC', Georgia, serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.6;
}

a { color: var(--accent); }

/* ─── Header / footer ─────────────────────────────────────────────────── */
.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.85rem 1.25rem;
    background: var(--accent-dark);
    color: #fff;
}
.brand {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.01em;
}
.site-nav { display: flex; gap: 1rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size: 0.95rem; }
.site-nav a { color: #f5e7d6; text-decoration: none; }
.site-nav a:hover { color: #fff; text-decoration: underline; }

.site-main { flex: 1; }

.site-footer {
    padding: 1.5rem 1.25rem;
    background: var(--accent-dark);
    color: #f0e6d8;
    text-align: center;
    font-size: 0.9rem;
}
.site-footer p { margin: 0; }

/* ─── Buttons / chips ─────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.45rem 1.4rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 999px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }

.chip {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    border-radius: 999px;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.chip--active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Hero (homepage / index background) ──────────────────────────────── */
.hero {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 60vh;
    padding: 2.5rem 1.25rem;
    text-align: center;
    /* Placeholder until the Feb-and-village hero art exists. When it does, add
       it ABOVE the gradient and drop the gradient if you like:
         background-image: url('/assets/img/feb-village.webp'), linear-gradient(...);
       background-size: cover; background-position: center; */
    background: linear-gradient(180deg, #cfe3f2 0%, #e8edd8 55%, #d9c9a3 100%);
    background-size: cover;
    background-position: center;
}
.hero--compact { min-height: 34vh; }
.hero--full { min-height: 100vh; min-height: 100dvh; }   /* homepage splash fills the viewport */
.hero--home {
    display: flex;
    flex-direction: column;
    justify-content: center;   /* centered when it fits; scrolls when taller than the viewport */
    align-items: center;
    gap: 1.75rem;
    padding: 3rem 1.25rem;
}
.hero-stories {
    position: relative;        /* sit above the background layers */
    display: grid;
    gap: 1rem;
    width: 100%;
    max-width: 26rem;
}

/* Layered homepage background: video (left) → colored lineart (centre) → b&w (right). */
.hero-bg { position: absolute; inset: 0; overflow: hidden; }
.hero-bg__layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;   /* anchor media to the top of the hero (crop the bottom) */
    /* Zoom 10% anchored to the right: shifts the whole composition left (Feb
       moves left) and crops the far-left edge. Raise the scale to shift more. */
    transform: scale(1.1);
    transform-origin: right top;
}
/* colored lineart: transparent until 40% from the left, fully opaque by 60% */
.hero-bg__mid {
    -webkit-mask-image: linear-gradient(to right, transparent 40%, #000 70%);
            mask-image: linear-gradient(to right, transparent 40%, #000 70%);
}
/* b&w layer: the SAME colored image, desaturated via CSS so it registers
   pixel-perfectly with the colored layer (no AI re-render mismatch). Transparent
   at 50% from the left, ramping to fully opaque by 85%. */
.hero-bg__top {
    filter: grayscale(1);
    -webkit-mask-image: linear-gradient(to right, transparent 60%, #000 90%);
            mask-image: linear-gradient(to right, transparent 60%, #000 90%);
}
.hero__overlay { position: absolute; inset: 0; background: rgba(43, 33, 24, 0.10); }

.title-card {
    position: relative;
    background: rgba(255, 253, 249, 0.88);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow);
    max-width: 32rem;
}
.title-card--small { padding: 1.5rem 2rem; }
.title-card__title {
    margin: 0 0 0.4rem;
    color: var(--accent);
    font-family: var(--font-title);
    font-size: clamp(2.2rem, 8vw, 3.5rem);
    line-height: 1.1;
}
.title-card__line {
    margin: 0.1rem 0;
    line-height: 1.2;
    font-size: clamp(1rem, 3.5vw, 1.4rem);
}
.title-card__line--muted { color: var(--muted); font-style: italic; }
.title-card__cta { margin: 1.1rem 0 0; }
.music-toggle {
    margin-top: calc(0.9rem + 10px);           /* extra breathing room above the button */
    width: 3.1rem;
    height: 3.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--accent);                 /* brown — stands out on the light title card */
    color: #fff;
    font-size: 1.45rem;
    cursor: pointer;
    opacity: 0.45;                             /* faded = music off */
    transition: opacity 0.25s ease, transform 0.15s ease, background 0.2s ease;
}
.music-toggle:hover { opacity: 0.75; }
.music-toggle.is-playing {
    opacity: 1;
    background: var(--accent-dark);            /* solid + darker while playing */
    animation: music-pulse 2.4s ease-in-out infinite;
}
@keyframes music-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
    .music-toggle.is-playing { animation: none; }
}

/* ─── Generic content sections ────────────────────────────────────────── */
.strip, .index, .story, .notfound {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 2rem 1.25rem;
}
.section-heading {
    margin: 0 0 1.25rem;
    font-size: 1.5rem;
    color: var(--accent-dark);
}
.strip__cta { text-align: center; margin-top: 1.75rem; }

/* ─── Story cards ─────────────────────────────────────────────────────── */
.card-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }

.story-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.story-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(43, 33, 24, 0.16); }
.story-card__title { padding: 0.9rem 1rem 0; font-size: 1.2rem; color: var(--accent); }
.story-card__summary { padding: 0.35rem 1rem 1.1rem; margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ─── Story index: filter bar ─────────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}
.filter-bar__search {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font: inherit;
    background: var(--card);
}
.filter-bar__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ─── Story page ──────────────────────────────────────────────────────── */
.story__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}
.story__title { margin: 0; text-align: center; color: var(--accent); font-size: clamp(1.6rem, 5vw, 2.4rem); }
.speaker {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
}
.speaker:hover { background: var(--accent); color: #fff; }

.story__layout { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
.story__main { order: -1; }            /* story comes first on mobile */
.story__chars { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }

.char { margin: 0; text-align: center; width: 8rem; }
.char__img {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 4;
    padding: 0.5rem;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: linear-gradient(135deg, #f1e7d4, #e3d2b3);
    color: var(--accent-dark);
    font-size: 0.8rem;
}
.char__name { display: block; margin-top: 0.4rem; font-size: 0.9rem; }
.char__facing { display: block; color: var(--muted); font-size: 0.75rem; }

/* CSS-only tabs (no JS): the checked radio drives label + panel state. */
.tabs__radio { position: absolute; opacity: 0; pointer-events: none; }
.tabs__labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.tabs__label {
    padding: 0.6rem 1.1rem;
    border-radius: 8px 8px 0 0;
    color: var(--muted);
    cursor: pointer;
    font-weight: 600;
}
.tabs__label:hover { color: var(--ink); }
.tab-panel { display: none; padding-top: 1.1rem; }
.tab-panel p { margin: 0 0 1rem; }
.moral { color: var(--accent-dark); font-style: italic; }

#tab-modern:checked     ~ .tabs__labels label[for="tab-modern"],
#tab-original:checked    ~ .tabs__labels label[for="tab-original"],
#tab-activities:checked  ~ .tabs__labels label[for="tab-activities"] {
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom: none;
}
#tab-modern:checked     ~ .tabs__panels .tab-panel--modern,
#tab-original:checked    ~ .tabs__panels .tab-panel--original,
#tab-activities:checked  ~ .tabs__panels .tab-panel--activities { display: block; }

.activity-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.activity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.badge {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
}

.notfound { text-align: center; }

/* ─── Wider screens ───────────────────────────────────────────────────── */
@media (min-width: 40rem) {
    .card-grid--auto { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
    .filter-bar { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (min-width: 48rem) {
    .card-grid--3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 64rem) {
    /* the spec's 25% / 50% / 25% story layout — only at desktop widths */
    .story__layout { grid-template-columns: 1fr 2fr 1fr; align-items: start; }
    .story__main { order: 0; }
    .story__chars { flex-direction: column; flex-wrap: nowrap; }
    .char { width: 100%; }
}
