/* Toonaweza: Toons list (posts/index) and single Toon (posts/show). Styling only. */
:root {
    --tp-pink: #ff4880;
    --tp-purple: #7b2ff7;
    --tp-yellow: #ffc83d;
    --tp-ink: #2b2350;
    --tp-muted: #6b6880;
    --tp-soft: #f6f2ff;
}

/* ================= LIST PAGE ================= */
.tt-toons-hero {
    position: relative;
    padding: 64px 0 48px;
    margin-bottom: 32px;
    background: radial-gradient(700px 260px at 15% 0%, rgba(255, 72, 128, .18), transparent 70%),
                radial-gradient(700px 260px at 85% 100%, rgba(123, 47, 247, .16), transparent 70%),
                linear-gradient(180deg, #fff5f9, #fbf8ff);
    overflow: hidden;
}
.tt-toons-kicker {
    display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600;
    color: var(--tp-purple); background: #fff; box-shadow: 0 4px 14px rgba(123, 47, 247, .12);
}
.tt-toons-heading {
    font-family: Fredoka, sans-serif; font-size: clamp(2.2rem, 5vw, 3.6rem); color: var(--tp-ink); margin: 14px 0 6px;
}
.tt-toons-lead { color: var(--tp-muted); max-width: 560px; margin: 0 auto 24px; font-size: 1.05rem; }

.tt-toons-search {
    position: relative; display: flex; max-width: 560px; margin: 0 auto 20px;
    background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 10px 30px rgba(43, 35, 80, .1);
    border: 2px solid transparent; transition: border-color .2s ease;
}
.tt-toons-search:focus-within { border-color: var(--tp-purple); }
.tt-toons-search i { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: #a39fb8; }
.tt-toons-search input { flex: 1; border: 0; outline: 0; background: transparent; padding: 10px 12px 10px 44px; min-width: 0; font-size: 1rem; }
.tt-toons-search button {
    border: 0; border-radius: 999px; padding: 0 22px; min-height: 44px; font-weight: 600; color: #fff;
    background: linear-gradient(90deg, var(--tp-pink), var(--tp-purple));
}

.tt-toons-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tt-toons-chips a {
    padding: 8px 16px; border-radius: 999px; font-size: .9rem; font-weight: 600; text-decoration: none;
    color: var(--tp-ink); background: #fff; border: 2px solid #ece8f6; transition: all .2s ease;
}
.tt-toons-chips a:hover { border-color: var(--tp-pink); color: var(--tp-pink); }
.tt-toons-chips a.active { background: var(--tp-ink); border-color: var(--tp-ink); color: #fff; }

/* Cards */
.tt-toon-col { animation: tp-rise .6s cubic-bezier(.34, 1.4, .64, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes tp-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.tt-toon-card {
    display: flex; flex-direction: column; background: #fff; border-radius: 24px; overflow: hidden;
    box-shadow: 0 8px 24px rgba(43, 35, 80, .08); transition: transform .3s cubic-bezier(.34, 1.4, .64, 1), box-shadow .3s ease;
}
.tt-toon-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(123, 47, 247, .18); }

.tt-toon-thumb { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--tp-soft); }
.tt-toon-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.tt-toon-card:hover .tt-toon-thumb img { transform: scale(1.06); }
.tt-toon-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(43, 35, 80, .45)); }
.tt-toon-play {
    position: absolute; left: 50%; top: 50%; z-index: 1; width: 60px; height: 60px; border-radius: 50%;
    display: grid; place-items: center; color: var(--tp-pink); background: rgba(255, 255, 255, .95);
    transform: translate(-50%, -50%) scale(.85); opacity: .9; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease;
}
.tt-toon-play i { margin-left: 4px; font-size: 1.2rem; }
.tt-toon-card:hover .tt-toon-play { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
.tt-toon-chip, .tt-toon-draft {
    position: absolute; z-index: 1; top: 12px; padding: 4px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700;
}
.tt-toon-chip { left: 12px; background: var(--tp-yellow); color: var(--tp-ink); }
.tt-toon-draft { right: 12px; background: #111; color: #fff; }

.tt-toon-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tt-toon-school {
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%;
    font-size: .78rem; font-weight: 600; color: var(--tp-purple); text-decoration: none;
    padding: 3px 10px; border-radius: 999px; background: var(--tp-soft);
}
.tt-toon-school span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-toon-title { font-family: Fredoka, sans-serif; font-size: 1.15rem; line-height: 1.3; margin: 0; }
.tt-toon-title a { color: var(--tp-ink); text-decoration: none; }
.tt-toon-title a:hover { color: var(--tp-pink); }
.tt-toon-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: auto; font-size: .82rem; color: var(--tp-muted); }
.tt-toon-narrator { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--tp-pink); }

.tt-toons-empty { text-align: center; padding: 56px 16px; border-radius: 28px; background: var(--tp-soft); }
.tt-toons-empty-emoji { font-size: 64px; animation: tp-bob 3s ease-in-out infinite; }
@keyframes tp-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ================= SINGLE TOON (styles the existing markup) ================= */
.post-container {
    max-width: 860px !important;
    margin: 32px auto 56px !important;
    padding: 36px clamp(16px, 4vw, 48px) 40px !important;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 12px 40px rgba(43, 35, 80, .08);
    position: relative;
}
.post-container::before { /* Kenyan flag stripe */
    content: ""; position: absolute; top: 0; left: 28px; right: 28px; height: 6px; border-radius: 0 0 6px 6px;
    background: linear-gradient(90deg, #000 0 25%, #fff 25% 27%, #BB0000 27% 73%, #fff 73% 75%, #006600 75%);
}
.post-container h1 {
    font-family: Fredoka, sans-serif; color: var(--tp-ink);
    font-size: clamp(1.9rem, 4.5vw, 3rem); line-height: 1.15; margin: 8px 0 24px;
}

.post-content { font-size: 1.08rem; line-height: 1.85; color: #3b3755; }
.post-content p { margin-bottom: 1.15rem; }
.post-content p:first-child::first-letter {
    float: left; font-family: Fredoka, sans-serif; font-size: 3.4em; line-height: .9; margin: 4px 10px 0 0; color: var(--tp-pink);
}
.post-content img { max-width: 100%; height: auto; border-radius: 18px; }
.post-content h2, .post-content h3 { font-family: Fredoka, sans-serif; color: var(--tp-ink); margin-top: 1.6rem; }
.post-content blockquote {
    margin: 1.5rem 0; padding: 14px 20px; border-left: 5px solid var(--tp-yellow); border-radius: 0 16px 16px 0; background: #fffaf0;
}
.post-content .video-container, .post-container .video-container {
    border-radius: 20px; overflow: hidden; box-shadow: 0 14px 34px rgba(43, 35, 80, .18); margin: 1.5rem 0;
}

.post-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 !important; }
.post-meta .badge {
    font-size: .82rem; font-weight: 600; padding: 8px 14px; border-radius: 999px;
}
.post-meta .badge.bg-primary { background: var(--tp-soft) !important; color: var(--tp-purple); }
.post-meta .badge.bg-info { background: #fff5e0 !important; color: #8a5a00; }

/* Downloads, admin buttons and the back link */
.post-container .d-flex.justify-content-between { flex-wrap: wrap; gap: 10px; align-items: center; }
.post-container .btn { border-radius: 999px; padding: .55rem 1.2rem; font-weight: 600; }
.post-container .btn-secondary {
    background: var(--tp-ink); border-color: var(--tp-ink);
}
.post-container .btn-secondary:hover { background: var(--tp-pink); border-color: var(--tp-pink); }

/* Quiz */
.post-container > .row .card-body { padding: 28px 0 0; margin-top: 28px; border-top: 2px dashed #ece8f6; }
.post-container .card-body > h3 { font-family: Fredoka, sans-serif; color: var(--tp-ink); }
.post-container .card-body > h3::before { content: "🧠 "; }
.post-container .question {
    background: var(--tp-soft); border-radius: 20px; padding: 20px 22px; margin-top: 16px;
}
.post-container .question h4 { font-size: 1.1rem; color: var(--tp-ink); margin-bottom: 12px; }
.post-container .question .choices { display: grid; gap: 10px; }
.post-container .question .form-check {
    position: relative; margin: 0; padding: 0;
}
.post-container .question .form-check-input { position: absolute; opacity: 0; pointer-events: none; }
.post-container .question .form-check-label {
    display: block; cursor: pointer; padding: 12px 16px 12px 46px; border-radius: 14px; background: #fff;
    border: 2px solid #ece8f6; transition: border-color .2s ease, transform .15s ease, background .2s ease; position: relative;
}
.post-container .question .form-check-label::before {
    content: ""; position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid #c9c2e6; background: #fff; transition: all .2s ease;
}
.post-container .question .form-check-label:hover { border-color: var(--tp-pink); transform: translateX(3px); }
.post-container .question .form-check-input:checked + .form-check-label { border-color: var(--tp-purple); background: #fbf8ff; }
.post-container .question .form-check-input:checked + .form-check-label::before { border-color: var(--tp-purple); box-shadow: inset 0 0 0 4px #fff; background: var(--tp-purple); }
.post-container .question .form-check-input:focus-visible + .form-check-label { outline: 3px solid var(--tp-yellow); outline-offset: 2px; }
.post-container .question .btn-primary {
    margin-top: 14px !important; border: 0; background: linear-gradient(90deg, var(--tp-pink), var(--tp-purple));
}
.post-container .question .alert { border-radius: 14px; margin-top: 14px !important; }

@media (max-width: 575.98px) {
    .post-container { margin: 16px 12px 40px !important; border-radius: 22px; padding-top: 28px !important; }
    .post-content { font-size: 1.02rem; }
    .tt-toons-hero { padding: 40px 0 32px; }
}

@media (prefers-reduced-motion: reduce) {
    .tt-toon-col, .tt-toons-empty-emoji { animation: none; }
    .tt-toon-card, .tt-toon-thumb img, .tt-toon-play { transition: none; }
}
