/* ==========================================================================
   Eduardo Duarte · portfolio
   Monochrome, dark only. A narrow editorial column framed by dashed guide rails.
   Instrument Serif for display, Inter for reading, JetBrains Mono for metadata.
   Section titles sit on full-bleed hatched bands. No hue except the agent cursors.
   ========================================================================== */

:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface-2: #181818;
  --surface-3: #222222;    /* hover tone step */
  --line: #232323;
  --line-2: #2E2E2E;       /* dashed rails, hatching */
  --hud: #333333;          /* viewfinder corner marks */
  --field-line: #5E5E5E;   /* form field borders: 3:1 on --surface */
  --ink: #F5F5F4;
  --ink-2: #A1A1A1;        /* 7.9:1 on --bg */
  --ink-3: #737373;        /* metadata, 4.5:1 on --bg */
  --accent: #F5F5F4;       /* fills: primary button, live dot */
  --accent-hover: #FFFFFF;
  --accent-ink: #0A0A0A;
  --accent-text: #F5F5F4;
  --radius: 10px;
  --radius-sm: 5px;

  --col: clamp(920px, 64vw, 1280px); /* the column between the rails: grows on wide screens */
  --pad: 36px;             /* content inset from the rails */
  --section-gap: 112px;
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Agent hues: only for the swarm cursors and their dots in the build bar. */
  --agent-1: #5B86F0;
  --agent-2: #3FC8B4;
  --agent-3: #F0B24A;
  --agent-4: #F0705B;
  --agent-5: #E86BB0;
  --agent-6: #9B7BF0;
  --agent-7: #5BC4F0;
  --agent-8: #8FD46A;

  color-scheme: dark;
}

@media (min-width: 1600px) {
  :root { --pad: 48px; }
}
@media (max-width: 1024px) {
  :root { --pad: 28px; --section-gap: 96px; }
}
@media (max-width: 640px) {
  :root { --pad: 16px; --section-gap: 80px; --header-h: 60px; }
}

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

html {
  background: var(--bg);
  overflow-x: clip; /* the full-bleed bands are 100vw wide */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  scrollbar-color: var(--surface-3) var(--bg);
}
::selection { background: var(--ink); color: var(--bg); }

/* Decorative dot grid + neural network, drawn by script.js behind the content */
.bg-net {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
main,
.site-footer { position: relative; z-index: 1; }

/* The two dashed guide rails that frame the column, top to bottom */
body::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 2;
  width: min(var(--col), 100%);
  transform: translateX(-50%);
  border-inline: 1px dashed var(--line-2);
  pointer-events: none;
}

/* ASCII sky behind the content: stars, nebulae, a galaxy and black holes (script.js) */
.cosmos {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  contain: layout paint style;
  pointer-events: none;
  user-select: none;
  color: #2A2A2A;
  font-family: var(--mono);
}
.cosmos .star {
  position: absolute;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.cosmos .twinkle {
  color: #6B6B6B;
  animation: twinkle 5s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
.space {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 10px;
}
/* Computed pieces use many small characters; hand-drawn ones stay legible. */
.space.fine { font-size: 7px; }
.space-burst,
.space-constellation { color: #4A4A4A; }
.space-hole { color: #606060; }
.space-nebula { color: rgba(255, 255, 255, 0.16); }
.space-galaxy { color: rgba(255, 255, 255, 0.2); }
@media (max-width: 1100px) {
  .space { font-size: 8px; }
  .space.fine { font-size: 6px; }
}
@media (max-width: 640px) {
  .space { font-size: 7px; }
  .space.fine { font-size: 5px; }
}
@media print { .bg-net { display: none; } }

body {
  position: relative; /* the agent swarm layer spans the whole document */
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--ink);
  accent-color: var(--ink);
}

h1, h2, h3, p, figure, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
a, button, label, input, textarea, select, summary { touch-action: manipulation; }

.container {
  width: min(var(--col), 100%);
  margin-inline: auto;
  padding-inline: var(--pad);
}

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

.num, .date, .count, .lb-caption { font-variant-numeric: tabular-nums; }
.br { color: var(--ink-3); }
.accent { color: var(--ink); }
.arrow { display: inline-block; margin-left: 0.3em; font-variant-emoji: text; transition: transform 0.2s var(--ease); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
#main:focus { outline: none; }

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Type ---------- */
.display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3.2vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

/* Small mono metadata: dates, tags, captions, labels */
.lead,
.tags,
.status-tag,
.frame-caption,
.device-caption,
.zv-step,
.zv-note,
.count,
.preview-label,
.direct-label,
.stack-list dt,
.timeline .where,
.footer-row,
.service .proof,
.hero-meta {
  font-family: var(--mono);
  letter-spacing: 0;
}

.lead { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); max-width: 56ch; }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }

.text-link {
  display: inline-flex;
  align-items: baseline;
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  text-decoration-color: var(--ink-3);
}
.text-link:hover { text-decoration-color: var(--ink); }
.text-link:hover .arrow { transform: translate(2px, -2px); }
.text-link:active { transform: scale(0.98); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}
.wordmark {
  margin-right: auto;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav ul { display: flex; gap: 22px; list-style: none; }
.site-nav a,
.footer-links a,
.direct-list a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.site-nav a { font-size: 14px; font-weight: 500; color: var(--ink-2); transition: color 0.15s var(--ease); }
.site-nav a:hover { color: var(--ink); text-decoration-color: currentColor; }
.footer-links a:hover,
.direct-list a:hover { text-decoration-color: currentColor; }

.lang { display: flex; gap: 2px; }
.lang button {
  padding: 8px 5px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.lang button[aria-pressed="true"] { color: var(--ink); }
.lang button:hover { color: var(--ink); }

.menu-btn {
  display: none;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.menu-btn:hover { background: var(--surface-2); }
.menu-btn-bars,
.menu-btn-bars::before {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  transition: transform 0.2s var(--ease);
}
.menu-btn-bars { position: relative; transform: translateY(-3px); }
.menu-btn-bars::before { content: ""; position: absolute; top: 6px; left: 0; }
.menu-btn[aria-expanded="true"] .menu-btn-bars { transform: translateY(0) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn-bars::before { transform: translateY(-6px) rotate(-90deg); }

.mobile-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 0 40px;
  background: var(--bg);
}
.mobile-panel[hidden] { display: none; }
.mobile-links { list-style: none; }
.mobile-links a {
  display: block;
  padding: 8px 0;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-decoration: none;
}
.lang-lg { margin-top: 32px; gap: 20px; }
.lang-lg button { padding: 10px 0; font-size: 14px; }

@media (max-width: 860px) {
  .site-nav,
  .header-inner > .lang { display: none; }
  .js .menu-btn { display: inline-flex; }
  .header-inner { gap: 10px; }
}
@media (min-width: 861px) {
  .mobile-panel { display: none !important; }
}
/* Without JS: the menu button cannot work, so show the links as a wrapping row. */
html:not(.js) .lang { display: none; }
@media (max-width: 860px) {
  html:not(.js) .header-inner { flex-wrap: wrap; height: auto; padding-block: 12px; row-gap: 8px; }
  html:not(.js) .site-nav { display: block; order: 3; width: 100%; }
  html:not(.js) .site-nav ul { flex-wrap: wrap; gap: 6px 20px; }
}
html.menu-open, html.lb-open { overflow: hidden; }

/* ---------- Hero: a profile card, then the statement ---------- */
.hero { padding-top: clamp(40px, 6vw, 72px); }

.profile {
  display: flex;
  align-items: flex-end;
  gap: clamp(20px, 3vw, 32px);
}
.profile-text { min-width: 0; flex: 1; }

.name-wrap { container-type: inline-size; }
.hero-name {
  font-size: clamp(48px, 7vw, 80px);
  white-space: nowrap;
  width: fit-content; /* the selection frame hugs the name, not the whole row */
  max-width: 100%;
}
.footer-name {
  /* "Eduardo Duarte" in Instrument Serif measures ~6.2em: 16cqi fills the container. */
  font-size: clamp(40px, 9vw, 140px);
  font-size: 16cqi;
  white-space: nowrap;
}
.hero-name .line,
.footer-name .line { display: inline-block; vertical-align: top; }
.hero-name .line {
  overflow: hidden;
  padding-top: 0.08em;
  margin-top: -0.08em;
  padding-bottom: 0.06em;
}
.hero-name .word { display: inline-block; }

.js .hero-name:not(.is-in) .word { transform: translateY(102%); }
.js .hero-name.is-in .word { animation: rise 0.8s var(--ease-out) both; }
.js .hero-name.is-in .line:nth-of-type(2) .word { animation-delay: 90ms; }
@keyframes rise {
  from { transform: translateY(102%); }
  to { transform: translateY(0); }
}

.hero-meta {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}
.hero-meta .hero-role { color: var(--ink-2); }
.coords { white-space: nowrap; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  margin-top: 10px;
  padding: 4px 12px 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
}
.dot {
  position: relative;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.2s var(--ease) 3;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(3.2); opacity: 0; }
}

.hero-copy {
  display: grid;
  gap: 28px;
  justify-items: start;
  margin-top: clamp(40px, 5vw, 56px);
}
.statement {
  max-width: 30ch;
  font-family: var(--serif);
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.statement .br:first-child { margin-right: 0.08em; }
.statement .br:last-child { margin-left: 0.08em; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}

.hero-photo {
  flex: none;
  width: clamp(128px, 14vw, 220px);
}
.hero-photo .frame,
.hero-photo picture { display: block; }
.hero-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface);
}
/* The portrait redrawn in characters (script.js samples the real photo). It shows
   while the agents place the picture, and again on hover. */
.ascii {
  display: block;
  font-family: var(--mono);
  font-stretch: normal;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  white-space: pre;
  user-select: none;
}
.ascii-probe {
  position: absolute;
  visibility: hidden;
  font-size: 100px;
}
.ascii-portrait {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #050505;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s var(--ease);
}
.hero-photo.is-ascii .ascii-portrait { opacity: 1; }
@media (hover: hover) {
  .hero-photo.has-ascii .frame:hover .ascii-portrait { opacity: 1; transition-duration: 0.25s; }
}
/* script.js scales this block so the character grid covers the frame exactly */
.ascii-portrait .ascii {
  position: absolute;
  top: 0;
  left: 0;
  width: max-content;
  transform-origin: 0 0;
  color: var(--ink-2);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  /* Each character takes the colour of the photo behind it. */
  .ascii-portrait .ascii {
    background-size: 100% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: saturate(1.15) brightness(1.7);
  }
}

/* ---------- HUD viewfinder corners ---------- */
.hud { position: relative; }
.hud::before,
.hud::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 16px;
  height: 16px;
  border: 0 solid var(--hud);
  pointer-events: none;
}
.hud::before { top: -7px; left: -7px; border-top-width: 1px; border-left-width: 1px; }
.hud::after { bottom: -7px; right: -7px; border-bottom-width: 1px; border-right-width: 1px; }
.tile .hud::before,
.tile .hud::after { border-color: #3A3A3A; }

/* ---------- Sections: title on a full-bleed hatched band ---------- */
.section { margin-top: var(--section-gap); }

.section-head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  padding-block: 16px 14px;
  margin-bottom: clamp(32px, 4vw, 48px);
}
.section-head::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: -1;
  width: 100vw;
  transform: translateX(-50%);
  border-block: 1px solid var(--line);
  background: repeating-linear-gradient(-45deg, transparent 0 7px, rgba(255, 255, 255, 0.035) 7px 8px);
}
/* Small marks where the band edges cross the rails */
.section-head::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: calc(-1 * var(--pad) - 3px);
  right: calc(-1 * var(--pad) - 3px);
  pointer-events: none;
  --m: radial-gradient(circle, var(--ink-3) 0 1.6px, transparent 2px);
  background:
    var(--m) left top / 6px 6px no-repeat,
    var(--m) right top / 6px 6px no-repeat,
    var(--m) left bottom / 6px 6px no-repeat,
    var(--m) right bottom / 6px 6px no-repeat;
}
.section-head .lead { text-align: right; }
.section-head .lead::before { content: "( "; }
.section-head .lead::after { content: " )"; }

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 2.6vw, 28px);
}

/* ---------- Projects: features ---------- */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.feature + .feature { margin-top: 20px; }
.feature-text { max-width: 68ch; }

.feature-title,
.work h3,
.service h3,
.how-title {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.005em;
}
h3 { text-wrap: balance; }
.feature-title { font-size: clamp(30px, 3.6vw, 38px); }
.work h3,
.how-title { font-size: 28px; }
.title-row { display: flex; align-items: center; gap: 14px; }
.app-icon { width: 48px; height: 48px; border-radius: 11px; flex: none; }

.feature-sub {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
}
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 3px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.status-tag .br { display: none; }
.status-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.feature-text .body { margin-top: 16px; color: var(--ink-2); }
.feature-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: 20px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 22px;
  list-style: none;
}
.chips li {
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
}

.zoom {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: zoom-in;
}
.zoom img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.zoom:hover img { transform: scale(1.02); }
.zoom:active img { transform: scale(1.01); }

/* Madre Tierra: live site overlapped by the portal dashboard */
.mt-stack { position: relative; padding-bottom: 13%; }
.mt-a { width: 82%; }
.mt-b { position: absolute; right: 0; bottom: 0; width: 58%; }
/* A solid surface-coloured mat separates the overlapping screenshot: padding + fill, no shadow. */
.mt-b {
  padding: 8px 0 0 8px;
  background: var(--surface);
  border-radius: calc(var(--radius-sm) + 2px);
}

/* The machine's own touchscreen, under the web stack, in a dark hardware bezel. */
.mt-device {
  display: flex;
  align-items: flex-end;
  gap: 16px 24px;
  margin-top: clamp(28px, 3vw, 40px);
}
.device-frame {
  flex: none;
  width: 50%;
  padding: 7px;
  border-radius: 10px;
  background: #050505;
  border: 1px solid var(--line);
}
.device-frame .zoom { border-radius: 4px; }
.device-caption {
  max-width: 28ch;
  padding-bottom: 4px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

/* Nest: three phone screens */
.phones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}
.phones .zoom { aspect-ratio: 9 / 16; }

/* Zenvik: the admin dashboard over the three steps a batch goes through on the plant floor */
.zv-main .zoom,
.zv-flow .zoom { aspect-ratio: 16 / 10; }
.zv-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 18px);
  margin-top: clamp(20px, 2.4vw, 28px);
  list-style: none;
}
.zv-step,
.zv-note {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}
.zv-step { margin-top: 12px; }
.zv-step .num { margin-right: 4px; }
.zv-note { margin-top: 18px; }

/* ---------- Projects: other work as bordered cards ---------- */
.works {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.work {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 14px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.work > .hud { align-self: stretch; }
.work .zoom { aspect-ratio: 16 / 9; }
.work .zoom .pos-pigs { object-position: 50% 45%; }
.count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 10, 0.85);
  font-size: 11px;
}
/* Always stacked so titles, tags and copy line up across a row of cards. */
.work-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px;
  padding-inline: 6px;
}
.tags { font-size: 12px; color: var(--ink-3); }
.work-head .status-tag { margin-top: 2px; }
.work-text { margin-top: 10px; padding-inline: 6px; color: var(--ink-2); font-size: 15px; }
.work .text-link { margin-top: auto; padding-top: 16px; margin-left: 6px; }

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.service {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 210px;
}
.service h3 { font-size: clamp(24px, 2.4vw, 28px); }
.service p { max-width: 46ch; color: var(--ink-2); font-size: 15px; }
.service .proof {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed var(--line-2);
  font-size: 12px;
  color: var(--ink-3);
}
.proof a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--ink-3);
}
.proof a:hover { text-decoration-color: var(--ink); }

.how { margin-top: clamp(56px, 7vw, 88px); }
.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 32px;
  margin-top: 24px;
  counter-reset: step;
}
.steps li {
  display: block;
  list-style: none;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  counter-increment: step;
}
.steps li::before {
  content: "0" counter(step);
  display: block;
  margin-bottom: 8px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
}
.steps strong { font-weight: 600; }
.steps li span {
  display: block;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "bio bio"
    "exp exp"
    "stack stack"
    "awards certs"
    "email cv";
  gap: 16px;
}
.t-bio { grid-area: bio; }
.t-exp { grid-area: exp; }
.t-stack { grid-area: stack; }
.t-awards { grid-area: awards; }
.t-certs { grid-area: certs; }
.t-email { grid-area: email; }
.t-cv { grid-area: cv; }

/* The bio reads as plain text, not a card */
.tile.t-bio {
  padding: 0 0 12px;
  border: 0;
  background: none;
}
.bio {
  max-width: 60ch;
  color: var(--ink-2);
  font-size: clamp(17px, 1.6vw, 19px);
  line-height: 1.65;
}
.tile-title {
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}

/* Experience: one row per role, dates flush right */
.timeline { list-style: none; }
.timeline li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 24px;
  padding-block: 12px;
}
.timeline li + li { border-top: 1px dashed var(--line-2); }
.timeline li:first-child { padding-top: 0; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .role { font-weight: 500; line-height: 1.4; }
.timeline .where { font-size: 12px; color: var(--ink-3); text-align: right; }

.stack-list > div {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 4px 16px;
  align-items: baseline;
}
.stack-list > div + div { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.stack-list dt { font-size: 12px; color: var(--ink-3); }
.stack-list dd { color: var(--ink-2); font-size: 15px; }

.plain-list { list-style: none; color: var(--ink-2); font-size: 15px; }
.plain-list li { position: relative; padding-left: 16px; }
.plain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
}
.plain-list li + li { margin-top: 10px; }

.link-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  min-height: 150px;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.link-tile:hover { background: var(--surface-2); border-color: var(--line-2); }
.link-tile-title {
  padding-right: 40px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
}
.link-tile-sub { font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.t-cv .link-tile-sub { color: var(--ink-3); }
.tile-arrow {
  position: absolute;
  top: 20px;
  right: 22px;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-2);
  font-variant-emoji: text;
  transition: transform 0.25s var(--ease), color 0.25s var(--ease);
}
.link-tile:hover .tile-arrow { color: var(--ink); }
.t-email:hover .tile-arrow { transform: translate(3px, -3px); }
.t-cv:hover .tile-arrow { transform: translateY(3px); }

/* ---------- Contact / brief builder ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field + .field { margin-top: 28px; }
legend,
.field-label {
  display: block;
  padding: 0;
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
}
.field-label { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--ink-2); margin-bottom: 8px; }

.chip-set { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  pointer-events: none;
  transition: transform 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.chip:hover span { border-color: var(--ink-3); background: var(--surface-2); transform: translateY(-1px); }
.chip:active span { transform: scale(0.97); }
.chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip input:checked + span::before { content: "\2713"; font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.input {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--field-line); /* taste-skill-ignore: form field boundary, 3:1 non-text contrast */
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.input:hover { border-color: var(--ink-2); }
.input:focus-visible { border-color: var(--ink); }
textarea.input { resize: vertical; min-height: 104px; }

.preview {
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.preview-label { font-size: 12px; color: var(--ink-3); }
.preview-text {
  margin-top: 6px;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.brief-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.direct-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
  list-style: none;
}
.direct-label { display: block; font-size: 12px; color: var(--ink-3); }
.direct-list a { font-weight: 500; overflow-wrap: anywhere; }
.phone { white-space: nowrap; }
.direct-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--line-2);
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Footer ---------- */
.site-footer { margin-top: var(--section-gap); padding-bottom: 32px; }

.marquee {
  position: relative;
  overflow: hidden;
  margin-bottom: 40px;
  padding-block: 14px;
  border-block: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 38s linear infinite;
}
.marquee-track span {
  flex: none;
  padding-right: 0.3em;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1;
  color: var(--ink-3);
  white-space: pre;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.footer-name { color: var(--surface-2); user-select: none; }
/* script.js redraws the name in ASCII; the live text stays as the no-JS version. */
.footer-name.is-ascii { overflow: hidden; }
.footer-name.is-ascii .line { display: none; }
.footer-name .ascii { width: max-content; transform-origin: 0 0; color: #3A3A3A; }
.footer-name .ascii + .ascii { margin-top: 0.9em; }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--ink); }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 72px clamp(16px, 7vw, 96px) 24px;
  border: 0;
  background: var(--bg);
  color: var(--ink);
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: var(--bg); }
.lb-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  max-height: 100%;
}
.lb-img {
  width: auto;
  height: auto;
  max-width: min(1200px, 100%);
  max-height: calc(100dvh - 160px);
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--surface);
}
.lb-caption { max-width: 70ch; font-family: var(--mono); font-size: 12px; color: var(--ink-2); text-align: center; }
.lb-caption .num { color: var(--ink); margin-right: 8px; }
.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.lb-btn:hover { background: var(--surface-2); }
.lb-btn:active { transform: scale(0.94); }
.lb-close { top: 16px; right: 16px; font-size: 26px; }
.lb-prev { left: 16px; top: 50%; margin-top: -22px; }
.lb-next { right: 16px; top: 50%; margin-top: -22px; }

/* ---------- Entrance ----------
   Most content simply fades in as it arrives. A few chosen pieces ([data-agent]) are
   handled by the cursor swarm: "place" pieces stay hidden until a cursor drags out
   their frame; "arrange" pieces arrive slightly out of position and a cursor
   straightens them. script.js sets --ox / --oy / --rot per piece. */
.js [data-reveal],
.js [data-agent] {
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.js [data-reveal].is-in,
.js [data-agent="place"].is-in,
.js [data-agent="arrange"].is-seen { opacity: 1; }
.js [data-agent="arrange"]:not(.is-in) {
  transform: translate(var(--ox, 0px), var(--oy, 0px)) rotate(var(--rot, 0deg));
}

/* ---------- Agent swarm (built by script.js) ---------- */
.swarm {
  position: absolute;
  inset: 0;
  z-index: 40; /* over the page, under the sticky header */
  overflow: hidden;
  contain: layout paint style;
  pointer-events: none;
}
.agent {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--c);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.agent.is-on { opacity: 1; }
.agent svg {
  display: block;
  width: 18px;
  height: 18px;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

/* The selection frame a cursor drags out around a layer */
.sel {
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.3s var(--ease);
}
/* Around a piece being straightened: no fill, appears when the cursor grabs it */
.sel.is-grab { opacity: 0; }
.sel.is-grab .sel-fill { display: none; }
.sel.is-grab.is-held { opacity: 1; transition-duration: 0.12s; }
.sel.is-grab.is-out { opacity: 0; transition-duration: 0.3s; }
.sel.is-out { opacity: 0; }
/* Edges and fill: script.js opens them with transforms only */
.sel b {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--ink-2);
  transform-origin: 0 0;
}
.sel-t, .sel-b { width: 100%; height: 1px; }
.sel-l, .sel-r { width: 1px; height: 100%; }
.sel .sel-fill {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.05);
  transition: opacity 0.3s var(--ease);
}
.sel.is-set .sel-fill { opacity: 0; }
/* Resize handles */
.sel i {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 7px;
  height: 7px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.sel-size {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}
.sel.is-set .sel-size { opacity: 1; }

/* Build bar: how many agents are working and how much of the page is assembled */
.buildbar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 14px 32px -10px rgba(0, 0, 0, 0.7);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease-out), visibility 0s 0.35s;
}
.buildbar.is-on {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.bb-dots { display: flex; padding-left: 3px; }
.bb-dots i {
  width: 10px;
  height: 10px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px var(--surface);
}
.bb-agents { color: var(--ink); font-weight: 600; }
.bb-layers,
.bb-meter { font-family: var(--mono); font-size: 12px; }
.bb-meter { white-space: pre; }
.bb-on { color: var(--ink); }
.bb-off { color: var(--field-line); }
.bb-state {
  min-width: 15ch;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.buildbar.is-idle .bb-state { background: var(--surface-3); color: var(--ink); }
.bb-skip {
  min-height: 32px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.bb-skip:hover { background: var(--surface-3); color: var(--ink); }
.bb-skip:active { transform: scale(0.96); }

/* ---------- Wide screens: the column is wide enough for two-up layouts ---------- */
@media (min-width: 1500px) {
  .hero-name { font-size: clamp(80px, 5.6vw, 112px); }
  .hero-meta { font-size: 14px; }
  .statement { max-width: 32ch; font-size: clamp(46px, 3.3vw, 62px); }

  .feature {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 40px 56px;
    align-items: start;
  }
  .feature-text { position: sticky; top: calc(var(--header-h) + 32px); }

  .about-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-areas:
      "bio bio bio bio bio exp exp exp exp exp exp exp"
      "stack stack stack stack stack exp exp exp exp exp exp exp"
      "awards awards awards awards certs certs certs certs email email cv cv";
  }
  .tile.t-bio { padding: 0 8px 0 0; }

  .services-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .direct-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .works,
  .services-grid { grid-template-columns: minmax(0, 1fr); }
  .service { min-height: 0; }
  .section-head .lead { text-align: left; }
}

@media (max-width: 640px) {
  body::after { display: none; } /* no margin outside the column for the rails */
  .section-head::after { display: none; }

  .profile { align-items: flex-start; flex-direction: column; gap: 20px; }
  .hero-photo { width: 128px; }
  .hero-name { font-size: clamp(48px, 15vw, 64px); }
  .footer-name {
    /* "Eduardo" alone measures ~3.1em: 30cqi fills the container. */
    font-size: clamp(40px, 26vw, 140px);
    font-size: 30cqi;
  }
  .footer-name .line { display: block; }
  .coords { display: none; }

  .hero-actions .btn { flex: 1 1 auto; }

  .tile { padding: 18px; }
  .feature { gap: 28px; }
  .mt-stack { padding-bottom: 18%; }
  .mt-a { width: 92%; }
  .mt-b { width: 66%; padding: 5px 0 0 5px; }
  .mt-device { flex-direction: column; align-items: flex-start; }
  .device-frame { width: 78%; padding: 5px; border-radius: 8px; }

  /* Nest: two phones per row are legible; the third lives in the lightbox. */
  .phones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phones > .hud:nth-child(3) { display: none; }

  /* Zenvik: same rule, two steps per row; the report stays in the lightbox. */
  .zv-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zv-flow > li:nth-child(3) { display: none; }

  .about-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "bio" "exp" "stack" "awards" "certs" "email" "cv";
  }
  .timeline li { flex-direction: column; gap: 2px; }
  .timeline .where { text-align: left; }
  .stack-list > div { grid-template-columns: minmax(0, 1fr); }
  .link-tile { min-height: 132px; }
  .link-tile-title { font-size: 30px; }

  .steps { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .direct-list { grid-template-columns: minmax(0, 1fr); }

  .brief-actions .btn { flex: 1 1 100%; }

  .footer-row { flex-direction: column; align-items: flex-start; }

  .buildbar { gap: 10px; padding-left: 14px; font-size: 12px; }
  .bb-dots,
  .bb-state { display: none; }
  .bb-layers,
  .bb-meter { font-size: 11px; }
  .agent svg { width: 15px; height: 15px; }

  .lightbox { padding: 64px 12px 88px; }
  .lb-img { max-height: calc(100dvh - 200px); }
  .lb-prev,
  .lb-next { top: auto; bottom: 16px; margin-top: 0; }
  .lb-prev { left: calc(50% - 52px); }
  .lb-next { right: calc(50% - 52px); }
}

/* Very narrow phones: the menu button drops its visible word (it stays as the accessible name). */
@media (max-width: 400px) {
  .menu-btn { flex: none; width: 36px; padding: 0; justify-content: center; }
  .menu-btn-label {
    position: absolute;
    width: 1px; height: 1px; margin: -1px; padding: 0; /* taste-skill-ignore: visually-hidden label, not a rule */
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }
  .bb-agents { display: none; }
}
/* Below ~340px wordmark + CTA + menu no longer fit; the CTA repeats in the hero and the menu. */
@media (max-width: 340px) {
  .header-cta { display: none; }
}

/* ---------- Reduced motion: no travel, no pulse ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .hero-name .word { animation: none !important; transform: none !important; }
  .swarm, .buildbar { display: none; }
  .dot::after { animation: none; opacity: 0; }
  .marquee-track { animation: none; }
  .js [data-reveal],
  .js [data-agent] { opacity: 1 !important; transform: none !important; transition: none; }
  .cosmos .twinkle { animation: none; }
  .btn, .zoom img, .chip span, .tile-arrow, .arrow, .lb-btn, .menu-btn-bars { transition: none; }
  .btn:hover, .chip:hover span, .zoom:hover img { transform: none; }
}

/* ---------- Print: everything visible, no chrome ---------- */
@media print {
  body::after, .section-head::before, .section-head::after, .marquee { display: none !important; }
  .js [data-reveal],
  .js [data-agent] { opacity: 1 !important; transform: none !important; }
  .cosmos { display: none !important; }
  .js .hero-name .word { animation: none !important; transform: none !important; }
  .site-header, .mobile-panel, .lightbox, .skip-link, .swarm, .buildbar { display: none !important; }
}
