/* ---------------------------------------------------------------
   z0pus-lab — Lab notebook
   Paper & ink, EB Garamond + JetBrains Mono, zero JS.
--------------------------------------------------------------- */

/* --- Self-hosted fonts ------------------------------------ */

@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/eb-garamond-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/eb-garamond-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* --- Tokens ----------------------------------------------- */

:root {
  --paper: #ECE8DF;
  --paper-2: #E3DED1;
  --ink: #101014;
  --ink-soft: #2A2A30;
  --graphite: #5A5A62;
  --rule: #CFC8B7;
  --red: #C7361B;
  --red-soft: #D93B1A;

  --serif: 'EB Garamond', 'Times New Roman', Times, serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --pad-x: clamp(24px, 5vw, 72px);
  --gutter: clamp(24px, 4vw, 48px);
  --col: minmax(0, 1fr);

  --rhythm: 180px;
}

/* --- Reset ------------------------------------------------ */

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

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  font-feature-settings: 'kern', 'liga', 'onum';
  font-variant-numeric: oldstyle-nums;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
}

/* --- Accessibility ---------------------------------------- */

.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 999;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: top 0.15s ease;
}
.skip:focus { top: 16px; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}

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

/* --- Paper texture (very subtle) -------------------------- */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/></svg>");
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* --- Nav -------------------------------------------------- */

.nav {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 24px var(--pad-x);
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink);
}
.wordmark .zero { color: var(--red); }

.build-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--graphite);
  text-transform: uppercase;
  white-space: nowrap;
}
.build-tag .dot {
  display: inline-block;
  margin: 0 8px;
  color: var(--rule);
}

/* --- Layout ----------------------------------------------- */

.main {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.block {
  display: grid;
  grid-template-columns: var(--rhythm) 1fr;
  gap: 48px var(--gutter);
  padding: clamp(48px, 9vw, 120px) 0;
  border-bottom: 1px solid var(--rule);
}

.block-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--graphite);
  padding-top: 10px;
}
.block-label .num {
  color: var(--ink);
  margin-right: 8px;
}

.block-body { max-width: 760px; }

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

.hero {
  padding: clamp(80px, 14vw, 180px) 0 clamp(64px, 10vw, 120px);
  border-bottom: 1px solid var(--rule);
}

.hero-statement {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 7.4vw, 96px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  max-width: 18ch;
  color: var(--ink);
  text-wrap: balance;
}
.hero-statement em {
  font-style: italic;
  color: var(--ink-soft);
}

.hero-sub {
  margin-top: clamp(24px, 3vw, 40px);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--graphite);
  max-width: 60ch;
  line-height: 1.6;
}

/* --- Works index ------------------------------------------ */

.works-list {
  list-style: none;
  border-top: 1px solid var(--ink);
}

.work {
  display: grid;
  grid-template-columns: 56px 1fr auto 100px;
  gap: 24px;
  align-items: baseline;
  padding: 22px 4px;
  border-bottom: 1px solid var(--rule);
  position: relative;
  isolation: isolate;
  transition: background-color 0.25s ease;
}

.work-num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--graphite);
  padding-top: 6px;
}

.work-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.work-link {
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}
.work-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
}
.work-desc {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--graphite);
  line-height: 1.4;
}

.work-year {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--graphite);
  padding-top: 6px;
}

.work-status {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-top: 7px;
  white-space: nowrap;
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 7px;
  color: var(--graphite);
  justify-self: end;
}
.work-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rule);
  flex-shrink: 0;
}

/* In studio — hands-on now */
.work-status[data-status="active"] { color: var(--ink); }
.work-status[data-status="active"]::before {
  background: var(--red);
  animation: status-breathe 2800ms ease-in-out infinite;
}

/* At rest — delivered and live, studio paused */
.work-status[data-status="paused"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--graphite);
}

/* Closed — delivered, handed off */
.work-status[data-status="closed"] { font-weight: 400; }
.work-status[data-status="closed"]::before { background: var(--rule); }

@keyframes status-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.work:hover .work-link,
.work-link:focus-visible { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.work:hover { background-color: var(--paper-2); }
.work-link:focus-visible { outline: none; }
.work:has(.work-link:focus-visible) { outline: 2px solid var(--ink); outline-offset: 0; }

@media (prefers-reduced-motion: reduce) {
  .work-status[data-status="active"]::before { animation: none; opacity: 1; }
}

/* --- Practice --------------------------------------------- */

.prose p + p { margin-top: 1.2em; }
.prose em { font-style: italic; }

.services {
  margin-top: clamp(32px, 4vw, 56px);
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 32px;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
}
.services li {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding: 6px 0;
  display: flex;
  gap: 16px;
}
.services li::before {
  content: attr(data-num);
  color: var(--graphite);
  font-weight: 500;
}

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

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.contact-list li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 24px;
  align-items: baseline;
}

.contact-key {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--graphite);
}

.contact-val {
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 24px);
  color: var(--ink);
}

.contact-val a {
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.contact-val a:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}

/* --- Colophon footer ------------------------------------- */

.colophon {
  padding: clamp(40px, 6vw, 72px) var(--pad-x);
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--graphite);
}
.colophon p { max-width: 60ch; line-height: 1.7; }

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

@media (max-width: 880px) {
  :root { --rhythm: 1fr; }
  .block {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .block-label { padding-top: 0; }
  .work {
    grid-template-columns: 40px 1fr 100px;
    gap: 14px;
  }
  .work-year {
    grid-column: 2;
    padding-top: 0;
    margin-top: -2px;
    font-size: 11px;
  }
  .work-status { grid-column: 3; grid-row: 1; }
  .contact-list li { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 520px) {
  .nav { padding: 16px var(--pad-x); }
  .build-tag { font-size: 10px; }
  .build-tag .dot { margin: 0 5px; }
  .hero-statement { font-size: clamp(36px, 10vw, 56px); }
}

/* --- Motion preferences ---------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Hover-capable devices only -------------------------- */

@media (hover: none) {
  .work:hover { background: transparent; }
}

/* --- CLI cursor trail ------------------------------------ */

.trail-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.trail-char {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) rotate(var(--r));
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--graphite);
  opacity: 0;
  mix-blend-mode: multiply;
  animation: trailFade 1400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
  will-change: opacity;
  user-select: none;
}

.trail-char[data-glyph="bracket"] {
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
}

@keyframes trailFade {
  0%   { opacity: 0; }
  15%  { opacity: 0.6; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .trail-layer { display: none; }
}

@media (hover: none), (pointer: coarse) {
  .trail-layer { display: none; }
}

/* --- Print ----------------------------------------------- */

@media print {
  .nav, .skip, .build-tag { display: none; }
  body::before { display: none; }
  body { background: white; color: black; }
  .block, .hero, .colophon { page-break-inside: avoid; border-color: #999; }
}
