/* ============================================================
   Odd Tech, Inc. — Design System
   odd-home landing: tokens, hero, constitution, invariant, contact
   Inter + JetBrains Mono · Dark minimal
   ============================================================ */

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

:root {
    --bg: #0a0a0b;
    --surface: #111113;
    --surface-raised: #161618;
    --border: #1e1e22;
    --border-subtle: #16161a;
    --text: #e8e8ed;
    --text-secondary: #b0b0ba;
    --text-muted: #7a7a85;
    --text-faint: #4a4a52;
    --accent: #6e56cf;
    --accent-light: #9b8afb;
    --accent-dim: rgba(110, 86, 207, 0.15);
    --red: #e5484d;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
    z-index: 0;
}

/* Gradient glow */
.glow {
    position: fixed;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 1000px;
    height: 1000px;
    background: radial-gradient(circle, rgba(110, 86, 207, 0.06) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

/* ── Hero ── */
.hero {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 4rem 2rem;
    text-align: center;
}

.logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 4rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.logo-mark {
    width: 1.75rem;
    height: 1.75rem;
    display: block;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.03em;
    max-width: 720px;
    margin-bottom: 2rem;
}

.foundational {
    font-size: clamp(1rem, 2vw, 1.125rem);
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 1.5rem;
}

.foundational-emphasis {
    font-size: clamp(0.9375rem, 1.5vw, 1rem);
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 560px;
    font-style: italic;
    margin-bottom: 1.5rem;
}

.foundational-constraint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-faint);
    letter-spacing: 0.02em;
    max-width: 520px;
}

.scroll-hint {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-faint);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: pulse-down 2.5s ease-in-out infinite;
}

.scroll-hint svg {
    width: 16px;
    height: 16px;
    opacity: 0.4;
}

@keyframes pulse-down {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.7; transform: translateX(-50%) translateY(4px); }
}

/* ── Constitution ── */
.constitution {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
}

/* ── Working Here intro ── */
.working-here-intro {
    padding-bottom: 1rem;
}

.working-here-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.working-here-lead {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 540px;
}

/* ── Article ── */
.article {
    margin-bottom: 4rem;
}

.article-body {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.article-body:last-of-type {
    margin-bottom: 0;
}

.article-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.article-title {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 1.75rem;
    color: var(--text);
}

.article ol {
    list-style: none;
    counter-reset: clause;
    margin-bottom: 1.5rem;
}

.article ol > li {
    counter-increment: clause;
    position: relative;
    padding-left: 2.25rem;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.article ol > li::before {
    content: counter(clause) ".";
    position: absolute;
    left: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-faint);
    font-weight: 500;
    top: 0.125rem;
}

.article ol ol {
    counter-reset: sub-clause;
    margin-top: 0.75rem;
    margin-bottom: 0;
    padding-left: 0;
}

.article ol ol > li {
    counter-increment: sub-clause;
    padding-left: 1.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.article ol ol > li::before {
    content: counter(sub-clause, lower-alpha) ".";
    font-size: 0.75rem;
}

.article-coda {
    font-size: 0.875rem;
    font-style: italic;
    color: var(--text-muted);
    padding-left: 2.25rem;
    border-left: 2px solid var(--border);
    margin-top: 1.5rem;
}

/* ── Divider ── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 4rem 0;
}

/* ── Invariant (final block) ── */
.invariant {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 2rem 6rem;
}

.invariant-box {
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 2.5rem;
    background: linear-gradient(135deg, rgba(110, 86, 207, 0.04) 0%, rgba(110, 86, 207, 0.01) 100%);
}

.invariant-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 1.25rem;
}

.invariant-text {
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.7;
    letter-spacing: -0.01em;
    color: var(--text);
}

/* ── Contact ── */
.contact-section {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 2rem 6rem;
}

.contact {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    transition: all 0.2s ease;
}

.contact:hover {
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 20px rgba(110, 86, 207, 0.1);
}

.contact svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* ── Footer ── */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    font-size: 0.75rem;
    color: var(--text-faint);
    font-family: 'JetBrains Mono', monospace;
    border-top: 1px solid var(--border-subtle);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .hero {
        min-height: 90vh;
        padding: 3rem 1.5rem;
    }

    .logo { margin-bottom: 3rem; }

    .constitution,
    .invariant,
    .contact-section {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .article ol > li {
        padding-left: 1.75rem;
    }

    .article-coda {
        padding-left: 1.75rem;
    }

    .invariant-box {
        padding: 1.75rem;
    }
}

/* ============================================================
   Nav (subpages only)
   ============================================================ */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: rgba(10, 10, 11, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.site-nav .logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-nav .logo-link:hover { color: var(--text); }

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

.nav-links a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ============================================================
   Detail page (object: product, document, blog, etc.)
   ============================================================ */

.detail-page {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-decoration: none;
    margin-bottom: 2rem;
    transition: color 0.2s ease;
}

.detail-back:hover {
    color: var(--accent-light);
}

.detail-kind {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.detail-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 1rem;
}

.detail-description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.detail-meta a,
.detail-meta span {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: color 0.2s ease;
}

.detail-meta a:hover {
    color: var(--accent-light);
}

.detail-meta svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* ============================================================
   Home: full-viewport case-study grid
   ============================================================ */

.home {
    position: fixed;
    inset: 0;
    z-index: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

/* ── Edge elements (logo, links, copyright) ── */

.edge-logo {
    position: fixed;
    top: 1.25rem;
    left: 1.5rem;
    z-index: 10;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.edge-links {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.edge-links a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.2s ease;
}

.edge-links a:hover {
    color: var(--text);
}

.edge-copy {
    position: fixed;
    bottom: 1.25rem;
    left: 1.5rem;
    z-index: 10;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5625rem;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    pointer-events: none;
}

/* ── Case-study grid ── */

.case-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.75rem;
    padding-top: 2.5rem;
    min-height: 0;
}

.case-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem 2.25rem;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: #fff;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.33, 1, 0.68, 1),
                box-shadow 0.25s ease;
}

.case-tile:hover {
    transform: scale(0.985);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.case-tile:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -4px;
}

/* Contained screenshot inside tile */
.case-img {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    right: 1.25rem;
    width: calc(100% - 2.5rem);
    height: 55%;
    object-fit: cover;
    object-position: center top;
    border-radius: 8px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
}

.case-tile:hover .case-img {
    opacity: 0.75;
}

.case-tile-content {
    position: relative;
    z-index: 1;
}

/* Per-tile color palettes */
.case-tile--indigo {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
}
.case-tile--amber {
    background: linear-gradient(135deg, #451a03 0%, #78350f 40%, #b45309 100%);
}
.case-tile--teal {
    background: linear-gradient(135deg, #042f2e 0%, #134e4a 40%, #0f766e 100%);
}
.case-tile--violet {
    background: linear-gradient(135deg, #2e1065 0%, #4c1d95 40%, #6d28d9 100%);
}

/* Tile content */
.case-kind {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 0.75rem;
}

.case-title {
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0 0 0.5rem;
}

.case-desc {
    font-size: 0.875rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.55);
    max-width: 28ch;
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .case-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .case-tile {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    .home { padding: 0.625rem; }

    .case-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 0.5rem;
        padding-top: 3rem;
        padding-bottom: 2.5rem;
    }

    .case-tile {
        min-height: 0;
        padding: 1.25rem;
        aspect-ratio: auto;
    }

    .case-img {
        display: none;
    }

    .case-tile-content {
        position: relative;
        z-index: 2;
    }

    .case-title {
        font-size: 1.5rem;
    }

    .case-desc {
        max-width: none;
    }

    .edge-logo { top: 0.75rem; left: 1rem; }
    .edge-links { top: 0.75rem; right: 1rem; }
    .edge-copy { bottom: 0.75rem; left: 1rem; }
}

/* ============================================================
   Slide-out detail panel (click outside to close)
   ============================================================ */

.panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.panel-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 201;
    width: min(480px, 92vw);
    max-width: 100%;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.panel.is-open {
    transform: translateX(0);
}

.panel-inner {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.5rem 2rem;
}

.panel-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
}

.panel-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.panel-close svg {
    width: 18px;
    height: 18px;
}

.panel .detail-kind { margin-top: 0; }
.panel .detail-title { margin-bottom: 0.75rem; }
.panel .detail-description { margin-bottom: 1rem; }
.panel .detail-meta { margin-top: 1.5rem; padding-top: 1.25rem; }

/* Panel rich content */
.detail-lead {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.detail-section {
    margin-bottom: 1.25rem;
}

.detail-heading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: 0 0 0.625rem;
}

.detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.detail-list li {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.detail-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 4px;
    height: 4px;
    border-radius: 1px;
    background: var(--accent);
}

.detail-tech {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    line-height: 1.6;
}

.detail-author {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-faint);
    letter-spacing: 0.02em;
}
