/* === BASED DESIGN RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
* { border-radius: 0 !important; }
* { box-shadow: none; }

:root {
    --bg: #0a0a0b;
    --bg-card: #111113;
    --bg-dark: #07070a;
    --text: #e8e6e3;
    --text-dim: #8a8a8e;
    --accent: #c4f04d;
    --accent-dim: #a3cc2d;
    --human: #4d9ef0;
    --ai: #f04dc4;
    --joint: #f0a84d;
    --border: #1f1f23;
    --font: 'Space Grotesk', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
    font-size: 16px;
}

/* === GRAIN === */
.grain {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* =============================================
   THREE-TIER SCALE SYSTEM (Law 6, 15)
   Tier 1: Display — clamp(8vw, 10vw, 180px)
   Tier 2: Metadata — 11px, letterspaced, uppercase
   Tier 3: Body — 16px
   NO INTERMEDIATE SIZES.
   ============================================= */

/* === NAV === */
.nav {
    position: fixed;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 3rem;
    z-index: 100;
    background: rgba(10, 10, 11, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.logo-m { color: var(--text); }
.logo-x { color: var(--accent); margin: 0 0.2em; }

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

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

/* =============================================
   HERO — Full viewport composition (Law 1, 3, 4, 8)
   Asymmetric weight: content loaded left.
   Type as architecture: headline at 10vw.
   ============================================= */
#hero-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}

.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 0;
    padding: 0;
    align-items: end;
    overflow: hidden;
}

.hero-content {
    padding: 0 0 8vh 5%;
    max-width: none;
}

.hero-tag {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: clamp(3rem, 10vw, 180px);
    font-weight: 700;
    line-height: 0.88;
    margin-bottom: 3rem;
    text-transform: uppercase;
    letter-spacing: -0.03em;
}

.hero h1 .line1 { display: block; }
.hero h1 .line2 { display: block; }
.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero-sub {
    font-size: 16px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 4rem;
    max-width: 45ch;
}

.hero-stats {
    display: flex;
    gap: 4rem;
}

.stat { display: flex; flex-direction: column; }

.stat-num {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--mono);
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 0.3rem;
}

/* Terminal — right column, collides with hero content */
.hero-terminal {
    align-self: stretch;
    background: var(--bg-dark);
    border-left: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: #161618;
    border-bottom: 1px solid var(--border);
}

.terminal-dots { display: flex; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50% !important; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #28ca41; }

.terminal-title {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.terminal-body {
    padding: 1.5rem;
    flex: 1;
    font-family: var(--mono);
    font-size: 14px;
    display: flex;
    align-items: end;
}

.terminal-line { display: flex; gap: 0.5rem; }
.prompt { color: var(--accent); }
.typing { color: var(--text); }
.cursor {
    color: var(--accent);
    animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* =============================================
   SECTIONS — Each earns its own spatial logic (Law 1)
   Collision between sections (Law 7) — no margins, hard edges
   ============================================= */

/* Section label — the micro-element cohesion thread */
.section-tag {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent-dim);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.section-header h2 {
    font-size: clamp(3rem, 8vw, 140px);
    font-weight: 700;
    line-height: 0.9;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    margin: 0.5rem 0 1rem;
}

.section-sub {
    color: var(--text-dim);
    font-size: 16px;
    max-width: 45ch;
}

/* =============================================
   PROJECTS — Dense grid (Law 2: dense section ~85% fill)
   Asymmetric weight (Law 4)
   ============================================= */
#projects {
    padding: 8vh 5% 8vh;
    max-width: none;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

#projects .section-header {
    margin-bottom: 4rem;
    max-width: 60%;
}

.project-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.filter-btn {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.15s;
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.filter-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: 500;
}

.project-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1px;
    background: var(--border);
}

.project-card {
    background: var(--bg-card);
    padding: 2rem;
    position: relative;
    transition: background 0.15s;
}

.project-card:hover { background: #161618; }

/* First card spans 2 rows — asymmetric weight */
.project-card:first-child {
    grid-row: span 2;
}

.card-badge {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
    padding: 0.2rem 0.6rem;
    display: inline-block;
}

.human .card-badge { background: rgba(77, 158, 240, 0.15); color: var(--human); }
.ai .card-badge { background: rgba(240, 77, 196, 0.15); color: var(--ai); }
.joint .card-badge { background: rgba(240, 168, 77, 0.15); color: var(--joint); }

.project-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 0.7rem;
}

.project-card p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.card-tags span {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.05);
    padding: 0.15rem 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =============================================
   AUTOMATIONS — Dark, dense, list-based (Law 2: dense)
   Collision with projects section (Law 7)
   ============================================= */
#automations {
    background: var(--bg-dark);
    padding: 8vh 5%;
    max-width: none;
    border-top: none; /* collision — no mediating border */
}

#automations .section-header {
    margin-bottom: 3rem;
}

.automation-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auto-item {
    display: grid;
    grid-template-columns: 3rem 1fr auto;
    align-items: center;
    gap: 1.5rem;
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border);
}

.auto-item:first-child {
    border-top: 1px solid var(--border);
}

.auto-item:hover { background: rgba(255,255,255,0.02); }

.auto-icon { font-size: 1.2rem; text-align: center; }

.auto-content { flex: 1; }
.auto-content h4 { font-size: 16px; font-weight: 600; margin-bottom: 0.2rem; }
.auto-content p { font-size: 14px; color: var(--text-dim); line-height: 1.4; }

.auto-status {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.3rem 0.8rem;
    white-space: nowrap;
}

.auto-status.active { background: rgba(40, 202, 65, 0.15); color: #28ca41; }
.auto-status.building { background: rgba(240, 168, 77, 0.15); color: var(--joint); }

/* =============================================
   LAB — Sparse breath section (Law 2: sparse ~35% fill)
   Open field, not uniform grid
   ============================================= */
#lab {
    padding: 12vh 5% 8vh;
    max-width: none;
    background: var(--bg);
    position: relative;
}

/* Ghost type behind lab (Law 3) */
#lab::before {
    content: 'LAB';
    position: absolute;
    top: 50%;
    left: -2%;
    transform: translateY(-50%);
    font-size: clamp(20vw, 30vw, 500px);
    font-weight: 900;
    color: rgba(196, 240, 77, 0.025);
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    line-height: 0.75;
    text-transform: uppercase;
    letter-spacing: -0.05em;
}

#lab .section-header {
    position: relative;
    z-index: 1;
    margin-bottom: 4rem;
}

.lab-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    position: relative;
    z-index: 1;
}

.lab-card {
    background: var(--bg-card);
    padding: 1.5rem;
    transition: background 0.15s;
}

.lab-card:hover { background: #161618; }

.lab-status {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 0.5rem;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.lab-card h4 { font-size: 16px; font-weight: 600; margin-bottom: 0.4rem; }
.lab-card p { font-size: 14px; color: var(--text-dim); line-height: 1.4; }

/* =============================================
   JOURNAL — Dense reading section (Law 2)
   Asymmetric 2-column (Law 4)
   ============================================= */
#journal {
    background: var(--bg-dark);
    padding: 8vh 5%;
    max-width: none;
}

#journal .section-header {
    margin-bottom: 3rem;
}

.journal-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}

.journal-preview-card {
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: background 0.15s;
    border: none;
}

.journal-preview-card:hover {
    background: #161618;
}

.preview-date {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.journal-preview-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.journal-preview-card p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preview-link {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.journal-preview-card:hover .preview-link { opacity: 1; }

/* =============================================
   ABOUT — Sparse breath section (Law 2)
   Asymmetric: story left-weighted (Law 4)
   ============================================= */
#about {
    padding: 12vh 5% 8vh;
    max-width: none;
    background: var(--bg);
    position: relative;
}

#about .section-header {
    margin-bottom: 4rem;
}

.about-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1px;
    background: var(--border);
    margin-bottom: 6rem;
}

.about-card {
    background: var(--bg-card);
    padding: 3rem;
    text-align: left;
}

.about-emoji { font-size: 2rem; margin-bottom: 1rem; }
.about-card h3 { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1rem; }
.about-card p { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 1.5rem; }

.about-links {
    display: flex;
    gap: 1rem;
}

.about-links a {
    color: var(--accent);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 11px;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.15s;
}

.about-links a:hover {
    background: var(--accent);
    color: var(--bg);
}

.about-story {
    max-width: 55ch;
}

.about-story h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.about-story p {
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* =============================================
   FOOTER — Minimal, hard collision with about (Law 7)
   ============================================= */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer p {
    font-size: 11px;
    color: var(--text-dim);
    font-family: var(--mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.footer-sub {
    margin-top: 0;
}

.footer-stats {
    opacity: 0.4;
}

/* === HAMBURGER === */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 200;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1100px) {
    .project-grid {
        grid-template-columns: 1fr 1fr;
    }
    .project-card:first-child {
        grid-row: span 1;
    }
    .lab-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        align-items: end;
    }
    .hero-content {
        padding: 0 5% 4vh;
    }
    .hero-terminal {
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 200px;
    }
    .hero h1 {
        font-size: clamp(2.5rem, 12vw, 100px);
    }
    .hero-stats { gap: 2rem; }
    .nav { padding: 1rem 1.5rem; }
    .section-header h2 {
        font-size: clamp(2.5rem, 10vw, 100px);
    }
    .project-grid {
        grid-template-columns: 1fr;
    }
    .journal-preview-grid {
        grid-template-columns: 1fr;
    }
    .about-grid {
        grid-template-columns: 1fr;
    }
    .lab-grid {
        grid-template-columns: 1fr 1fr;
    }
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .hamburger { display: flex; }
    .nav-links {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100vh;
        background: rgba(10, 10, 11, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        z-index: 150;
    }
    .nav-links.mobile-open { display: flex; }
    .nav-links a { font-size: 16px; }
    .hero h1 { font-size: clamp(2rem, 14vw, 80px); }
    .hero-stats { flex-direction: column; gap: 1rem; }
    .project-filters { flex-wrap: wrap; }
    .lab-grid { grid-template-columns: 1fr; }
    #projects, #automations, #lab, #journal, #about {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}
