:root {
  --background: #2d2e2e;
  --panel: #2e2e2e;
  --paper: #fff;
  --text: #f4f4f4;
  --link: #999;
  --focus: #85aadf;
  --stage-width: 960px;
  --stage-height: 400px;
  --frame: 20px;
  --font: Arial, Helvetica, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--background);
}

body {
  color: var(--text);
  font: 13px/1.4 var(--font);
}

img {
  display: block;
  max-width: 100%;
  border: 0;
}

a {
  color: var(--link);
  font-weight: 700;
}

a:hover,
a:focus-visible {
  color: var(--text);
}

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

.skip-link {
  position: absolute;
  z-index: 10;
  top: -3rem;
  left: 1rem;
  padding: 0.5rem 0.75rem;
  color: #000;
  background: #fff;
}

.skip-link:focus {
  top: 1rem;
}

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

.page {
  width: min(100% - 2rem, 1040px);
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

/* The legacy banner is retained as visual art; real links sit over its old map areas. */
.site-header {
  position: relative;
  width: 690px;
  max-width: 100%;
  height: 145px;
  margin: 0 auto 1.1rem;
}

.banner,
.banner img {
  width: 100%;
  height: 100%;
}

.banner img {
  object-fit: fill;
}

.banner-nav {
  position: absolute;
  inset: 0;
}

.banner-link {
  position: absolute;
  display: block;
  text-decoration: none;
}

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

.banner-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.banner-link--logo {
  top: 0;
  left: 0;
  width: 57%;
  height: 100%;
}

.banner-link--home {
  top: 12%;
  left: 74%;
  width: 11%;
  height: 17%;
}

.banner-link--resume {
  top: 32%;
  left: 74%;
  width: 15%;
  height: 17%;
}

.banner-link--about {
  top: 53%;
  left: 74%;
  width: 18%;
  height: 17%;
}

.banner-link--contact {
  top: 75%;
  left: 74%;
  width: 21%;
  height: 18%;
}

/* One desktop stage size prevents page-to-page layout shifts. */
.content-card {
  width: min(100%, calc(var(--stage-width) + (var(--frame) * 2)));
  min-height: calc(var(--stage-height) + (var(--frame) * 2));
  margin: 0 auto;
  padding: var(--frame);
  background: var(--paper);
  border-radius: 5px;
}

.content-card--terminal {
  padding: var(--frame);
}

.content-card--unavailable {
  padding: var(--frame);
}

.content-card--not-found {
  padding: var(--frame);
}

.not-found {
  display: flex;
  width: var(--stage-width);
  max-width: 100%;
  min-height: var(--stage-height);
  padding: clamp(1.5rem, 4vw, 3.25rem);
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: var(--text);
  background: var(--panel);
}

.not-found-art {
  align-self: center;
  margin: 0;
  color: #f4f4f4;
  font: 900 clamp(1rem, 3vw, 2.75rem) / 0.95 var(--mono);
  letter-spacing: 0.08em;
  white-space: pre;
}

.not-found-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
}

.not-found-copy p {
  margin: 0;
  font-size: 16px;
}

.not-found-copy a {
  padding-bottom: 0.2rem;
  border-bottom: 2px solid currentColor;
  color: var(--text);
  text-decoration: none;
}

.not-found-copy a:hover,
.not-found-copy a:focus-visible {
  color: var(--active);
}

.work-unavailable {
  display: flex;
  width: var(--stage-width);
  max-width: 100%;
  height: var(--stage-height);
  padding: clamp(2rem, 6vw, 5rem);
  flex-direction: column;
  justify-content: center;
  color: var(--text);
  background: var(--panel);
}

.work-unavailable h1 {
  max-width: 16ch;
  margin: 0.2rem 0 1rem;
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  line-height: 1.05;
}

.work-unavailable p {
  max-width: 42ch;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.unavailable-status {
  color: var(--active);
  font: 12px/1.2 var(--mono) !important;
  letter-spacing: 0.08em;
}

.unavailable-action {
  width: fit-content;
  margin-top: 1.5rem;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid currentColor;
  color: var(--text);
  text-decoration: none;
}

.unavailable-action:hover,
.unavailable-action:focus-visible {
  color: var(--active);
}

.terminal {
  --term-bg: #151816;
  --term-surface: #1d211e;
  --term-border: #343936;
  --term-text: #d4d4d4;
  --term-muted: #9aa69d;
  --term-accent: #8ecf9b;
  --term-error: #db9b9b;
  display: flex;
  width: var(--stage-width);
  max-width: 100%;
  height: var(--stage-height);
  flex-direction: column;
  overflow: auto;
  color: var(--term-text);
  background: var(--term-bg);
  font: 14px/1.55 var(--mono);
  cursor: text;
}

.terminal[data-theme="amber"] {
  --term-bg: #1b1710;
  --term-surface: #242016;
  --term-border: #4b4025;
  --term-text: #f0dfb3;
  --term-muted: #c7b887;
  --term-accent: #f5c869;
  --term-error: #e49d7b;
}

.terminal[data-theme="mono"] {
  --term-bg: #161616;
  --term-surface: #202020;
  --term-border: #414141;
  --term-text: #e2e2e2;
  --term-muted: #ababab;
  --term-accent: #fff;
  --term-error: #d7d7d7;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--term-border);
  color: var(--term-muted);
  background: var(--term-surface);
  font-size: 12px;
}

.terminal-header-actions {
  display: flex;
  gap: 0.9rem;
}

.terminal-popout {
  color: var(--term-muted, #9aa69d);
  font-weight: 400;
  text-decoration: none;
}

.terminal-popout:hover,
.terminal-popout:focus-visible {
  color: var(--term-accent, #8ecf9b);
}

.terminal-output {
  flex: 1;
  padding: 1rem 1.1rem 0;
}

.terminal-output p {
  margin: 0 0 0.35rem;
}

.terminal-output strong,
.terminal-prompt,
.terminal-command {
  color: var(--term-accent);
}

.terminal-output a {
  color: var(--term-accent);
}

.terminal-output a:hover,
.terminal-output a:focus-visible {
  color: var(--term-text);
}

.terminal-muted {
  color: var(--term-muted);
}

.terminal-error {
  color: var(--term-error);
}

.game-board {
  margin: 0.45rem 0;
  color: var(--term-text);
  font: inherit;
  line-height: 1.35;
}

.terminal-canvas {
  display: block;
  width: min(500px, 100%);
  height: auto;
  margin: 0.65rem 0;
  border: 1px solid var(--term-border);
  background: #101410;
  image-rendering: pixelated;
}

.terminal-form {
  padding: 0.4rem 1.1rem 1rem;
}

.terminal-form label {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.terminal-input,
.terminal-form input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--term-text);
  background: transparent;
  font: inherit;
  caret-color: var(--term-accent);
}

.terminal-page {
  overflow: hidden;
  background: #151816;
}

.terminal-fullscreen {
  width: 100vw;
  height: 100vh;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.terminal-fullscreen .terminal {
  width: 100%;
  height: 100%;
}

.panel {
  display: grid;
  width: var(--stage-width);
  max-width: 100%;
  height: var(--stage-height);
  overflow: hidden;
  background: var(--panel);
}

.panel--home,
.panel--about {
  grid-template-columns: minmax(0, 1fr) 318px;
}

.panel--contact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel--resume {
  grid-template-columns: minmax(0, 1fr) 598px;
}

.panel-copy {
  display: flex;
  min-width: 0;
  padding: 1.25rem 0.9rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.7rem;
  color: var(--text);
}

.panel-copy p {
  margin: 0;
  font-weight: 700;
}

.panel-title {
  margin: 0 0 0.3rem;
  font-size: 24px;
  line-height: 1;
}

.lede {
  font-size: 15px;
}

.panel-media {
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.panel-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.panel--home .panel-photo,
.panel--about .panel-photo {
  object-fit: cover;
  object-position: center top;
}

.panel--contact .panel-photo {
  object-fit: cover;
  object-position: center;
}

/* The original resume graphic gets semantic links instead of an image map. */
.resume-download {
  display: flex;
  width: 598px;
  max-width: 100%;
  height: 100%;
  padding: 24px 10px 25px;
  background: var(--panel);
}

.resume-art-shell {
  position: relative;
  width: 578px;
  height: 351px;
}

.resume-art {
  width: 100%;
  height: 100%;
}

.resume-link {
  position: absolute;
  top: 53%;
  width: 16%;
  height: 14%;
  color: transparent;
  font-size: 1px;
}

.resume-link:focus-visible {
  color: transparent;
  outline: 2px solid var(--focus);
}

.resume-link--doc {
  left: 22%;
}

.resume-link--pdf {
  left: 65%;
}

.linkish {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--link);
  background: none;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.linkish:hover,
.linkish:focus-visible {
  color: var(--text);
}

.modal {
  width: min(720px, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal-panel {
  color: #111;
  background: #f7f7f7;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.5rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  padding: 0;
  border: 0;
  color: #666;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.pgp-block {
  max-height: min(50vh, 360px);
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  overflow: auto;
  font: 0.78rem/1.45 var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0 1rem 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border: 1px solid #d0d0d0;
  color: #111;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn--primary {
  border-color: var(--background);
  color: #fff;
  background: var(--background);
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 1rem, 1040px);
    padding-top: 0.75rem;
  }

  .site-header {
    height: auto;
    aspect-ratio: 690 / 145;
    margin-bottom: 0.75rem;
  }

  .content-card {
    min-height: 0;
    padding: 12px;
  }

  .terminal {
    width: 100%;
    height: min(440px, 62vh);
  }

  .work-unavailable {
    width: 100%;
    height: min(440px, 62vh);
    padding: 2rem;
  }

  .not-found {
    width: 100%;
    min-height: min(440px, 62vh);
    padding: 1.5rem;
  }

  .not-found-art {
    align-self: flex-start;
    font-size: clamp(0.76rem, 3.35vw, 1.25rem);
    letter-spacing: 0;
  }

  .panel,
  .panel--home,
  .panel--about,
  .panel--contact,
  .panel--resume {
    grid-template-columns: 1fr;
    width: 100%;
    height: auto;
  }

  .panel-copy {
    min-height: 180px;
    padding: 1.25rem;
  }

  .panel-media {
    min-height: 240px;
  }

  .panel--home .panel-media,
  .panel--about .panel-media {
    height: 320px;
  }

  .panel--contact .panel-media {
    height: auto;
    min-height: 0;
  }

  .panel--contact .panel-photo {
    height: auto;
  }

  .resume-download {
    width: min(598px, 100%);
    height: auto;
    aspect-ratio: 598 / 400;
    padding: 10px;
  }

  .resume-art-shell {
    width: 100%;
    height: 100%;
  }
}
