/* Crunchyroll-style theme for personal.html#anime -- active only while
   body.theme-crunchy is set by assets/personal-crunchy.js.
   v1 (2026-09-29): black canvas, orange #F47521 accent, full-bleed key-art
   hero with dash progress, portrait 2:3 cards with a review panel on hover. */

body.theme-crunchy { --cr-orange: #F47521; --cr-bg: #000; --cr-panel: #141519; --cr-text: #fff; --cr-sub: #a0a0a0; background: #000; }
body.theme-crunchy .gallery-wrap { max-width: none; padding: 0 4% 5rem; }
body.theme-crunchy .back-bar,
body.theme-crunchy .hero-title,
body.theme-crunchy .hero-sub,
body.theme-crunchy .category-view-header,
body.theme-crunchy .pcms-admin-only[onclick="openDraftModal()"],
body.theme-crunchy[data-cr-cat="anime"] .gallery-section[data-category="anime"] { display: none !important; }

#crunchyView { display: none; font-family: 'Outfit', 'Mitr', var(--font-body, 'Plus Jakarta Sans', 'Sarabun'), sans-serif; color: var(--cr-text); }
body.theme-crunchy #crunchyView { display: block; }

/* ---------- top bar ---------- */
.cr-bar {
    position: sticky; top: 64px; z-index: 40; display: flex; align-items: center; gap: 18px;
    margin: 0 -4.2%; padding: 0 4.2%; height: 60px; background: #23252b; box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
.cr-back { background: none; border: 0; color: #dadada; font-size: 1.9rem; line-height: 1; cursor: pointer; padding: 0 6px 4px; }
.cr-back:hover { color: #fff; }
.cr-logo { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em; color: var(--cr-orange); flex: 0 0 auto; user-select: none; }
.cr-tabs { display: flex; align-items: stretch; height: 100%; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.cr-tabs::-webkit-scrollbar { display: none; }
.cr-tab {
    flex: 0 0 auto; background: none; border: 0; border-bottom: 3px solid transparent; color: #dadada; font: inherit; font-size: .9rem; font-weight: 600;
    padding: 0 14px; cursor: pointer; white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.cr-tab span { color: var(--cr-sub); font-weight: 400; font-size: .78rem; margin-left: 3px; }
.cr-tab:hover { background: #141519; color: #fff; }
.cr-tab.is-on { color: #fff; border-bottom-color: var(--cr-orange); background: #141519; }
.cr-add { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--cr-orange); color: #000; border: 0; border-radius: 4px; padding: 9px 16px; font: inherit; font-size: .9rem; font-weight: 800; letter-spacing: .02em; cursor: pointer; flex: 0 0 auto;
    box-shadow: 0 4px 0 #b3520f, 0 8px 18px rgba(244,117,33,0.3); transition: transform .12s ease, box-shadow .12s ease, background .15s ease; }
.cr-add span { font-size: 1.1rem; line-height: 1; }
.cr-add:hover { background: #ff8a3d; transform: translateY(-1px); }
.cr-add:active { transform: translateY(3px); box-shadow: 0 1px 0 #b3520f; }

/* ---------- hero ---------- */
.cr-hero { position: relative; margin: 0 -4.2%; height: min(72vh, 680px); min-height: 400px; background: #000; overflow: hidden; }
.cr-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; }
.cr-slide.is-on { opacity: 1; z-index: 1; }
.cr-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cr-hero-shade {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.6) 32%, rgba(0,0,0,0) 62%),
                linear-gradient(0deg, #000 0%, rgba(0,0,0,0) 34%);
}
.cr-hero-body { position: absolute; left: 4.2%; bottom: 70px; max-width: min(520px, 80%); }
.cr-hero-title { font-size: clamp(2rem, 4.2vw, 3.6rem); line-height: 1.05; font-weight: 800; margin: 0 0 12px; text-shadow: 0 2px 16px rgba(0,0,0,0.6); color: #fff; }
.cr-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; font-size: .88rem; }
.cr-pill { background: rgba(255,255,255,0.14); padding: 2px 9px; font-size: .78rem; font-weight: 600; }
.cr-pill.is-ghost { background: none; border: 1px solid rgba(255,255,255,0.35); }
.cr-dim { color: var(--cr-sub); }
.cr-hero-blurb { color: #dadada; font-size: .95rem; line-height: 1.55; margin: 0 0 18px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cr-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cr-btn {
    background: var(--cr-orange); color: #000; border: 2px solid var(--cr-orange); padding: 9px 18px; font: inherit; font-size: .9rem; font-weight: 800;
    letter-spacing: .03em; text-transform: uppercase; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cr-btn:hover { background: #ff8a3d; border-color: #ff8a3d; }
.cr-btn.is-ghost { background: none; color: var(--cr-orange); }
.cr-btn.is-ghost:hover { background: rgba(244,117,33,0.12); color: #ff8a3d; }
.cr-stars { color: var(--cr-orange); letter-spacing: .08em; font-size: .9rem; }
.cr-stars i { font-style: normal; color: rgba(255,255,255,0.22); }

.cr-dashes { position: absolute; left: 4.2%; bottom: 28px; z-index: 2; display: flex; align-items: center; gap: 8px; }
.cr-dash { width: 36px; height: 14px; padding: 5px 0; border: 0; background: none; cursor: pointer; }
.cr-dash i { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.3); position: relative; overflow: hidden; }
.cr-dash i::after { content: ''; position: absolute; inset: 0; background: var(--cr-orange); transform: scaleX(0); transform-origin: left; }
.cr-dash.is-on { width: 64px; }
.cr-dash.is-on i::after { animation: crFill 8s linear forwards; }
.cr-hero.is-paused .cr-dash.is-on i::after { animation: none; transform: scaleX(1); }
@keyframes crFill { to { transform: scaleX(1); } }
.cr-pause { margin-left: 6px; background: none; border: 1px solid rgba(255,255,255,0.35); color: #fff; width: 26px; height: 26px; border-radius: 50%; font-size: .6rem; cursor: pointer; }

/* ---------- rows ---------- */
.cr-row { margin: 30px 0 6px; }
.cr-row-title { font-size: 1.35rem; font-weight: 700; margin: 0 0 12px; color: #fff; }
.cr-row-title span { font-size: .85rem; color: var(--cr-sub); font-weight: 400; margin-left: 4px; }
.cr-row-wrap { position: relative; margin: 0 -4.2%; }
.cr-track {
    display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 8.4% - 5 * 16px) / 6.3);
    gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 4.2%;
    padding: 4px 4.2% 18px; scrollbar-width: none;
}
.cr-track::-webkit-scrollbar { display: none; }
.cr-track > * { scroll-snap-align: start; }
.cr-arrow {
    position: absolute; top: 4px; width: 4.2%; min-width: 30px; aspect-ratio: auto; height: calc((100% - 22px) * 0.78); z-index: 3; border: 0; cursor: pointer;
    background: linear-gradient(90deg, rgba(0,0,0,0.85), rgba(0,0,0,0)); color: #fff; font-size: 2.4rem; opacity: 0; transition: opacity .2s ease; display: none;
}
.cr-right { right: 0; background: linear-gradient(270deg, rgba(0,0,0,0.85), rgba(0,0,0,0)); }
.cr-left { left: 0; }
.cr-row-wrap.has-overflow .cr-arrow { display: block; }
.cr-row-wrap.at-start .cr-left, .cr-row-wrap.at-end .cr-right { display: none; }
.cr-row-wrap:hover .cr-arrow { opacity: 1; }

.cr-card { display: flex; flex-direction: column; border: 0; padding: 0; background: none; cursor: pointer; font: inherit; color: inherit; text-align: left; min-width: 0; }
.cr-poster { position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; background: #23252b; }
.cr-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cr-noart { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; }
.cr-type { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,0.78); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 7px; }
.cr-over {
    position: absolute; inset: 0; display: flex; flex-direction: column; gap: 5px; padding: 14px 12px;
    background: rgba(20,21,25,0.94); opacity: 0; transition: opacity .2s ease;
}
.cr-over b { font-size: .98rem; line-height: 1.25; color: #fff; }
.cr-over small { color: var(--cr-sub); font-size: .76rem; }
.cr-over p { margin: 4px 0 0; font-size: .8rem; line-height: 1.5; color: #dadada; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; }
.cr-over p.is-dim { color: var(--cr-sub); font-style: italic; }
.cr-over-cta { color: var(--cr-orange); font-weight: 800; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.cr-title { margin-top: 8px; font-size: .92rem; font-weight: 600; line-height: 1.3; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-meta { margin-top: 2px; font-size: .78rem; color: var(--cr-sub); }
.cr-card:hover .cr-over, .cr-card:focus-visible .cr-over { opacity: 1; }
.cr-card:hover .cr-title { color: var(--cr-orange); }
.cr-card:focus-visible { outline: 2px solid var(--cr-orange); outline-offset: 3px; }

.cr-grid-sec { margin: 30px 0; }
.cr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 24px 16px; }
.cr-empty { color: var(--cr-sub); padding: 30px 0; }

.cr-tab:focus-visible, .cr-btn:focus-visible, .cr-back:focus-visible, .cr-add:focus-visible, .cr-dash:focus-visible, .cr-pause:focus-visible { outline: 2px solid var(--cr-orange); outline-offset: 2px; }

/* ---------- tiers: colour per rating, headers + badges ---------- */
.is-r5 { --tc: #f6c453; --tc2: #fff1c1; --tc3: #b8801c; }
.is-r4 { --tc: #F47521; --tc2: #ffd2b0; --tc3: #b84d0c; }
.is-r3 { --tc: #2abdbb; --tc2: #c4f3f2; --tc3: #16807e; }
.is-r2 { --tc: #a58cff; --tc2: #e3dbff; --tc3: #6a52c6; }
.is-r1 { --tc: #8f949c; --tc2: #e0e2e5; --tc3: #5c6067; }

.cr-tier-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 14px; padding-left: 14px; border-left: 5px solid var(--tc); line-height: 1; }
.cr-tier-ico { font-size: 1.7rem; }
.cr-tier-name {
    font-family: 'Bebas Neue', 'Outfit', 'Mitr', sans-serif; font-weight: 400; font-size: 2.3rem; letter-spacing: .05em;
    background: linear-gradient(180deg, var(--tc2) 0%, var(--tc) 55%, var(--tc3) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cr-tier-stars { color: var(--tc); font-size: 1.25rem; letter-spacing: .1em; }
.cr-tier-stars i { font-style: normal; color: rgba(255,255,255,0.18); }
.cr-tier-count { color: var(--cr-sub); font-size: .85rem; border: 1px solid rgba(255,255,255,0.2); padding: 3px 9px; }

/* MASTERPIECE row: bigger cards, glowing header. */
.cr-row.is-r5 { margin-top: 34px; padding: 22px 0 8px; background: radial-gradient(ellipse 70% 100% at 20% 0%, rgba(246,196,83,0.13) 0%, rgba(246,196,83,0) 70%); }
.cr-row.is-r5 .cr-tier-name { font-size: 3.1rem; filter: drop-shadow(0 0 18px rgba(246,196,83,0.35)); }
.cr-row.is-r5 .cr-tier-ico { font-size: 2.3rem; }
.cr-row.is-r5 .cr-tier-stars { font-size: 1.5rem; text-shadow: 0 0 12px rgba(246,196,83,0.6); }
.cr-row.is-r5 .cr-track { grid-auto-columns: calc((100% - 8.4% - 4 * 16px) / 5.2); }

/* Card: rating badge on the poster, tier-coloured stars below. */
.cr-badge {
    position: absolute; right: 8px; bottom: 8px; z-index: 1; background: var(--tc); color: #000; font-weight: 800; font-size: .85rem;
    padding: 3px 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.cr-card.is-r5 .cr-poster { outline: 2px solid rgba(246,196,83,0.85); outline-offset: -2px; box-shadow: 0 0 22px rgba(246,196,83,0.28); }
.cr-card.is-r5 .cr-badge { background: linear-gradient(180deg, #fff1c1, #f6c453 55%, #b8801c); font-size: .95rem; }
.cr-ribbon {
    position: absolute; left: 0; right: 0; top: 0; z-index: 1; padding: 5px 8px; font-size: .68rem; font-weight: 800; letter-spacing: .08em; color: #000;
    background: linear-gradient(90deg, #b8801c, #f6c453 40%, #fff1c1 60%, #f6c453 80%, #b8801c); text-align: center;
}
.cr-card.is-r5 .cr-type { top: 30px; }
.cr-meta { display: flex; align-items: center; gap: 6px; }
.cr-meta .cr-stars { color: var(--tc, var(--cr-orange)); font-size: .92rem; }
.cr-meta em { font-style: normal; color: var(--tc, var(--cr-sub)); font-weight: 700; font-size: .74rem; letter-spacing: .03em; }
.cr-card.is-r5 .cr-title { font-size: 1rem; }

/* The review modal follows the theme while it's open over the anime page. */
body.theme-crunchy .modal-content { background: #141519; border-color: #2a2c33; }
body.theme-crunchy .modal-tag { color: #000; background: var(--cr-orange); }

@media (hover: none) { .cr-over { display: none; } }
@media (prefers-reduced-motion: reduce) {
    .cr-slide, .cr-over { transition: none; }
    .cr-dash.is-on i::after { animation: none; transform: scaleX(1); }
}
@media (max-width: 1100px) { .cr-track { grid-auto-columns: calc((100% - 8.4% - 3 * 16px) / 4.3); } .cr-row.is-r5 .cr-track { grid-auto-columns: calc((100% - 8.4% - 2 * 16px) / 3.3); } }
@media (max-width: 720px) {
    .cr-bar { gap: 8px; }
    .cr-logo { font-size: 0; gap: 0; }
    .cr-tab { padding: 0 10px; font-size: .82rem; }
    .cr-hero { height: 64vh; min-height: 360px; }
    .cr-hero-shade { background: linear-gradient(0deg, #000 0%, rgba(0,0,0,0.75) 40%, rgba(0,0,0,0.1) 75%); }
    .cr-hero-body { max-width: 92%; bottom: 58px; }
    .cr-hero-blurb { -webkit-line-clamp: 2; font-size: .88rem; }
    .cr-track { grid-auto-columns: calc((100% - 8.4% - 2 * 12px) / 2.4); gap: 12px; }
    .cr-grid { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
    .cr-row-title { font-size: 1.15rem; }
    .cr-tier-name { font-size: 1.8rem; }
    .cr-row.is-r5 .cr-tier-name { font-size: 2.3rem; }
    .cr-row.is-r5 .cr-track { grid-auto-columns: calc((100% - 8.4% - 12px) / 1.7); }
    .cr-tier-stars, .cr-row.is-r5 .cr-tier-stars { font-size: 1.05rem; }
    .cr-dashes { gap: 5px; bottom: 22px; }
    .cr-dash { width: 20px; }
    .cr-dash.is-on { width: 40px; }
}
