/* ==========================================================================
   Tokens — measured from sub.global (Tailwind build): black field,
   #606060 "dark" pills/panels, #444 window bars, #d9d9d9 connector lines.
   Swap --font for your own face (@font-face) when you have one.
   ========================================================================== */
:root {
  --font: "Geist", "Helvetica Neue", Arial, sans-serif;
  --bg: #000;
  --fg: #fff;
  --dark: #606060;
  --bar: #444;
  --line: #d9d9d9;
  --dim: 0.2;
  --pad: 10px;
  --ease: cubic-bezier(0.87, 0, 0.13, 1);      /* GSAP expo.inOut */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);   /* expo.out */
}

@property --w { syntax: "<number>"; inherits: true; initial-value: 120; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body {
  text-transform: lowercase;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 200; background: #000;
  display: grid; place-items: center;
  transition: opacity .6s ease .1s;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader.hold { background: transparent; pointer-events: none; transition: background-color .9s ease; }
#loader.hold .loader-bar { opacity: 0; transition: opacity .5s ease; }
#loader .loader-mark { transition: opacity .9s cubic-bezier(.4,0,.2,1) .15s, transform 1.6s cubic-bezier(.4,0,.2,1), filter .9s ease .15s; }
#loader.open .loader-mark { opacity: 0; transform: scale(1.35); filter: blur(2px); }
#loader.open.done { transition: opacity .01s; }
.loader-mark { font-weight: 600; font-size: 26px; letter-spacing: -.02em; line-height: 1; }
.loader-bar {
  position: absolute; left: 50%; bottom: 7.5vh; width: 12vw; min-width: 90px; height: 1px;
  transform: translateX(-50%); background: rgba(255,255,255,.25); overflow: hidden;
}
.loader-bar i { position: absolute; inset: 0; background: #fff; transform-origin: 0 50%; transform: scaleX(0); transition: transform .3s ease; }

/* ---------- Header ---------- */
#hdr {
  position: fixed; left: 0; right: 0; top: 0; z-index: 50;
  display: flex; align-items: flex-start; gap: 36px;
  padding: var(--pad); pointer-events: none;
}
.hdr-grad {
  position: absolute; inset: 0 0 auto 0; height: 110px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.85), rgba(0,0,0,0));
  transition: opacity .4s;
}
body.view-page .hdr-grad { opacity: 0; }
#hdr > * { position: relative; pointer-events: auto; }
#hdr > .hdr-grad { position: absolute; pointer-events: none; }
.logo { display: flex; align-items: center; height: 20px; font-weight: 600; font-size: 17px; letter-spacing: -.02em; line-height: 1; }
.menu { display: flex; gap: 16px; list-style: none; margin: 0 0 0 -16px; padding: 0; }
.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0;
  border: 0; border-radius: 0; background: none;
  font-size: 12px; letter-spacing: .04em; line-height: 1; white-space: nowrap;
  opacity: .5; transition: opacity .25s ease-out;
}
@media (hover: hover) { .pill:hover { opacity: 1; } }
.pill.is-active { opacity: 1; }
#clearBtn, #closeBtn, #statusLink { opacity: .85; }
.only-mobile { display: none; }

/* Filter columns */
.filters { display: flex; gap: 0; margin-top: 0; flex: 1 1 auto; min-width: 0; }
.filters ul { list-style: none; margin: 0; padding: 0 8px 0 0; flex: 1 1 0; max-width: 120px; min-width: 0; }
.filters ul:last-child { flex: 0 0 auto; }
.filters button { white-space: nowrap; }
.filters button {
  display: block; font-size: 12px; line-height: 16px; letter-spacing: .02em; text-align: left;
  transition: opacity .3s, transform .3s var(--ease-out);
}
.filters.has-active button { opacity: .45; }
.filters.has-active button.on { opacity: 1; }
@media (hover: hover) { .filters button:hover { opacity: 1; transform: translateX(2px); } }
body:not(.view-projects):not(.view-project) .filters { opacity: 0; pointer-events: none; }
body.view-project .filters { opacity: 0; pointer-events: none; }

.hdr-right { flex-shrink: 0; margin-left: auto; display: flex; align-items: center; gap: 12px; height: 20px; }

/* Zoom slider: hairline with end dots and a knob (sub.global top-right) */
.zoom { display: flex; align-items: center; width: 110px; height: 20px; position: relative; cursor: pointer; }
.zoom::before, .zoom::after { content: ""; position: absolute; top: 50%; width: 3px; height: 3px; border-radius: 50%; background: #fff; transform: translateY(-50%); }
.zoom::before { left: 0; width: 4px; height: 4px; }
.zoom::after { right: 0; }
.zoom input { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; background: transparent; cursor: pointer; }
.zoom input::-webkit-slider-runnable-track { height: 1px; background: rgba(255,255,255,.6); }
.zoom input::-moz-range-track { height: 1px; background: rgba(255,255,255,.6); }
.zoom input::-webkit-slider-thumb { -webkit-appearance: none; width: 5px; height: 5px; margin-top: -2px; border-radius: 50%; background: #fff; }
.zoom input::-moz-range-thumb { width: 5px; height: 5px; border: 0; border-radius: 50%; background: #fff; }
body:not(.view-projects) .zoom { display: none; }

/* ---------- Stage / world ---------- */
#stage {
  position: fixed; inset: 0; overflow: hidden; touch-action: none;
  background:
    radial-gradient(ellipse at 50% 50%, #050507 0%, #000 85%);
  cursor: grab; transition: opacity .5s ease, filter .5s ease;
}
#stage.dragging { cursor: grabbing; }
body.view-page #stage { opacity: 0; pointer-events: none; }
body.view-project #stage { filter: brightness(.55); pointer-events: none; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#neural { position: absolute; left: 0; top: 0; pointer-events: none; }
#traces { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; }
/* soft vignette over everything on the field: the edge of vision */
#stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse 85% 80% at 50% 50%, transparent 55%, rgba(0,0,0,.75) 100%);
}

/* ---------- Nodes ---------- */
.node {
  --w: 120;                                   /* world units; JS sets */
  position: absolute; left: 0; top: 0;
  width: calc(var(--w) * 1px);
  transform-origin: 0 0;
  transition: filter .9s ease;
  will-change: transform;
  opacity: 0;
}
.node.in { opacity: 1; }
/* depth of field: far neurons sit out of focus */
.node.far { filter: blur(.9px) brightness(.72); }
.node.in.far { opacity: .85; }
/* when a thought is in focus, everything else recedes */
.node.dim { opacity: .2; filter: blur(3px) brightness(.5) saturate(.5); }
/* label above the image: no bar, no rounded chrome — just the file name */
.node .bar {
  display: flex; align-items: center;
  height: calc(var(--w) * .06px); padding: 0;
  background: none; border-radius: 0;
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: calc(var(--w) * .034px); font-weight: 500; letter-spacing: .06em; line-height: 1;
  white-space: nowrap; overflow: hidden; color: #fff; opacity: .55;
  transition: opacity .5s ease;
}
.node .bar i { display: none; }
.node.fire .bar { opacity: 1; transition-duration: .05s; }
.node .img { position: relative; background: #111; overflow: hidden; border-radius: 0; transition: padding-top 1s var(--ease); }
.node .img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
@media (hover: hover) { .node:hover .bar { opacity: 1; } .node.far:hover { filter: none; } }
.node { cursor: pointer; }

/* Expanded card (selected + related) */
.node .tags {
  position: relative; background: var(--dark); border-radius: 0 0 calc(var(--w) * .022px) calc(var(--w) * .022px);
  font-size: 8px; line-height: 1; letter-spacing: .0275em;
  max-height: 0; overflow: hidden; transition: max-height .8s var(--ease) .4s;
}
.node.card .tags { max-height: 160px; overflow: visible; }
.tags-in { padding: 6px 5px 6px; }
.tag { position: relative; height: 10px; display: flex; align-items: center; white-space: nowrap; opacity: 0; transition: opacity .4s ease .9s; }
.node.card .tag { opacity: 1; }
.tag b { font-weight: 600; margin-left: .3em; }
.tag.c-l::before, .tag.c-r::after {
  content: ""; position: absolute; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 0; background: #fff;
}
.tag.c-l::before { left: -7px; }
.tag.c-r::after { right: -7px; }
.tag.c-r { width: 100%; }
.see-more { display: block; margin-top: 16px; padding-bottom: 1px; font-size: 8px; opacity: 0; transition: opacity .4s ease 1s; }
.node.card .see-more { opacity: 1; }
@media (hover: hover) { .see-more:hover { text-decoration: underline; } }

#veil { position: fixed; inset: 0; z-index: 12; background: #000; opacity: 0; pointer-events: none; transition: opacity .4s ease; }
#veil.on { opacity: 1; transition-duration: .35s; }
#stage { transform-origin: 50% 50%; }
.node .img img { transition: filter .35s ease; }
body:not(.view-projects) #driftBtn { display: none; }

/* ---------- Status (bottom right) ---------- */
#status {
  position: fixed; right: var(--pad); bottom: var(--pad); z-index: 40;
  display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .04em;
}
body:not(.view-projects) #status { display: none; }

/* ---------- Project overlay ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 30; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 0 72px; pointer-events: auto;
  background: rgba(0,0,0,.94);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.proj { opacity: 0; transform: translateY(10px); transition: opacity .6s ease, transform .9s var(--ease-out); }
#overlay.in .proj { opacity: 1; transform: none; }
.proj-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  padding: 108px var(--pad) 18px;
}
.proj-head h1 { margin: 0; font-weight: 400; font-size: clamp(26px, 3.2vw, 52px); line-height: 1; letter-spacing: -.02em; }
.proj-sub, .proj-count, .proj-meta dt {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace; font-size: 11px; letter-spacing: .02em; color: rgba(255,255,255,.5);
}
.strip {
  display: flex; gap: 2px; height: min(70vh, 820px); overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity; cursor: ew-resize;
}
.strip::-webkit-scrollbar { display: none; }
.strip figure { margin: 0; flex: none; height: 100%; scroll-snap-align: start; }
.strip img, .strip video { height: 100%; width: auto; display: block; }
.proj-count { padding: 10px var(--pad) 0; }
.proj-count .cur { color: #fff; }
.proj-body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: 0 48px;
  padding: 56px var(--pad) 0; max-width: 1600px;
}
.proj-meta { margin: 0; display: grid; grid-template-columns: 112px 1fr; gap: 0 20px; align-content: start; }
.proj-meta dt, .proj-meta dd { padding: 7px 0 8px; border-top: 1px solid rgba(255,255,255,.14); line-height: 1.3; }
.proj-meta dd { margin: 0; font-size: 13px; }
.proj-text { margin: 0; font-size: clamp(15px, 1.15vw, 19px); line-height: 1.45; letter-spacing: -.005em; max-width: 46ch; border-top: 1px solid rgba(255,255,255,.14); padding-top: 9px; }

/* ---------- Text pages ---------- */
#page {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; padding: 0 var(--pad) 80px;
  opacity: 0; transition: opacity .45s ease;
}
#page.in { opacity: 1; }
.col { width: 64vw; max-width: 1100px; margin-left: 18vw; }
.label { font-size: 10px; letter-spacing: .04em; line-height: 1.4; margin-bottom: 4px; }
.big { font-size: clamp(20px, 1.9vw, 34px); line-height: 1.15; letter-spacing: -.005em; font-weight: 400; margin: 0 0 1.15em; }
.small { font-size: 11px; line-height: 1.45; letter-spacing: .01em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 36px; }
.about-top { padding-top: 76px; }
.clients { columns: 4; column-gap: 24px; list-style: none; padding: 0; margin: 4px 0 0; }

/* Index table */
.search { display: flex; align-items: center; margin-top: 100px; border-bottom: 1px solid rgba(255,255,255,.5); }
.search input {
  flex: 1; background: transparent; border: 0; outline: 0; color: #fff;
  font: inherit; font-size: clamp(18px, 1.55vw, 26px); padding: 6px 0 8px; letter-spacing: .005em;
}
.search input::placeholder { color: rgba(255,255,255,.85); }
.search svg { width: 12px; height: 12px; opacity: .8; }
table.idx { width: 100%; border-collapse: collapse; margin-top: 100px; }
.idx th { text-align: left; font-weight: 400; font-size: 10px; letter-spacing: .04em; padding: 0 0 6px; }
.idx td { font-size: clamp(16px, 1.45vw, 24px); line-height: 1.2; padding: 7px 0 8px; border-top: 1px solid rgba(255,255,255,.6); vertical-align: top; }
.idx tr.row { cursor: pointer; transition: opacity .2s; }
.idx tbody:hover tr.row { opacity: .4; }
.idx tbody tr.row:hover { opacity: 1; }
.idx .c-year { width: 10%; } .idx .c-name { width: 36%; } .idx .c-client { width: 15%; } .idx .c-dept { width: 20%; }
.idx .empty td { opacity: .6; }
#preview {
  position: fixed; z-index: 25; width: 240px; height: auto; pointer-events: none;
  border: 1px solid rgba(255,255,255,.3); border-radius: 4px;
}

/* News */
.news-item { padding: 26px 0 30px; border-top: 1px solid rgba(255,255,255,.6); display: grid; grid-template-columns: 10% 1fr 28%; gap: 0 20px; }
.news-item .big { margin: 0 0 .5em; }
.news-item img { width: 100%; height: auto; display: block; cursor: pointer; }

/* Contact */
.contact-line { display: grid; grid-template-columns: 18vw 1fr; align-items: baseline; border-top: 1px solid rgba(255,255,255,.6); padding: 8px 0 10px; }
.contact-line .big { margin: 0; }
@media (hover: hover) { .contact-line a:hover { opacity: .6; } }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  #hdr { flex-wrap: wrap; gap: 10px; }
  .menu { margin-left: 0; }
  .only-mobile { display: block; }
  #hdr .filters {
    position: absolute; left: var(--pad); right: var(--pad); top: 40px;
    flex-wrap: wrap; gap: 10px 0; padding: 10px; border-radius: 8px;
    background: rgba(40,40,40,.8); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
    opacity: 0; pointer-events: none; transform: translateY(-6px); transition: opacity .3s, transform .3s;
  }
  body.filters-open.view-projects #hdr .filters { opacity: 1; pointer-events: auto; transform: none; }
  .filters ul, .filters ul:last-child { flex: 0 0 25%; max-width: none; padding-right: 0; }
  .filters button { font-size: 13px; line-height: 19px; }
  .zoom { width: 70px; }
  .col { width: auto; margin-left: 0; }
  .proj-body { grid-template-columns: 1fr; gap: 40px; padding-top: 36px; }
  .proj-head { padding-top: 96px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .two { grid-template-columns: 1fr; gap: 16px; }
  .clients { columns: 2; }
  .idx .c-client, .idx .c-dept { display: none; }
  .news-item { grid-template-columns: 1fr; gap: 10px; }
  .contact-line { grid-template-columns: 1fr; }
  .strip { height: 58vh; }
  #preview { display: none !important; }
}
@media (max-width: 600px) {
  .filters ul, .filters ul:last-child { flex: 0 0 50%; }
  #hdr .hdr-right { position: absolute; right: var(--pad); top: var(--pad); }
  .menu { width: 100%; gap: 14px; margin-left: 0; }
  #hdr .filters { top: 66px; }
}
@media (prefers-reduced-motion: reduce) {
  .node, .proj, #page, #loader { transition-duration: .01s !important; transition-delay: 0s !important; }
}

/* no capitals anywhere */
input, button, textarea, select { text-transform: lowercase; }
::placeholder { text-transform: lowercase; }

/* pass-through hint (focused view) */
#passHint {
  position: fixed; left: 50%; bottom: 18px; z-index: 40; transform: translateX(-50%);
  font-family: "Geist Mono", ui-monospace, Menlo, monospace; font-size: 11px; letter-spacing: .02em;
  color: rgba(255,255,255,.55); text-align: center; pointer-events: none;
}
#passHint i { display: block; width: 120px; height: 1px; margin: 7px auto 0; background: #fff; transform-origin: 0 50%; transform: scaleX(0); }
#passHint::after { content: ""; display: block; width: 120px; height: 1px; margin: -1px auto 0; background: rgba(255,255,255,.18); }
#passHint .no-hover { display: none; }
@media (hover: none) { #passHint .can-hover { display: none; } #passHint .no-hover { display: inline; } }

.node .img video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

/* wordmark tiles: square, no label */
.node.sq .bar { display: none; }
.node.sq .img { transition: none; }

/* wordmark view: no glow, flat black */
#stage::before { content: ""; position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
body.logo #stage::before { opacity: 1; }

/* opening glitch */
.node.gl .img { filter: drop-shadow(5px 0 0 rgba(255,43,28,.75)) drop-shadow(-4px 0 0 rgba(90,200,255,.55)); transition: none; }
.node.gl2 { clip-path: inset(var(--gt, 30%) 0 var(--gb, 40%) 0); }

/* build: an image arrives as a bare frame, then its picture is scanned in top to bottom */
.node.wire .img { background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.38); }
.node.wire .img > img, .node.wire .img > video { clip-path: inset(0 0 calc(100% - var(--rv, 0%)) 0); }
.node.wire .img::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent calc(var(--rv, 0%) - 2px), rgba(255,255,255,.95) calc(var(--rv, 0%) - 2px), rgba(255,255,255,.95) var(--rv, 0%), transparent var(--rv, 0%)); }
.node.wire .bar { opacity: .95; }

/* Minimal header: filters live behind "filter" */
.filter-li { display: block; }
body:not(.view-projects) .filter-li { display: none; }
#filterToggle.is-active { opacity: 1; }
.zoom { display: none !important; }
@media (min-width: 1024px) {
  #hdr .filters {
    position: absolute; left: var(--pad); top: calc(var(--pad) + 34px); flex: none;
    opacity: 0; pointer-events: none; transform: translateY(-4px);
    transition: opacity .3s ease, transform .3s var(--ease-out);
  }
  body.filters-open.view-projects #hdr .filters { opacity: 1; pointer-events: auto; transform: none; }
  .filters ul { flex: 0 0 auto; max-width: none; padding-right: 28px; }
  .hdr-grad { transition: opacity .4s, height .4s var(--ease-out); }
  body.filters-open.view-projects .hdr-grad { height: 210px; }
}
.filters button { text-shadow: 0 0 10px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.9); }

/* About: small, airy text */
.about-page { max-width: 520px; }
.about-page .label { margin-bottom: 40px; }
.about-page p.big { font-size: 14px; line-height: 1.75; letter-spacing: .01em; margin: 0 0 30px; }
@media (max-width: 600px) { .about-page p.big { font-size: 13px; } }
/* filter hidden for now */
.filter-li, #hdr .filters { display: none !important; }
