/* ============================================
   Agentic Games — Light Editorial Studio
   Clean, open, premium. Not a game page.
   ============================================ */

:root {
    --bg: #FAFBFC;
    --bg-tinted: #F2F4F7;
    --surface: #FFFFFF;
    --ink: #1A1A2E;
    --ink-soft: #2E2E45;
    --ink-muted: #4A4A5E;
    --ink-faint: #C4C4D4;
    --teal: #0D9488;
    --teal-light: #14B8A6;
    --teal-bright: #2dd4bf;
    --teal-wash: rgba(13, 148, 136, 0.06);
    --teal-wash-strong: rgba(13, 148, 136, 0.10);
    --purple: #3D3B6B;
    --purple-wash: rgba(61, 59, 107, 0.06);
    --border: #E5E7EB;
    --border-hover: #D1D5DB;

    --font-display: 'Michroma', system-ui, sans-serif;
    --font-body: 'Manrope', system-ui, sans-serif;

    --max-width: 1080px;
    --nav-height: 72px;
}

/* ---- Reset ---- */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body.nav-open {
    overflow: hidden;
}

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

a:hover {
    color: var(--teal-light);
}

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

/* ---- Utility ---- */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: clamp(5rem, 10vw, 9rem) 0;
}

.section-tinted {
    background: var(--bg-tinted);
}

.overline {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 0.75rem;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    padding: 0.8rem 1.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-dark:hover {
    background: #2a2a42;
    color: #fff;
    box-shadow: 0 4px 20px rgba(26, 26, 46, 0.2);
    transform: translateY(-1px);
}

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

.btn-teal:hover {
    background: var(--teal-light);
    color: #fff;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.25);
    transform: translateY(-1px);
}

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

.btn-outline:hover {
    border-color: var(--teal);
    color: var(--teal);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.08);
    transform: translateY(-1px);
}

/* ---- Navigation ---- */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    background: rgba(250, 251, 252, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.nav-scrolled {
    border-bottom-color: var(--border);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.04);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.nav-logo-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.nav-logo span {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--ink);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav-links a {
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--teal);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 110;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--ink);
    transition: all 0.3s;
}

.nav-toggle.active span {
    background: var(--teal);
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ---- Hero ---- */

.hero {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
    padding: calc(var(--nav-height) + 2rem) 2rem 4rem;
    overflow: hidden;
    background: var(--bg);
}

/* Hexagonal background shapes */
.hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* Particle canvas */
.hero-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Gradient wash */
.hero-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(61, 59, 107, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(61, 59, 107, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    width: 100%;
}

.hero-logo-wrap {
    display: inline-block;
    margin-bottom: 1.75rem;
}

.hero-logo {
    width: clamp(120px, 18vw, 180px);
    height: auto;
    filter: drop-shadow(0 8px 40px rgba(13, 148, 136, 0.15));
    animation: hero-float 12s ease-in-out infinite;
}

@keyframes hero-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    line-height: 1.15;
    margin-bottom: 1rem;
    color: var(--ink);
}

.hero-tagline {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 400;
    color: var(--ink-muted);
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

/* Word-by-word reveal */
.hero-tagline .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: word-reveal 0.5s ease forwards;
}

@keyframes word-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    font-weight: 500;
    color: var(--teal);
    letter-spacing: 0.06em;
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: fade-up 0.6s ease 1.8s forwards;
}

@keyframes fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}


/* Scroll hint: teal line + diamond */
.scroll-hint {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    animation: scroll-bob 2.5s ease-in-out infinite;
}

.scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, transparent, var(--teal));
    opacity: 0.5;
}

.scroll-diamond {
    width: 8px;
    height: 8px;
    border: 1.5px solid var(--teal);
    transform: rotate(45deg);
    opacity: 0.5;
    margin-top: -1px;
}

@keyframes scroll-bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(6px); }
}

/* ---- Mithril ---- */

.mithril-intro {
    text-align: center;
    margin-bottom: 3rem;
}

.mithril-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.2rem);
    font-weight: 400;
    letter-spacing: 0.1em;
    line-height: 1.15;
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.mithril-subtitle {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 1rem;
}

.mithril-desc {
    font-size: 1.05rem;
    color: var(--ink-muted);
    line-height: 1.8;
}

/* Trailer */

.trailer-wrap {
    margin-bottom: 2rem;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.trailer {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--ink);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 8px 40px rgba(26, 26, 46, 0.12);
    transition: box-shadow 0.3s, transform 0.3s;
}

.trailer:hover {
    box-shadow: 0 12px 48px rgba(26, 26, 46, 0.18);
    transform: translateY(-2px);
}

.trailer iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 12px;
}

.trailer-facade {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a1a2e;
    background-size: cover;
    background-position: center;
    transition: filter 0.3s;
    border-radius: 12px;
}

.trailer:hover .trailer-facade {
    filter: brightness(1.1);
}

.trailer-play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.trailer-play-btn svg {
    margin-left: 3px;
}

.trailer:hover .trailer-play-btn {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.25);
}

/* Screenshots */

.screenshots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 3.5rem;
}

.screenshot-item {
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px;
    transition: box-shadow 0.3s, transform 0.3s;
    box-shadow: 0 2px 12px rgba(26, 26, 46, 0.06);
}

.screenshot-item:hover {
    box-shadow: 0 8px 32px rgba(26, 26, 46, 0.12);
    transform: translateY(-3px);
}

.screenshot-item img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}

.screenshot-item:hover img {
    transform: scale(1.04);
}

/* Features */

.features-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 3rem;
    border-top: 1px solid var(--border);
}

.feature {
    padding: 2rem 1.75rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    transition: background 0.3s;
}

.feature:nth-child(3n) {
    border-right: none;
}

.feature:hover {
    background: var(--teal-wash);
}

.feature-num {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    display: block;
    margin-bottom: 0.75rem;
}

.feature h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.feature p {
    font-size: 0.85rem;
    color: var(--ink-muted);
    line-height: 1.65;
}

/* CTAs */

.mithril-cta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ---- Studio ---- */

.studio-header {
    max-width: 620px;
    margin-bottom: 4rem;
}

.studio-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0.04em;
    margin-bottom: 1.25rem;
    color: var(--ink);
}

.studio-desc {
    font-size: 1.05rem;
    color: var(--ink-soft);
    line-height: 1.8;
}

.pillars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.pillar {
    padding-top: 1.5rem;
}

.pillar-line {
    width: 40px;
    height: 3px;
    background: var(--teal);
    margin-bottom: 1.5rem;
    border-radius: 2px;
}

.pillar-line--alt {
    background: var(--purple);
}

.pillar-line--dark {
    background: var(--ink);
}

.pillar h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--ink);
}

.pillar p {
    font-size: 0.9rem;
    color: var(--ink-muted);
    line-height: 1.75;
}

/* ---- Open Source ---- */

.oss {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4rem;
    align-items: start;
}

.oss-text h2 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
    color: var(--ink);
}

.oss-text p {
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
    line-height: 1.75;
    max-width: 480px;
}

.oss-crates {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.crate {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    padding: 0.6rem 1rem;
    background: var(--teal-wash);
    border: 1px solid rgba(13, 148, 136, 0.12);
    color: var(--teal);
    text-align: center;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.crate:hover {
    background: var(--teal-wash-strong);
    border-color: rgba(13, 148, 136, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(13, 148, 136, 0.08);
}

/* ---- Connect ---- */

.connect-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.connect-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--ink);
}

.socials {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 3.5rem;
}

.social-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.25s;
    min-width: 100px;
}

.social-link svg {
    width: 22px;
    height: 22px;
    color: var(--ink-soft);
    transition: color 0.25s, transform 0.25s;
}

.social-link span {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-muted);
    transition: color 0.25s;
}

.social-link:hover {
    border-color: var(--teal);
    background: var(--teal-wash);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.08);
    transform: translateY(-2px);
}

.social-link:hover svg {
    color: var(--teal);
    transform: scale(1.08);
}

.social-link:hover span {
    color: var(--teal);
}

/* Newsletter */

.newsletter {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

.newsletter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.newsletter-form {
    display: flex;
    gap: 0;
    overflow: hidden;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.newsletter-form:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.08);
}

.newsletter-form input[type="email"] {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.875rem;
    outline: none;
}

.newsletter-form input[type="email"]::placeholder {
    color: var(--ink-faint);
}

.newsletter-form .btn {
    flex-shrink: 0;
    border-radius: 0 4px 4px 0;
}

.newsletter-success {
    color: var(--teal);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.75rem 0;
}

/* ---- Footer ---- */

.footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-logo {
    text-decoration: none;
    opacity: 0.35;
    transition: opacity 0.2s;
}

.footer-logo:hover {
    opacity: 0.6;
}

.footer-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
}

.footer-links a {
    color: var(--ink-faint);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--teal);
}

.footer-links a svg {
    display: block;
}

.footer-copy {
    font-size: 0.7rem;
    color: var(--ink-faint);
}

/* ---- Lightbox ---- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(26, 26, 46, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    cursor: pointer;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    line-height: 1;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    cursor: default;
    border-radius: 8px;
}

/* ---- Section Dividers ---- */

.section {
    position: relative;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, transparent, var(--purple));
    opacity: 0.35;
}

.section::after {
    content: '';
    position: absolute;
    top: 47px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 7px;
    height: 7px;
    border: 1.5px solid var(--purple);
    opacity: 0.35;
}

/* First section (Mithril) - no divider at top since hero is above */
#mithril::before,
#mithril::after {
    display: none;
}

/* ---- Scroll Animations ---- */

.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger feature items */
.feature:nth-child(2) .fade-in { transition-delay: 0.06s; }
.feature:nth-child(3) .fade-in { transition-delay: 0.12s; }

/* Stagger pillars */
.pillar.fade-in:nth-child(2) { transition-delay: 0.1s; }
.pillar.fade-in:nth-child(3) { transition-delay: 0.2s; }

/* ---- Responsive ---- */

@media (max-width: 1024px) {
    .oss {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

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

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        inset: 0;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        background: rgba(250, 251, 252, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        font-size: 1.1rem;
        color: var(--ink);
    }

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

    .features-row {
        grid-template-columns: 1fr;
    }

    .feature {
        border-right: none;
    }

    .pillars {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .socials {
        gap: 0.5rem;
    }

    .social-link {
        min-width: 85px;
        padding: 1rem;
    }

    .mithril-cta {
        flex-direction: column;
        align-items: center;
    }

    .mithril-cta .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

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

@media (max-width: 480px) {
    .container {
        padding: 0 1.25rem;
    }

    .screenshots {
        grid-template-columns: 1fr;
    }

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

    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-form .btn {
        width: 100%;
        justify-content: center;
        border-radius: 0 0 4px 4px;
    }
}

/* ---- Accessibility ---- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .fade-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-logo {
        animation: none;
    }

    .hero-tagline .word {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .hero-subtitle {
        opacity: 1;
        animation: none;
    }


    .scroll-hint {
        animation: none;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
