@import url('https://fonts.cdnfonts.com/css/sf-mono');

:root {
    --text-font: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --terminal-input: #39ff14;
    color-scheme: dark;
    --paper: #121213;
    --ink: #deddd8;
    --link: #fff;
    --muted: #9d9b96;
    --rule: #303030;
    --image-frame: #242424;
}
html[data-theme='light'] {
    --terminal-input: #087b26;
    color-scheme: light;
    --paper: #fdfdfc;
    --ink: #292824;
    --link: #080808;
    --muted: #77746d;
    --rule: #e5e2db;
    --image-frame: #f1f1f1;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body {
    max-width: 480px;
    margin: 0 auto;
    padding: 72px 24px 60px;
    color: var(--ink);
    font-family: var(--text-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}
a { color: var(--link); font-weight: 450; text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--link); text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 0 0 46px;
}
.site-header h1 { display: flex; margin: 0; font-size: inherit; }
.site-header .name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -.2px;
}
.logo { display: block; width: 14px; height: 14px; }
.site-header .logo { width: 24px; height: 24px; }
#logo-light { display: none; }
html[data-theme='light'] #logo-light { display: block; }
html[data-theme='light'] #logo-dark { display: none; }
html[data-theme='light'] .project-mark { filter: invert(1); }
.site-header nav { display: flex; align-items: center; gap: 20px; font-size: 12px; }
.social-link { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex-shrink: 0; font-size: 12px; font-weight: 700; min-height: 24px; padding: 3px 7px; border-radius: 3px; background: var(--image-frame); line-height: 1.4; white-space: nowrap; }
.social-link:hover, .social-link:focus-visible { background: var(--rule); text-decoration: none; }
.site-header .social-link {
    position: fixed;
    right: calc(max(20px, env(safe-area-inset-right)) + 48px);
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 10;
    width: 40px;
    height: 40px;
    padding: 0;
}
.theme-toggle {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 10;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--paper);
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.theme-toggle svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle[hidden] { display: none; }
main { min-width: 0; }
h1 { font-size: 18px; line-height: 1.4; font-weight: 500; letter-spacing: -.2px; margin: 0 0 28px; }
h2 { font-size: 14px; font-weight: 600; margin: 34px 0 10px; line-height: 1.5; }
h3 { font-size: 14px; font-weight: 600; margin: 28px 0 8px; line-height: 1.5; }
p { margin: 0 0 20px; }
ul { padding-left: 24px; margin: 12px 0 24px; }
li { margin: 7px 0; }
.home h2 { margin-top: 32px; }
.terminal-intro { position: relative; cursor: text; }
.terminal-intro:focus { outline: none; }
.terminal-user-text, .terminal-intro[data-user-input] .terminal-source .terminal-caret { color: var(--terminal-input); }
.terminal-response { margin: 0 0 20px; font: inherit; color: var(--terminal-input); white-space: pre-wrap; }
.terminal-intro[data-effect='coffee'] .terminal-caret { animation: none; }
.terminal-command-menu {
    position: fixed;
    z-index: 70;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--rule);
    border-radius: 7px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 8px 28px #0003;
    font: 12px/1.5 var(--text-font);
}
.terminal-command-menu[hidden] { display: none; }
.terminal-command-menu button {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    padding: 9px 8px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.terminal-command-menu button:hover, .terminal-command-menu .is-selected { background: var(--image-frame); }
.terminal-command-menu button:focus-visible { outline-offset: -2px; }
.terminal-command-description { color: var(--muted); font-size: 11px; }
.terminal-matrix, .terminal-party { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; }
.terminal-game, .terminal-ascii { font-size: min(14px, 3vw); line-height: 1.4; white-space: pre; }
.terminal-game-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.terminal-game-controls button { min-width: 44px; min-height: 44px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.terminal-pong-score { display: block; }
.terminal-pong-board { display: block; position: relative; width: 28ch; height: 16.8em; contain: layout paint; }
.terminal-pong-paddle, .terminal-pong-ball { position: absolute; top: 0; left: 0; will-change: transform; }
.terminal-pong-player { left: 2ch; }
.terminal-pong-computer { left: 25ch; }
.terminal-intro[data-effect='pong'] .terminal-game-controls button { touch-action: none; user-select: none; }
.terminal-snake-board { display: block; position: relative; }
.terminal-snake-board .terminal-snake-head { position: absolute; width: 1ch; height: 1.4em; margin: 0; animation: none; }
.terminal-intro[data-effect='snake'] .terminal-game, .terminal-intro[data-effect='pong'] .terminal-game { font-size: min(14px, 3vw, 2.6dvh); }
.terminal-gravity { position: fixed; inset: 0; z-index: 60; overflow: hidden; background: var(--paper); touch-action: none; cursor: grab; user-select: none; }
.terminal-gravity:active { cursor: grabbing; }
.terminal-gravity-stars, .terminal-gravity-field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.terminal-gravity-word { position: absolute; left: 0; top: 0; white-space: pre; overflow: hidden; will-change: transform; transform-origin: center; }
.terminal-gravity-pointer { position: absolute; left: 0; top: 0; width: 56px; height: 56px; border: 1px solid var(--terminal-input); border-radius: 50%; opacity: 0; pointer-events: none; box-shadow: 0 0 28px color-mix(in srgb, var(--terminal-input) 30%, transparent); }
.terminal-gravity-ring { position: absolute; width: 20px; height: 20px; border: 1px solid var(--terminal-input); border-radius: 50%; pointer-events: none; animation: terminal-gravity-burst .8s ease-out forwards; }
@keyframes terminal-gravity-burst { from { transform: translate(-50%, -50%) scale(1); opacity: .8; } to { transform: translate(-50%, -50%) scale(18); opacity: 0; } }
.terminal-gravity-hud { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 24px); padding: 8px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: 11px/1.4 var(--text-font); cursor: default; }
.terminal-gravity-hud > span:nth-child(2) { min-width: 38px; color: var(--muted); }
.terminal-gravity-hud button { flex-shrink: 0; min-height: 44px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--image-frame); color: inherit; font: inherit; cursor: pointer; }
.terminal-scene { overflow: hidden; }
.terminal-scene > span { display: block; width: max-content; }
.terminal-source, .terminal-output { display: flow-root; }
.terminal-source > p:last-child, .terminal-output > p:last-child { margin-bottom: 0; }
.terminal-intro[data-typing] > .terminal-source { opacity: 0; }
.terminal-output { position: absolute; inset: 0; }
.terminal-output .terminal-caret { color: var(--ink); }
.terminal-output .social-link .terminal-caret { position: absolute; left: calc(100% - 7px); }
.terminal-output .project-list li:not([data-terminal-revealed]) .project-logo,
.terminal-output .social-link:not([data-terminal-revealed]),
.terminal-output .building-notes li:not([data-terminal-revealed])::before { visibility: hidden; }
.terminal-output .project-list li:not([data-terminal-revealed]),
.terminal-output .archive-year li:not([data-terminal-revealed]) { pointer-events: none; }
.terminal-intro[data-typing] .terminal-caret { animation: none; }
.terminal-caret {
    display: inline-block;
    width: .42em;
    height: 1.2em;
    margin-left: .12em;
    vertical-align: -.2em;
    background: currentColor;
    animation: terminal-caret-blink 1s step-end infinite;
}
@keyframes terminal-caret-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .terminal-caret { animation: none; }
}
.project-list { list-style: none; margin: 0 0 24px; padding: 0; }
.project-list li { margin: 0 0 13px; line-height: 1.45; }
.project-row { display: flex; align-items: flex-start; gap: 10px; }
.project-link { display: flex; align-items: flex-start; gap: 8px; }
.project-name { display: inline-flex; align-items: center; gap: 5px; }
.project-link:hover, .project-link:focus-visible { text-decoration: none; }
.project-list li:hover .project-domain, .project-list li:focus-within .project-domain { color: var(--ink); }
.project-logo { display: flex; align-items: center; justify-content: center; flex: 0 0 18px; height: 20px; }
.project-mark { display: block; width: 18px; height: auto; }
.project-icon { display: block; width: 16px; height: 16px; }
.project-domain { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.building-notes { list-style: none; padding-left: 20px; }
.building-notes li { position: relative; }
.building-notes li::before { content: '⡢'; position: absolute; left: -20px; top: -.25em; }
.home-writing { margin-top: 48px; }
.home-writing > h2 { margin: 0 0 24px; }
.archive-year { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 22px; margin: 0 0 25px; }
.archive-year h3 { color: var(--muted); font-size: 12px; font-weight: 400; margin: 12px 0 0; }
.archive-year ul { list-style: none; margin: 0; padding: 0; }
.archive-year li { margin: 0 0 13px; line-height: 1.45; }
.archive-year time { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.project-list li, .home-writing .archive-year li {
    position: relative;
    padding: 8px;
    margin: 0 -9px 6px;
    border: 1px dashed transparent;
    cursor: pointer;
}
.project-list li:hover, .project-list li:focus-within,
.home-writing .archive-year li:hover, .home-writing .archive-year li:focus-within {
    border-color: var(--rule);
}
.project-link::after, .writing-link::after {
    content: '';
    position: absolute;
    inset: 0;
}
.project-list .social-link { position: relative; z-index: 1; }
.writing-link { display: block; }
.writing-link:hover, .writing-link:focus-visible { text-decoration: none; }
.home-writing .archive-year li:hover time, .home-writing .archive-year li:focus-within time {
    color: var(--ink);
}
.date { color: var(--muted); font-size: 11px; margin: -12px 0 28px; }
.article-navigation { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 12px; }
.contact { margin-top: 48px; }
@media (max-width: 560px) {
    body { padding: 36px 22px 40px; }
    .site-header { margin-bottom: 34px; }
    .archive-year { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; }
}
