:root {
    --bg: #0a0c10;
    --bg-card: #12161d;
    --bg-elev: #161b23;
    --border: #232a35;
    --border-hi: #313b49;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #4cc2ff;
    --accent-2: #7c5cff;
    --ok: #3fb950;
    --danger: #f85149;
    --radius: 14px;
}

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

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visible keyboard focus for all interactive elements. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip link: hidden until focused via keyboard. */
.skip-link {
    position: absolute;
    left: 12px;
    top: -48px;
    z-index: 100;
    padding: 8px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--text);
    transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(124, 92, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(76, 194, 255, 0.06) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
    mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nav */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.02em;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: block;
    box-shadow: 0 0 0 1px var(--border), 0 6px 18px -8px rgba(124, 92, 255, 0.7);
}
.brand .accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--muted); font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.main { flex: 1; padding: 24px 0 56px; }

/* Page intro */
.intro { position: relative; text-align: center; margin: 6vh 0 52px; }
.intro::before {
    content: "";
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    height: 320px;
    background: radial-gradient(circle, rgba(124, 92, 255, 0.22), rgba(76, 194, 255, 0.10) 45%, transparent 70%);
    filter: blur(20px);
    z-index: -1;
    pointer-events: none;
}
.intro .eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(76, 194, 255, 0.25);
    background: rgba(76, 194, 255, 0.06);
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 22px;
}
.intro h1 {
    font-size: clamp(2.6rem, 9vw, 4.2rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.03;
    background: linear-gradient(135deg, var(--text) 30%, #aeb8c4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.intro h1 .accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.intro p { color: var(--muted); margin-top: 16px; font-size: 1.12rem; max-width: 560px; margin-left: auto; margin-right: auto; }

/* Featured (full-width) project */
.feature {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 48px;
    box-shadow: 0 28px 70px -34px rgba(124, 92, 255, 0.55);
}
.feature-media { position: relative; min-height: 240px; background: linear-gradient(135deg, #1a2230, #11151c); }
.feature-media a { display: block; height: 100%; }
.feature-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feature-play {
    position: absolute;
    bottom: 14px; left: 14px;
    background: rgba(10, 12, 16, 0.72);
    border: 1px solid var(--border-hi);
    color: var(--text);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(6px);
}
.feature-media a:hover { text-decoration: none; }
.feature-media a:hover .feature-play { border-color: var(--accent); }
.feature-text { padding: 32px 34px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.feature-text .eyebrow {
    align-self: flex-start;
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(76, 194, 255, 0.25);
    background: rgba(76, 194, 255, 0.06);
    padding: 4px 12px;
    border-radius: 999px;
}
.feature-text h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    letter-spacing: -0.025em;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text) 40%, #aeb8c4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.feature-text p { color: var(--muted); font-size: 1.02rem; }
.feature-actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }

.grid-title { font-size: 1.3rem; letter-spacing: -0.01em; margin: 0 0 20px; color: var(--text); }

@media (max-width: 760px) {
    .feature { grid-template-columns: 1fr; }
}

/* Project grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.proj-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, transform .15s ease;
}
.proj-card:hover { border-color: var(--border-hi); transform: translateY(-2px); text-decoration: none; }

.proj-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1a2230, #11151c);
    object-fit: cover;
    width: 100%;
    display: block;
}
.proj-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border-hi);
    font-size: 2rem;
    font-weight: 800;
}

.proj-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.proj-body h3 { font-size: 1.15rem; color: var(--text); letter-spacing: -0.01em; }
.proj-body p { color: var(--muted); font-size: 0.92rem; flex: 1; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    font-size: 0.72rem;
    color: var(--accent);
    background: rgba(76, 194, 255, 0.08);
    border: 1px solid rgba(76, 194, 255, 0.2);
    padding: 3px 9px;
    border-radius: 999px;
}

/* Empty state */
.empty {
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 56px 24px;
}

/* Detail page */
.detail-head { margin-bottom: 24px; }
.detail-head h1 { font-size: clamp(2rem, 6vw, 2.8rem); letter-spacing: -0.02em; }
.detail-head .summary { color: var(--muted); font-size: 1.15rem; margin-top: 10px; max-width: 720px; }
.detail-hero {
    margin: 8px 0 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    background: linear-gradient(135deg, #1a2230, #11151c);
    box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
}
.detail-hero img { width: 100%; display: block; }
.back { color: var(--muted); font-size: 0.92rem; display: inline-block; margin-bottom: 20px; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 36px;
    align-items: start;
}
.detail-aside { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }
.aside-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.aside-card h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 12px;
}
.btn-block { display: flex; justify-content: center; width: 100%; margin-bottom: 8px; }
.btn-block:last-child { margin-bottom: 0; }

@media (max-width: 760px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-aside { position: static; }
}

/* Rich Markdown content */
.detail-main { font-size: 1.02rem; color: #cdd6e0; }
.detail-main h2 {
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 1.8em 0 0.6em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border);
}
.detail-main h2:first-child { margin-top: 0; }
.detail-main h3 { font-size: 1.18rem; color: var(--text); margin: 1.4em 0 0.5em; }
.detail-main p { margin-bottom: 1em; }
.detail-main ul, .detail-main ol { margin: 0 0 1.2em 1.4em; }
.detail-main li { margin-bottom: 0.4em; }
.detail-main li::marker { color: var(--accent); }
.detail-main a { color: var(--accent); }
.detail-main strong { color: var(--text); }
.detail-main code {
    background: rgba(124, 92, 255, 0.12);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    color: #c8b6ff;
}
.detail-main pre {
    background: #0c0f15;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    overflow-x: auto;
    margin: 0 0 1.3em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.detail-main pre code {
    background: none;
    border: none;
    padding: 0;
    color: #d7e0ea;
    font-size: 0.86rem;
    line-height: 1.65;
}
.detail-main blockquote {
    border-left: 3px solid var(--accent-2);
    background: rgba(124, 92, 255, 0.06);
    padding: 10px 16px;
    border-radius: 0 10px 10px 0;
    color: var(--muted);
    margin: 0 0 1.2em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-hi);
    background: var(--bg-elev);
    color: var(--text);
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 0.92rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    font-family: inherit;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #06121c; font-weight: 600; }
.btn-primary:hover { opacity: .92; }
.btn-danger { border-color: rgba(248, 81, 73, .4); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Admin */
.admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.admin-head h1 { font-size: 1.8rem; letter-spacing: -0.02em; }
.admin-actions { display: flex; gap: 10px; align-items: center; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .08em; }
.table .row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.badge-state { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-hi); color: var(--muted); }
.badge-state.live { color: var(--ok); border-color: rgba(63,185,80,.4); }

/* Forms */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.form { display: flex; flex-direction: column; gap: 18px; max-width: 640px; }
.form.narrow { max-width: 380px; margin: 8vh auto 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 0.78rem; color: var(--muted); }
.field input[type=text],
.field input[type=password],
.field input[type=url],
.field input[type=number],
.field textarea {
    background: var(--bg);
    border: 1px solid var(--border-hi);
    border-radius: 10px;
    color: var(--text);
    padding: 11px 13px;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 140px; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 200px; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: 18px; height: 18px; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 4px; }

.thumb-preview { max-width: 200px; border-radius: 10px; border: 1px solid var(--border); margin-top: 8px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 20px; }
.alert-error { background: rgba(248,81,73,.1); border: 1px solid rgba(248,81,73,.3); color: #ffb3ae; }
.alert-ok { background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.3); color: #8ee79a; }

/* About page */
.section-title {
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin: 44px 0 18px;
}
.about-lead { font-size: 1.06rem; color: #cdd6e0; }
.about-lead p { margin-bottom: 1em; }
.about-lead p:last-child { margin-bottom: 0; }
.about-lead strong { color: var(--text); }
.about-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color .15s ease, transform .15s ease;
}
.feature-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.feature-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.feature-card p { color: var(--muted); font-size: 0.92rem; }
.tags-lg { gap: 9px; }
.tags-lg .tag { font-size: 0.85rem; padding: 6px 13px; }
.about-cta {
    text-align: center;
    margin: 52px 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.about-cta p { color: var(--muted); }

.about-cta-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* AI build stats grid (About page) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-top: 4px;
}
.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 18px;
    text-align: center;
    transition: border-color .15s ease, transform .15s ease;
}
.stat:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.stat-num {
    display: block;
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-label {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.86rem;
}
.stat-intro { color: var(--muted); font-size: 0.95rem; margin: 0 0 18px; max-width: 720px; }
.stat-intro strong { color: var(--text); }
.stat-note { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 16px; font-style: italic; }

/* Homepage "from the notebook" teaser */
.notes-teaser {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 8px 0 8px;
    box-shadow: 0 28px 70px -34px rgba(76, 194, 255, 0.45);
}
.notes-teaser-media {
    background: var(--bg-elev);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border-right: 1px solid var(--border);
}
.notes-teaser-media a { display: block; width: 100%; }
.notes-teaser-media a:hover { text-decoration: none; }
.notes-teaser-media img { width: 100%; height: auto; display: block; }
.notes-teaser-text { padding: 30px 32px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.notes-teaser-text .eyebrow {
    align-self: flex-start;
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(76, 194, 255, 0.25);
    background: rgba(76, 194, 255, 0.06);
    padding: 4px 12px;
    border-radius: 999px;
}
.notes-teaser-text h2 {
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    letter-spacing: -0.025em;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text) 40%, #aeb8c4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.notes-teaser-text h2 .accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.notes-teaser-text > p { color: var(--muted); font-size: 1rem; }
.notes-list { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-direction: column; }
.notes-list li { border-top: 1px solid var(--border); }
.notes-list li:first-child { border-top: none; }
.notes-list a { display: block; padding: 9px 0; color: var(--text); }
.notes-list a:hover { text-decoration: none; }
.notes-list a:hover .notes-list-title { color: var(--accent); }
.notes-list-title { display: block; font-size: 0.96rem; font-weight: 600; transition: color .12s ease; }
.notes-list-sum { display: block; color: var(--muted); font-size: 0.84rem; }

@media (max-width: 760px) {
    .notes-teaser { grid-template-columns: 1fr; }
    .notes-teaser-media { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ============================================================
   Engineering notebook (wiki)
   ============================================================ */

/* Index toolbar: search + filter chips */
.wiki-toolbar { margin: 0 0 8px; display: flex; flex-direction: column; gap: 16px; }
.wiki-search { position: relative; display: flex; align-items: center; }
#wikiSearch {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-hi);
    border-radius: 12px;
    color: var(--text);
    padding: 13px 110px 13px 16px;
    font-size: 1rem;
    font-family: inherit;
}
#wikiSearch::placeholder { color: var(--muted); }
#wikiSearch:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 194, 255, 0.12); }
.wiki-search-count {
    position: absolute;
    right: 14px;
    color: var(--muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.wiki-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    border: 1px solid var(--border-hi);
    background: var(--bg-elev);
    color: var(--muted);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-hi); }
.chip-active {
    color: #06121c;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    font-weight: 600;
}

/* Category sections */
.wiki-cat { margin-top: 40px; }
.wiki-cat-head { margin-bottom: 18px; }
.wiki-cat-head .section-title { margin: 0; }
.wiki-cat-blurb { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }

/* Article cards (note cards) */
.wiki-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, transform .15s ease;
}
a.wiki-card:hover { border-color: var(--border-hi); transform: translateY(-2px); text-decoration: none; }
.wiki-card-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.wiki-card-body h3 {
    font-size: 1.12rem;
    color: var(--text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.wiki-card-body p { color: var(--muted); font-size: 0.92rem; flex: 1; }
.wiki-card.is-planned { opacity: 0.6; cursor: default; }
.wiki-card.is-planned:hover { transform: none; border-color: var(--border); }
.wiki-soon {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-2);
    border: 1px solid rgba(124, 92, 255, 0.35);
    background: rgba(124, 92, 255, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
}

/* Article page */
.article-eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(76, 194, 255, 0.25);
    background: rgba(76, 194, 255, 0.06);
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.detail-main h2 { scroll-margin-top: 84px; }

/* Table of contents */
.toc-card { position: relative; }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc a {
    color: var(--muted);
    font-size: 0.88rem;
    padding: 5px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.toc-active {
    color: var(--text);
    border-left-color: var(--accent);
    background: rgba(76, 194, 255, 0.06);
}

/* Prev / next */
.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.article-nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 48%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    transition: border-color .15s ease;
}
.article-nav-link:hover { border-color: var(--border-hi); text-decoration: none; }
.article-nav-link.next { text-align: right; margin-left: auto; }
.article-nav-dir { font-size: 0.74rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.article-nav-title { color: var(--text); font-size: 0.95rem; }

/* Article figures (images + diagrams) */
.detail-main .article-figure {
    margin: 1.4em 0;
    padding: 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
}
.detail-main .article-figure img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
}
.detail-main .article-figure figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

/* Interactive inspection pyramid */
.pyramid {
    margin: 0 0 1.6em;
    padding: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.pyramid-stack { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pyramid-layer {
    width: var(--w, 100%);
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    border: 1px solid var(--border-hi);
    background: var(--bg-elev);
    color: var(--text);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.pyramid-layer:hover, .pyramid-layer.is-active, .pyramid-layer:focus-visible {
    outline: none;
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(76, 194, 255, 0.16), rgba(124, 92, 255, 0.16));
    transform: scale(1.015);
}
.pyramid-name { font-weight: 600; }
.pyramid-cost { font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.pyramid-layer.is-active .pyramid-cost { color: var(--accent); }
.pyramid-panel {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-2);
    border-radius: 0 10px 10px 0;
    background: rgba(124, 92, 255, 0.06);
}
.pyramid-panel-name { display: block; color: var(--text); margin-bottom: 4px; }
.pyramid-panel-detail { color: var(--muted); font-size: 0.92rem; }
.pyramid-caption { margin-top: 12px; color: var(--muted); font-size: 0.8rem; text-align: center; }

@media (max-width: 760px) {
    .article-nav { flex-direction: column; }
    .article-nav-link, .article-nav-link.next { max-width: 100%; text-align: left; margin-left: 0; }
    .pyramid-layer { width: 100% !important; }
}

.foot { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 24px 0; border-top: 1px solid var(--border); }

@media (max-width: 600px) {
    .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
