/*
 * v4-pages.css — the v4 chrome for every page that isn't the homepage:
 * menu bar extras, the page heading, the command palette, the doom egg,
 * and /lab. Page-specific looks live in v4-people / v4-wall / v4-games.
 */

/* handwriting for sticky notes; only downloaded where it's used */
@font-face { font-family: 'Kalam'; src: url('/assets/fonts/kalam-400-latin.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Kalam'; src: url('/assets/fonts/kalam-400-latin-ext.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Kalam'; src: url('/assets/fonts/kalam-700-latin.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Kalam'; src: url('/assets/fonts/kalam-700-latin-ext.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Older page stylesheets (wall.css, runner.css) speak in these names. */
body.v4-page {
    --black: var(--v4-ink);
    --white: #fff;
    --bg-cream: var(--v4-cream);
    --paper-tint: var(--v4-cream-2);
    --paper-yellow: #fff7e0;
    --accent-yellow: var(--v4-yellow);
    --ink-rgb: 24, 38, 43;
    --font-mono: var(--v4-mono);
    --font-hand: 'Kalam', var(--v4-font);
    --font-sans: var(--v4-font);
    --yellow: var(--v4-yellow);
    --purple: #6c4cd8;
}

html[data-theme="night"] body.v4-page { --ink-rgb: 238, 241, 248; }

/* =========================== menu bar extras =========================== */

.v4-menus a[aria-current="page"] {
    padding: 2px 9px 3px;
    border-radius: 999px;
    background: var(--v4-yellow);
    color: #18262b;
    text-shadow: none;
    opacity: 1;
}

.v4-cmd {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 26px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .16);
    color: inherit;
    font: 600 .82rem var(--v4-mono);
    cursor: pointer;
}
.v4-cmd kbd { padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .2); font: 500 .68rem var(--v4-mono); }
.v4-cmd:hover { background: rgba(255, 255, 255, .28); }
.v4-menubar.is-solid .v4-cmd,
.v4-menubar.is-solid .v4-cmd kbd { background: rgba(24, 38, 43, .07); }
html[data-theme="night"] .v4-menubar.is-solid .v4-cmd,
html[data-theme="night"] .v4-menubar.is-solid .v4-cmd kbd { background: rgba(255, 255, 255, .1); }

.v4-menu-btn {
    display: none;
    height: 26px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    color: inherit;
    font: 600 .86rem var(--v4-font);
    cursor: pointer;
}
.v4-menubar.is-solid .v4-menu-btn { background: rgba(24, 38, 43, .08); }
html[data-theme="night"] .v4-menubar.is-solid .v4-menu-btn { background: rgba(255, 255, 255, .12); }

@media (max-width: 1100px) {
    .v4-menu-btn { display: inline-block; }
    .v4-cmd kbd { display: none; }

    /* the menus drop down as a little card */
    .v4-menus.is-open {
        position: fixed;
        top: 44px;
        right: 10px;
        display: grid;
        gap: 2px;
        min-width: 200px;
        padding: 8px;
        border-radius: 16px;
        background: rgba(255, 255, 255, .96);
        color: #18262b;
        text-shadow: none;
        box-shadow: 0 0 0 1px rgba(24, 38, 43, .1), 0 24px 40px -18px rgba(10, 30, 40, .5);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    .v4-menus.is-open a { padding: 10px 12px; border-radius: 10px; font-size: 1.05rem; }
    .v4-menus.is-open a:hover { background: var(--v4-cream); text-decoration: none; }
    .v4-menus.is-open a[aria-current="page"] { padding: 10px 12px; }
}

@media (max-width: 520px) {
    .v4-cmd { display: none; }
}

/* =========================== page heading =========================== */

.v4-page-main { padding-top: 36px; }

.v4-page-head {
    position: relative;
    max-width: 1240px;
    margin: 0 auto;
    padding: 90px 24px 50px;
}

.v4-page-head h1 {
    margin: 18px 0 16px;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 600;
    line-height: .98;
    letter-spacing: -.03em;
}

.v4-page-lead { max-width: 640px; margin: 0; color: var(--v4-muted); font-size: 1.22rem; line-height: 1.6; text-wrap: pretty; }
.v4-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 30px; }
.v4-page-note { color: var(--v4-muted); font: 500 .86rem var(--v4-mono); }
.v4-page-back { margin: 22px 0 0; }
.v4-page-back a { color: var(--v4-ink); font-weight: 600; text-decoration: none; }
.v4-page-back a:hover { text-decoration: underline; text-decoration-color: var(--v4-yellow); text-decoration-thickness: 3px; text-underline-offset: 4px; }

.v4-section-label {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px 16px;
    margin-bottom: 22px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--v4-line);
}
.v4-section-label h2 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.v4-section-label span { color: var(--v4-muted); font: 500 .8rem var(--v4-mono); }

@media (prefers-reduced-motion: no-preference) {
    .v4-page-head > * { animation: v4-rise .7s var(--v4-ease) both; }
    .v4-page-head > :nth-child(2) { animation-delay: .06s; }
    .v4-page-head > :nth-child(3) { animation-delay: .12s; }
    .v4-page-head > :nth-child(n+4) { animation-delay: .18s; }
}

@media (max-width: 700px) {
    .v4-page-head { padding: 64px 18px 36px; }
    .v4-page-lead { font-size: 1.08rem; }
}

/* =========================== command palette =========================== */

.command-palette,
.doom-easter { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 20px; }
.command-palette[hidden],
.doom-easter[hidden] { display: none !important; }

.palette-backdrop,
.doom-backdrop { position: absolute; inset: 0; border: 0; background: rgba(10, 18, 24, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.palette-terminal {
    position: relative;
    z-index: 2;
    width: min(640px, calc(100vw - 28px));
    border-radius: 16px;
    background: #0f1216;
    color: #e9ece8;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 40px 80px -30px rgba(0, 0, 0, .7);
    overflow: hidden;
}
.palette-terminal:focus { outline: none; }

.palette-titlebar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 38px;
    padding: 0 12px;
    background: linear-gradient(180deg, #2a2d33, #222429);
    color: #b8bcc4;
    font: 500 .8rem var(--v4-mono);
}
.palette-titlebar strong { justify-self: center; font-weight: 500; }
.palette-dots { display: flex; gap: 7px; }
.palette-dots span { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.palette-dots span:nth-child(2) { background: #febc2e; }
.palette-dots span:nth-child(3) { background: #28c840; }
.palette-esc { justify-self: end; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, .08); font-size: .7rem; }

.palette-body { min-height: 300px; padding: 22px 24px 26px; font: 500 .92rem/1.7 var(--v4-mono); }
.palette-body p { margin: 0; }
.palette-muted { color: #7a828c; }
.palette-user { color: #8cd3ff; }
.palette-success { margin: 6px 0 16px !important; color: #7fe2a8; }
.palette-body label { display: block; margin-top: 12px; color: var(--v4-yellow); font-weight: 600; }
.palette-input-row { display: flex; align-items: center; gap: 10px; color: var(--v4-yellow); }
.palette-input-row input { flex: 1; min-width: 0; padding: 6px 0; border: 0; outline: 0; background: transparent; color: #fff; caret-color: var(--v4-yellow); font: inherit; }
.palette-input-row input::placeholder { color: #4f5660; }
.palette-hint { margin-top: 10px !important; color: #6e7782; font-size: .8rem; }
.palette-hint button { padding: 0; border: 0; background: none; color: #a8c7fa; font: inherit; text-decoration: underline dotted; cursor: pointer; }
.palette-output { min-height: 24px; margin-top: 14px; color: #e9ece8; white-space: pre-wrap; }
.palette-output .is-command { color: #8c949e; }
.palette-output .is-error { color: #ff8a80; }
.palette-terminal.is-shaking { animation: v4-shake .26s ease; }
@keyframes v4-shake { 25% { translate: -5px 0; } 50% { translate: 4px 0; } 75% { translate: -2px 0; } }
body.overlay-open,
html.overlay-open body { overflow: hidden; }

/* =========================== doom easter egg =========================== */

.doom-card {
    position: relative;
    z-index: 2;
    width: min(560px, calc(100vw - 28px));
    padding: 34px 28px 30px;
    border-radius: 22px;
    background: radial-gradient(80% 60% at 50% 30%, #3a0d0d, #120607 70%);
    color: #ffe9e4;
    text-align: center;
    box-shadow: 0 0 0 1px rgba(255, 90, 70, .3), 0 40px 80px -30px rgba(0, 0, 0, .8);
}
.doom-tape { display: none; }
.doom-code { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(255, 90, 70, .18); color: #ff8a70; font: 600 .75rem var(--v4-mono); }
.doom-portal { position: relative; display: grid; place-items: center; width: 150px; height: 150px; margin: 22px auto 18px; }
.doom-ring { position: absolute; inset: 0; border: 4px solid #ff5a46; border-radius: 50%; box-shadow: 0 0 24px rgba(255, 90, 70, .6); }
.doom-ring.r2 { inset: 14px; border-style: dashed; opacity: .7; }
.doom-ring.r3 { inset: 30px; opacity: .5; }
.doom-mascot-wrap { position: relative; z-index: 1; width: 82px; height: 82px; }
.doom-mascot { width: 100%; height: 100%; border-radius: 50%; filter: drop-shadow(0 0 14px rgba(255, 90, 70, .7)); }
.doom-card h2 { margin: 0; font-size: clamp(2rem, 6vw, 3rem); font-weight: 600; line-height: 1; }
.doom-card h2 em { color: #ff5a46; font-style: normal; }
.doom-card > p { margin: 10px 0 20px; color: #f1b9ad; }
.doom-close { padding: 10px 18px; border: 0; border-radius: 999px; background: #ff5a46; color: #fff; font: 600 .95rem var(--v4-font); cursor: pointer; }

@media (prefers-reduced-motion: no-preference) {
    .doom-ring.r1 { animation: v4-spin 6s linear infinite; }
    .doom-ring.r2 { animation: v4-spin 9s linear infinite reverse; }
}
@keyframes v4-spin { to { rotate: 360deg; } }

/* =========================== /lab =========================== */

.v4-lab { max-width: 1240px; margin: 0 auto; padding: 10px 24px 120px; }

.lab-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--v4-shadow-card);
    color: var(--v4-ink-2);
    font: 500 .85rem var(--v4-mono);
}
.lab-state[hidden] { display: none; }
.lab-state[data-state="error"] { background: #ffe1dc; color: #8c2a1c; }

.lab-retry { padding: 10px 18px; border: 0; border-radius: 999px; background: var(--v4-yellow); color: #18262b; font: 600 1rem var(--v4-font); cursor: pointer; }

.lab-workbench {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 26px;
    align-items: stretch;
}

.lab-project {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    background: #fbfaf7;
    color: #18262b;
    box-shadow: 0 1px 0 #fff inset, 0 0 0 1px rgba(24, 38, 43, .12), 0 24px 44px -26px rgba(10, 30, 40, .45);
    overflow: hidden;
    transition: transform .3s var(--v4-ease), box-shadow .3s ease, opacity .5s ease;
}
.lab-project--featured { grid-column: span 3; }
.lab-project:hover { transform: translateY(-4px); box-shadow: 0 1px 0 #fff inset, 0 0 0 1px rgba(24, 38, 43, .14), 0 34px 54px -26px rgba(10, 30, 40, .5); }

/* lab.js reveals the cards one by one */
@media (prefers-reduced-motion: no-preference) {
    .lab-project:not(.is-revealed) { opacity: 0; transform: translateY(18px); }
}

/* the visual: a browser bar, a file tab, or a sticky note */
.lab-browser-visual,
.lab-file-visual {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 14px;
    background: linear-gradient(180deg, #f4f2ec, #ebe7de);
    border-bottom: 1px solid rgba(24, 38, 43, .1);
}
.lab-browser-bar { font-size: 0; }
.lab-browser-bar::before {
    content: '';
    display: block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 18px 0 0 #febc2e, 36px 0 0 #28c840;
    margin-right: 36px;
}
.lab-browser-address {
    flex: 1;
    min-width: 0;
    padding: 4px 12px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(24, 38, 43, .1) inset;
    color: #5f6d70;
    font: 500 .78rem var(--v4-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lab-file-tab { padding: 3px 12px; border-radius: 8px 8px 0 0; background: #fff; box-shadow: 0 0 0 1px rgba(24, 38, 43, .1) inset; color: #3c4b50; font: 500 .8rem var(--v4-mono); }
.lab-file-lines { flex: 1; height: 8px; border-radius: 4px; background: repeating-linear-gradient(90deg, rgba(24, 38, 43, .12) 0 40px, transparent 40px 52px); }

.lab-sticky-visual {
    position: relative;
    margin: 22px 22px 0;
    padding: 22px 18px 18px;
    border-radius: 3px 3px 3px 14px;
    background: #fff4b8;
    box-shadow: 3px 6px 0 rgba(0, 0, 0, .1);
    font: 400 1.25rem/1.3 'Kalam', var(--v4-font);
    transform: rotate(-1.5deg);
}
.lab-sticky-tape { position: absolute; top: -9px; left: 50%; width: 64px; height: 18px; margin-left: -32px; background: rgba(255, 225, 150, .85); transform: rotate(-3deg); }

/* the two games get a painted banner under their browser bar */
.lab-project--featured .lab-browser-visual { border-bottom: 0; }
.lab-project--featured .lab-project-content {
    background:
        linear-gradient(180deg, rgba(251, 250, 247, 0) 0, rgba(251, 250, 247, .88) 150px, #fbfaf7 200px),
        var(--lab-art, none) top / 100% auto no-repeat;
    padding-top: 150px;
}
.lab-project--featured[data-featured-slot="1"] { --lab-art: url('/assets/v4/art/meadow-720.webp'); }
.lab-project--featured[data-featured-slot="2"] { --lab-art: url('/assets/v4/art/town-720.webp'); }

.lab-project-image { display: block; width: 100%; height: 180px; object-fit: cover; }

.lab-project-content { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 22px 22px 24px; }
.lab-project-number { color: #5f6d70; font: 500 .8rem var(--v4-mono); }
.lab-project-content h3 { margin: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.lab-project-content > p:not(.lab-project-status) { margin: 0; color: #5f6d70; font-size: 1.02rem; line-height: 1.6; }
.lab-project-status { margin: 0; color: #5f6d70; font: 500 .82rem var(--v4-mono); }
.lab-project-status strong { color: #1f6b38; font-weight: 600; }

.lab-project-stack { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.lab-project-stack li { padding: 4px 10px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px rgba(24, 38, 43, .12); color: #3c4b50; font: 500 .76rem var(--v4-mono); }

.lab-project-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 10px; }
.lab-project-link {
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(24, 38, 43, .14), 0 4px 10px -6px rgba(24, 38, 43, .3);
    color: #18262b;
    font-weight: 600;
    text-decoration: none;
}
.lab-project-link:hover { background: var(--v4-yellow-hi); }
.lab-project-link--play {
    background: linear-gradient(180deg, #ffe39b, var(--v4-yellow) 55%, var(--v4-yellow-lo));
    box-shadow: 0 2px 0 rgba(255, 255, 255, .8) inset, 0 0 0 1.5px rgba(150, 85, 0, .4), 0 10px 20px -10px rgba(220, 140, 0, .7);
}
.lab-project-link--play:hover { background: linear-gradient(180deg, #ffeab0, #ffcb5e 55%, var(--v4-yellow-lo)); }

@media (max-width: 980px) {
    .lab-workbench { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lab-project,
    .lab-project--featured { grid-column: span 1; }
}

@media (max-width: 640px) {
    .v4-lab { padding: 0 16px 90px; }
    .lab-workbench { grid-template-columns: 1fr; gap: 20px; }
}

/* bot traps stay out of sight and out of the tab order */
.terminal-honeypot {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* phones: the island sits beside the app icon so the right side stays free for buttons */
@media (max-width: 520px) {
    .v4-island { left: 44px; transform: none; }
}

/* ---------- nothing jumps while content loads ---------- */

.v4-lab { position: relative; }
.lab-state { position: absolute; }
.lab-workbench[aria-busy="true"] { min-height: 860px; }
