/* archetypic.dev - Blueprint Technical Architecture */
/* Palette: #e8eef6, #ffffff40, #1b2838, #0ea5e9, #10b981, #f59e0b, #ef4444, #1e293b, #cbd5e1 */

:root {
    --blueprint: #e8eef6;
    --grid-line: rgba(255, 255, 255, 0.4);
    --grid-major: rgba(255, 255, 255, 0.15);
    --panel: #1b2838;
    --accent: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text: #1e293b;
    --text-light: #cbd5e1;
    --white: #ffffff;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--blueprint);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--panel);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
    padding: 1.5rem;
    border-right: 1px solid rgba(14, 165, 233, 0.15);
}

.sidebar-brand {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(203, 213, 225, 0.15);
}

.brand-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--white);
    letter-spacing: -0.02em;
}

.brand-ver {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    color: var(--accent);
}

/* Directory Tree */
.dir-tree {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.tree-item {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-light);
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0;
    transform: translateX(-12px);
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.tree-item.visible {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease, color 0.2s ease;
}

.tree-item:hover {
    background: rgba(14, 165, 233, 0.08);
}

.tree-item.active {
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent);
}

.tree-item.active .tree-label {
    color: var(--accent);
}

.tree-branch {
    color: rgba(203, 213, 225, 0.25);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.tree-label {
    color: inherit;
}

.ti-root { padding-left: 0.5rem; }
.ti-1 { padding-left: 0.5rem; }
.ti-2 { padding-left: 0.75rem; }

.tree-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-blue { background: var(--accent); }
.dot-green { background: var(--success); }
.dot-amber { background: var(--warning); }
.dot-red { background: var(--error); }

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(203, 213, 225, 0.1);
}

.compass-rose {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.6rem;
    color: rgba(203, 213, 225, 0.2);
    line-height: 1.5;
    letter-spacing: 0.1em;
}

.compass-cross {
    color: rgba(14, 165, 233, 0.25);
    margin: 0 0.3rem;
}

.compass-row {
    letter-spacing: 0.15em;
}

/* ============================================================
   MAIN CANVAS
   ============================================================ */
.canvas {
    margin-left: 280px;
    min-height: 100vh;
    position: relative;
    background:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        linear-gradient(var(--grid-major) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
    background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
    background-color: var(--blueprint);
}

/* Grid Overlay for fade-in */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    bottom: 0;
    background: var(--blueprint);
    z-index: 3;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1.2s ease;
}

.grid-overlay.revealed {
    opacity: 0;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
    position: sticky;
    top: 0;
    background: rgba(232, 238, 246, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(30, 41, 59, 0.08);
    padding: 0.65rem 2rem;
    z-index: 5;
    display: flex;
    align-items: center;
}

.crumb {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.crumb-cursor {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    animation: blink 1s step-end infinite;
    margin-left: 1px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ============================================================
   BLUEPRINT SECTIONS
   ============================================================ */
.blueprint-section {
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.section-hero {
    padding-top: 4rem;
    padding-bottom: 4rem;
    min-height: 80vh;
    justify-content: center;
}

.section-detail {
    /* Grid scale change hint for detail sections */
}

.section-overview {
    padding-bottom: 6rem;
}

/* ============================================================
   SPECIFICATION SHEETS
   ============================================================ */
.spec-sheet {
    max-width: 600px;
    width: 100%;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
}

.spec-sheet.visible {
    opacity: 1;
    transform: translateY(0);
}

.spec-wide {
    max-width: 700px;
}

/* SVG border animation */
.spec-border-svg {
    position: absolute;
    top: -5px;
    left: -5px;
    width: calc(100% + 10px);
    height: calc(100% + 10px);
    z-index: 0;
    pointer-events: none;
}

.spec-border-rect {
    stroke: var(--text);
    stroke-width: 0.4;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.2s ease;
}

.spec-sheet.visible .spec-border-rect {
    stroke-dashoffset: 0;
}

/* Inner container */
.spec-inner {
    background: rgba(255, 255, 255, 0.75);
    border: 2px solid var(--text);
    position: relative;
    z-index: 1;
}

.spec-title-bar {
    background: var(--text);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
}

.spec-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

.spec-rev {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    color: var(--accent);
}

.spec-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background: linear-gradient(225deg, var(--blueprint) 50%, transparent 50%);
    z-index: 2;
}

.spec-content {
    padding: 1.5rem;
}

.spec-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--text);
    margin-bottom: 0.8rem;
    letter-spacing: -0.01em;
}

.spec-body {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    line-height: 1.6;
    color: rgba(30, 41, 59, 0.72);
}

.spec-footer {
    border-top: 1px solid rgba(30, 41, 59, 0.12);
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
}

.spec-date, .spec-scale {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    color: rgba(30, 41, 59, 0.38);
}

/* ============================================================
   HERO
   ============================================================ */
.spec-hero {
    max-width: 700px;
}

.hero-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--text);
    line-height: 1.08;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.hero-body {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: rgba(30, 41, 59, 0.68);
    margin-bottom: 1.5rem;
    max-width: 480px;
}

.dimension-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    color: var(--accent);
    opacity: 0.55;
}

.dim-arrow {
    font-size: 0.85rem;
}

.dim-value {
    border-top: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
    padding: 0.1rem 0.75rem;
    letter-spacing: 0.05em;
}

/* ============================================================
   CONNECTOR LINES
   ============================================================ */
.connector-line {
    display: flex;
    justify-content: center;
}

.cl-vertical {
    width: 1.5px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--accent), transparent);
    opacity: 0.35;
    margin: 0 auto;
}

.cl-angled {
    margin: 0.5rem auto;
}

.connector-path {
    animation: dashDraw 2.5s linear infinite;
}

@keyframes dashDraw {
    to { stroke-dashoffset: -16; }
}

/* ============================================================
   CODE BLOCK
   ============================================================ */
.code-block {
    background: var(--panel);
    padding: 1rem 1.25rem;
    border-radius: 4px;
    margin-top: 1rem;
    border-left: 3px solid var(--accent);
}

.code-line {
    display: block;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.9;
}

.code-kw { color: var(--accent); }
.code-type { color: var(--success); }

/* ============================================================
   SPEC LIST
   ============================================================ */
.spec-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.spec-list li {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(30, 41, 59, 0.72);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.s-green { background: var(--success); }
.s-amber { background: var(--warning); }
.s-red { background: var(--error); }

/* ============================================================
   COMPONENT GRID
   ============================================================ */
.component-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

.component-card {
    border: 1px solid rgba(30, 41, 59, 0.15);
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    transition: border-color 0.3s ease;
}

.component-card:hover {
    border-color: var(--accent);
}

.component-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.component-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.component-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.component-type {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.65rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.component-ver {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.65rem;
    color: rgba(30, 41, 59, 0.45);
}

.component-deps {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.65rem;
    color: rgba(30, 41, 59, 0.4);
    padding-top: 0.35rem;
    border-top: 1px solid rgba(30, 41, 59, 0.08);
}

/* ============================================================
   API TABLE
   ============================================================ */
.api-table {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(30, 41, 59, 0.12);
    margin-top: 0.8rem;
}

.api-row {
    display: grid;
    grid-template-columns: 80px 1fr 80px;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.06);
    align-items: center;
}

.api-row:last-child {
    border-bottom: none;
}

.api-header {
    background: rgba(30, 41, 59, 0.04);
    font-family: 'Source Code Pro', monospace;
    font-size: 0.65rem;
    color: rgba(30, 41, 59, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.api-method {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    font-weight: 500;
}

.method-get { color: var(--success); }
.method-post { color: var(--accent); }
.method-put { color: var(--warning); }
.method-del { color: var(--error); }

.api-path {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text);
}

.api-status {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ============================================================
   FLOW DIAGRAM
   ============================================================ */
.flow-diagram {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1rem;
}

.flow-node {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border: 1.5px solid;
    letter-spacing: 0.04em;
}

.fn-input {
    border-color: var(--success);
    color: var(--success);
}

.fn-process {
    border-color: var(--accent);
    color: var(--accent);
}

.fn-output {
    border-color: var(--warning);
    color: var(--warning);
}

.flow-arrow {
    font-family: 'Source Code Pro', monospace;
    color: var(--accent);
    opacity: 0.4;
    font-size: 1.1rem;
}

/* ============================================================
   VERSION MATRIX
   ============================================================ */
.version-matrix {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(30, 41, 59, 0.12);
    margin-top: 0.5rem;
}

.matrix-row {
    display: grid;
    grid-template-columns: 1fr 0.8fr 0.8fr 0.5fr;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.06);
    align-items: center;
}

.matrix-row:last-child {
    border-bottom: none;
}

.matrix-header {
    background: rgba(30, 41, 59, 0.04);
}

.matrix-header .matrix-cell {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.65rem;
    color: rgba(30, 41, 59, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.matrix-cell {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: rgba(30, 41, 59, 0.65);
}

.matrix-name {
    color: var(--text);
    font-weight: 500;
}

/* ============================================================
   OVERVIEW MAP
   ============================================================ */
.overview-map {
    position: relative;
    min-height: 220px;
    padding: 1rem;
}

.map-lines {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.overview-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease;
}

.overview-map.drawn .overview-line {
    stroke-dashoffset: 0;
}

.map-labels {
    position: relative;
    width: 100%;
    height: 200px;
}

.map-node {
    position: absolute;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--accent);
    padding: 0.3rem 0.6rem;
    letter-spacing: 0.04em;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.overview-map.drawn .map-node {
    opacity: 1;
}

.map-node-sm {
    font-family: 'Source Code Pro', monospace;
    font-weight: 400;
    font-size: 0.62rem;
    color: rgba(30, 41, 59, 0.55);
    border-color: rgba(14, 165, 233, 0.4);
    padding: 0.2rem 0.5rem;
}

/* ============================================================
   REVISION BLOCK
   ============================================================ */
.revision-block {
    max-width: 420px;
    width: 100%;
    border: 1px solid rgba(30, 41, 59, 0.18);
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.55);
    opacity: 0;
    transform: translateY(20px);
}

.revision-block.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.rev-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: rgba(30, 41, 59, 0.4);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.1);
}

.rev-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(30, 41, 59, 0.06);
}

.rev-row:last-child {
    border-bottom: none;
}

.rev-label {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.73rem;
    color: rgba(30, 41, 59, 0.42);
}

.rev-value {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.73rem;
    color: var(--text);
}

.rev-status {
    color: var(--success);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: 220px;
    }

    .canvas {
        margin-left: 0;
    }

    .grid-overlay {
        left: 0;
    }

    .spec-sheet {
        max-width: 100%;
    }

    .spec-wide {
        max-width: 100%;
    }

    .spec-border-svg {
        display: none;
    }

    .api-row {
        grid-template-columns: 60px 1fr 60px;
    }

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

    .overview-map {
        min-height: 160px;
    }

    .map-labels {
        display: none;
    }

    .blueprint-section {
        padding: 2rem 1.25rem;
    }

    .section-hero {
        min-height: 60vh;
        padding-top: 2rem;
    }
}
