/* IAN-86: a retro computer in a dark room whose screen lists and runs the projects */
:root {
    /* Fonts */
    --font-screen: 'VT323', ui-monospace, 'Courier New', monospace;
    --font-body: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --font-text: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    /* Room */
    --bg: #0b0a08;
    --ink: #e8e0cc;
    --ink-soft: #c9c1ad;
    --muted: #9d937f;
    --line: rgba(232, 224, 204, 0.12);

    /* Amber phosphor */
    --phosphor: #ffb641;
    --phosphor-rgb: 255 182 65;
    --screen-bg: #130d04;

    /* Case plastic, kept a little dim: the lights are off */
    --case-hi: #d3c8ab;
    --case: #bfb293;
    --case-lo: #a19476;
    --case-shade: #6f6552;

    /* Layout */
    --column: 760px;
    --screen-virtual-width: 1280;
}

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

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 620px at 50% 30%, rgb(var(--phosphor-rgb) / 0.08), transparent 70%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    font-variant-ligatures: none;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--phosphor);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Layout: one centred column, the width of the computer */
.page {
    width: 100%;
    max-width: calc(var(--column) + 4rem);
    margin: 0 auto;
    padding: 2rem 2rem 3.5rem;
}

/* Page title, centred above the computer */
.masthead {
    margin-bottom: 1.75rem;
    text-align: center;
}

.page-title {
    font-family: var(--font-screen);
    font-weight: 400;
    font-size: 56px;
    line-height: 1;
    letter-spacing: 0.06em;
    color: var(--phosphor);
    text-shadow:
        0 0 2px rgb(var(--phosphor-rgb) / 0.9),
        0 0 18px rgb(var(--phosphor-rgb) / 0.45);
}

/* Profile links, centred below the computer */
.profiles {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 1.75rem;
}

.profile {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 18px;
    transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.profile svg {
    width: 38px;
    height: 38px;
    fill: currentColor;
}

.profile:hover {
    color: var(--phosphor);
    border-color: rgb(var(--phosphor-rgb) / 0.6);
    box-shadow: 0 0 24px -6px rgb(var(--phosphor-rgb) / 0.6);
    transform: translateY(-2px);
}

/* The computer */
.computer-wrap {
    width: 100%;
}

.computer-wrap::after {
    content: "";
    display: block;
    width: 92%;
    height: 28px;
    margin: -8px auto 0;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent);
}

.computer {
    position: relative;
    padding: 5.5% 5.5% 0;
    border-radius: 26px 26px 14px 14px;
    background: linear-gradient(180deg, var(--case-hi) 0%, var(--case) 40%, var(--case-lo) 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.45),
        inset 0 -3px 0 rgba(0, 0, 0, 0.14),
        0 40px 80px -24px rgba(0, 0, 0, 0.85),
        0 0 140px -20px rgb(var(--phosphor-rgb) / 0.2);
}

.tube {
    padding: 2.4%;
    border-radius: 30px / 34px;
    background: linear-gradient(180deg, #2c2821, #4a443a);
    box-shadow:
        inset 0 6px 14px rgba(0, 0, 0, 0.7),
        0 2px 0 rgba(255, 255, 255, 0.35),
        0 -1px 0 rgba(0, 0, 0, 0.25);
}

.screen {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 22px / 26px;
    background:
        radial-gradient(ellipse at 50% 45%, rgb(var(--phosphor-rgb) / 0.07), transparent 70%),
        var(--screen-bg);
    container-type: inline-size;
    isolation: isolate;
}

/* The screen's project menu */
.terminal {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    padding: 6% 7%;
    font-family: var(--font-screen);
    font-size: clamp(15px, 3.6cqi, 28px);
    line-height: 1.2;
    color: var(--phosphor);
    text-shadow:
        0 0 2px rgb(var(--phosphor-rgb) / 0.9),
        0 0 10px rgb(var(--phosphor-rgb) / 0.45);
}

.t-brand {
    font-size: 0.8em;
    letter-spacing: 0.12em;
    opacity: 0.65;
}

.t-title {
    margin: 0.5em 0 0.7em;
    font-weight: 400;
    font-size: 1.35em;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 0.45em;
    list-style: none;
}

/* Each project is a boxed button with a RUN tag (or a link with a CODE tag) */
.menu-item {
    display: flex;
    align-items: center;
    gap: 1em;
    width: 100%;
    padding: 0.35em 0.7em;
    font: inherit;
    color: inherit;
    text-align: left;
    text-shadow: inherit;
    text-decoration: none;
    background: rgb(var(--phosphor-rgb) / 0.05);
    border: 1px solid rgb(var(--phosphor-rgb) / 0.45);
    border-radius: 3px;
    cursor: pointer;
    animation: row-in 0.35s ease both;
    animation-delay: calc(var(--i) * 90ms + 250ms);
}

@keyframes row-in {
    from { opacity: 0; }
}

.menu-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.menu-name {
    font-size: 1.1em;
    line-height: 1.1;
}

.menu-tag {
    display: inline-block;
    margin-left: 0.4em;
    padding: 0 0.35em;
    border: 1px solid currentColor;
    font-size: 0.6em;
    letter-spacing: 0.08em;
    vertical-align: middle;
}

.menu-blurb {
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
}

.menu-run {
    flex: none;
    font-size: 0.9em;
    letter-spacing: 0.06em;
}

/* The selection bar (js/app.js moves it with the pointer and arrow keys) */
.menu-item.is-selected {
    color: var(--screen-bg);
    background: var(--phosphor);
    border-color: var(--phosphor);
    text-shadow: none;
    box-shadow: 0 0 18px rgb(var(--phosphor-rgb) / 0.35);
}

.menu-item.is-selected .menu-blurb {
    opacity: 0.85;
}

.menu-item:focus-visible {
    outline: 2px solid var(--phosphor);
    outline-offset: 3px;
}

/* Small screens: name and RUN only */
@container (max-width: 420px) {
    .menu-blurb {
        display: none;
    }
}

.t-status {
    margin-top: auto;
    font-size: 0.85em;
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* A blinking cursor while the menu waits for a pick */
.t-status.is-idle::after {
    content: "";
    display: inline-block;
    width: 0.55em;
    height: 0.95em;
    margin-left: 0.3em;
    vertical-align: -0.12em;
    background: var(--phosphor);
    box-shadow: 0 0 8px rgb(var(--phosphor-rgb) / 0.7);
    animation: blink 1.06s steps(1) infinite;
}

/* The running project: a back bar on top, then a desktop-sized iframe scaled
   down to fill the rest of the screen (js/app.js) */
.screen-app {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    visibility: hidden;
    background: #000;
}

.app-bar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    /* Wide side padding keeps the button clear of the screen's rounded corners */
    padding: 0.55em 1.4em 0.5em;
    font-family: var(--font-screen);
    font-size: clamp(14px, 3cqi, 22px);
    line-height: 1;
    color: var(--phosphor);
    text-shadow: 0 0 8px rgb(var(--phosphor-rgb) / 0.5);
    background: var(--screen-bg);
    border-bottom: 1px solid rgb(var(--phosphor-rgb) / 0.4);
}

.app-back {
    flex: none;
    padding: 0.3em 0.8em 0.25em;
    font: inherit;
    letter-spacing: 0.06em;
    color: var(--screen-bg);
    text-shadow: none;
    background: var(--phosphor);
    border: 0;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 0 0 14px rgb(var(--phosphor-rgb) / 0.45);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.app-back:hover {
    background: #ffc76a;
    box-shadow: 0 0 22px rgb(var(--phosphor-rgb) / 0.7);
}

.app-back:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* Pulse twice when a project opens, so the way back is easy to spot */
.screen.is-running .app-back {
    animation: back-pulse 0.9s ease-in-out 0.5s 2;
}

@keyframes back-pulse {
    50% { box-shadow: 0 0 0 5px rgb(var(--phosphor-rgb) / 0.35), 0 0 26px rgb(var(--phosphor-rgb) / 0.8); }
}

.app-title {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
}

.app-view {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.screen-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--screen-virtual-width) * 1px);
    height: 960px;  /* replaced by js/app.js to fill the area under the bar */
    border: 0;
    transform: scale(var(--screen-scale, 0.5));
    transform-origin: 0 0;
    background: #fff;
}

.screen.is-running .screen-app {
    visibility: visible;
}

.screen.is-running .terminal {
    visibility: hidden;
}

/* Glass: scanlines, a slow refresh band, curvature shading and glare */
.scanlines {
    position: absolute;
    inset: 0;
    z-index: 7;
    pointer-events: none;
    background: repeating-linear-gradient(180deg, transparent 0 2px, rgba(0, 0, 0, 0.24) 2px 3px);
}

.scanlines::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -20%;
    height: 18%;
    background: linear-gradient(180deg, transparent, rgb(var(--phosphor-rgb) / 0.06), transparent);
    animation: refresh-band 7s linear infinite;
}

@keyframes refresh-band {
    to { transform: translateY(700%); }
}

.screen.is-running .scanlines {
    opacity: 0.5;
}

.glass {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(120% 90% at 22% 8%, rgba(255, 255, 255, 0.09), transparent 45%);
    box-shadow:
        inset 0 0 70px rgba(0, 0, 0, 0.75),
        inset 0 0 14px rgba(0, 0, 0, 0.6);
}

.screen.is-running .glass {
    box-shadow:
        inset 0 0 36px rgba(0, 0, 0, 0.55),
        inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Chin: badge, vents and the drive */
.chin {
    display: flex;
    align-items: center;
    gap: 4%;
    padding: 3.2% 1% 3.8%;
}

.badge {
    display: inline-flex;
    flex-direction: column;
    flex: none;
    padding: 6px 10px 5px;
    line-height: 1;
    background: #1c1a16;
    border-radius: 4px;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.6),
        0 1px 0 rgba(255, 255, 255, 0.4);
}

.badge-name {
    font-family: var(--font-screen);
    font-size: 20px;
    letter-spacing: 0.08em;
    color: var(--phosphor);
    text-shadow: 0 0 6px rgb(var(--phosphor-rgb) / 0.5);
}

.badge-sub {
    margin-top: 3px;
    font-size: 7px;
    letter-spacing: 0.22em;
    color: var(--muted);
}

.vents {
    flex: 1;
    height: 22px;
    border-radius: 4px;
    background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 3px, transparent 3px 8px);
}

.drive {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    padding: 8px 10px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--case-lo), var(--case));
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.35),
        0 1px 0 rgba(255, 255, 255, 0.35);
}

.drive-slot {
    position: relative;
    display: block;
    width: 150px;
    height: 12px;
    overflow: hidden;
    border-radius: 3px;
    background: #15130f;
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.8);
}

.drive-disk {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 3px;
    height: 5px;
    border-radius: 1px;
    background: var(--disk-color, transparent);
    transform: translateY(10px);
    transition: transform 0.25s ease;
}

.computer.has-disk .drive-disk {
    transform: none;
}

.drive-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2e3a2d;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6);
}

.computer.has-disk .drive-led {
    background: #6dff7a;
    box-shadow: 0 0 8px #6dff7a;
}

.computer.is-loading .drive-led {
    animation: blink 0.2s steps(1) infinite;
}

.drive-eject {
    width: 26px;
    height: 12px;
    border: 0;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--case-hi), var(--case-lo));
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.drive-eject:disabled {
    cursor: default;
}

.drive-eject:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.foot {
    width: 70%;
    height: 16px;
    margin: 0 auto;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(180deg, var(--case-shade), #564e40);
}

/* Links for the project on screen */
.running {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.running a,
.running button {
    font: inherit;
    color: var(--ink);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgb(var(--phosphor-rgb) / 0.5);
    text-underline-offset: 4px;
}

.running a:hover,
.running button:hover {
    color: var(--phosphor);
}

/* Section labels */
.section-label {
    margin-bottom: 1rem;
    font-family: var(--font-screen);
    font-weight: 400;
    font-size: 22px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Professional summary */
.summary {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

.summary p {
    font-family: var(--font-text);
    font-size: 16.5px;
    line-height: 1.75;
    color: var(--ink-soft);
}

/* Technical skills, grouped as on the resume */
.skills {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

.skill-groups {
    display: grid;
    gap: 1.1rem;
}

.skill-group {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 1rem;
    align-items: baseline;
}

.skill-group dt {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    list-style: none;
}

.chips li {
    padding: 3px 10px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.noscript-list {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    list-style: none;
    font-family: var(--font-screen);
    font-size: 22px;
    color: var(--phosphor);
}

/* Footer */
.footer {
    padding: 1.6rem 2rem;
    text-align: center;
    font-family: var(--font-screen);
    font-size: 18px;
    letter-spacing: 0.04em;
    color: var(--muted);
    border-top: 1px solid rgb(var(--phosphor-rgb) / 0.12);
}

/* Responsive */
@media (max-width: 720px) {
    .page {
        padding: 1.25rem 1rem 2.5rem;
    }

    .page-title {
        font-size: 42px;
    }

    .profile {
        width: 62px;
        height: 62px;
        border-radius: 16px;
    }

    .profile svg {
        width: 32px;
        height: 32px;
    }

    .computer {
        border-radius: 18px 18px 10px 10px;
    }

    .tube {
        border-radius: 20px / 24px;
    }

    .screen {
        border-radius: 14px / 18px;
    }

    .terminal {
        padding: 5% 6%;
    }

    .badge-sub,
    .vents {
        display: none;
    }

    .chin {
        justify-content: space-between;
    }

    .drive-slot {
        width: 90px;
    }

    .summary p {
        font-size: 15.5px;
    }

    .skill-group {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
