:root {
    --bg-dark: #050508;
    --bg-card: rgba(15, 15, 20, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);

    --accent-primary: #8b5cf6;
    /* Cyberpunk Purple */
    --accent-secondary: #0ea5e9;
    /* Cyberpunk Cyan */
    --accent-danger: #ef4444;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 5%;
}

.section {
    padding: 100px 0;
}

.section-header {
    margin-bottom: 50px;
    position: relative;
    display: inline-block;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.title-line {
    height: 4px;
    width: 60px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

.line-red {
    color: #fecaca;
}

.bg-red {
    background: linear-gradient(90deg, var(--accent-danger), #f87171);
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    color: var(--text-primary);
    line-height: 1.3;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

strong {
    color: #f1f5f9;
    font-weight: 600;
}

.mt-4 {
    margin-top: 1rem;
}

.text-center {
    text-align: center;
}

.gradient-text {
    background: linear-gradient(135deg, #c084fc, #818cf8, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Background glowing effects --- */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(circle at 50% 0%, #171124 0%, var(--bg-dark) 50%);
}

.glow {
    position: absolute;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.12;
}

.glow-1 {
    top: -200px;
    left: -200px;
    background: var(--accent-primary);
    animation: float 12s ease-in-out infinite alternate;
}

.glow-2 {
    bottom: -200px;
    right: -200px;
    background: var(--accent-secondary);
    animation: float 15s ease-in-out infinite alternate-reverse;
}

.glow-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(60px, 80px);
    }
}

/* --- Glassmorphism Components --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        border-color 0.4s ease, box-shadow 0.4s ease;
}

.glass-card:hover {
    transform: translateY(-8px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 20px 50px rgba(139, 92, 246, 0.15);
}

.glass-panel {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(139, 92, 246, 0.03));
    border-radius: 20px;
    border-left: 4px solid var(--accent-secondary);
    padding: 30px;
    backdrop-filter: blur(10px);
    margin-bottom: 60px;
}

/* --- Images --- */
.image-frame {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-frame:hover img {
    transform: scale(1.03);
}

/* Diagram images with light backgrounds: invert for dark theme */
.arch-frame,
.loop-frame {
    background: #f5f5f5;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.arch-frame img,
.loop-frame img {
    object-fit: contain;
    padding: 12px;
}

/* --- Video Embed --- */
.video-section {
    padding-top: 0;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.05);
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    padding-top: 120px;
    overflow: visible;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 520px;
    padding-bottom: 80px;
}

.hero-image-wrapper {
    position: absolute;
    top: 0;
    right: calc(-1 * ((100vw - 1140px) / 2 + 5%));
    width: 60vw;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hero-frame {
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    border: none;
}

.hero-frame img {
    object-fit: cover;
    object-position: center;
}

/* Gradient overlay to blend the hero image into the dark background */
.hero-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right,
            var(--bg-dark) 0%,
            rgba(5, 5, 8, 0.85) 15%,
            rgba(5, 5, 8, 0.4) 40%,
            transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* Bottom fade */
.hero-image-wrapper::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, var(--bg-dark), transparent);
    pointer-events: none;
    z-index: 1;
}

.title {
    font-size: 4.5rem;
    font-weight: 800;
    margin-bottom: 24px;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.6rem;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 30px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 35px;
}

.tag {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #d8b4fe;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.hero .description {
    font-size: 1.15rem;
    margin-bottom: 45px;
    line-height: 1.8;
    color: #94a3b8;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
    color: white;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 12px 35px rgba(139, 92, 246, 0.55);
    transform: translateY(-3px);
}

.icon-play {
    width: 22px;
    height: 22px;
}

/* --- Agent Architecture --- */
.arch-image-wrapper {
    margin-bottom: 60px;
}

.arch-frame {
    height: 450px;
    box-shadow: 0 20px 40px rgba(14, 165, 233, 0.1);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card-icon {
    font-size: 2.8rem;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.arch-cards h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #f8fafc;
}

.arch-cards p {
    font-size: 1rem;
    color: #cbd5e1;
}

/* --- Gameplay --- */
.core-philosophy {
    font-size: 1.2rem;
    color: #e2e8f0;
    margin: 0;
    line-height: 1.8;
}

.gameplay-content {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 60px;
    align-items: center;
}

.list-item {
    margin-bottom: 40px;
    position: relative;
    padding-left: 20px;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    transition: border-color 0.3s ease;
}

.list-item:hover {
    border-left-color: var(--accent-secondary);
}

.list-item h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: #f1f5f9;
}

.emoji {
    font-size: 1.8rem;
}

.item-details p {
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.loop-frame {
    height: 600px;
    border-radius: 20px;
    border-color: rgba(14, 165, 233, 0.2);
}

/* --- Showcase --- */
.showcase-cards {
    display: flex;
    flex-direction: column;
    gap: 50px;
}

.showcase-card {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 50px;
    align-items: center;
}

.card-badge {
    display: inline-block;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.glow-badge {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.showcase-card h3 {
    font-size: 2rem;
    margin-bottom: 24px;
}

.showcase-card h3 small {
    display: block;
    font-size: 1.1rem;
    color: var(--accent-secondary);
    margin-top: 10px;
    font-weight: 500;
}

.showcase-images {
    display: grid;
    gap: 20px;
}

.three-imgs {
    grid-template-columns: 1fr 1fr;
}

.three-imgs .img-large {
    grid-column: 1 / -1;
    height: 260px;
}

.three-imgs .m-img:not(.img-large) {
    height: 180px;
}

.two-imgs {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.two-imgs .img-tall {
    height: 280px;
}

/* --- Reflections --- */
.border-red {
    border-color: rgba(239, 68, 68, 0.3);
}

.reflection-list {
    padding-left: 24px;
    color: var(--text-secondary);
}

.reflection-list li {
    margin-bottom: 20px;
    line-height: 1.8;
    font-size: 1.05rem;
}

.reflection-list li::marker {
    color: var(--accent-danger);
    font-weight: bold;
}

.reflection-list li strong {
    color: #f8fafc;
    font-weight: 700;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 50px 0 30px;
    margin-top: 80px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.glow-border-top {
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    position: relative;
}

.glow-border-top::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    width: 200px;
    height: 2px;
    background: var(--accent-primary);
    transform: translateX(-50%);
    box-shadow: 0 0 10px var(--accent-primary);
}

/* --- Animations for JS --- */
.invisible-on-load {
    opacity: 0;
}

.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.slide-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-right {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-left {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.zoom-in {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-in.visible {
    opacity: 1;
    transform: scale(1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .container {
        max-width: 900px;
    }

    .gameplay-content,
    .showcase-card {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .hero {
        padding-top: 100px;
        min-height: 80vh;
    }

    .hero-image-wrapper {
        right: -5%;
        width: 55vw;
    }

    .loop-frame {
        height: 400px;
    }

    .title {
        font-size: 3.5rem;
    }
}

@media (max-width: 768px) {
    .hero-image-wrapper {
        right: -5%;
        width: 100vw;
        opacity: 0.3;
    }

    .hero-content {
        max-width: 100%;
    }

    .title {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 60px 0;
    }

    .title {
        font-size: 2.8rem;
    }

    .subtitle {
        font-size: 1.3rem;
    }

    .hero-frame,
    .arch-frame,
    .loop-frame {
        height: 300px;
    }

    .three-imgs {
        grid-template-columns: 1fr;
    }

    .showcase-images .image-frame {
        height: 200px !important;
    }
}