@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url(/assets/fonts/jetbrains-mono-400.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url(/assets/fonts/jetbrains-mono-500.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap; src: url(/assets/fonts/jetbrains-mono-700.woff2) format('woff2'); }

/* 3270 palette: green for content, turquoise for ISPF chrome, yellow for highlights. */
:root {
  --bg: #0b0d0c;
  --fg: #e6ebe8;
  --muted: #8a948f;
  --faint: #151917;
  --line: #262c29;
  --accent: #5cf2a0;
  --accent-ink: #06130c;
  --cyan: #5fd7e6;
  --yellow: #f0d878;
  --error: #ff8f8f;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8f6;
    --fg: #121614;
    --muted: #5d6762;
    --faint: #eceeea;
    --line: #d6dbd5;
    --accent: #0a8a4a;
    --accent-ink: #ffffff;
    --cyan: #0b7686;
    --yellow: #8a6a00;
    --error: #b42318;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0 auto;
  max-width: 82rem;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font: 400 .875rem/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
::selection { background: var(--accent); color: var(--accent-ink); }
h1, h2 { line-height: 1.15; }

/* top nav */
.top { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0 .75rem; }
.brand { text-decoration: none; font-weight: 700; }
.brand span { color: var(--accent); }
.top nav { display: flex; gap: 1.25rem; align-items: center; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--fg); }
.top .lang { border: 1px solid var(--line); border-radius: 3px; padding: 0 .45rem; font-size: .75rem; }

/* ISPF chrome (decorative) */
.ispf { color: var(--cyan); user-select: none; border-top: 1px solid var(--line); }
.actionbar { display: flex; gap: 2.25ch; padding: .35rem 0; border-bottom: 1px dashed var(--line); overflow: hidden; white-space: nowrap; }
.actionbar span { cursor: default; }
.actionbar span::first-letter { text-decoration: underline; }
.panel-id { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0 0; white-space: nowrap; overflow: hidden; }
.panel-id span:nth-child(2) { color: var(--fg); overflow: hidden; text-overflow: ellipsis; }
.msg { transition: color .15s; }
.msg.on { color: var(--yellow); font-weight: 700; }
.cmd { display: flex; align-items: baseline; gap: 1ch; padding: .15rem 0 .5rem; white-space: nowrap; }
.cmd-line { flex: 1; border-bottom: 1px solid var(--line); height: 1em; }

/* footer: disclaimer + PF keys */
footer { padding: .5rem 0 1rem; color: var(--muted); font-size: .75rem; }
footer p { margin: 0; }
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1.5rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.disclaimer { font-style: italic; }
.pfkeys { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 2.25ch; padding-top: .5rem; border-top: 1px dashed var(--line); color: var(--cyan); }
.pfkeys button { all: unset; cursor: pointer; white-space: nowrap; user-select: none; }
.pfkeys button:hover, .pfkeys button:focus-visible { color: var(--fg); text-decoration: underline; }
/* Easter egg: same colour as the background, only visible when selected. */
.egg { margin-left: auto; color: var(--bg); text-shadow: none !important; white-space: nowrap; }

/* home grid */
.grid { display: grid; gap: 1rem; padding: 1rem 0; }
.box { position: relative; border: 1px solid var(--line); border-radius: 4px; padding: 1.1rem 1rem .9rem; min-height: 0; }
.box h2 {
  position: absolute; top: -.6em; left: .75rem; margin: 0; padding: 0 .5ch;
  background: var(--bg); color: var(--yellow); font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
}
.hero { padding: .5rem 0; }
.prompt { color: var(--muted); margin: 0 0 .75rem; }
.ps1 { color: var(--accent); }
.cursor { display: inline-block; width: .6em; height: 1.1em; margin-left: .2em; vertical-align: -.2em; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); font-weight: 700; letter-spacing: -.04em; margin: 0 0 .5rem; }
.tagline { font-size: 1rem; margin: 0 0 1rem; color: var(--accent); }
.about { color: var(--muted); margin: 0; }

.links, .projects, .posts { list-style: none; margin: 0; padding: 0; }
.links a { display: grid; grid-template-columns: 10ch 1fr auto; gap: 1ch; padding: .4rem 0; border-bottom: 1px dashed var(--line); text-decoration: none; }
.links li:last-child a { border-bottom: 0; }
.links .v { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrow { color: var(--muted); transition: transform .15s; display: inline-block; }
a:hover .arrow { color: var(--accent); transform: translate(2px, -2px); }

.projects { display: grid; gap: .6rem; }
.projects a { display: block; text-decoration: none; padding: .1rem 0; }
.projects .name { display: block; font-weight: 700; }
.projects .desc { display: block; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.projects a:hover .name { color: var(--accent); }

.posts a { display: grid; grid-template-columns: 11ch 1fr; column-gap: 1ch; padding: .35rem 0; text-decoration: none; }
.posts time { grid-row: span 2; color: var(--muted); }
.posts .summary { color: var(--muted); font-size: .8rem; }
.posts a:hover .title { color: var(--accent); }
.more { margin: .5rem 0 0; }
.more a { color: var(--cyan); text-decoration: none; }

/* contact */
.intro { color: var(--muted); margin: 0 0 .75rem; font-size: .8rem; }
.contact { display: grid; gap: .55rem; }
.contact .row { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.contact label { display: grid; gap: .2rem; font-size: .75rem; color: var(--muted); }
input {
  font: inherit; color: var(--fg); background: var(--faint); width: 100%;
  border: 0; border-bottom: 1px solid var(--accent); border-radius: 0; padding: .35rem .5rem;
}
input:focus { outline: none; background: var(--line); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
button, .button {
  justify-self: start; display: inline-block; cursor: pointer;
  font: 700 .8rem/1 var(--mono); padding: .6rem .9rem; border: 0; border-radius: 3px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
button:hover, .button:hover { filter: brightness(1.08); color: var(--accent-ink); }
button:disabled { opacity: .6; cursor: progress; }
.status { margin: 0; min-height: 1.1em; font-size: .75rem; color: var(--error); }
.status:empty { display: none; }
.fine { margin: 0; font-size: .7rem; color: var(--muted); }
.contact-done p { margin: 0 0 .75rem; }

/* F9 swap highlight */
.box { transition: border-color .15s, box-shadow .15s; }
.box.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px -6px var(--accent); }
.box.active h2 { color: var(--accent); }

/* one screen, no scroll, on desktop-sized viewports */
@media (min-width: 960px) {
  .grid { grid-template-columns: 1.1fr 1fr 1fr; grid-template-rows: auto auto; align-items: start; }
  .hero { grid-row: span 2; padding-right: 1.5rem; }
}
@media (min-width: 960px) and (min-height: 640px) {
  body.screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.screen main { flex: 1; min-height: 0; display: flex; }
  body.screen .grid { flex: 1; align-content: center; grid-template-rows: 1fr 1fr; align-items: stretch; }
  body.screen .hero { align-self: center; }
}
@media (max-width: 560px) {
  .contact .row { grid-template-columns: 1fr; }
  .actionbar { gap: 1.5ch; }
}

/* inner pages (posts) */
main > section, main > article { max-width: 46rem; margin: 0 auto; }
.page-title { font-size: 2rem; letter-spacing: -.03em; margin: 1.5rem 0 .5rem; }
.lead { color: var(--muted); margin: 0 0 1.5rem; }
.post { padding: 1.5rem 0 2rem; }
.back { margin: 0 0 1.5rem; }
.back a { color: var(--cyan); text-decoration: none; }
.post header time { color: var(--muted); }
.post h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); letter-spacing: -.03em; margin: .4rem 0 .75rem; }
.translated { margin: 0; }
.translated a { color: var(--accent); text-decoration: none; }
.prose { margin-top: 2rem; font-size: .925rem; line-height: 1.75; }
.prose h2 { font-size: 1.05rem; color: var(--yellow); margin: 2.25rem 0 .75rem; }
.prose strong { color: var(--accent); font-weight: 500; }
.prose blockquote { margin: 1.5rem 0; padding: .1rem 1.1rem; border-left: 2px solid var(--accent); color: var(--muted); }
.prose code { background: var(--faint); padding: .1em .35em; border-radius: 3px; }
.prose pre { background: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 1rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose li { margin: .3rem 0; }
.post > .disclaimer { display: block; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.hero .about + p { margin-top: 1rem; }

/* F1 help panel */
.help { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 1rem; background: rgb(0 0 0 / .6); }
.help[hidden] { display: none; }
.help-panel { width: min(40rem, 100%); max-height: 100%; overflow: auto; background: var(--bg); border: 1px solid var(--cyan); border-radius: 4px; padding: 1rem 1.25rem; box-shadow: 0 20px 60px rgb(0 0 0 / .5); }
.help-head { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; padding-bottom: .5rem; border-bottom: 1px dashed var(--line); color: var(--cyan); }
.help-head span:last-child { color: var(--fg); }
.help dl { display: grid; grid-template-columns: 5ch 1fr; gap: .35rem 1ch; margin: 1rem 0; }
.help dt { color: var(--cyan); }
.help dd { margin: 0; }
.help-tip { color: var(--yellow); font-size: .8rem; }
.help-foot { margin: 1rem 0 0; padding-top: .5rem; border-top: 1px dashed var(--line); }
.help-foot button { all: unset; cursor: pointer; color: var(--cyan); }
.help-foot button:hover, .help-foot button:focus-visible { color: var(--fg); text-decoration: underline; }

/* F2 split screen: second session in the bottom half */
body.split { height: auto !important; overflow: visible !important; padding-bottom: 50vh; }
.split-pane { position: fixed; left: 0; right: 0; bottom: 0; height: 50vh; z-index: 10; background: var(--bg); display: flex; flex-direction: column; }
.split-bar { height: 0; border-top: 2px dashed var(--cyan); }
.split-pane iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }

/* F10 3270 mode: green phosphor, scanlines */
body.crt {
  --bg: #020a04; --fg: #4dff7a; --muted: #2bb552; --faint: #06170b; --line: #0e3a1a;
  --accent: #8dffab; --accent-ink: #020a04; --cyan: #5fe8f0; --yellow: #f5e26b; --error: #ff6b6b;
  color-scheme: dark;
  text-shadow: 0 0 2px currentColor, 0 0 8px rgb(77 255 122 / .35);
}
body.crt::after {
  content: ''; position: fixed; inset: 0; z-index: 30; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgb(0 0 0 / .28) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgb(0 0 0 / .55));
}
body.crt .button, body.crt button:not(.pfkeys button):not(.help-foot button) { text-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  html { scroll-behavior: auto; }
}

/* Satan the ASCII cat */
.cat { all: unset; position: relative; display: inline-block; cursor: pointer; margin: 0 0 .5rem; color: var(--accent); -webkit-tap-highlight-color: transparent; }
.cat pre { margin: 0; font: 500 .9rem/1.15 var(--mono); white-space: pre; user-select: none; }
.cat:hover pre { color: var(--fg); }
.cat:focus-visible { outline: 1px dashed var(--cyan); outline-offset: 4px; }
.cat .bubble { position: absolute; left: calc(100% + .75ch); top: .1rem; white-space: nowrap; font-size: .75rem; color: var(--yellow); opacity: 0; transition: opacity .15s; }
.cat .bubble.on { opacity: 1; }
.cat .heart { position: absolute; top: 0; color: #ff6b9a; pointer-events: none; animation: heart 1.1s ease-out forwards; }
@keyframes heart { from { transform: translateY(0) scale(.8); opacity: 1; } to { transform: translateY(-2.5rem) scale(1.3); opacity: 0; } }
.cat.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
