:root {
    --paper: #f5f2e8;
    --paper-2: #ece8da;
    --paper-3: #e0dcce;
    --ink: #1a1a1a;
    --ink-soft: #6b6b5e;
    --rule: #c4bca8;
    --rule-soft: #d8d0bc;
    --case-hi: #ebe0c8;
    --case-1: #d8cab0;
    --case-2: #c8b896;
    --case-3: #b8a880;
    --case-ink: #5a4c30;
    --bezel-1: #1a1815;
    --bezel-2: #2a2620;
    --accent: #00aa44;
    --danger: #cc3333;
    --terminal-bg: #1a1a1a;
    --terminal-text: #b0ffb0;
    --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    --pixel: 'VT323', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--mono); font-size: 14px; color: var(--ink); }

body {
    background:
        radial-gradient(120% 80% at 50% 0%, #e8d8b8 0%, transparent 60%),
        radial-gradient(80% 60% at 50% 100%, #b8a888 0%, transparent 50%),
        linear-gradient(160deg, #d4c4a4 0%, #b8a888 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 16px;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed; inset: 0; pointer-events: none;
    background-image: repeating-linear-gradient(0deg, rgba(0,0,0,0.01) 0 1px, transparent 1px 3px);
    z-index: 1;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }

/* ── mac shell ───────────────────────────────────────────────────────────── */
.mac {
    position: relative;
    width: min(760px, 100%);
    background: linear-gradient(180deg, var(--case-hi) 0%, var(--case-1) 8%, var(--case-2) 65%, var(--case-3) 100%);
    border-radius: 16px 16px 22px 22px;
    padding: 22px 22px 0;
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.5),
        inset 0 -2px 0 rgba(0,0,0,0.15),
        inset 2px 0 0 rgba(255,255,255,0.22),
        inset -2px 0 0 rgba(0,0,0,0.12),
        0 30px 60px -20px rgba(60,40,20,0.4),
        0 8px 20px -8px rgba(0,0,0,0.3);
    z-index: 2;
}

.vents { display: flex; justify-content: center; gap: 3px; padding: 2px 0 14px; }
.vents span {
    width: 3px; height: 9px; border-radius: 1px;
    background: linear-gradient(180deg, rgba(0,0,0,0.32), rgba(0,0,0,0.12));
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.28);
}

.bezel {
    background: linear-gradient(180deg, var(--bezel-1) 0%, var(--bezel-2) 50%, var(--bezel-1) 100%);
    border-radius: 7px;
    padding: 13px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.55), inset 0 -1px 0 rgba(255,255,255,0.04),
        0 1px 0 rgba(255,255,255,0.35);
}

.screen {
    background: var(--paper);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    min-height: 540px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 24px rgba(120,100,60,0.16), inset 0 0 0 1px rgba(0,0,0,0.08);
}

.screen::before {
    content: ''; position: absolute; inset: 0;
    background-image: repeating-linear-gradient(180deg, rgba(0,0,0,0.015) 0 1px, transparent 1px 3px);
    pointer-events: none; z-index: 5;
}

.screen::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(120% 90% at 50% 50%, transparent 62%, rgba(80,60,30,0.14) 100%);
    pointer-events: none; z-index: 5;
}

/* ── CRT animations ──────────────────────────────────────────────────────── */
.crt-shutdown { animation: crtCollapse 0.07s cubic-bezier(0.4,0,1,1) forwards; }
@keyframes crtCollapse {
    0%   { transform: scaleY(1); opacity: 1; filter: brightness(1); }
    60%  { transform: scaleY(0.05); opacity: 0; filter: brightness(0); background: #1a1a1a; }
    100% { transform: scaleY(0); opacity: 0; filter: brightness(0); background: #0a0a0a; }
}

.crt-startup { animation: crtExpand 0.4s ease-out forwards; }
@keyframes crtExpand {
    0%   { transform: scaleY(0); opacity: 0; filter: brightness(0); background: #0a0a0a; }
    70%  { transform: scaleY(0.9); opacity: 0.8; filter: brightness(0.8); background: #e0d8c0; }
    100% { transform: scaleY(1); opacity: 1; filter: brightness(1); background: transparent; }
}

/* ── menubar ─────────────────────────────────────────────────────────────── */
.menubar {
    height: 22px;
    background: var(--paper);
    border-bottom: 1px solid var(--ink);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px;
    font-family: var(--pixel); font-size: 16px;
    position: relative; z-index: 6;
    user-select: none;
}
.menubar .left { display: flex; align-items: center; gap: 14px; }
.menubar .apple { padding: 1px 4px; border-radius: 2px; cursor: default; }
.menubar .apple:hover { background: var(--ink); color: var(--paper); }
.menubar .apple svg { width: 12px; height: 15px; }
.menubar .mitem { padding: 1px 4px; border-radius: 2px; cursor: default; }
.menubar .mitem:hover { background: var(--ink); color: var(--paper); }
.menubar .clock { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

/* ── window chrome ───────────────────────────────────────────────────────── */
.window {
    margin: 10px;
    background: var(--paper);
    border: 1px solid var(--ink);
    box-shadow: 1px 1px 0 var(--ink);
    display: flex; flex-direction: column; flex: 1; min-height: 0;
}

.titlebar {
    height: 19px;
    border-bottom: 1px solid var(--ink);
    background: repeating-linear-gradient(180deg, var(--ink) 0 1px, var(--paper) 1px 3px);
    display: flex; align-items: center; justify-content: center; position: relative;
    font-family: var(--pixel); font-size: 14px; letter-spacing: 0.5px; color: var(--ink);
}
.titlebar .close {
    position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
    width: 11px; height: 11px; background: var(--paper); border: 1px solid var(--ink);
}
.title-text { background: var(--paper); padding: 0 12px; white-space: nowrap; }

.nav {
    display: flex; flex-wrap: wrap;
    border-bottom: 1px solid var(--ink);
    background: var(--ink);
    gap: 1px;
    font-family: var(--pixel); font-size: 15px;
}
.nav a {
    background: var(--paper-2); color: var(--ink); text-decoration: none;
    padding: 4px 11px; flex: 1 1 auto; text-align: center;
    user-select: none; letter-spacing: 0.5px; line-height: 1.2;
    transition: background 80ms; cursor: pointer;
}
.nav a:hover, .nav a.active { background: var(--ink); color: var(--paper); }

.body {
    padding: 22px 22px 16px; overflow: auto; flex: 1; min-height: 0;
    line-height: 1.55; font-size: 13px;
}
.body::-webkit-scrollbar { width: 14px; }
.body::-webkit-scrollbar-track {
    background: repeating-linear-gradient(0deg, var(--paper-2) 0 2px, var(--paper) 2px 4px);
    border-left: 1px solid var(--ink);
}
.body::-webkit-scrollbar-thumb {
    background: var(--paper); border: 1px solid var(--ink);
    box-shadow: inset 1px 1px 0 var(--paper-2);
}

/* ── hero & tagline ──────────────────────────────────────────────────────── */
.hero {
    font-family: var(--pixel); font-size: 38px; line-height: 1;
    margin: 4px 0 6px; color: var(--ink); min-height: 40px;
    letter-spacing: 0.5px; display: flex; align-items: baseline;
}
.hero .typed { white-space: pre-wrap; word-break: break-word; }
.caret {
    display: inline-block; width: 0.55ch; height: 0.9em;
    background: var(--accent); margin-left: 3px; transform: translateY(3px);
    animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.tagline { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); letter-spacing: 0.03em; margin-bottom: 22px; }

/* ── feed rows ───────────────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; border-top: 1px solid var(--rule-soft); }

.row {
    display: grid; grid-template-columns: 100px 1fr auto;
    gap: 16px; padding: 10px 2px;
    border-bottom: 1px solid var(--rule-soft);
    align-items: baseline;
}
.row time, .row .label { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.row .title { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.row .tag   { font-family: var(--pixel); font-size: 13px; color: var(--ink-soft); opacity: 0; transition: opacity 120ms; }
.row:hover  { background: rgba(0,0,0,0.04); }
.row:hover .tag { opacity: 1; }
.row.lib .label { color: var(--ink); font-family: var(--pixel); font-size: 14px; }

.promptline {
    margin-top: 22px; padding-top: 14px;
    border-top: 1px solid var(--rule-soft);
    font-family: var(--mono); font-size: 12px; color: var(--ink-soft); line-height: 1.5;
}

/* ── expandable entry / project detail ───────────────────────────────────── */
.entry { border-bottom: 1px solid var(--rule-soft); }
.entry .row { border-bottom: none; }
.entry[data-expandable] .row { cursor: pointer; }

.expand-hint {
    font-family: var(--pixel); font-size: 14px;
    color: var(--accent); opacity: 0.4;
    display: inline-block;
    transition: opacity 120ms, transform 160ms ease;
    user-select: none;
}
.entry[data-expandable]:hover .expand-hint { opacity: 0.9; }
.entry.open .expand-hint { opacity: 1; transform: rotate(90deg); }

.project-detail {
    display: none;
    padding: 4px 4px 14px 18px;
    border-left: 2px solid var(--accent);
    margin: 0 2px 2px 4px;
    font-family: var(--mono); font-size: 11.5px;
    color: var(--ink-soft); line-height: 1.7;
}
.entry.open .project-detail { display: block; animation: fadeIn 0.18s ease; }
.entry.open { background: rgba(0,170,68,0.025); }

.project-meta {
    display: flex; flex-wrap: wrap; gap: 6px 20px;
    padding: 6px 0 10px;
    border-bottom: 1px solid var(--rule-soft);
    margin-bottom: 10px;
}
.project-meta .k { font-size: 10.5px; color: var(--ink-soft); }
.project-meta .k::after { content: ':'; margin-right: 4px; }
.project-meta .v { font-size: 11px; color: var(--ink); }

.project-p { margin-bottom: 8px; }
.project-p:last-child { margin-bottom: 0; }

/* ── sketch canvas (math art) ────────────────────────────────────────────── */
.sketch-canvas {
    width: 100%; height: 180px; display: block;
    background: #111;
    border: 1px solid #2a2a2a; border-radius: 2px;
    margin: 6px 0 10px;
}

/* ── library ─────────────────────────────────────────────────────────────── */
.lib-category {
    margin: 18px 0 8px; font-family: var(--pixel); font-size: 16px;
    letter-spacing: 0.5px; border-left: 3px solid var(--accent);
    padding-left: 10px; color: var(--ink);
}
.book-entry { border-bottom: 1px solid var(--rule-soft); cursor: pointer; user-select: none; transition: background 80ms; }
.book-entry:hover { background: rgba(0,0,0,0.03); }
.book-title-row {
    display: grid; grid-template-columns: 1fr auto; gap: 12px;
    padding: 8px 4px; align-items: baseline;
    font-family: var(--mono); font-size: 13px; color: var(--ink);
}
.book-author { font-size: 11px; color: var(--ink-soft); text-align: right; }
.book-thoughts {
    display: none; padding: 0 4px 10px 16px;
    font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
    line-height: 1.6; border-left: 2px solid var(--accent);
    margin-left: 4px; margin-bottom: 4px; font-style: italic;
}
.book-entry.open .book-thoughts { display: block; animation: fadeIn 0.2s ease; }
.book-entry.open { background: rgba(0,170,68,0.04); }

/* ── sign terminal ───────────────────────────────────────────────────────── */
.terminal-sign {
    background: var(--terminal-bg); color: var(--terminal-text);
    padding: 16px; border: 2px solid #333;
    font-family: var(--mono); font-size: 13px; margin-top: 20px;
    border-radius: 4px; box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}
.terminal-sign h3 { color: #a0ffa0; font-family: var(--pixel); font-size: 18px; margin-bottom: 8px; }
.terminal-prompt { display: flex; align-items: center; margin: 8px 0; }
.terminal-prompt span { color: #80ff80; margin-right: 6px; }
.terminal-input {
    flex: 1; background: transparent; border: none;
    color: var(--terminal-text); font-family: var(--mono); font-size: 14px;
    outline: none; caret-color: var(--accent);
}
.terminal-log { list-style: none; margin-top: 10px; max-height: 160px; overflow-y: auto; }
.terminal-log li { padding: 2px 0; border-bottom: 1px solid #333; }

/* ── glitch button ───────────────────────────────────────────────────────── */
.glitch {
    position: fixed; z-index: 9998; background: transparent; border: none;
    cursor: pointer; font-family: var(--pixel); font-size: 18px; color: var(--ink);
    opacity: 0.35; padding: 6px 8px; border-radius: 2px;
    transition: opacity 0.2s ease, left 1.4s cubic-bezier(0.4,0.05,0.2,1), top 1.4s cubic-bezier(0.4,0.05,0.2,1);
    user-select: none;
    animation: glitch-flicker 8s steps(1) infinite;
}
@keyframes glitch-flicker {
    0%,92%,94%,96%,100% { opacity: 0.35; }
    93% { opacity: 0.08; }
    95% { opacity: 0.6; }
    97% { opacity: 0.15; }
}
.glitch:hover, .glitch:focus-visible { opacity: 1; color: var(--accent); animation: shake 90ms steps(2) infinite; }
@keyframes shake {
    0%,100% { transform: translate(0,0); }
    25% { transform: translate(-1.5px,-1px); }
    50% { transform: translate(1.5px,1.5px); }
    75% { transform: translate(-1px,1.5px); }
}
.glitch.vanishing { animation: pixel-collapse 0.5s ease-in forwards; pointer-events: none; }
@keyframes pixel-collapse {
    0%  { transform: scale(1); opacity: 1; filter: brightness(1); }
    60% { transform: scale(0.3); opacity: 0.4; filter: brightness(3); color: var(--accent); }
    100%{ transform: scale(0); opacity: 0; filter: brightness(0); color: var(--accent); }
}

/* ── status bar / chin ───────────────────────────────────────────────────── */
.statusbar {
    height: 18px; border-top: 1px solid var(--ink); background: var(--paper-2);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px; font-family: var(--pixel); font-size: 13px; color: var(--ink-soft);
}

.chin {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 4px 18px; color: var(--case-ink);
    font-family: var(--pixel); font-size: 15px; letter-spacing: 1.2px;
}
.chin .label { font-style: italic; text-shadow: 0 1px 0 rgba(255,255,255,0.4); }
.floppy {
    width: 46px; height: 12px;
    background: linear-gradient(180deg, var(--bezel-2), var(--bezel-1));
    border: 1px solid #4a4540; border-radius: 1px; position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.5);
}
.floppy::before {
    content: ''; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 2px; background: #0a0a0a; border-radius: 1px;
}

/* ── pages ───────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.h-card-hidden { display: none; }
::selection { background: var(--ink); color: var(--paper); }

/* ── SVD puzzle terminal ─────────────────────────────────────────────────── */
.terminal-puzzle {
    background: var(--terminal-bg); color: var(--terminal-text);
    padding: 16px; border: 2px solid #333;
    font-family: var(--mono); font-size: 13px;
    margin-top: 8px; border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}
.terminal-puzzle h3 { color: #a0ffa0; font-family: var(--pixel); font-size: 18px; margin-bottom: 10px; letter-spacing: 0.5px; }
.lede { font-size: 11.5px; color: #70a070; line-height: 1.65; margin-bottom: 14px; }
.puzzle-math {
    font-family: var(--mono); font-size: 12px; color: #608060;
    background: rgba(0,0,0,0.35); padding: 8px 12px; margin: 10px 0;
    border-left: 2px solid #2a5a2a; white-space: pre;
    letter-spacing: 0.04em; line-height: 1.5;
}
.matrix-stage {
    width: 100%; height: 220px; display: block; margin: 10px 0;
    border: 1px solid #2a2a2a; border-radius: 2px; background: #111;
}
.puzzle-readout {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px;
    margin: 10px 0; padding: 8px 0;
    border-top: 1px solid #2a2a2a; border-bottom: 1px solid #2a2a2a;
}
.k { color: #507050; font-size: 11px; font-family: var(--mono); letter-spacing: 0.03em; }
.v { color: var(--terminal-text); font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; }
.highlight { color: var(--accent) !important; }
.warning   { color: var(--danger)  !important; }
.puzzle-input-group { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; flex-wrap: wrap; }
.puzzle-input-group label { color: #70a070; font-family: var(--mono); font-size: 12px; min-width: 10px; }
.matrix-input {
    width: 54px; background: #0a0a0a; border: 1px solid #3a3a3a;
    color: var(--terminal-text); font-family: var(--mono); font-size: 13px;
    padding: 3px 6px; text-align: center; -moz-appearance: textfield;
}
.matrix-input::-webkit-inner-spin-button,
.matrix-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.matrix-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kbd-hints { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: #3a5a3a; margin: 4px 0 10px; user-select: none; }
.kbd-hints kbd { background: #111; border: 1px solid #333; border-radius: 2px; padding: 0 4px; font-family: var(--mono); font-size: 10px; color: #609060; }
.btn {
    font-family: var(--pixel); background: #111; color: #609060;
    border: 1px solid #3a3a3a; padding: 3px 12px; cursor: pointer;
    font-size: 13px; letter-spacing: 0.5px;
    transition: background 80ms, color 80ms, border-color 80ms;
}
.btn:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.puzzle-reward {
    margin-top: 12px;
    padding: 0;
    background: transparent;
    border: none;
}
.puzzle-reward-text {
    font-family: var(--mono); font-size: 11.5px;
    color: var(--terminal-text); line-height: 1.75;
    background: rgba(0,50,15,0.4);
    border: 1px solid #2a5a2a;
    padding: 10px 12px;
}

/* ── cyberdeck sign page ─────────────────────────────────────────────────── */
.cyber-sign {
    background: #0b0b0f;
    border: 1px solid #00aa44;
    box-shadow: 0 0 12px rgba(0,170,68,0.2);
    padding: 16px;
    border-radius: 4px;
    font-family: var(--mono);
    margin-top: 8px;
}
.sign-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #2a5a2a;
    margin-bottom: 12px;
    padding-bottom: 6px;
}
.sign-glitch {
    font-family: var(--pixel);
    font-size: 20px;
    color: #00dd55;
    text-shadow: 0 0 3px #00aa44;
    letter-spacing: 2px;
    animation: glitchPulse 2s infinite;
}
@keyframes glitchPulse {
    0%,100% { opacity: 1; text-shadow: 0 0 2px #00aa44; }
    50%      { opacity: 0.9; text-shadow: 0 0 6px #00ff88; }
}
.sign-sub {
    font-size: 10px;
    color: #507050;
    align-self: flex-end;
}
.falling-zone {
    position: relative;
    height: 60px;
    margin-bottom: 16px;
    background: #030303;
    border: 1px solid #1a2a1a;
    overflow: hidden;
}
.falling-equation {
    position: absolute;
    top: -20px;
    left: 10%;
    color: #a0ffa0;
    font-family: var(--mono);
    font-size: 12px;
    white-space: nowrap;
    background: #111;
    padding: 2px 8px;
    border-left: 2px solid #00aa44;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}
.falling-equation.fall {
    animation: fallLinear 1.2s ease-in forwards;
}
@keyframes fallLinear {
    0%   { top: -20px; opacity: 1; transform: rotate(0deg); }
    70%  { opacity: 1; }
    100% { top: 100%;  opacity: 0; transform: rotate(2deg); }
}
.falling-equation.secret {
    color: #80ff80;
    border-left-color: #ffff80;
    text-shadow: 0 0 4px #88ff88;
}
.equation-log-container {
    max-height: 200px;
    overflow-y: auto;
    margin: 12px 0;
    background: #050505;
    border: 1px solid #1e2a1e;
    padding: 8px;
}
.log-header {
    font-family: var(--pixel);
    font-size: 12px;
    color: #60b060;
    margin-bottom: 6px;
}
.equation-log {
    list-style: none;
    font-family: var(--mono);
    font-size: 11px;
    color: #c0f0c0;
}
.equation-log li {
    padding: 3px 0;
    border-bottom: 0.5px solid #1a2a1a;
    word-break: break-all;
}
.sign-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0a0a0a;
    border: 1px solid #2a4a2a;
    padding: 6px 10px;
}
.prompt {
    color: #00aa44;
    font-family: var(--pixel);
    font-size: 18px;
}
.cyber-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #c0f0c0;
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
}
.cyber-btn {
    background: #0a1a0a;
    border: 1px solid #2a5a2a;
    color: #00aa44;
    font-family: var(--pixel);
    font-size: 16px;
    padding: 2px 10px;
    cursor: pointer;
    transition: all 0.1s;
}
.cyber-btn:hover {
    background: #00aa44;
    color: #050505;
    border-color: #aaffaa;
}

/* ── project pages ───────────────────────────────────────────────────────── */
.project-back {
    display: inline-block;
    font-family: var(--pixel); font-size: 14px;
    color: var(--ink-soft); cursor: pointer;
    margin-bottom: 18px; padding: 2px 0;
    letter-spacing: 0.3px;
    opacity: 0.65; transition: opacity 120ms, color 120ms;
    border: none; background: transparent;
}
.project-back:hover { opacity: 1; color: var(--accent); }
.project-page-title {
    font-family: var(--pixel); font-size: 19px;
    color: var(--ink); line-height: 1.3;
    margin-bottom: 12px; letter-spacing: 0.3px;
}
.project-page-tags {
    display: flex; flex-wrap: wrap; gap: 5px;
    margin-bottom: 14px;
}
.project-page-tag {
    font-family: var(--pixel); font-size: 12px;
    color: var(--ink-soft); border: 1px solid var(--rule);
    padding: 1px 6px; border-radius: 1px;
}
.project-page-status {
    font-family: var(--pixel); font-size: 12px;
    padding: 1px 8px; border-radius: 1px;
}
.project-page-status.done { color: var(--accent); border: 1px solid var(--accent); }
.project-page-status.wip  { color: #c08030;       border: 1px solid #8a5a20; }
.project-page-stack {
    font-family: var(--mono); font-size: 11px;
    color: var(--ink-soft); margin-bottom: 14px;
    padding: 5px 10px;
    border-left: 2px solid var(--rule);
    background: var(--paper-2);
}
.project-page-code {
    font-family: var(--mono); font-size: 11.5px;
    color: #b0ffb0; background: var(--terminal-bg);
    border: 1px solid #333; border-radius: 2px;
    padding: 12px 14px; margin: 12px 0 16px;
    white-space: pre; overflow-x: auto;
    line-height: 1.5; letter-spacing: 0.03em;
}
.project-page-body {
    font-family: var(--mono); font-size: 12.5px;
    color: var(--ink); line-height: 1.75;
}
.project-page-body p { margin-bottom: 12px; }
.project-github {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 18px; padding: 4px 14px;
    border: 1px solid var(--rule); border-radius: 2px;
    font-family: var(--pixel); font-size: 14px;
    color: var(--ink); text-decoration: none;
    background: var(--paper-2);
    transition: background 80ms, border-color 80ms, color 80ms;
}
.project-github:hover {
    background: var(--ink); color: var(--paper);
    border-color: var(--ink);
}
.entry[data-project] .row { cursor: pointer; }
.entry[data-project]:hover { background: rgba(0,0,0,0.04); }
.entry[data-project]:hover .expand-hint { opacity: 0.9; }

/* ── p5 generative sketches ──────────────────────────────────────────────── */
.sketch-p5-container {
    width: 100%; height: 260px;
    display: block; overflow: hidden;
    background: #050505;
    border: 1px solid #2a2a2a; border-radius: 2px;
    margin: 6px 0 10px;
}
.sketch-p5-container canvas { display: block !important; }

/* Torpid Cabinet featured hero */
.p5-featured .sketch-p5-container {
    height: 340px;
    border-color: #3a3a3a;
    box-shadow: 0 0 18px rgba(0,0,0,0.7);
}
.p5-featured > .project-detail { padding-left: 4px; }
.p5-featured .row .label {
    font-size: 16px;
    color: var(--accent);
    letter-spacing: 0.5px;
}

/* code viewer toggle + pre */
.sketch-code-panel { margin: 2px 0 10px; }
.sketch-code-toggle {
    background: none; border: none;
    font-family: var(--pixel); font-size: 13px;
    color: var(--ink-soft); cursor: pointer;
    padding: 0; opacity: 0.55;
    transition: opacity 120ms, color 120ms;
}
.sketch-code-toggle:hover { opacity: 1; color: var(--accent); }
.sketch-code-pre {
    font-family: var(--mono); font-size: 10.5px;
    color: #b0ffb0; background: #060606;
    border: 1px solid #222; border-radius: 2px;
    padding: 10px 12px; margin-top: 6px;
    white-space: pre; overflow-x: auto;
    line-height: 1.5; letter-spacing: 0.02em;
    max-height: 260px; overflow-y: auto;
}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
    body { padding: 12px 8px; }
    .mac { padding: 14px 14px 0; border-radius: 14px 14px 18px 18px; }
    .bezel { padding: 10px; }
    .screen { min-height: 500px; }
    .window { margin: 6px; }
    .body { padding: 16px 14px 12px; font-size: 12.5px; }
    .hero { font-size: 26px; min-height: 30px; }
    .nav { font-size: 13px; }
    .row { grid-template-columns: 78px 1fr; gap: 10px; }
    .row .tag { display: none; }
    .expand-hint { display: none; }
    .puzzle-readout { grid-template-columns: 1fr; }
    .matrix-stage { height: 160px; }
    .sketch-canvas { height: 140px; }
}

@media (prefers-reduced-motion: reduce) {
    .caret, .glitch { animation: none; }
    .crt-shutdown, .crt-startup, .glitch.vanishing { animation: none; }
    .expand-hint { transition: none; }
}

@media print {
    body { background: white; padding: 0; }
    .mac, .bezel, .window { box-shadow: none; border: none; background: white; }
    .vents, .chin, .menubar, .titlebar, .statusbar, .glitch, .nav { display: none; }
    .body { overflow: visible; }
    .page { display: block !important; }
    .book-thoughts, .project-detail { display: block !important; }
}
