:root {
    --bg-app: #fcfcfd;
    --bg-card: rgba(255, 255, 255, 0.7);
    --accent: #FF8C42;
    --accent-dark: #E67430;
    --accent-light: rgba(255, 140, 66, 0.1);
    --text-primary: #1d1d1f;
    --text-secondary: #424245;
    --text-muted: #86868b;
    --border: rgba(0, 0, 0, 0.08);
    --glass-border: rgba(255, 255, 255, 0.3);
    --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.04);
    --shadow-glossy: 0 4px 16px rgba(0, 0, 0, 0.08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    background-image:
        radial-gradient(at 0% 0%, rgba(255, 140, 66, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 140, 66, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Glass Header */
header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    padding: 100px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 120%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 140, 66, 0.1) 0%, transparent 70%);
    z-index: 0;
}

.logo-container {
    position: relative;
    z-index: 1;
    margin-bottom: 32px;
}

.logo {
    width: 240px;
    height: 240px;
    filter: drop-shadow(0 8px 24px rgba(255, 140, 66, 0.25));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover {
    transform: scale(1.05) rotate(2deg);
}

h1 {
    font-size: 56px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.tagline {
    font-size: 22px;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    border-radius: 99px;
    font-weight: 600;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 10px 20px rgba(255, 140, 66, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(255, 140, 66, 0.4);
    background: var(--accent-dark);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--accent);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

main {
    padding: 80px 0;
}

/* Section Titles */
h2 {
    font-size: 32px;
    margin-bottom: 48px;
    text-align: center;
    letter-spacing: -0.01em;
}

/* Feature Grid with Glossy Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 80px;
}

/* Center last row when there are 5 items (3 + 2) */
.grid .card:nth-child(4) {
    grid-column: 1 / 2;
}

.grid .card:nth-child(5) {
    grid-column: 2 / 3;
}

/* For exactly 5 items, center the last 2 */
.grid:has(.card:nth-child(5):last-child) {
    grid-template-columns: repeat(6, 1fr);
}

.grid:has(.card:nth-child(5):last-child) .card:nth-child(1),
.grid:has(.card:nth-child(5):last-child) .card:nth-child(2),
.grid:has(.card:nth-child(5):last-child) .card:nth-child(3) {
    grid-column: span 2;
}

.grid:has(.card:nth-child(5):last-child) .card:nth-child(4) {
    grid-column: 2 / 4;
}

.grid:has(.card:nth-child(5):last-child) .card:nth-child(5) {
    grid-column: 4 / 6;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-glossy);
    border-color: rgba(255, 140, 66, 0.3);
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
    pointer-events: none;
}

.card h3 {
    color: var(--accent);
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 600;
}

.card p {
    color: var(--text-secondary);
    font-size: 15px;
}

code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    color: var(--accent-dark);
}

/* Open Source Section */
#open-source {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 64px 40px;
    background: linear-gradient(135deg, rgba(255, 140, 66, 0.05) 0%, rgba(255, 140, 66, 0.02) 100%);
    border-radius: 32px;
    border: 1px solid var(--accent-light);
}

#open-source p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.legal {
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

footer {
    padding: 64px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 1024px) {

    .grid,
    .grid:has(.card:nth-child(5):last-child) {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .grid .card,
    .grid:has(.card:nth-child(5):last-child) .card {
        grid-column: span 1 !important;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 40px;
    }

    .tagline {
        font-size: 18px;
    }

    .container {
        padding: 0 24px;
    }

    .card {
        padding: 32px;
    }

    .grid,
    .grid:has(.card:nth-child(5):last-child) {
        grid-template-columns: 1fr !important;
    }

    .grid .card,
    .grid:has(.card:nth-child(5):last-child) .card {
        grid-column: span 1 !important;
    }
}

/* Dynamic Grid Gallery */
.gallery-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
    justify-content: center;
}

.wide-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 514px));
}

.tall-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 334px));
    width: 100%;
}

.gallery-item {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    /* For hover effect stacking */
    box-shadow: var(--shadow-soft);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: zoom-in;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Premium Hover Effects */
.gallery-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 0 20px rgba(255, 140, 66, 0.15);
    border-color: rgba(255, 140, 66, 0.3);
    z-index: 10;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 40px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: transform 0.2s;
    line-height: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Media Queries */
@media (max-width: 1100px) {
    .container {
        padding: 0 24px;
    }
}

@media (max-width: 768px) {

    .wide-grid,
    .tall-grid {
        grid-template-columns: 1fr;
    }

    .lightbox-close {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 32px;
    }

    .gallery-item:hover {
        /* Tone down effect on mobile */
        transform: translateY(-2px);
    }
}