@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========================================
   Design Tokens
   ======================================== */
:root {
    --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --color-primary: #6C5CE7;
    --color-primary-dark: #5A4BD1;
    --color-secondary: #00B894;
    --color-secondary-dark: #00A381;
    --color-accent: #FDCB6E;
    --color-accent-dark: #F0B842;

    --color-bg: #FAFAFA;
    --color-card-bg: #FFFFFF;
    --color-text: #2D3436;
    --color-text-muted: #636E72;
    --color-border: #E0E0E0;

    --radius-card: 12px;
    --radius-btn: 8px;

    --max-width: 1200px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ========================================
   Reset & Base
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-dark);
}

ul, ol {
    list-style: none;
}

/* ========================================
   Container
   ======================================== */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* ========================================
   Nav
   ======================================== */
.site-nav {
    background: var(--color-card-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-nav__logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.site-nav__logo:hover {
    color: var(--color-primary);
}

.site-nav__logo span:nth-child(1) { color: var(--color-primary); }
.site-nav__logo span:nth-child(2) { color: var(--color-secondary); }
.site-nav__logo span:nth-child(3) { color: var(--color-accent-dark); }

.site-nav__links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.site-nav__links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-nav__links a:hover {
    color: var(--color-primary);
}

.site-nav__links a.disabled {
    color: var(--color-text-muted);
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

/* Hamburger – checkbox hack */
.site-nav__toggle {
    display: none;
}

.site-nav__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 110;
}

.site-nav__hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Mobile nav */
@media (max-width: 767px) {
    .site-nav__hamburger {
        display: flex;
    }

    .site-nav__links {
        position: fixed;
        top: 0;
        right: 0;
        width: 260px;
        height: 100vh;
        background: var(--color-card-bg);
        flex-direction: column;
        align-items: flex-start;
        padding: 5rem 2rem 2rem;
        gap: 1.5rem;
        box-shadow: var(--shadow-lg);
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .site-nav__toggle:checked ~ .site-nav__links {
        transform: translateX(0);
    }

    /* Animate hamburger to X */
    .site-nav__toggle:checked ~ .site-nav__hamburger span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .site-nav__toggle:checked ~ .site-nav__hamburger span:nth-child(2) {
        opacity: 0;
    }
    .site-nav__toggle:checked ~ .site-nav__hamburger span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Overlay */
    .site-nav__toggle:checked ~ .site-nav__overlay {
        display: block;
    }
}

.site-nav__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

/* ========================================
   Main Content Area
   ======================================== */
.site-main {
    flex: 1;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: auto;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--color-card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card__text {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background-color: var(--color-primary);
    color: #fff;
}

.btn--primary:hover {
    background-color: var(--color-primary-dark);
    color: #fff;
}

.btn--secondary {
    background-color: var(--color-secondary);
    color: #fff;
}

.btn--secondary:hover {
    background-color: var(--color-secondary-dark);
    color: #fff;
}

.btn--accent {
    background-color: var(--color-accent);
    color: var(--color-text);
}

.btn--accent:hover {
    background-color: var(--color-accent-dark);
}

.btn--outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn--outline:hover {
    background-color: var(--color-primary);
    color: #fff;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 991px) {
    .grid--3,
    .grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .grid--2,
    .grid--3,
    .grid--4 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Section spacing
   ======================================== */
.section {
    padding: 4rem 0;
}

.section__title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section__subtitle {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* ========================================
   Hero
   ======================================== */
.hero {
    position: relative;
    overflow: hidden;
    padding: 6rem 0 5rem;
    text-align: center;
}

.hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(108, 92, 231, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 70% 50% at 80% 20%, rgba(0, 184, 148, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(253, 203, 110, 0.10) 0%, transparent 70%),
        linear-gradient(170deg, #f4f1ff 0%, #fafafa 40%, #eefbf7 100%);
}

.hero__inner {
    position: relative;
    z-index: 1;
}

.hero__heading {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.hero__word {
    display: inline-block;
    margin: 0 0.15em;
}

.hero__word--build { color: var(--color-primary); }
.hero__word--play  { color: var(--color-secondary); }
.hero__word--learn { color: var(--color-accent-dark); }

.hero__tagline {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--color-text-muted);
    max-width: 540px;
    margin: 0 auto 2rem;
    line-height: 1.5;
}

.hero__cta {
    font-size: 1.1rem;
    padding: 0.85rem 2rem;
}

/* ========================================
   Carousel
   ======================================== */
.carousel-section {
    padding-bottom: 5rem;
}

.carousel {
    position: relative;
    margin-top: 1rem;
}

.carousel__track {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 1.5rem;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 0 1.5rem;
    /* hide scrollbar */
    scrollbar-width: none;
}

.carousel__track::-webkit-scrollbar {
    display: none;
}

.carousel__card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    background: var(--color-card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.carousel__card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    color: var(--color-text);
}

.carousel__card--soon {
    opacity: 0.75;
    cursor: default;
}

.carousel__card--soon:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Gradient placeholder thumbnails */
.carousel__thumb {
    height: 160px;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel__thumb-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

canvas.scanimation-preview,
canvas.moireme-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel__thumb--scanimation {
    background: linear-gradient(135deg, var(--color-primary) 0%, #a29bfe 50%, var(--color-secondary) 100%);
}

.carousel__thumb--moireme {
    background: linear-gradient(135deg, var(--color-secondary) 0%, #55efc4 50%, var(--color-accent) 100%);
}

.carousel__thumb--soon1 {
    background: linear-gradient(135deg, var(--color-accent) 0%, #ffeaa7 50%, #fab1a0 100%);
}

.carousel__thumb--soon2 {
    background: linear-gradient(135deg, #dfe6e9 0%, #b2bec3 50%, #636e72 100%);
}

.carousel__body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.carousel__title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.carousel__desc {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

.carousel__badge {
    display: inline-block;
    margin-top: auto;
    padding-top: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Arrow buttons */
.carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--color-card-bg);
    box-shadow: var(--shadow-md);
    font-size: 1.6rem;
    line-height: 1;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.carousel__arrow:hover {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.carousel__arrow--left {
    left: -0.5rem;
}

.carousel__arrow--right {
    right: -0.5rem;
}

/* Responsive carousel */
@media (max-width: 767px) {
    .carousel__card {
        flex: 0 0 260px;
    }

    .carousel__arrow {
        display: none;
    }

    .hero {
        padding: 4rem 0 3.5rem;
    }

    .hero__word {
        display: block;
        margin: 0;
    }
}

/* ========================================
   Demo Page Layout
   ======================================== */
.demo-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
}

@media (max-width: 767px) {
    .demo-layout {
        grid-template-columns: 1fr;
    }
}

.demo-canvas canvas {
    width: 100%;
    height: 400px;
    border-radius: var(--radius-card);
    background: #fff;
    display: block;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.preview-controls .btn--small {
    padding: 0.3rem 0.75rem;
    font-size: 0.9rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--clr-border);
    background: var(--clr-card);
    cursor: pointer;
    line-height: 1;
}

.preview-controls .btn--small:hover {
    background: var(--clr-bg);
}

.preview-controls__label {
    font-size: 0.85rem;
    color: var(--clr-text-muted);
    margin-left: 0.25rem;
}

.demo-instructions h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.demo-instructions h2:first-child {
    margin-top: 0;
}

.demo-instructions ul,
.demo-instructions ol {
    list-style: disc;
    padding-left: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

.demo-instructions ol {
    list-style: decimal;
}

/* ========================================
   Drop Zone
   ======================================== */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-card);
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    margin-bottom: 1.5rem;
}

.drop-zone:hover,
.drop-zone--dragover {
    border-color: var(--color-primary);
    background-color: rgba(108, 92, 231, 0.04);
}

.drop-zone p {
    margin: 0;
    font-size: 1rem;
    color: var(--color-text);
}

.drop-zone input[type="file"] {
    display: none;
}

/* ========================================
   Output Links
   ======================================== */
.output-links {
    background: var(--color-card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.output-links .btn {
    margin: 0.5rem;
}
