/* ========================================
   STAGE 2 — SERVICES (Canvas Text Reveals + Core Sphere)
   Adapted from Stage-what do we do reference
   ======================================== */

.svc-scene {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* --- Canvas --- */
#svc-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

/* --- Core Sphere --- */
.svc-core {
    position: absolute;
    left: 50%;
    top: 60%;
    width: 130px;
    height: 130px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.55) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, var(--accent) 0%, transparent 70%);
    box-shadow:
        0 0 45px rgba(201,168,76,0.4),
        0 0 110px rgba(255,255,255,0.1),
        inset 0 0 22px rgba(255,255,255,0.18);
    will-change: transform;
    pointer-events: none;
    z-index: 20;
}

.svc-core.moving {
    filter: saturate(1.25) contrast(1.05);
}

.svc-core-ring {
    position: absolute;
    inset: -10px;
    border-radius: inherit;
    border: 1px solid rgba(255,255,255,0.22);
    opacity: 0.35;
    mix-blend-mode: screen;
    animation: svcCoreSpin 4.8s linear infinite;
}

.svc-core-ring.r2 {
    inset: -18px;
    opacity: 0.18;
    animation-duration: 8.6s;
    animation-direction: reverse;
}

@keyframes svcCoreSpin {
    to { transform: rotate(360deg); }
}

.svc-core-slit {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56%;
    height: 2px;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.55);
    box-shadow: 0 0 14px rgba(255,255,255,0.25);
    opacity: 0;
    transition: opacity 0.2s;
}

.svc-core.laser .svc-core-slit {
    opacity: 0.95;
}

.svc-core.laser .svc-core-ring {
    opacity: 0.08;
}

/* --- Dual Triangles (Beat 3) --- */
.svc-ripple {
    position: absolute;
    width: 0;
    height: 0;
    top: 50%;
    left: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.svc-core.dualtri .svc-ripple.r1,
.svc-core.dualtri .svc-ripple.r2 {
    opacity: 0;
    width: 180px;
    height: 180px;
    top: 50%;
    left: 50%;
    margin-top: -90px;
    margin-left: -90px;
    clip-path: polygon(50% 5%, 95% 90%, 5% 90%);
    background: transparent;
    border: none;
    border-radius: 0;
}

.svc-core.dualtri .svc-ripple.r1 {
    background: linear-gradient(180deg, rgba(201,168,76,0.15) 0%, rgba(201,168,76,0.03) 100%);
    box-shadow: inset 0 0 20px rgba(201,168,76,0.1);
    animation: svcTriGrowCW 0.8s ease-out forwards, svcTriCW 7s linear 0.8s infinite;
}

.svc-core.dualtri .svc-ripple.r1::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 5%, 95% 90%, 5% 90%);
    border: 1.5px solid rgba(201,168,76,0.35);
    box-sizing: border-box;
}

.svc-core.dualtri .svc-ripple.r2 {
    clip-path: polygon(50% 95%, 95% 10%, 5% 10%);
    background: linear-gradient(0deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
    box-shadow: inset 0 0 20px rgba(255,255,255,0.05);
    animation: svcTriGrowCCW 0.8s ease-out 0.15s forwards, svcTriCCW 9s linear 0.95s infinite;
}

.svc-core.dualtri .svc-ripple.r2::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 95%, 95% 10%, 5% 10%);
    border: 1.5px solid rgba(255,255,255,0.2);
    box-sizing: border-box;
}

.svc-core.dualtri .svc-ripple.r3 {
    opacity: 0;
}

@keyframes svcTriGrowCW {
    from { transform: scale(0) rotate(0deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes svcTriGrowCCW {
    from { transform: scale(0) rotate(0deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes svcTriCW {
    from { transform: scale(1) rotate(0deg); }
    to   { transform: scale(1) rotate(360deg); }
}

@keyframes svcTriCCW {
    from { transform: scale(1) rotate(0deg); }
    to   { transform: scale(1) rotate(-360deg); }
}

/* Mic active: core turns red */
.svc-core.mic-active {
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.55) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, var(--holo-red) 0%, transparent 70%);
    box-shadow: 0 0 50px rgba(255,59,59,0.4);
}

/* Speaking: subtle pulse when TTS is active */
.svc-core.speaking {
    animation: speakPulse 0.8s ease-in-out infinite alternate;
}
@keyframes speakPulse {
    from { box-shadow: 0 0 30px rgba(201,168,76,0.3); }
    to   { box-shadow: 0 0 50px rgba(201,168,76,0.6); }
}

/* --- HUD Pill (top-left) --- */
.svc-hud {
    position: absolute;
    left: 16px;
    top: 16px;
    z-index: 30;
    pointer-events: none;
}

.svc-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: rgba(10,10,10,0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.svc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.svc-hud-title {
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text);
}

.svc-sub {
    font-size: 11px;
    color: var(--dim);
    margin-top: 4px;
    padding-left: 4px;
    max-width: 520px;
}

/* --- Progress Dots (top-right) --- */
.svc-progress {
    position: absolute;
    right: 16px;
    top: 16px;
    z-index: 32;
    display: flex;
    gap: 6px;
    pointer-events: none;
}

.svc-pdot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.svc-pdot.active {
    width: 18px;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(201,168,76,0.4);
}

/* ========================================
   MOBILE
   ======================================== */
@media (max-width: 900px) {
    .svc-core {
        width: 100px;
        height: 100px;
    }

    .svc-hud { left: 12px; top: 12px; }
    .svc-progress { right: 12px; top: 12px; }

    .svc-pill { padding: 7px 12px; }
    .svc-hud-title { font-size: 10px; }

}

@media (max-width: 600px) {
    .svc-core {
        width: 85px;
        height: 85px;
    }
}

/* ========================================
   NARROW VIEWPORT — ≤ 374px (iPhone 4/5, small Androids)
   ======================================== */
@media (max-width: 374px) {
    .svc-scene { padding: 0 10px; }
    .svc-core {
        width: 70px;
        height: 70px;
    }
    .svc-hud { left: 8px; top: 8px; }
    .svc-progress { right: 8px; top: 8px; gap: 6px; }
    .svc-pill { padding: 4px 8px; }
    .svc-hud-title { font-size: 8px; letter-spacing: 1.5px; }
}

