/* ============================================
   Deep-dive project page styles
   Inherits design tokens from ../style.css
   ============================================ */

/* --- Document level --- */
.project-page { padding-top: var(--nav-height); }

/* --- Compact top nav --- */
.project-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 1000;
    background: rgba(3,3,5,0.78);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.project-nav-back {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: color 0.3s ease;
}

.project-nav-back:hover { color: var(--text); }

.project-nav-back svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.project-nav-back:hover svg { transform: translateX(-3px); }

.project-nav-title {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--text-muted);
}

.project-nav-logo {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Layout: TOC + content --- */
.project-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 64px;
    align-items: start;
}

@media (max-width: 980px) {
    .project-layout { grid-template-columns: 1fr; }
    .project-toc { display: none !important; }
}

/* --- Side table of contents --- */
.project-toc {
    position: sticky;
    top: calc(var(--nav-height) + 32px);
    padding: 32px 0;
}

.project-toc-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-left: 24px;
}

.project-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 1px solid var(--border);
}

.project-toc-link {
    display: block;
    padding: 10px 24px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.project-toc-link:hover {
    color: var(--text-dim);
    border-left-color: var(--border-hover);
}

.project-toc-link.active {
    color: var(--text);
    border-left-color: var(--accent);
}

/* --- Content column --- */
.project-content { min-width: 0; padding: 32px 0 96px; }

/* --- Hero --- */
.dd-hero {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 80px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(99,102,241,0.08), transparent 70%);
    isolation: isolate;
}

.dd-hero-media {
    position: relative;
    height: 420px;
    overflow: hidden;
    background: #0a0a12;
}

.dd-hero-media img,
.dd-hero-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.dd-hero-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(3,3,5,0.85) 100%);
    pointer-events: none;
}

.dd-hero-body { padding: 36px 40px 40px; }

.dd-hero-eyebrow {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.dd-hero-eyebrow .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.dd-hero-title {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1;
    margin-bottom: 18px;
}

.dd-hero-tagline {
    font-size: clamp(15px, 1.6vw, 18px);
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 760px;
    margin-bottom: 28px;
}

.dd-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dd-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.025);
    color: var(--text-dim);
}

.dd-tag.accent {
    border-color: rgba(99,102,241,0.4);
    background: rgba(99,102,241,0.12);
    color: #c7d2fe;
}

.dd-tag.gold {
    border-color: rgba(234,179,8,0.35);
    background: rgba(234,179,8,0.1);
    color: #fde68a;
}

/* --- Stats row --- */
.dd-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-top: 32px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.dd-stat {
    padding: 24px 28px;
    border-right: 1px solid var(--border);
    min-width: 0;
}

.dd-stat:last-child { border-right: none; }

.dd-stat-value {
    font-family: var(--font-sans);
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: -1px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 8px;
}

.dd-stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .dd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dd-stat:nth-child(2) { border-right: none; }
    .dd-stat:nth-child(1), .dd-stat:nth-child(2) {
        border-bottom: 1px solid var(--border);
    }
}

/* --- Section --- */
.dd-section {
    margin-bottom: 96px;
    scroll-margin-top: calc(var(--nav-height) + 24px);
}

.dd-section-num {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.dd-section-num::before {
    content: '';
    width: 32px;
    height: 1px;
    background: var(--gradient);
}

.dd-section-title {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 16px;
    line-height: 1.1;
}

.dd-section-lede {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-dim);
    max-width: 760px;
    margin-bottom: 40px;
}

.dd-section-lede strong { color: var(--text); font-weight: 600; }

/* --- Prose --- */
.dd-prose {
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1.75;
    max-width: 760px;
}

.dd-prose p { margin-bottom: 18px; }
.dd-prose strong { color: var(--text); font-weight: 600; }
.dd-prose em { color: var(--accent); font-style: normal; }

.dd-prose a {
    color: #c7d2fe;
    border-bottom: 1px dashed rgba(199,210,254,0.4);
}

.dd-prose a:hover { color: var(--text); border-bottom-color: var(--text); }

/* --- Callout cards --- */
.dd-callouts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 32px 0;
}

.dd-callout {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.dd-callout:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
}

.dd-callout-value {
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.dd-callout-label {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.dd-callout-note {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* --- Image cards --- */
.dd-figure {
    margin: 32px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}

.dd-figure img,
.dd-figure video {
    display: block;
    width: 100%;
    height: auto;
}

.dd-figure-caption {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.dd-figure-caption .num { color: var(--accent); }

.dd-figure-grid {
    display: grid;
    gap: 16px;
    margin: 32px 0;
}

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

@media (max-width: 720px) {
    .dd-figure-grid.cols-2,
    .dd-figure-grid.cols-3 { grid-template-columns: 1fr; }
}

/* --- Two-column block --- */
.dd-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin: 32px 0;
}

@media (max-width: 720px) {
    .dd-2col { grid-template-columns: 1fr; }
}

/* --- Component tree --- */
.dd-tree {
    background: rgba(10,10,15,0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-dim);
    margin: 32px 0;
    max-height: 540px;
    overflow-y: auto;
}

.dd-tree details {
    margin-left: 0;
}

.dd-tree details details {
    margin-left: 20px;
    border-left: 1px solid var(--border);
    padding-left: 14px;
    margin-top: 4px;
}

.dd-tree summary {
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
    color: var(--text);
    transition: color 0.2s ease;
}

.dd-tree summary::-webkit-details-marker { display: none; }

.dd-tree summary::before {
    content: '▸';
    color: var(--accent);
    margin-right: 8px;
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 11px;
}

.dd-tree details[open] > summary::before {
    transform: rotate(90deg);
}

.dd-tree summary:hover { color: #c7d2fe; }

.dd-tree .leaf {
    padding: 2px 0 2px 22px;
    color: var(--text-muted);
    font-size: 12px;
}

.dd-tree .tag {
    color: var(--accent);
    font-size: 10px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dd-tree .body { color: #94a3b8; }

/* --- Spec table --- */
.dd-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}

.dd-table th {
    text-align: left;
    padding: 14px 18px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-hover);
    background: rgba(255,255,255,0.02);
}

.dd-table td {
    padding: 14px 18px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.dd-table td.label {
    color: var(--text);
    font-weight: 500;
    width: 30%;
}

.dd-table td.mono {
    font-family: var(--font-mono);
    font-size: 12px;
    color: #c7d2fe;
}

.dd-table tr:last-child td { border-bottom: none; }

.dd-table tr:hover td { background: rgba(255,255,255,0.018); }

/* --- Block diagram (CSS-only) --- */
.dd-diagram {
    background: rgba(10,10,15,0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin: 32px 0;
    overflow-x: auto;
}

.dd-flow {
    display: flex;
    align-items: stretch;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
}

.dd-node {
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 220px;
    padding: 16px 18px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
    text-align: left;
}

.dd-node-tier {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.dd-node-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.dd-node-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.dd-arrow {
    align-self: center;
    color: var(--accent);
    font-size: 20px;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .dd-arrow { transform: rotate(90deg); }
}

/* --- Reward function block --- */
.dd-reward {
    background: rgba(10,10,15,0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin: 24px 0;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.9;
}

.dd-reward .lhs {
    color: var(--accent);
    font-weight: 700;
}

.dd-reward .op { color: var(--text-muted); }
.dd-reward .w { color: #fde68a; }
.dd-reward .term { color: #c7d2fe; }
.dd-reward .comment { color: var(--text-muted); margin-left: 12px; font-size: 12px; }

/* --- Iteration timeline --- */
.dd-iters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 32px 0;
}

.dd-iter {
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.dd-iter:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
}

.dd-iter-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.dd-iter-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.dd-iter-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.dd-iter.final {
    border-color: rgba(99,102,241,0.5);
    background: rgba(99,102,241,0.08);
}

.dd-iter.final .dd-iter-tag { color: #c7d2fe; }

/* --- Domain randomization grid --- */
.dd-rand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.dd-rand {
    padding: 18px;
    background: rgba(255,255,255,0.022);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.dd-rand-name {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text);
    margin-bottom: 6px;
}

.dd-rand-range {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 6px;
}

.dd-rand-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Quote / pull --- */
.dd-pull {
    margin: 40px 0;
    padding: 28px 32px;
    border-left: 3px solid var(--accent);
    background: rgba(99,102,241,0.05);
    border-radius: 0 12px 12px 0;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text);
}

.dd-pull cite {
    display: block;
    margin-top: 14px;
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--text-muted);
}

/* --- Gallery --- */
.dd-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.dd-gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.dd-gallery-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5);
}

.dd-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dd-gallery-item .label {
    position: absolute;
    bottom: 10px;
    left: 12px;
    right: 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text);
    background: rgba(3,3,5,0.85);
    padding: 6px 10px;
    border-radius: 6px;
    backdrop-filter: blur(8px);
    text-transform: uppercase;
}

/* --- Compare table --- */
.dd-compare {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 24px 0;
}

.dd-compare th,
.dd-compare td {
    padding: 14px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.dd-compare th {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    background: rgba(255,255,255,0.02);
}

.dd-compare th.us, .dd-compare td.us {
    color: var(--text);
    background: rgba(99,102,241,0.07);
}

.dd-compare td.us strong { color: #c7d2fe; }

.dd-compare td.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.dd-compare td:first-child { color: var(--text); font-weight: 500; }

/* --- Chart card --- */
.dd-chart-card {
    background: rgba(10,10,15,0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin: 24px 0;
}

.dd-chart-title {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.dd-chart-sub {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.dd-chart-canvas { position: relative; height: 280px; }

/* --- Bar visual (CSS only) --- */
.dd-bars { display: flex; flex-direction: column; gap: 16px; margin: 16px 0; }

.dd-bar-row {
    display: grid;
    grid-template-columns: 180px 1fr 80px;
    gap: 14px;
    align-items: center;
    font-size: 13px;
}

.dd-bar-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-dim);
}

.dd-bar-track {
    height: 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.dd-bar-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 100px;
    transform-origin: left;
    animation: barGrow 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: scaleX(0);
}

@keyframes barGrow { to { transform: scaleX(1); } }

.dd-bar-value {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    text-align: right;
    font-weight: 600;
}

@media (max-width: 720px) {
    .dd-bar-row { grid-template-columns: 1fr; gap: 6px; }
    .dd-bar-value { text-align: left; }
}

/* --- No reveal animations: content is always visible --- */
.dd-reveal { opacity: 1; transform: none; }

/* --- Footer of project page --- */
.dd-foot {
    margin-top: 96px;
    padding-top: 48px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

@media (max-width: 720px) {
    .dd-foot { grid-template-columns: 1fr; }
}

.dd-foot-card {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.dd-foot-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
}

.dd-foot-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.dd-foot-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.dd-foot-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

@media (max-width: 720px) {
    .project-nav {
        padding: 0 20px;
        gap: 16px;
    }

    .project-nav-title {
        display: none;
    }

    .project-nav-back {
        font-size: 11px;
        letter-spacing: 1.5px;
        min-width: 0;
    }

    .project-nav-logo {
        margin-left: auto;
    }

    .dd-hero-eyebrow {
        flex-wrap: wrap;
        line-height: 1.6;
    }

    .dd-stat-value {
        font-size: clamp(20px, 5.5vw, 28px);
        overflow-wrap: normal;
    }

    .dd-stat {
        padding: 22px 16px;
    }

    .dd-table,
    .dd-compare {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dd-table th,
    .dd-table td,
    .dd-compare th,
    .dd-compare td {
        min-width: 120px;
    }
}

/* --- Section dividers --- */
.dd-divider {
    margin: 24px 0;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
    border: none;
}

/* --- Inline pill --- */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(99,102,241,0.12);
    color: #c7d2fe;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    margin: 0 2px;
}

/* --- Make project cards on main page clickable --- */
a.project-card-link {
    color: inherit;
    text-decoration: none;
    display: block;
}
