/* ==========================================================
   COMIC theme — red comic page, halftone, ink, sound bursts
   ========================================================== */
:root {
    --c-ink: #120103;
    --c-red: #e62429;
    --c-yellow: #ffd200;
    --c-paper: #fff8e7;
    --fc7: #ffd200;
}

/* ---------- background page ---------- */
body.comic, .comic section { background-color: var(--c-ink); }
.comic section { background-color: transparent; }
body.comic::before {
    background-image: url(comic-bg.svg);
    opacity: 1;
    animation: comicDrift 40s ease-in-out infinite alternate;
}
body.comic > img, .comic #touch { display: none; }
@keyframes comicDrift {
    from { transform: scale(1.04) translate(0, 0); }
    to   { transform: scale(1.12) translate(-2%, 1.5%); }
}

/* ---------- page-flip intro ---------- */
#comicFlash {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    background: var(--c-ink);
    transition: opacity .5s ease;
}
#comicFlash.cf-done { opacity: 0; }
.cf-frame {
    position: absolute;
    inset: -5%;
    background-image: url(comic-bg.svg);
    background-repeat: no-repeat;
    opacity: 0;
    animation: cfFlip .11s steps(1) forwards;
    border: 10px solid var(--c-ink);
}
@keyframes cfFlip { to { opacity: 1; } }

/* ---------- fonts ---------- */
.comic section h2,
.comic .countdown div:before,
.comic .text,
.comic h4,
.comic-burst span { font-family: 'Bangers', 'Impact', sans-serif; }
.comic span#year,
.comic .countdown div { font-family: 'Anton', 'Impact', sans-serif; }

/* ---------- clock: a comic panel ---------- */
.comic section .box:before { display: none; }
.comic section .circle {
    background: var(--c-paper);
    border: 7px solid var(--c-ink);
    box-shadow: 12px 12px 0 var(--c-ink);
    transition: box-shadow .12s ease, transform .12s ease;
}
.comic section .circle:before {
    top: 16px; left: 16px; right: 16px; bottom: 16px;
    background:
        radial-gradient(circle, rgba(255, 210, 0, .85) 30%, transparent 33%) 0 0 / 13px 13px,
        var(--c-paper);
    border: 3px solid var(--c-ink);
}
.comic section .circle.poppuf:before {
    background:
        radial-gradient(circle, rgba(255, 210, 0, .85) 30%, transparent 33%) 0 0 / 13px 13px,
        var(--c-paper);
}
.comic section .circle.popbig {
    box-shadow: 4px 4px 0 var(--c-ink);
    transform: translate(8px, 8px);
}
.comic section h2 {
    color: var(--c-yellow);
    font-size: 4.6em;
    letter-spacing: .04em;
    line-height: 1;
    -webkit-text-stroke: 2.5px var(--c-ink);
    text-shadow: 5px 5px 0 var(--c-red), 8px 8px 0 var(--c-ink);
    transform: rotate(-5deg);
}
.comic section .poppuf h2 { font-size: 4.8em; }
.comic span#year {
    font-size: 1.15em;
    color: #fff;
    -webkit-text-fill-color: #fff;
    -webkit-text-stroke: 2.5px var(--c-ink);
    letter-spacing: .03em;
    transform: rotate(3deg);
}
.comic span#year em {
    color: var(--c-red);
    -webkit-text-fill-color: var(--c-red);
    -webkit-text-stroke: 2.5px var(--c-ink);
}
.comic .countdown div {
    width: 64px;
    margin: 0 5px;
    padding: 4px 0 2px;
    font-size: 1.7em;
    color: var(--c-ink);
    -webkit-text-fill-color: var(--c-ink);
    -webkit-text-stroke-width: 0;
    text-shadow: none;
    background: #fff;
    border: 3px solid var(--c-ink);
    box-shadow: 4px 4px 0 var(--c-ink);
    transform: rotate(-3deg);
}
.comic .countdown div:nth-child(even) { transform: rotate(3deg); }
.comic .countdown #second {
    background: var(--c-yellow);
    color: var(--c-red);
    -webkit-text-fill-color: var(--c-red);
    -webkit-text-stroke: 1.5px var(--c-ink);
}
.comic .countdown div:before,
.comic .countdown #second:before {
    bottom: -32px;
    font-size: 1rem;
    letter-spacing: .06em;
    color: var(--c-ink);
    -webkit-text-fill-color: var(--c-ink);
    -webkit-text-stroke-width: 0;
    text-shadow: none;
}

/* hands */
.comic .clock:before {
    width: 20px; height: 20px;
    background: var(--c-red);
    border: 4px solid var(--c-ink);
    box-shadow: none;
}
.comic .hr:before, .comic .mn:before {
    background: var(--c-ink);
    border: 2px solid #fff;
    border-radius: 3px;
    box-shadow: 0 0 0 2px var(--c-ink);
}
.comic .hr:before { width: 12px; }
.comic .mn:before { width: 8px; }
.comic .sc:before {
    width: 4px;
    background: var(--c-red);
    box-shadow: 0 0 0 1.5px var(--c-ink);
}

/* floating dots -> comic dots */
.comic section i {
    background: var(--c-yellow);
    border: 2px solid var(--c-ink);
    box-shadow: 2px 2px 0 var(--c-ink);
}
.comic section i:nth-child(3n+1) { background: #fff; border: 2px solid var(--c-ink); }
.comic section i:nth-child(4n+2) { background: var(--c-red); }
.comic section i:nth-child(n+70) { display: none; }

/* ---------- buttons ---------- */
.comic .label { color: #fff; }
.comic .text { letter-spacing: .06em; -webkit-text-stroke: .6px var(--c-ink); }
.comic .indicator {
    background: #fff;
    border: 3px solid var(--c-ink);
    box-shadow: 4px 4px 0 var(--c-ink);
}
.comic .indicator::before { box-shadow: none; }
.comic .indicator::after { background: #fff; box-shadow: none; }
/* the DOOM button looks pressed while comic is on */
.comic #doom ~ .label .indicator { background: var(--c-yellow); box-shadow: 1px 1px 0 var(--c-ink); transform: translate(3px, 3px); }
.comic #doom ~ .label .indicator::after { opacity: 0; }

.comic h4 {
    color: #fff;
    font-size: 1.3em;
    letter-spacing: .08em;
    -webkit-text-stroke: 1px var(--c-ink);
    text-shadow: 2px 2px 0 var(--c-ink);
}

/* ---------- sound-effect bursts ---------- */
.comic-burst {
    position: fixed;
    width: 200px;
    height: 140px;
    z-index: 5;
    pointer-events: none;
    transform: translate(-10%, 0) rotate(var(--r)) scale(0);
    animation: burstPop 1.6s cubic-bezier(.3, 1.8, .5, 1) forwards;
    filter: drop-shadow(6px 6px 0 var(--c-ink));
}
.comic-burst svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.comic-burst span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    letter-spacing: .03em;
    color: var(--c-red);
    -webkit-text-stroke: 2px var(--c-ink);
    text-shadow: 3px 3px 0 var(--c-ink);
    white-space: nowrap;
}
@keyframes burstPop {
    0%   { transform: rotate(var(--r)) scale(0); opacity: 1; }
    18%  { transform: rotate(var(--r)) scale(calc(var(--s) * 1.15)); }
    30%  { transform: rotate(var(--r)) scale(var(--s)); }
    80%  { transform: rotate(var(--r)) scale(var(--s)); opacity: 1; }
    100% { transform: rotate(var(--r)) scale(calc(var(--s) * 1.3)); opacity: 0; }
}

/* ---------- fireworks in comic yellow ---------- */
body.comic #fireworks:before, body.comic #fireworks:after {
    animation: 1s bang ease-out infinite backwards,
               1s gravity ease-in infinite backwards,
               5s position linear infinite backwards;
    box-shadow: -120px 0 var(--fc7), 120px 0 var(--fc7), 0 120px var(--fc7), 0 -120px var(--fc7),
                45px 45px var(--fc7), -45px 45px var(--fc7), 85px 85px var(--fc7), -85px 85px var(--fc7),
                45px -45px var(--fc7), -45px -45px var(--fc7), 85px -85px var(--fc7), -85px -85px var(--fc7),
                65px 0 var(--fc7), -65px 0 var(--fc7), 0 65px var(--fc7), 0 -65px var(--fc7),
                100px 45px var(--fc7), -100px 45px var(--fc7), -50px 100px var(--fc7), 50px 100px var(--fc7),
                100px -45px var(--fc7), -100px -45px var(--fc7), -50px -100px var(--fc7), 50px -100px var(--fc7),
                5px 10px var(--fc7);
}
body.comic #fireworks:after {
    animation-delay: 1.25s, 1.25s, 1.25s;
    animation-duration: 1.25s, 1.25s, 6.25s;
}

@media only screen and (max-width: 600px) {
    .comic section h2 { font-size: 3.8em; }
    .comic-burst { width: 150px; height: 105px; }
    .comic-burst span { font-size: 30px; }
}
