/* ==========================================================================
   Terminal edition — design system
   Monospace only, zero radii, hard 1px rules, phosphor dark + paper light.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0a0e0a;
  --bg-panel: #0c110c;
  --bg-raised: #101710;
  --bg-inset: #080b08;
  --fg: #b6efbe;
  --fg-bright: #e9ffea;
  --fg-dim: #6d9c76;
  --fg-faint: #3d5c44;
  --accent: #3dfc7a;
  --accent-dim: #24a355;
  --accent-tint: rgba(61, 252, 122, .09);
  --line: #1e3324;
  --line-strong: #2d4a34;
  --warn: #ffcf6b;
  --error: #ff8080;
  --select: rgba(61, 252, 122, .22);
  --media-filter: saturate(.85) contrast(1.06) brightness(.92);

  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --maxw: 68rem;
  --pad: clamp(1rem, 3.5vw, 2.5rem);
  --bar-h: 2.5rem;
  --prompt-h: 2.9rem;
  --gap-block: clamp(2.75rem, 6vw, 4.75rem);
  --ease: cubic-bezier(.2, .8, .3, 1);
}

[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f1ea;
  --bg-panel: #f0ece3;
  --bg-raised: #e8e3d8;
  --bg-inset: #faf8f3;
  --fg: #1f261f;
  --fg-bright: #0a0f0a;
  --fg-dim: #5d6a5f;
  --fg-faint: #94a096;
  --accent: #0f7a3d;
  --accent-dim: #0c5f2f;
  --accent-tint: rgba(15, 122, 61, .08);
  --line: #d2ccbe;
  --line-strong: #b9b2a1;
  --warn: #8a5a00;
  --error: #a32222;
  --select: rgba(15, 122, 61, .18);
  --media-filter: none;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + var(--prompt-h) + 1rem);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  font-family: var(--font);
  font-size: clamp(.875rem, .35vw + .8rem, .9375rem);
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
  font-variant-ligatures: none;
  transition: background-color .3s ease, color .3s ease;
}

::selection { background: var(--select); color: var(--fg-bright); }

a { color: inherit; }

img, video { display: block; max-width: 100%; }

button, input, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

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

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

.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--pad);
  z-index: 300;
  padding: .5rem .9rem;
  background: var(--bg-raised);
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: .5rem; }

/* --------------------------------------------------------------------------
   CRT overlay (dark theme only)
   -------------------------------------------------------------------------- */

.crt {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom,
      rgba(180, 255, 190, .035) 0 1px,
      transparent 1px 3px),
    radial-gradient(120% 90% at 50% 50%,
      transparent 55%,
      rgba(0, 0, 0, .38) 100%);
  animation: crt-flicker 5.5s steps(60) infinite;
}

[data-theme='light'] .crt { display: none; }

@keyframes crt-flicker {
  0%, 100% { opacity: .94; }
  47% { opacity: .9; }
  48% { opacity: .99; }
  73% { opacity: .92; }
}

/* --------------------------------------------------------------------------
   Terminal window shell
   -------------------------------------------------------------------------- */

.term {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-panel);
  border-inline: 1px solid var(--line);
}

.titlebar {
  position: sticky;
  top: 0;
  z-index: 42;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--bar-h);
  padding-inline: var(--pad);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  font-size: .75rem;
}

.titlebar-buttons { display: flex; gap: .4rem; flex: none; }
.tb-dot {
  width: .6rem; height: .6rem;
  border: 1px solid var(--line-strong);
  background: transparent;
}
.tb-close { background: var(--error); border-color: var(--error); opacity: .7; }
.tb-min { background: var(--warn); border-color: var(--warn); opacity: .7; }
.tb-max { background: var(--accent-dim); border-color: var(--accent-dim); opacity: .7; }

.titlebar-name {
  flex: none;
  color: var(--fg-dim);
  white-space: nowrap;
}

.titlebar-nav {
  display: flex;
  gap: .1rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.titlebar-nav::-webkit-scrollbar { display: none; }

.navlink {
  padding: .15rem .5rem;
  color: var(--fg-dim);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.navlink:hover { color: var(--accent); }
.navlink.current {
  color: var(--accent);
  border-color: var(--line-strong);
  background: var(--accent-tint);
}

.titlebar-progress {
  flex: none;
  color: var(--fg-faint);
  letter-spacing: -.05em;
  white-space: pre;
}

/* Keep edition + theme pinned on the right so they never get clipped. */
.titlebar-actions {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: none;
  margin-inline-start: auto;
}

.themebtn {
  flex: none;
  padding: .15rem .35rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim);
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.themebtn:hover { color: var(--accent); border-color: var(--line-strong); }

.edition-switcher {
  display: inline-flex;
  align-items: stretch;
  flex: none;
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  overflow: hidden;
}
.edition-switch {
  flex: none;
  padding: .15rem .45rem;
  color: var(--fg-dim);
  text-decoration: none;
  white-space: nowrap;
  border: 0;
  background: transparent;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.edition-switch + .edition-switch {
  border-left: 1px solid var(--line-strong);
}
.edition-switch:hover {
  color: var(--fg-bright);
  background: rgba(61, 252, 122, .1);
}
.edition-switch.is-active {
  color: var(--accent);
  background: var(--accent-tint);
}
.edition-switch.is-active:hover {
  color: var(--fg-bright);
  background: rgba(61, 252, 122, .16);
}

/* --------------------------------------------------------------------------
   Prompt bar
   -------------------------------------------------------------------------- */

.ps1 { color: var(--accent-dim); white-space: nowrap; }
.ps1-punc, .ps1-path { color: var(--fg-faint); }
.ps1-sign { color: var(--accent); margin-inline-start: .1ch; }

.promptbar {
  position: sticky;
  top: var(--bar-h);
  z-index: 41;
  display: flex;
  align-items: center;
  gap: .6ch;
  height: var(--prompt-h);
  padding-inline: var(--pad);
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line);
  font-size: .8125rem;
}

.promptfield {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.promptfield input {
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--fg-bright);
  caret-color: var(--accent);
  position: relative;
  z-index: 1;
}
.promptfield input::placeholder { color: var(--fg-faint); }
.promptfield input:focus { outline: none; }
.promptbar:focus-within { box-shadow: inset 0 0 0 1px var(--accent-dim); }

.ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  white-space: pre;
  overflow: hidden;
}
.ghost-typed { color: transparent; }
.ghost-rest { color: var(--fg-faint); }

.promptkbd {
  flex: none;
  padding: .05rem .35rem;
  border: 1px solid var(--line);
  color: var(--fg-faint);
  font-size: .6875rem;
}

.caret {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}

@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

/* Console output from typed commands */
.console {
  position: sticky;
  top: calc(var(--bar-h) + var(--prompt-h));
  z-index: 40;
  padding: .7rem var(--pad);
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line-strong);
  font-size: .8125rem;
  line-height: 1.6;
}

.console-lines {
  max-height: 32vh;
  overflow-y: auto;
  padding-inline-end: 5.5rem;
}

.console-clear {
  position: absolute;
  top: .55rem;
  right: var(--pad);
  padding: .05rem .3rem;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: .6875rem;
  cursor: pointer;
}
.console-clear:hover { color: var(--accent); border-color: var(--accent); }

.console-line { white-space: pre-wrap; word-break: break-word; }
.console-line.is-echo { color: var(--fg-bright); }
.console-line.is-out { color: var(--fg); }
.console-line.is-dim { color: var(--fg-dim); }
.console-line.is-err { color: var(--error); }
.console-line.is-ok { color: var(--accent); }
.console-line a { color: var(--accent); text-decoration: underline dotted; }
.console-gap { height: .6rem; }

/* --------------------------------------------------------------------------
   Blocks and shared type
   -------------------------------------------------------------------------- */

.term-body { padding-inline: var(--pad); }

.block {
  padding-block: var(--gap-block);
  border-top: 1px dashed var(--line);
  min-width: 0;
}
.out { min-width: 0; }
.block:first-child { border-top: 0; }

.cmd {
  margin-bottom: 1.75rem;
  color: var(--fg-bright);
  font-size: .8125rem;
  word-break: break-word;
}
.cmd .ps1 { margin-inline-end: .6ch; }
.cmd-flag { color: var(--accent); }
.cmd-inline { margin-block: 2rem 1rem; }

.blocktitle {
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-bright);
}

.subtitle {
  margin-top: .35rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.prose { max-width: 62ch; }
.prose + .prose { margin-top: .9rem; }
.dim { color: var(--fg-dim); }
.ok { color: var(--accent); }

.tlink {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: .2em;
}
.tlink:hover { text-decoration-style: solid; background: var(--accent-tint); }

.kv {
  margin-top: 1.5rem;
  display: grid;
  gap: .2rem;
  font-size: .8125rem;
}
.kv-row { display: flex; gap: 1ch; flex-wrap: wrap; }
.kv dt { flex: none; width: 9ch; color: var(--fg-faint); }
.kv dt::after { content: ':'; }
.kv dd { margin: 0; color: var(--fg); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.tbtn {
  display: inline-flex;
  align-items: center;
  gap: .5ch;
  padding: .4rem .8rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-size: .8125rem;
  text-decoration: none;
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.tbtn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-tint);
}
.tbtn-primary { color: var(--accent); border-color: var(--accent-dim); }
.tbtn[disabled] { opacity: .5; cursor: not-allowed; }

.actions {
  margin-top: 1.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.sociallist {
  margin-top: 1.5rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .1rem 1.1rem;
  font-size: .8125rem;
}
.sociallist a { color: var(--fg-dim); text-decoration: none; }
.sociallist a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   ASCII-style media frames
   -------------------------------------------------------------------------- */

.asciiframe { margin: 0; }

.asciiframe-media {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line-strong);
  background: var(--bg-inset);
  overflow: hidden;
}
.asciiframe-media.wide { aspect-ratio: 16 / 9; }
.asciiframe-media.tall { aspect-ratio: 9 / 16; }

.asciiframe-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--media-filter);
  transition: filter .25s var(--ease);
}

/* Corner brackets: two pseudo-elements cover the diagonal corners. */
.asciiframe-media::before,
.asciiframe-media::after {
  content: '';
  position: absolute;
  width: .65rem;
  height: .65rem;
  border: 0 solid var(--accent);
  opacity: .55;
  transition: opacity .2s var(--ease);
  z-index: 2;
}
.asciiframe-media::before {
  top: -1px; left: -1px;
  border-top-width: 1px;
  border-left-width: 1px;
}
.asciiframe-media::after {
  bottom: -1px; right: -1px;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

.asciiframe-cap {
  margin-top: .35rem;
  color: var(--fg-faint);
  font-size: .6875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playmark {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  color: var(--accent);
  font-size: 1.1rem;
  background: rgba(4, 8, 5, .35);
  opacity: 0;
  transition: opacity .2s var(--ease);
}
[data-theme='light'] .playmark { background: rgba(244, 241, 234, .55); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 15rem);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.hero-name { margin: 0; font-weight: 400; }

/* Vector pixel banner — avoids Safari system-font fallback for missing U+2588. */
.banner {
  --banner-cell: clamp(.3rem, 2.05vw, 1.3rem);
  display: block;
  width: min(100%, calc(var(--banner-cell) * 40));
  height: auto;
  margin: 0;
  color: var(--accent);
  aspect-ratio: 40 / 11;
  flex-shrink: 0;
}

.hero-name-fallback { display: none; }

.hero-portrait { position: sticky; top: calc(var(--bar-h) + var(--prompt-h) + 1.5rem); }

/* --------------------------------------------------------------------------
   Projects
   -------------------------------------------------------------------------- */

.filters {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.flag {
  padding: .25rem .65rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: .75rem;
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.flag:hover { color: var(--accent); border-color: var(--line-strong); }
.flag.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-tint);
}

.lscount {
  margin-top: 1.5rem;
  color: var(--fg-faint);
  font-size: .75rem;
}

/* Peek carousel ----------------------------------------------------------- */
.carousel {
  --carousel-fade: var(--bg);
  margin-top: .85rem;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

.carousel-viewport {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.carousel-viewport::before,
.carousel-viewport::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: clamp(1rem, 3.5vw, 2.25rem);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.carousel-viewport::before {
  left: 0;
  background: linear-gradient(90deg, var(--carousel-fade), transparent);
}
.carousel-viewport::after {
  right: 0;
  background: linear-gradient(270deg, var(--carousel-fade), transparent);
}
.carousel[data-can-scroll-prev='true'] .carousel-viewport::before,
.carousel[data-can-scroll-next='true'] .carousel-viewport::after { opacity: 1; }

.carousel-track {
  display: flex;
  align-items: stretch;
  gap: clamp(.75rem, 2vw, 1.15rem);
  margin: 0;
  padding: .2rem .1rem .65rem;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-padding-inline: .1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  outline: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.carousel-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-raised);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.carousel-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-tint);
}
.carousel-btn:disabled {
  opacity: .35;
  cursor: default;
  pointer-events: none;
}

.projlist { min-width: 0; }

.proj {
  display: flex;
  flex: 0 0 min(20.5rem, 78vw);
  flex-direction: column;
  width: min(20.5rem, 78vw);
  max-width: none;
  min-width: min(16.5rem, 78vw);
  padding: .85rem;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  scroll-snap-align: start;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.proj[hidden] { display: none; }
.proj[id] { scroll-margin-top: calc(var(--bar-h) + var(--prompt-h) + 1rem); }
.proj:hover {
  border-color: var(--accent-dim);
  background: var(--bg-raised);
}

.proj-stat {
  color: var(--fg-faint);
  font-size: .6875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-file { color: var(--accent-dim); }
.proj:hover .proj-file { color: var(--accent); }

.proj .asciiframe { margin-top: .65rem; }
.proj .asciiframe-media { aspect-ratio: 16 / 10; }

.proj-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: .85rem;
  min-width: 0;
}

.proj-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-bright);
  letter-spacing: .01em;
  line-height: 1.35;
}
.proj-desc {
  margin-top: .5rem;
  color: var(--fg);
  font-size: .8125rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.tags {
  margin-top: .85rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.tags li {
  padding: .05rem .45rem;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: .6875rem;
}
.proj:hover .tags li { border-color: var(--line-strong); }

.proj-actions {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.proj:hover .asciiframe-media img,
.film:hover .asciiframe-media img,
.reel:hover .asciiframe-media img { filter: none; }

.proj:hover .asciiframe-media::before,
.proj:hover .asciiframe-media::after,
.film:hover .asciiframe-media::before,
.film:hover .asciiframe-media::after,
.reel:hover .asciiframe-media::before,
.reel:hover .asciiframe-media::after { opacity: 1; }

/* --------------------------------------------------------------------------
   Creative work
   -------------------------------------------------------------------------- */

.subblock { min-width: 0; }
.subblock + .subblock { margin-top: clamp(2.25rem, 5vw, 3.5rem); }
.subblock .carousel { margin-top: 1.25rem; }

.filmlist,
.reellist { min-width: 0; }

.filmlist.carousel-track { gap: clamp(1rem, 2vw, 1.35rem); }
.reellist.carousel-track {
  justify-content: flex-start;
  gap: clamp(.85rem, 2vw, 1.25rem);
}

.film,
.reel {
  display: block;
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
}
.film:focus-visible,
.reel:focus-visible { outline-offset: 4px; }

.film {
  flex: 0 0 min(20.5rem, 78vw);
  width: min(20.5rem, 78vw);
  max-width: none;
  min-width: min(16.5rem, 78vw);
}

.reel {
  flex: 0 0 min(9.75rem, 42vw);
  width: min(9.75rem, 42vw);
  max-width: none;
  min-width: min(8.25rem, 38vw);
}

.film-text { margin-top: .6rem; }
.film-title { font-size: .9375rem; font-weight: 500; color: var(--fg-bright); }
.film-desc { margin-top: .25rem; color: var(--fg-dim); font-size: .8125rem; }

.reel-client {
  margin-top: .5rem;
  color: var(--fg-faint);
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.reel-title { margin-top: .15rem; font-size: .8125rem; font-weight: 500; color: var(--fg-bright); }

.film:hover .film-title,
.film:hover .playmark,
.reel:hover .reel-title,
.reel:hover .playmark { opacity: 1; }
.film:hover .film-title, .reel:hover .reel-title { color: var(--accent); }
.film:focus-visible .playmark, .reel:focus-visible .playmark { opacity: 1; }

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 3.5rem);
  align-items: start;
}

.tform { margin-top: 1.75rem; display: grid; gap: 1.1rem; }

.tform-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.1rem;
}

.tfield { display: grid; gap: .35rem; }
.tfield label {
  color: var(--fg-dim);
  font-size: .75rem;
  letter-spacing: .06em;
}
.tfield label::before { content: '> '; color: var(--accent-dim); }
.req { color: var(--accent); }

.tfield input,
.tfield textarea {
  padding: .55rem .7rem;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  color: var(--fg-bright);
  caret-color: var(--accent);
  font-size: .875rem;
  transition: border-color .15s var(--ease);
}
.tfield textarea { resize: vertical; min-height: 7rem; }
.tfield input::placeholder,
.tfield textarea::placeholder { color: var(--fg-faint); }
.tfield input:focus,
.tfield textarea:focus { border-color: var(--accent); outline: none; }

.tbtn-submit { justify-self: start; }

.formresult { font-size: .8125rem; min-height: 1.7em; }
.formresult.is-ok { color: var(--accent); }
.formresult.is-err { color: var(--error); }
.formresult.is-pending { color: var(--fg-dim); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.termfooter {
  padding: var(--gap-block) var(--pad) 2.5rem;
  border-top: 1px dashed var(--line);
  font-size: .8125rem;
}
.footer-out { display: grid; gap: .3rem; }
.footer-end { margin-top: 1.75rem; margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Video popup
   -------------------------------------------------------------------------- */

.vp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(2, 6, 3, .82);
}
[data-theme='light'] .vp-backdrop { background: rgba(30, 34, 30, .68); }

.vp {
  position: fixed;
  z-index: 121;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(56rem, calc(100vw - 2rem));
  background: var(--bg-panel);
  border: 1px solid var(--accent-dim);
}

.vp-bar {
  display: flex;
  align-items: center;
  gap: 1ch;
  padding: .5rem .75rem;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  font-size: .75rem;
}
.vp-badge { flex: none; color: var(--accent); }
.vp-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--fg-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vp-close {
  flex: none;
  padding: .1rem .3rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim);
  cursor: pointer;
}
.vp-close:hover { color: var(--error); border-color: var(--line-strong); }

.vp video {
  width: 100%;
  max-height: 72vh;
  background: #000;
}

body.locked { overflow: hidden; }

/* --------------------------------------------------------------------------
   Boot sequence + matrix easter egg (injected by JS)
   -------------------------------------------------------------------------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  padding: clamp(1.25rem, 5vw, 3rem);
  background: var(--bg);
  color: var(--accent);
  font-size: .8125rem;
  line-height: 1.8;
  overflow: hidden;
}
.boot[data-done='true'] {
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s var(--ease);
}
.boot-line { white-space: pre-wrap; }
.boot-skip {
  position: absolute;
  bottom: clamp(1.25rem, 5vw, 3rem);
  left: clamp(1.25rem, 5vw, 3rem);
  color: var(--fg-faint);
}

.matrix {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  opacity: .38;
}

/* --------------------------------------------------------------------------
   Reveal on scroll — only armed once JS is ready
   -------------------------------------------------------------------------- */

.js-ready .reveal {
  opacity: 0;
  transform: translateY(.5rem);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.js-ready .reveal.in { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 60rem) {
  .contact { grid-template-columns: minmax(0, 1fr); }
  .titlebar-progress { display: none; }
}

@media (max-width: 48rem) {
  :root { --bar-h: 2.35rem; }

  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-portrait {
    position: static;
    max-width: 13rem;
    order: -1;
  }
  .banner { display: none; }
  .hero-name-fallback {
    display: block;
    font-size: clamp(1.5rem, 8vw, 2.25rem);
    font-weight: 700;
    letter-spacing: .16em;
    color: var(--accent);
    line-height: 1.2;
  }
  .carousel {
    grid-template-columns: minmax(0, 1fr);
    gap: .65rem;
  }
  .carousel-btn {
    position: absolute;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
  }
  .carousel-btn:hover:not(:disabled) { transform: translateY(-50%); }
  .carousel-btn-prev { left: .15rem; }
  .carousel-btn-next { right: .15rem; }
  .carousel-viewport { grid-column: 1; }
  .proj {
    flex-basis: min(18.5rem, 82vw);
    width: min(18.5rem, 82vw);
  }
  .film {
    flex-basis: min(18.5rem, 82vw);
    width: min(18.5rem, 82vw);
  }
  .reel {
    flex-basis: min(9rem, 46vw);
    width: min(9rem, 46vw);
    min-width: min(7.75rem, 42vw);
  }
  /* Fixed-width labels force awkward wrapping on narrow screens. */
  .kv dt { width: auto; }
  .titlebar-name, .titlebar-buttons { display: none; }
  .console { max-height: 40vh; }
}

@media (max-width: 30rem) {
  .promptkbd { display: none; }
}

/* --------------------------------------------------------------------------
   Motion and print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .crt { animation: none; opacity: .9; }
  .caret { animation: none; }
  .js-ready .reveal { opacity: 1; transform: none; }
}

@media print {
  .crt, .promptbar, .console, .titlebar-nav, .titlebar-progress, .themebtn, .edition-switcher, .vp, .vp-backdrop { display: none !important; }
  body { background: #fff; color: #000; }
  .term { border: 0; }
}
