/* CSS Variables for Soft Tech Theme */
:root {
    --bg-color: #fdfbf7;
    --text-primary: #4a4a4a;
    --text-secondary: #7a7a7a;
    --accent-tech: #e0b0ff;
    --accent-warm: #ffccd5;
    --accent-glow: #b388eb;
    --glass-bg: rgba(255, 255, 255, 0.65);
    /* Increased opacity for contrast */
    --glass-border: rgba(255, 255, 255, 0.8);
    --shadow-soft: 0 10px 40px rgba(224, 176, 255, 0.2);
    /* Stronger shadow */
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Lora', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background: #fdfbf7;
    /* Fallback */
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* --- V3: Tech Grid Background --- */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(224, 176, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(224, 176, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: perspective(500px) rotateX(60deg);
    animation: moveGrid 20s linear infinite;
    z-index: -2;
    pointer-events: none;
}

@keyframes moveGrid {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(50px);
    }
}

/* Floating Orbs (Still kept for softness) */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    /* Softened more */
    z-index: -1;
    opacity: 0.5;
    animation: floatOrb 25s infinite ease-in-out;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-tech), transparent);
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-warm), transparent);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes floatOrb {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, -30px) scale(1.1);
    }
}


h1,
h2,
h3,
.label,
.btn-text {
    font-family: var(--font-heading);
    letter-spacing: -0.5px;
    /* Tighter modern look */
}

/* --- Boot Screen --- */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #0a0a0a;
    color: var(--accent-tech);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.terminal-container {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    text-shadow: 0 0 10px var(--accent-tech);
    width: 90%;
    max-width: 600px;
}

/* --- Main Layout --- */
.hidden {
    display: none !important;
}

#main-interface {
    opacity: 0;
    animation: fadeInPage 1.5s ease-out forwards;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

@keyframes fadeInPage {
    to {
        opacity: 1;
    }
}

/* --- Header --- */
.hero-section {
    text-align: center;
    padding: 8rem 0 5rem;
}

.header-badge {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--accent-tech);
    color: #6a1b9a;
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(224, 176, 255, 0.3);
    animation: pulseBadge 3s infinite;
}

@keyframes pulseBadge {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(224, 176, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(224, 176, 255, 0);
    }
}

h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #2d3436 0%, #6a1b9a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.4rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Sections */
.content-section {
    margin-bottom: 10rem;
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}

h2 {
    text-align: center;
    margin-bottom: 4rem;
    font-size: 2.5rem;
    font-weight: 200;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: var(--text-primary);
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--accent-tech);
    margin: 15px auto 0;
    border-radius: 2px;
}

/* --- Promise Cards (V3: Active & Sharper) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    /* More space */
    padding: 1rem;
    perspective: 1200px;
}

.promise-card {
    background: rgba(255, 255, 255, 0.5);
    /* Cleaner glass */
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    /* Sharper border */
    border-top: 1px solid white;
    border-left: 1px solid white;
    border-radius: 30px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: transform 0.1s ease, box-shadow 0.4s ease, border-color 0.4s ease;
    cursor: pointer;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;

    /* V3: Breathing Animation */
    animation: breatheCard 6s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 1s);
    /* Staggered breathing in JS? Or just random CSS delays */
}

/* Assign random delays via nth-child for organic feel */
.promise-card:nth-child(1) {
    animation-delay: 0s;
}

.promise-card:nth-child(2) {
    animation-delay: 1.5s;
}

.promise-card:nth-child(3) {
    animation-delay: 3s;
}

.promise-card:nth-child(4) {
    animation-delay: 4.5s;
}

@keyframes breatheCard {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-5px) scale(1.01);
    }
}

.promise-card:hover {
    box-shadow: 0 30px 60px rgba(224, 176, 255, 0.25);
    border-color: var(--accent-tech);
    animation-play-state: paused;
    /* Stop breathing on interaction */
}

.icon {
    font-size: 4rem;
    margin-bottom: 2rem;
    filter: drop-shadow(0 10px 20px rgba(224, 176, 255, 0.4));
    transform: translateZ(50px);
    transition: transform 0.3s ease;
}

h3 {
    font-size: 1.6rem;
    margin-bottom: 0.8rem;
    transform: translateZ(40px);
    font-weight: 600;
}

.summary {
    color: var(--text-secondary);
    font-size: 1.1rem;
    transform: translateZ(30px);
    transition: opacity 0.3s;
}

.promise-card.expanded .summary {
    opacity: 0;
    display: none;
}

.card-back {
    display: none;
    margin-top: 1.5rem;
    font-size: 1.2rem;
    color: #444;
    line-height: 1.8;
    animation: floatUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: translateZ(30px);
}

.promise-card.expanded .card-back {
    display: block;
}

.promise-card.expanded {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--accent-tech);
    transform: scale(1.05) !important;
    z-index: 100;
    /* Ensure it stays on top */
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.1);
    animation: none;
    /* Stop breathing when reading */
}

@keyframes floatUp {
    from {
        opacity: 0;
        transform: translateY(20px) translateZ(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0) translateZ(30px);
    }
}

/* --- Profile HUD --- */
.hud-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 40px;
    padding: 3.5rem;
    box-shadow: var(--shadow-soft);
    max-width: 700px;
    margin: 0 auto;
    border-left: 8px solid var(--accent-tech);
    position: relative;
    overflow: hidden;
}

/* V3: Tech decorative elements */
.hud-panel::after {
    content: 'TRUST-OS // V3.0';
    position: absolute;
    bottom: 20px;
    right: 30px;
    font-family: monospace;
    color: rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

/* --- Letter --- */
.paper-container {
    background: #fff;
    padding: 5rem;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    /* More paper-like */
    position: relative;
    font-size: 1.25rem;
    border: 1px solid #eee;
}

.paper-container p {
    margin-bottom: 2rem;
}

/* --- Seal Button --- */
#seal-section {
    text-align: center;
    position: relative;
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

button#seal-promise-btn {
    background: #fff;
    border: none;
    padding: 2rem 5rem;
    border-radius: 100px;
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    box-shadow: 0 15px 40px rgba(224, 176, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    z-index: 2;
    overflow: hidden;
    letter-spacing: 1px;
}

button#seal-promise-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 25px 60px rgba(224, 176, 255, 0.5);
}

#confirmation-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    opacity: 0;
    transition: opacity 1s ease;
    pointer-events: none;
}

#confirmation-msg.visible {
    opacity: 1;
}

.check-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    display: block;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* --- V3: Marquee Footer --- */
.marquee-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 10px 0;
    overflow: hidden;
    white-space: nowrap;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: scrollText 30s linear infinite;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 4px;
}

@keyframes scrollText {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Canvas & Music */
#music-toggle {
    position: fixed;
    bottom: 60px;
    /* Moved up for marquee */
    right: 30px;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 100;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
    border: 2px solid transparent;
}

#music-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    border-color: var(--accent-tech);
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 999;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.8rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .paper-container {
        padding: 2rem;
    }

    .hero-section {
        padding-top: 6rem;
    }

    .marquee-footer {
        display: none;
        /* Too cluttered on mobile */
    }

    #music-toggle {
        bottom: 30px;
    }
}