/* ═══════════════════════════════════════════════════════════════
   MIDI Matrix Router — Landing page
   ═══════════════════════════════════════════════════════════════ */

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

:root {
    --bg:        #0f1117;
    --bg2:       #161b27;
    --fg:        #e8eaf0;
    --fg2:       #9aa3b8;
    --accent:    #4a9eff;
    --accent2:   #7ec8e3;
    --green:     #3ecf8e;
    --border:    #2a3045;
    --radius:    8px;
    --maxw:      960px;
    --sans:      'Helvetica Neue', Arial, sans-serif;
    --mono:      'SF Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.7;
    font-size: 16px;
}

/* ── HERO ── */
.hero { position: relative; width: 100%; max-height: 520px; overflow: hidden; }

.hero-img-wrap { position: relative; width: 100%; }

.hero-img {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    object-position: center;
    display: block;
    filter: brightness(0.45);
}

/* Fallback when no photo yet */
.hero-img-wrap:not(:has(img[src*="hardware"])) .hero-img,
.hero-img[src="assets/photos/hardware.jpg"]:not([complete]) {
    min-height: 320px;
    background: linear-gradient(135deg, #0d1b2a 0%, #1a2a4a 60%, #0d1b2a 100%);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.hero-overlay h1 {
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 2px 20px rgba(0,0,0,0.8);
    margin-bottom: 0.6rem;
}

.hero-sub {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255,255,255,0.82);
    text-shadow: 0 1px 8px rgba(0,0,0,0.7);
    max-width: 560px;
}

/* Placeholder when no hero image */
.hero-placeholder {
    min-height: 320px;
    background: linear-gradient(135deg, #0d1b2a 0%, #1a3060 60%, #0d1b2a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
}
.hero-placeholder h1 {
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.6rem;
}
.hero-placeholder p { color: rgba(255,255,255,0.75); font-size: 1.15rem; }

/* ── NAV ── */
.sitenav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 23, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0;
    align-items: center;
    padding: 0 2rem;
    height: 48px;
}

.sitenav a {
    color: var(--fg2);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0 1rem;
    height: 48px;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.sitenav a:hover { color: var(--fg); border-bottom-color: var(--accent); }

.nav-cta {
    margin-left: auto;
    color: var(--accent) !important;
    font-weight: 600;
}
.nav-cta:hover { color: var(--accent2) !important; }

/* ── SECTIONS ── */
.section { padding: 5rem 1.5rem; }
.section-dark { background: var(--bg2); }

.container { max-width: var(--maxw); margin: 0 auto; }

h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    margin-bottom: 1.2rem;
    color: var(--fg);
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--fg);
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.4rem;
}

p { color: var(--fg2); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

.lead {
    font-size: 1.1rem;
    color: var(--fg);
    margin-bottom: 2rem;
    max-width: 720px;
}

/* ── FEATURE GRID ── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.feature {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

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

.feature-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.6rem;
}

/* ── HARDWARE ── */
.hw-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    margin-bottom: 3rem;
}

@media (max-width: 680px) { .hw-layout { grid-template-columns: 1fr; } }

.hw-list {
    list-style: none;
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.hw-list li { color: var(--fg2); font-size: 0.95rem; }
.hw-list li strong { color: var(--fg); }

.hw-photos { display: flex; flex-direction: column; gap: 1rem; }

.hw-photo {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    object-fit: cover;
    max-height: 200px;
}

figure { margin: 0; }
figcaption { font-size: 0.8rem; color: var(--fg2); margin-top: 0.3rem; text-align: center; }

/* ── BLOCK DIAGRAM ── */
.diagram-wrap {
    margin-top: 2.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    overflow-x: auto;
}

.block-diagram { width: 100%; max-width: 720px; display: block; margin: 0 auto; }

.bd-box       { fill: none; stroke-width: 1.5; }
.bd-in        { stroke: var(--green); }
.bd-out       { stroke: var(--accent); }
.bd-cpu       { stroke: var(--border); fill: rgba(74,158,255,0.04); }
.bd-router    { stroke: var(--accent); fill: rgba(74,158,255,0.08); }
.bd-sd        { stroke: var(--green); fill: rgba(62,207,142,0.06); }
.bd-ui        { stroke: #9b59b6; fill: rgba(155,89,182,0.06); }
.bd-port-line { stroke: var(--border); stroke-width: 1; }
.bd-arrow     { stroke: var(--fg2); stroke-width: 1.5; fill: none; }
.bd-arrowhead { fill: var(--fg2); }

.bd-label-v {
    fill: var(--fg2);
    font-size: 10px;
    font-family: var(--sans);
    text-anchor: middle;
}
.bd-title {
    fill: var(--fg);
    font-size: 13px;
    font-family: var(--sans);
    font-weight: 600;
    text-anchor: middle;
}
.bd-sublabel {
    fill: var(--fg);
    font-size: 11px;
    font-family: var(--sans);
    font-weight: 600;
    text-anchor: middle;
}
.bd-sublabel2 {
    fill: var(--fg2);
    font-size: 9.5px;
    font-family: var(--sans);
    text-anchor: middle;
}

/* ── DUAL REPR ── */
.dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}
@media (max-width: 680px) { .dual-grid { grid-template-columns: 1fr; } }

.dual-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.screenshot-wrap {
    margin: 1rem 0;
    background: #0a0d14;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot {
    width: 100%;
    display: block;
    border-radius: 6px;
}

/* ── EQUIVALENCE BOX ── */
.equiv-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 2rem;
}

.operator-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.op-node {
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--mono);
    border: 1px solid;
    white-space: nowrap;
}

.op-filter-note  { border-color: #4a9eff; color: #4a9eff; background: rgba(74,158,255,0.08); }
.op-filter-vel   { border-color: #7ec8e3; color: #7ec8e3; background: rgba(126,200,227,0.08); }
.op-split-note   { border-color: #3ecf8e; color: #3ecf8e; background: rgba(62,207,142,0.08); }
.op-split-vel    { border-color: #2ecc71; color: #2ecc71; background: rgba(46,204,113,0.08); }
.op-transpose    { border-color: #f39c12; color: #f39c12; background: rgba(243,156,18,0.08); }
.op-fuzz         { border-color: #e74c3c; color: #e74c3c; background: rgba(231,76,60,0.08); }
.op-channel      { border-color: #9b59b6; color: #9b59b6; background: rgba(155,89,182,0.08); }

/* ── EDITOR SECTION ── */
.editor-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0 2.5rem;
}

.ef {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.editor-note {
    background: rgba(255,255,255,0.04);
    border-left: 3px solid #8cf;
    border-radius: 4px;
    padding: 10px 16px;
    margin: 24px 0 16px;
    font-size: 0.88rem;
    color: #aaa;
    line-height: 1.5;
}
.editor-note strong { color: #ddd; }
.editor-note code   { color: #8cf; font-size: 0.85em; }

.editor-cta { text-align: center; }

.btn-primary {
    display: inline-block;
    padding: 0.9rem 2.4rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1.05rem;
    transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: #3a8ee8; transform: translateY(-1px); }

code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: rgba(255,255,255,0.06);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    color: var(--accent2);
}

/* ── FOOTER ── */
.footer {
    background: #080b10;
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    text-align: center;
}
.footer p { color: var(--fg2); font-size: 0.9rem; margin-bottom: 0.2rem; }
.footer-sub { font-size: 0.8rem !important; opacity: 0.6; }
