/* Balaban Studio — prototype styles
   Two voices: a sans for the human, a mono for the machine.
   Two themes: paper white, and true black for OLED. */

:root {
  --bg: #ffffff;
  --ink: #000000;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --fill: #f3f3f3;
  --scan: light;

  --sans: "Instrument Sans", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: clamp(20px, 4.5vw, 64px);
  --gap: clamp(20px, 3vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --ink: #ededed; --muted: #8e8e8e; --line: #222222; --fill: #0e0e0e;
    --scan: dark;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --ink: #ededed; --muted: #8e8e8e; --line: #222222; --fill: #0e0e0e;
  --scan: dark;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }

/* Hover: text links thicken their underline; the small mono links invert,
   like a selection in a terminal. */
a:hover { text-decoration-thickness: 2px; }
.links a, .top nav a, .mark { padding: 1px 4px; margin: -1px -4px; }
.links a:hover, .top nav a:hover, .mark:hover { background: var(--ink); color: var(--bg); text-decoration: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- machine voice ---------- */
.top, .meta, .links, .btn, .load, .foot {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: 0.01em;
}
.meta { color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* ---------- header ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px var(--pad);
  position: fixed; top: 0; left: 0; right: 0; z-index: 5; /* floats over the hero, then follows the page */
  border-bottom: 1px solid transparent;
  transition: padding 0.2s, background-color 0.2s, border-color 0.2s;
}
.top.stuck { padding-top: 10px; padding-bottom: 10px; background: var(--bg); border-bottom-color: var(--line); }
.top a { text-decoration: none; }
.top nav a.cta { border: 1px solid var(--ink); padding: 3px 10px; margin: 0; }
.top.stuck nav a.cta { background: var(--ink); color: var(--bg); }
[id] { scroll-margin-top: 64px; }
.mark { font-weight: 500; font-size: 12.5px; }
.top nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 28px); }
.theme {
  font: inherit; color: var(--muted); background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
}
.theme:hover { color: var(--bg); background: var(--ink); border-color: var(--ink); }

/* ---------- hero ----------
   Wide screens: the point cloud fills the right of the hero and the headline
   runs over its left edge. The cloud dissolves toward the text, and the
   headline carries an outline in the page colour, so letters cut cleanly
   through whatever characters sit behind them.
   Narrow screens: the cloud sits on top and the headline rises into its base. */
.hero {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: min(92vh, 900px);
  padding: 96px var(--pad) clamp(56px, 7vw, 96px);
  overflow: hidden;
}
.scan-wrap {
  position: absolute; top: 0; bottom: 0; right: 0; left: 34%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 2%, #000 34%), linear-gradient(to bottom, #000 82%, transparent);
          mask-image: linear-gradient(to right, transparent 2%, #000 34%), linear-gradient(to bottom, #000 82%, transparent);
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
}
#scan {
  margin: 0; height: 100%;
  font-family: var(--mono);
  font-stretch: 75%;
  font-weight: 400;
  font-size: clamp(7px, 0.62vw, 10px);
  line-height: 1.12;
  white-space: pre;
  text-align: center;
  color: var(--ink);
  cursor: grab;
  user-select: none; -webkit-user-select: none;
  touch-action: pan-y;
}
#scan.is-dragging { cursor: grabbing; }

.hero-copy { position: relative; z-index: 1; max-width: 880px; pointer-events: none; }
.hero-copy > * { pointer-events: auto; }
h1 {
  font-weight: 500;
  font-size: clamp(36px, 5.6vw, 80px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 10em;
  text-wrap: balance;
  -webkit-text-stroke: 0.2em var(--bg);
  paint-order: stroke fill;
}
.lede {
  margin-top: clamp(18px, 2.4vw, 28px);
  max-width: 31em;
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.5;
  color: var(--muted);
  text-shadow: 0 0 6px var(--bg), 0 0 12px var(--bg), 0 0 20px var(--bg);
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(24px, 3vw, 36px); }


.btn {
  display: inline-block;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.btn { background: var(--bg); }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.solid:hover { background: var(--bg); color: var(--ink); }

/* ---------- bands: heading on the left, work on the right ---------- */
.band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: var(--gap);
  padding: clamp(36px, 5vw, 64px) var(--pad);
  border-top: 1px solid var(--line);
}
.band-body { min-width: 0; }
.band-head { display: flex; flex-direction: column; gap: 10px; align-self: start; position: sticky; top: 72px; }
.band-head > p:not(.links) { color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 26em; }
.band-head .links { margin-top: 6px; flex-direction: column; gap: 4px; }
h2 { font-weight: 500; font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; }
h3 { font-weight: 500; font-size: 17px; line-height: 1.35; }
h3 a { text-decoration: none; }
h3 a:hover { text-decoration: underline; }

/* a second group inside a band, e.g. workflows under the splats */
.sub { margin: clamp(36px, 4.5vw, 56px) 0 20px; padding-top: 16px; border-top: 1px solid var(--ink); font-size: 20px; line-height: 1.25; letter-spacing: -0.01em; }
.sub.first { margin-top: 0; padding-top: 0; border-top: 0; }
.blurb { color: var(--muted); font-size: 15px; max-width: 36em; margin: -8px 0 18px; }

/* tiles: posters that load a 3D scene or model in place, and film links */
.tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap) 16px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--gap); align-items: start; }
.split .blurb { margin: 0; }
.split .stage { aspect-ratio: 16 / 9; }
.split .links { margin-top: 14px; }
.split.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* a lead image at the top of a band */
.lead { margin-bottom: 0; }
.lead img { width: 100%; height: auto; max-height: min(72vh, 620px); object-fit: cover; background: var(--fill); }
.tile.wide { grid-column: 1 / -1; }
.stage { position: relative; aspect-ratio: 4 / 3; background: var(--fill); overflow: hidden; }
.tiles.two .stage { aspect-ratio: 16 / 9; }
.tile.wide .stage { aspect-ratio: 21 / 9; }
.stage img, .stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.load {
  position: absolute; left: 12px; bottom: 12px;
  padding: 8px 12px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--ink);
  font-weight: 500; cursor: pointer;
}
.load:hover { background: var(--ink); color: var(--bg); }
figcaption, .film { font-size: 15px; line-height: 1.4; }
figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; margin-top: 10px; }
.film { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: baseline; align-content: start; text-decoration: none; }
.film img { grid-column: 1 / -1; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--fill); }
.film:hover span:first-of-type { text-decoration: underline; }

/* collage: stills from the VR work, a wide banner and a square side by side */
.collage {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 6px; aspect-ratio: 3 / 1; margin-bottom: var(--gap);
}
.collage a { position: relative; display: block; min-height: 0; overflow: hidden; background: var(--fill); text-decoration: none; }
.collage img { width: 100%; height: 100%; object-fit: cover; color: transparent; }
.chip {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px);
  padding: 3px 7px; background: var(--bg); color: var(--ink); border: 1px solid var(--ink);
  font-family: var(--mono); font-stretch: 87.5%; font-size: 10.5px; line-height: 1.5;
}
.collage a:hover .chip { background: var(--ink); color: var(--bg); }

/* stereo viewer */
.stereo { --h: min(66vh, 600px); }
.stereo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 14px; }
.modes { display: flex; flex-wrap: wrap; }
.modes button {
  font-family: var(--mono); font-stretch: 87.5%; font-size: 11.5px; line-height: 1.6;
  padding: 6px 11px; margin-right: -1px;
  background: var(--bg); color: var(--ink); border: 1px solid var(--ink); cursor: pointer;
}
.modes button:hover { background: var(--fill); }
.modes button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.stereo-stage {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  height: var(--h); background: var(--fill); overflow: hidden;
}
.eye {
  --w: min(var(--max, 100%), calc(var(--h) * var(--ar)));
  width: var(--w); aspect-ratio: var(--ar); flex: none;
  background-image: var(--src); background-size: 200% 100%; background-repeat: no-repeat;
  border-radius: 4.2% / calc(4.2% * var(--ar)); /* matches the rounded frame in the photos */
}
.eye.l { background-position: 0 0; }
.eye.r { background-position: 100% 0; }

[data-mode="2d"] .eye.r, [data-mode="wiggle"] .eye.r { display: none; }
[data-mode="wiggle"] .stereo-stage { cursor: pointer; }
@keyframes wiggle { 0% { background-position: 0 0; } 50%, 100% { background-position: 100% 0; } }
@media (hover: hover) {
  [data-mode="wiggle"] .stereo-stage:hover .eye.l { animation: wiggle 0.3s steps(1, end) infinite; }
}
[data-mode="wiggle"] .stereo-stage.is-playing .eye.l { animation: wiggle 0.3s steps(1, end) infinite; }

/* anaglyph: left eye keeps red, right eye keeps green and blue, then they add */
[data-mode="anaglyph"] .stereo-stage { position: relative; isolation: isolate; background: #000; }
[data-mode="anaglyph"] .eye { background-blend-mode: multiply; }
[data-mode="anaglyph"] .eye.l { background-color: #f00; }
[data-mode="anaglyph"] .eye.r { background-color: #0ff; mix-blend-mode: screen; position: absolute; }

/* free viewing: parallel needs small images, about as far apart as your eyes */
[data-mode="parallel"] .eye { --max: min(250px, calc(50% - 5px)); }
[data-mode="cross"] .eye { --max: calc(50% - 5px); }
[data-mode="cross"] .eye.l { order: 2; }

.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding: 3px; }
.thumb {
  flex: none; height: 60px; aspect-ratio: var(--ar); padding: 0; cursor: pointer;
  background: var(--src) 0 0 / 200% 100% no-repeat var(--fill);
  border: 0; border-radius: 3px; opacity: 0.55;
}
.thumb:hover { opacity: 0.85; }
.thumb[aria-pressed="true"] { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }


/* rows */
.rows li {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 13rem;
  gap: 4px 24px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.rows li:first-child { border-top: 0; padding-top: 0; }
.rows li > p:not(.links) { color: var(--muted); font-size: 15px; }
.rows .links { justify-content: flex-end; }
.rows.dated li { grid-template-columns: 5.5em minmax(0, 1fr); }
.rows.dated a { text-decoration: none; font-size: 16px; }
.rows h3 { font-size: 16px; }
.rows.dated a:hover { text-decoration: underline; }
.rows.tight { margin-top: 28px; }
.rows.two li { grid-template-columns: minmax(0, 5fr) minmax(0, 9fr); }
.rows .meta { margin-top: 2px; }

/* fold: rows that open in place. The summary is the row; the body holds the media. */
.rows.fold > li { display: block; padding: 0; }
.rows.fold > li:last-child { border-bottom: 1px solid var(--line); }
.fold summary {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 13rem; gap: 4px 24px; align-items: baseline;
  padding: 14px 0; cursor: pointer; list-style: none;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary > p { color: var(--muted); font-size: 15px; }
.fold-meta { display: flex; justify-content: flex-end; align-items: baseline; gap: 14px; }
.fold-mark { font-family: var(--mono); font-size: 13px; line-height: 1.4; min-width: 1.7em; padding: 0 4px; text-align: center; border: 1px solid var(--ink); }
.fold-mark::before { content: "+"; }
.fold details[open] .fold-mark::before { content: "\2212"; }
.fold summary:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
.fold summary:hover .fold-mark { background: var(--ink); color: var(--bg); }
.fold-body { padding: 8px 0 36px; }
.fold-body .links { justify-content: flex-start; }

/* prices */
.prices { width: 100%; max-width: 20em; margin-bottom: 6px; }
.prices li { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.prices li:last-child { border-bottom: 1px solid var(--line); }
.prices span:last-child { font-family: var(--mono); font-stretch: 87.5%; font-size: 13px; }

/* sub-page title, e.g. stereo.html */
.page-head { display: grid; gap: 18px; padding: clamp(110px, 12vw, 170px) var(--pad) clamp(36px, 5vw, 64px); }
.page-head .lede { margin-top: 0; text-shadow: none; }

/* about */
.prose { display: grid; gap: 1em; max-width: 36em; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; }

/* contact */
.contact { padding: clamp(64px, 10vw, 140px) var(--pad); border-top: 1px solid var(--line); }
.contact h2 { font-size: clamp(30px, 4.6vw, 60px); line-height: 1.05; letter-spacing: -0.03em; max-width: 16em; text-wrap: balance; }
.ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: clamp(32px, 5vw, 64px); max-width: 980px; }
.ways > div { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; scroll-margin-top: 72px; }
.ways p { color: var(--muted); max-width: 28em; margin-bottom: 8px; }

/* footer */
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding: 28px var(--pad); border-top: 1px solid var(--line); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .hero { display: block; min-height: 0; padding-top: 0; }
  .scan-wrap {
    position: relative; left: auto;
    height: clamp(300px, 54vh, 520px);
    margin: 52px calc(-1 * var(--pad)) 0; /* clear the header */
    -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
            mask-image: linear-gradient(to bottom, #000 70%, transparent);
  }
  .hero-copy { margin-top: -56px; max-width: none; }
}
@media (max-width: 860px) {
  .band { grid-template-columns: 1fr; }
  .band-head { position: static; }
  .band-head .links { flex-direction: row; gap: 4px 18px; }
  .tiles.three, .split, .split.even { grid-template-columns: 1fr; }
  .split.even > .film { order: -1; } /* writing: video sits right on wide screens, first on narrow */
  .collage { grid-template-columns: minmax(0, 1fr); aspect-ratio: auto; }
  .collage a { aspect-ratio: 2 / 1; }
  .collage a + a { aspect-ratio: 4 / 3; }
  .collage a + a img { object-position: 50% 25%; }
  .collage a:first-child .chip { top: 8px; bottom: auto; } /* clear the title in the banner */
  .split { row-gap: 28px; }
  .tile.wide .stage { aspect-ratio: 4 / 3; }
  .rows li, .rows.two li { grid-template-columns: 1fr; }
  .rows .links { justify-content: flex-start; margin-top: 4px; }
  .fold summary { grid-template-columns: minmax(0, 1fr) auto; }
  .fold summary > p { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .tiles.two, .ways { grid-template-columns: 1fr; }
  .lead img { aspect-ratio: 3 / 2; object-fit: cover; object-position: 31% 50%; }
  .stereo { --h: min(60vh, 440px); }
  .scan-wrap { height: clamp(280px, 48vh, 400px); }
  #scan { font-size: 7.5px; }
  .actions .btn { flex: 1 1 auto; text-align: center; }
  .top nav a:not(.cta) { display: none; } /* phones: wordmark, work with me, theme */
}
@media (max-width: 380px) {
  .top { gap: 8px; }
  .top nav { gap: 10px; }
  .mark { font-size: 11.5px; }
  .theme { padding: 3px 7px; }
}

/* ---------- hero scans ----------
   Built in header-lab/hero/hero.css. In the site's styles.css this replaces the
   "hero scans (ported from header-lab)" block and every .readout rule.

   Under the scan: the names of the three scans as buttons (the one shown in ink,
   the others muted), and below them one sentence about the scan shown, with a link.
   Wide screens: bottom right of the hero, over the fading base of the scan.
   Narrow screens: in the flow, after the hero copy. */
.scan-info {
  position: absolute; right: var(--pad); bottom: clamp(20px, 3vw, 36px); z-index: 1;
  width: min(360px, 32vw);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-shadow: 0 0 4px var(--bg), 0 0 8px var(--bg), 0 0 14px var(--bg); /* stays legible over the scan */
}
/* names in a fixed column to the left of the note, bottom-aligned with it; the scan shown is bold and underlined */
.scan-info { display: flex; align-items: flex-end; justify-content: flex-end; gap: 22px; width: min(540px, 48vw); }
.scan-names { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.scan-names button {
  font: inherit; letter-spacing: inherit; white-space: nowrap;
  color: var(--muted); background: none; border: 0; border-radius: 0;
  padding: 4px 0; margin: -4px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scan-names button[aria-pressed="true"] { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.scan-names button[aria-pressed="false"]:hover { color: var(--ink); }
.scan-names button:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* the note keeps room for three lines, so nothing moves when it changes */
.scan-note { flex: 0 1 360px; min-height: calc(1.6em * 3); text-wrap: pretty; }
.scan-note a { color: var(--ink); white-space: nowrap; }

@media (pointer: coarse) {
  .scan-names button { padding: 10px 0; margin: -10px 0; }
}
@media (max-width: 900px) {
  .scan-info { position: static; display: block; width: auto; max-width: 46ch; margin-top: 28px; }
  .scan-names { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 14px; margin-top: 0; }
  .scan-note { margin-top: 8px; }
}
