/* =====================================================================
   Cove Comic Loader — full-screen overlay with animated ink-panel SVG
   ===================================================================== */

.cove-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 20, 0.87);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: cl-fade-in 0.18s ease forwards;
}

.cove-loader-overlay[hidden] {
    display: none !important;
}

@keyframes cl-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Comic page card ───────────────────────────────────────────────── */
.cove-loader-page {
    position: relative;
    width: 180px;
    height: 234px;
    background: #fff;
    border-radius: 2px 8px 8px 2px;
    box-shadow:
        -5px 0 10px rgba(0,0,0,0.35),
        10px 10px 40px rgba(0,0,0,0.55),
        0 0 0 1px rgba(0,0,0,0.12);
    transform: rotate(-1.5deg);
    overflow: hidden;
    flex-shrink: 0;
}

/* Spine shadow */
.cove-loader-page::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(to right, #d4ccc0 0%, #f0ebe3 60%, transparent 100%);
    z-index: 1;
}

/* Subtle halftone dot texture — comic-book paper feel */
.cove-loader-page::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.06) 1px, transparent 1px);
    background-size: 8px 8px;
    pointer-events: none;
    z-index: 0;
}

.cove-loader-svg {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block;
}

/* ── SVG panel borders (ink-draw animation) ────────────────────────── */
.cl-panel {
    fill: none;
    stroke: #111;
    stroke-width: 2;
    stroke-linecap: square;
}

.cl-panel-1 {
    stroke-dasharray: 330;
    stroke-dashoffset: 330;
    animation: cl-draw-330 3.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 0s;
}

.cl-panel-2 {
    stroke-dasharray: 330;
    stroke-dashoffset: 330;
    animation: cl-draw-330 3.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 0.22s;
}

.cl-panel-3 {
    stroke-dasharray: 480;
    stroke-dashoffset: 480;
    animation: cl-draw-480 3.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 0.44s;
}

@keyframes cl-draw-330 {
    0%   { stroke-dashoffset: 330; opacity: 1; }
    28%  { stroke-dashoffset: 0;   opacity: 1; }
    72%  { stroke-dashoffset: 0;   opacity: 1; }
    85%  { stroke-dashoffset: 0;   opacity: 0; }
    86%  { stroke-dashoffset: 330; opacity: 0; }
    100% { stroke-dashoffset: 330; opacity: 0; }
}

@keyframes cl-draw-480 {
    0%   { stroke-dashoffset: 480; opacity: 1; }
    30%  { stroke-dashoffset: 0;   opacity: 1; }
    72%  { stroke-dashoffset: 0;   opacity: 1; }
    85%  { stroke-dashoffset: 0;   opacity: 0; }
    86%  { stroke-dashoffset: 480; opacity: 0; }
    100% { stroke-dashoffset: 480; opacity: 0; }
}

/* ── Panel 1 content: energy burst / action star ───────────────────── */
.cl-burst line {
    stroke: #111;
    stroke-width: 1.6;
    stroke-linecap: round;
    opacity: 0;
    animation: cl-content-pop 3.4s ease infinite;
    animation-delay: 0.8s;
}

/* ── Panel 2 content: speech bubble ────────────────────────────────── */
.cl-bubble-ring {
    fill: none;
    stroke: #111;
    stroke-width: 1.8;
    stroke-dasharray: 130;
    stroke-dashoffset: 130;
    opacity: 0;
    animation: cl-draw-bubble 3.4s ease infinite;
    animation-delay: 0.7s;
}

.cl-bubble-tail {
    fill: none;
    stroke: #111;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    animation: cl-content-pop 3.4s ease infinite;
    animation-delay: 0.92s;
}

@keyframes cl-draw-bubble {
    0%   { stroke-dashoffset: 130; opacity: 0; }
    20%  { stroke-dashoffset: 130; opacity: 0; }
    38%  { stroke-dashoffset: 0;   opacity: 1; }
    72%  { stroke-dashoffset: 0;   opacity: 1; }
    83%  { stroke-dashoffset: 0;   opacity: 0; }
    84%  { stroke-dashoffset: 130; opacity: 0; }
    100% { stroke-dashoffset: 130; opacity: 0; }
}

/* ── Bubble dots (blink inside speech bubble) ───────────────────────── */
.cl-dot {
    fill: #111;
    opacity: 0;
    animation: cl-dot-blink 3.4s ease infinite;
}

.cl-dot-1 { animation-delay: 0.98s; }
.cl-dot-2 { animation-delay: 1.12s; }
.cl-dot-3 { animation-delay: 1.26s; }

@keyframes cl-dot-blink {
    0%   { opacity: 0; }
    28%  { opacity: 0; }
    35%  { opacity: 1; }
    72%  { opacity: 1; }
    82%  { opacity: 0; }
    100% { opacity: 0; }
}

/* ── Panel 3 content: body text lines ──────────────────────────────── */
.cl-textline {
    stroke: #bbb;
    stroke-width: 2.5;
    stroke-linecap: round;
    opacity: 0;
    animation: cl-content-pop 3.4s ease infinite;
}

.cl-textline-1 { animation-delay: 0.90s; }
.cl-textline-2 { animation-delay: 1.05s; }
.cl-textline-3 { animation-delay: 1.20s; }
.cl-textline-short { animation-delay: 1.35s; }

/* Content pop-in shared keyframe */
@keyframes cl-content-pop {
    0%   { opacity: 0; }
    30%  { opacity: 0; }
    38%  { opacity: 1; }
    72%  { opacity: 1; }
    82%  { opacity: 0; }
    100% { opacity: 0; }
}

/* ── Speech bubble caption below the page ──────────────────────────── */
.cove-loader-caption {
    margin-top: 22px;
    display: flex;
    align-items: center;
    gap: 0;
}

.cove-loader-bubble {
    position: relative;
    background: #fff;
    border: 2.5px solid #111;
    border-radius: 22px;
    padding: 7px 18px 7px 16px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #111;
    white-space: nowrap;
    transform: rotate(0.8deg);
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Tail pointing up toward the page */
.cove-loader-bubble::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 28px;
    border: 8px solid transparent;
    border-bottom-color: #111;
}

.cove-loader-bubble::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 30px;
    border: 6px solid transparent;
    border-bottom-color: #fff;
}

.cove-loader-msg {
    color: #111;
}

/* ── Animated ellipsis dots ─────────────────────────────────────────── */
.cove-loader-dots {
    display: inline-flex;
    gap: 1px;
    align-items: flex-end;
    padding-bottom: 1px;
}

.cove-loader-dots span {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #111;
    animation: cl-ellipsis 1.3s ease-in-out infinite;
}

.cove-loader-dots span:nth-child(2) { animation-delay: 0.18s; }
.cove-loader-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes cl-ellipsis {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.25; }
    40%            { transform: translateY(-3px); opacity: 1;    }
}
