@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

* {
    box-sizing: border-box;
}

:root {
    /* Updated Palette */
    --ritual-bg: #FFFFFF;
    /* White Background */
    --ritual-text: #2A3930;
    /* Dark Green Text */
    --ritual-text-muted: rgba(42, 57, 48, 0.7);

    --ritual-accent: #ABC9AB;
    /* Sage Green */
    --ritual-olive-dark: #2A3930;
    /* Deep Olive/Green */
    --ritual-cream: #ECE0D4;
    /* Beige/Cream */

    --border-radius: 16px;
    --transition: 0.3s ease;
}

.ritual-container {
    font-family: 'Outfit', sans-serif;
    color: var(--ritual-text);
    background-color: var(--ritual-bg);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(42, 57, 48, 0.1);
    min-height: 600px;
    border: 1px solid rgba(42, 57, 48, 0.05);
}

.ritual-step {
    padding: 2.5rem;
    display: none;
    animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.ritual-step.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.ritual-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.ritual-title {
    font-size: 2.8rem;
    font-weight: 300;
    margin: 0;
    letter-spacing: 1px;
    color: var(--ritual-olive-dark);
}

.ritual-subtitle {
    color: var(--ritual-text-muted);
    font-size: 1rem;
    margin-top: 0.5rem;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Pillars - Olive Green Section */
.ritual-pillars {
    display: grid;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* This specific section uses the "Olive" colors as requested */
.pillar-card {
    background: var(--ritual-olive-dark);
    /* Dark Green Background */
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    /* Changed from flex-start to center for better look */
    gap: 1.25rem;
    transition: var(--transition);
    color: var(--ritual-cream);
    /* Light text for contrast */
    box-shadow: 0 4px 12px rgba(42, 57, 48, 0.15);
    width: 100%;
}

.pillar-info {
    flex: 1;
}

.pillar-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(42, 57, 48, 0.25);
}

.pillar-card .icon {
    font-size: 1.5rem;
}

.pillar-card h3 {
    margin: 0 0 0.3rem 0;
    font-size: 1.1rem;
    color: var(--ritual-accent);
    /* Sage Green for headings inside dark card */
    font-weight: 600;
}

.pillar-card p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(236, 224, 212, 0.9);
    /* Cream with varied opacity */
    line-height: 1.4;
}

/* Buttons */
.ritual-btn {
    width: 100%;
    padding: 1.1rem;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.9rem;
}

.ritual-btn.primary {
    background: var(--ritual-olive-dark);
    color: #FFFFFF;
}

.ritual-btn.primary:hover {
    background: var(--ritual-accent);
    color: var(--ritual-olive-dark);
    box-shadow: 0 5px 15px rgba(171, 201, 171, 0.4);
}

.ritual-btn.secondary {
    background: transparent;
    border: 1px solid var(--ritual-olive-dark);
    color: var(--ritual-olive-dark);
}

.ritual-btn.secondary:hover {
    background: var(--ritual-olive-dark);
    color: #FFFFFF;
}

.ritual-btn.text {
    background: transparent;
    color: var(--ritual-text-muted);
    margin-top: 1rem;
    text-transform: none;
    letter-spacing: normal;
}

.ritual-btn.text:hover {
    color: var(--ritual-olive-dark);
    text-decoration: underline;
}

/* Camera */
.camera-wrapper {
    position: relative;
    width: 100%;
    padding-top: 125%;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

#camera-feed,
#capture-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    height: 65%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.8);
    /* White overlay around face mask */
}

.scan-line {
    position: absolute;
    left: 12.5%;
    width: 75%;
    height: 2px;
    background: var(--ritual-accent);
    box-shadow: 0 0 15px var(--ritual-accent);
    animation: scan 2.5s infinite ease-in-out;
}

@keyframes scan {
    0% {
        top: 20%;
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    85% {
        opacity: 1;
    }

    100% {
        top: 80%;
        opacity: 0;
    }
}

.scanner-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.ritual-btn.capture {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(42, 57, 48, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    cursor: pointer;
}

.inner-circle {
    width: 60px;
    height: 60px;
    background: var(--ritual-olive-dark);
    border-radius: 50%;
    transition: var(--transition);
}

.ritual-btn.capture:hover .inner-circle {
    transform: scale(1.1);
    background: var(--ritual-accent);
}

/* Loader */
.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 450px;
}

.pulse-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--ritual-olive-dark);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

.ai-processing-text {
    margin-top: 2rem;
    font-family: 'Outfit', sans-serif;
    color: var(--ritual-olive-dark);
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.ai-model-badge {
    margin-top: 0.8rem;
    font-size: 0.75rem;
    background: rgba(42, 57, 48, 0.1);
    color: var(--ritual-olive-dark);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Results */
.skin-score {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 2.5rem;
}

.score-ring circle {
    fill: none;
    stroke-width: 6;
}

.score-bg {
    stroke: rgba(42, 57, 48, 0.1);
}

.score-progress {
    stroke: var(--ritual-olive-dark);
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 1.5s ease-out;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.score-value {
    color: var(--ritual-olive-dark);
}

#score-number {
    font-size: 2.5rem;
    font-weight: 500;
}

.score-label {
    display: block;
    font-size: 0.75rem;
    color: var(--ritual-text-muted);
    letter-spacing: 2px;
    margin-top: 0.2rem;
}

.insight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.insight-item {
    background: rgba(236, 224, 212, 0.3);
    /* Slight beige tint */
    padding: 1.2rem 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(42, 57, 48, 0.05);
}

.insight-label {
    display: block;
    font-size: 0.8rem;
    color: var(--ritual-text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
}

.insight-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ritual-olive-dark);
}

.timeline {
    position: relative;
    border-left: 1px solid rgba(42, 57, 48, 0.2);
    margin: 0 0 2rem 1.5rem;
    padding-left: 2rem;
}

.timeline-item {
    padding-bottom: 2.5rem;
    position: relative;
}

.timeline-marker {
    position: absolute;
    left: -2.85rem;
    width: 1.6rem;
    height: 1.6rem;
    background: #FFFFFF;
    border: 2px solid var(--ritual-olive-dark);
    color: var(--ritual-olive-dark);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}

.timeline-content h4 {
    margin: 0 0 0.5rem 0;
    color: var(--ritual-olive-dark);
    font-size: 1.1rem;
    font-weight: 600;
}

.timeline-content p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--ritual-text-muted);
}

.hidden {
    display: none !important;
}

/* --- RESPONSIVE DESIGN --- */

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {
    .ritual-container {
        max-width: 90%;
        min-height: auto;
        box-shadow: 0 5px 20px rgba(42, 57, 48, 0.1);
    }

    .ritual-title {
        font-size: 2.2rem;
    }

    .pillar-card {
        padding: 1rem;
    }

    .insight-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .loader-wrapper {
        height: 350px;
    }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .ritual-container {
        max-width: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    .ritual-step {
        padding: 1.5rem;
    }

    .ritual-header {
        margin-bottom: 2rem;
    }

    .ritual-title {
        font-size: 1.8rem;
    }

    .ritual-subtitle {
        font-size: 0.9rem;
    }

    .ritual-pillars {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .pillar-card {
        flex-direction: row;
        /* Maintain row layout but with better wrapping */
        align-items: center;
        text-align: left;
        gap: 1rem;
        padding: 1rem;
    }

    .pillar-card .icon {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    .camera-wrapper {
        padding-top: 133%;
    }

    .scan-frame {
        width: 85%;
        height: 55%;
    }

    .ritual-btn {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .skin-score {
        width: 110px;
        height: 110px;
    }

    #score-number {
        font-size: 2rem;
    }

    .timeline {
        margin-left: 0.5rem;
        padding-left: 1.5rem;
    }

    .timeline-marker {
        left: -2.35rem;
        width: 1.4rem;
        height: 1.4rem;
        font-size: 0.7rem;
    }
}