/* ============================================================
   Lab to Market — labtomarket.org
   Systems console. Monochrome + a single signal amber.
   Monospace throughout; hairlines and spacing do the work.
   No textures, no gradients, no rounded corners.
   ============================================================ */

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

/* ---- Tokens ------------------------------------------------ */
:root {
  --bg:      #0a0b0d;
  --bg-1:    #101215;
  --bg-2:    #14171b;
  --fg:      #e9e9e7;
  --dim:     #838a94;
  --faint:   #545b65;
  --line:    #1b1f25;
  --line-2:  #272d35;
  --accent:  #ffb627;
  --accent-d:#8a6212;

  --display: 'Martian Mono', ui-monospace, monospace;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --gut:  clamp(1rem, 4vw, 3.5rem);
  --maxw: 78rem;
  --bar:  2.75rem;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.7;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
svg { display: block; }

::selection { background: var(--accent); color: var(--bg); }

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

kbd {
  font: inherit; font-size: .78em;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--dim);
  padding: .05em .38em;
  line-height: 1.4;
}

.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;
}

/* clip rather than offscreen-left, so it can never widen the page */
.skip {
  position: absolute; top: 0; left: 0; z-index: 200;
  width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  background: var(--accent); color: var(--bg);
  padding: .6rem 1rem; font-size: .8rem; text-decoration: none;
  white-space: nowrap;
}
.skip:focus {
  width: auto; height: auto; overflow: visible; clip: auto;
  top: .5rem; left: .5rem;
}

/* Shared caret block */
.caret {
  display: inline-block;
  width: .5em; height: 1.05em;
  background: var(--accent);
  vertical-align: -.16em;
  margin-left: .22em;
  animation: blink 1.15s steps(1) infinite;
}
.caret--static { animation: none; height: .95em; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- Status bar -------------------------------------------- */
.statusbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--bar);
  display: flex; align-items: center; gap: 1.25rem;
  padding-inline: var(--gut);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: .78rem;
}

.brand {
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand__prompt { color: var(--accent); margin-right: .45em; }
.brand__sep { color: var(--faint); }

.statusbar__nav { display: flex; gap: 1.25rem; margin-left: auto; }
.statusbar__nav a {
  text-decoration: none; color: var(--dim);
  transition: color .2s;
}
.statusbar__nav a::before { content: '/'; color: var(--faint); margin-right: .15em; }
.statusbar__nav a:hover { color: var(--accent); }

.readout {
  display: flex; gap: 1.1rem; margin: 0;
  color: var(--faint); font-size: .72rem;
}
.readout div { display: flex; gap: .4rem; }
.readout dt { text-transform: uppercase; letter-spacing: .06em; }
.readout dt::after { content: ':'; }
.readout dd { margin: 0; color: var(--dim); font-variant-numeric: tabular-nums; }
.readout .ok { color: var(--accent); }

/* `div.` is required: plain `.readout--hide-sm` loses to `.readout div` */
@media (max-width: 62rem) { .readout div.readout--hide-sm { display: none; } }
@media (max-width: 40rem) {
  .statusbar__nav { display: none; }
  .readout { margin-left: auto; }
}

/* ---- Layout ------------------------------------------------ */
main { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }

/* Density is the point in a console layout — keep sections close. */
.block { padding-block: clamp(2.25rem, 5vw, 3.5rem); }

/* ---- Command line ------------------------------------------ */
.cmd {
  font-size: .84rem; color: var(--dim);
  margin: 0 0 1.5rem;
  white-space: nowrap; overflow: hidden;
}
.cmd__sigil { color: var(--accent); margin-right: .55em; }
.cmd__text {
  display: inline-block;
  clip-path: inset(0 100% 0 0);
  /* steps() ≈ the character count, so it reveals character by character */
  animation: type .85s steps(17) .2s forwards;
}
@keyframes type { to { clip-path: inset(0 0 0 0); } }
.cmd--sm { font-size: .78rem; margin-bottom: 1.1rem; }

/* ---- Hero -------------------------------------------------- */
.hero { padding-block: clamp(3rem, 9vh, 5.5rem) clamp(2.25rem, 5vw, 3.5rem); }

.headline {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.6rem, 5.3vw, 4rem);
  line-height: 1.18;
  letter-spacing: -.055em;
  margin: 0;
}
.headline__l {
  display: block;
  opacity: 0;
  animation: up .7s var(--ease) forwards;
}
.headline__l:nth-child(1) { animation-delay: .55s; }
.headline__l:nth-child(2) { animation-delay: .65s; }
@keyframes up {
  from { opacity: 0; transform: translateY(.5rem); }
  to   { opacity: 1; transform: none; }
}

.hero__out {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  padding-top: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid var(--line);
  opacity: 0;
  animation: fade .6s ease .95s forwards;
}
@keyframes fade { to { opacity: 1; } }

.hero__lede { margin: 0; max-width: 60ch; color: var(--dim); }

.hero__facts {
  list-style: none; margin: 0; padding: 0;
  font-size: .78rem; color: var(--faint);
  white-space: nowrap;
}
/* exactly two flex children per row, so space-between pins label left and
   value right — the value is wrapped in <b> to keep it one item even when it
   contains a separate count span */
.hero__facts li { display: flex; gap: .75rem; justify-content: space-between; }
.hero__facts li > span { text-transform: uppercase; letter-spacing: .06em; }
.hero__facts b { font-weight: 400; }
.hero__facts li::after { content: ''; }
@media (max-width: 52rem) {
  .hero__out { grid-template-columns: 1fr; }
  .hero__facts { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; }
  .hero__facts li { gap: .4rem; }
}

.hero__jump {
  display: flex; flex-wrap: wrap; gap: .6rem;
  margin: clamp(1.75rem, 4vw, 2.5rem) 0 0;
  opacity: 0;
  animation: fade .6s ease 1.15s forwards;
}
.key {
  display: inline-flex; align-items: center; gap: .6rem;
  text-decoration: none;
  font-size: .8rem;
  padding: .55rem .9rem;
  border: 1px solid var(--line-2);
  transition: border-color .2s, color .2s, background .2s;
}
.key kbd { border-color: var(--line-2); }
.key:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-1); }
.key:hover kbd { border-color: var(--accent); color: var(--accent); }
.key--dim { color: var(--dim); }

/* ---- Section header ---------------------------------------- */
.sec {
  display: flex; align-items: center; gap: .9rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.sec__id { color: var(--accent); font-size: .75rem; font-weight: 500; }
.sec__title {
  font-family: var(--display); font-weight: 700;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .02em;
  margin: 0; white-space: nowrap;
}
.sec__fill {
  flex: 1; height: 1px; min-width: 1rem;
  background-image: repeating-linear-gradient(90deg, var(--line-2) 0 4px, transparent 4px 8px);
}
.sec__meta {
  font-size: .7rem; color: var(--faint);
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap;
}
.sec__meta kbd { text-transform: none; letter-spacing: 0; }
@media (max-width: 40rem) { .sec__meta--hint { display: none; } }

.block__intro {
  margin: 0 0 clamp(1.75rem, 4vw, 2.5rem);
  max-width: 62ch; color: var(--dim);
}
.block__intro--wide { max-width: 55ch; }

/* ---- Untangle figure --------------------------------------- */
.untangle {
  margin: 0;
  padding-block: clamp(1rem, 3vw, 2rem) clamp(2.25rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--line);
}
/* below ~660px the labels stop being legible, so scroll rather than shrink */
.untangle__scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.untangle__svg { display: block; width: 100%; min-width: 640px; height: auto; }

.ut-key, .ut-cap, .ut-mid { font-family: var(--mono); }
.ut-key {
  font-size: 12px; text-transform: uppercase; letter-spacing: .14em;
  fill: var(--dim);
}
.ut-cap { font-size: 12px; fill: var(--faint); }
.ut-mid { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; fill: var(--faint); }

/* the tangle: many crossings, deliberately hard to read */
.ut-web line { stroke: var(--line-2); stroke-width: 1.5; }
.ut-node rect { fill: var(--dim); }
.ut-node--hit rect { fill: var(--accent); }

/* the resolution: orthogonal elbows, no crossings */
.ut-edge polyline { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.ut-path polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; }

.ut-flow { stroke: var(--faint); fill: var(--faint); stroke-width: 1.5; }
.ut-rule { stroke: var(--line); stroke-width: 1; }

/* only shown at widths where the SVG's min-width forces internal scrolling */
.untangle__hint {
  display: none;
  margin: .75rem 0 0;
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
}
@media (max-width: 43rem) { .untangle__hint { display: block; } }

.untangle__cap {
  margin-top: 1.5rem;
  font-size: .82rem;
  color: var(--dim);
  max-width: 76ch;
}

/* ---- Constraint flags -------------------------------------- */
.flags { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

.flag {
  display: grid;
  grid-template-columns: 15rem 7rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
}
.flag__key { font-size: .88rem; color: var(--fg); font-weight: 500; }
.flag__val {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: .45rem;
}
.flag__val::before {
  content: ''; width: 5px; height: 5px; background: var(--accent);
}
.flag__desc { margin: 0; color: var(--dim); font-size: .88rem; }

@media (max-width: 56rem) {
  .flag { grid-template-columns: 1fr auto; gap: .5rem 1rem; }
  .flag__desc { grid-column: 1 / -1; }
}

/* ---- Portfolio registry ------------------------------------ */
.registry { list-style: none; margin: 0; padding: 0; }

/* column headers + rows share one grid definition */
.registry__head, .row {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto 1.5rem;
  gap: clamp(.75rem, 2vw, 1.5rem);
  padding-inline: 1rem;
  margin-inline: -1rem;
}

.registry__head {
  align-items: center;
  padding-block: .5rem;
  border-bottom: 1px solid var(--line-2);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--faint);
}
.registry__head span:nth-child(3) { text-align: right; }
@media (max-width: 56rem) { .registry__head { display: none; } }

.row {
  position: relative;
  align-items: center;
  padding-block: 1.35rem;
  border-bottom: 1px solid var(--line);
  transition: background .25s var(--ease);
}
.row::before {
  content: '';
  position: absolute; left: 0; top: -1px; bottom: -1px; width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform .3s var(--ease);
}
.row:hover, .row:focus-within { background: var(--bg-1); }
.row:hover::before, .row:focus-within::before { transform: scaleY(1); }

.row__id {
  font-size: .78rem; color: var(--faint);
  font-variant-numeric: tabular-nums;
  transition: color .25s;
}
.row:hover .row__id { color: var(--accent); }

.row__body { min-width: 0; }

.row__name {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(.95rem, 2.1vw, 1.35rem);
  letter-spacing: -.045em;
  line-height: 1.3;
  margin: 0;
}
.row__name a { text-decoration: none; transition: color .25s; }
/* stretched link — whole row is the target */
.row__name a::after { content: ''; position: absolute; inset: 0; }
.row:hover .row__name a { color: var(--accent); }
.row__name .tld { color: var(--faint); font-weight: 400; }

.row__desc {
  margin: .3rem 0 0; color: var(--dim);
  font-size: .84rem; line-height: 1.6;
  max-width: 74ch;
}

.row__attrs { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.attr {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint);
  border: 1px solid var(--line-2);
  padding: .22rem .5rem;
  white-space: nowrap;
}
.attr--link {
  position: relative; z-index: 1;   /* must sit above the stretched link */
  color: var(--dim); text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: color .2s, border-color .2s;
}
.attr--link:hover { color: var(--accent); border-color: var(--accent); }

.row__go {
  color: var(--faint);
  opacity: 0; transform: translateX(-.35rem);
  transition: opacity .3s var(--ease), transform .3s var(--ease), color .25s;
  justify-self: end;
}
.row:hover .row__go { opacity: 1; transform: none; color: var(--accent); }

@media (max-width: 56rem) {
  .row { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .row__attrs { grid-column: 2; justify-content: flex-start; margin-top: .65rem; }
  .row__go { display: none; }
}

/* ---- Contact ----------------------------------------------- */
.mailto {
  display: inline-block;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.05rem, 3.6vw, 2.1rem);
  letter-spacing: -.05em;
  text-decoration: none;
  color: var(--accent);
  overflow-wrap: anywhere;
  transition: opacity .2s;
}
.mailto:hover { opacity: .75; }

/* ---- Footer ------------------------------------------------ */
.foot {
  border-top: 1px solid var(--line);
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 1.4rem var(--gut) 2.5rem;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  justify-content: space-between; align-items: center;
  font-size: .72rem; color: var(--faint);
}
.foot__flags { color: var(--accent-d); }

/* ---- Scroll reveal (opt-in via .js so a blocked script
        can never leave content invisible) ------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(.6rem);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .headline__l, .hero__out, .hero__jump { opacity: 1; }
  .cmd__text { clip-path: none; }
  .js .reveal { opacity: 1; transform: none; }
  .caret { animation: none; }
}
