/* Two-Speed Memory interactive hero (Three.js orthographic hairline scene + static SVG fallback).
   Matches szoloth.com's plant.css spatial grammar and tokens; sole colour accent is --green. */
@layer page{:root { --green: oklch(0.52 0.14 155); --amber: oklch(0.65 0.15 65); }
[data-theme="dark"] { --green: oklch(0.80 0.16 155); --amber: oklch(0.80 0.15 70); }

.mem-hero {
  --gut: max(36px, calc(50vw - 600px));
  --measure: 400px;
  --pad: 44px;
  --label: 500 var(--fs-xs, .75rem)/1.2 var(--sans);
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  padding: calc(var(--barh, 64px) + var(--pad)) 0 var(--pad);
  min-height: min(100svh, 840px, max(580px, calc(var(--barh, 64px) + 2 * var(--pad) + (100vw - var(--gut) - var(--measure) - 48px - 3vw) * .6)));
  overflow: hidden;
}
.mem-hero * { box-sizing: border-box; }
.mem-hero + main > .art:first-child { padding-top: 18px; }

.mem-stage { position: absolute; inset: 0; }
.mem-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.mem-stage canvas:active { cursor: grabbing; }
.mem-stage.is-hover canvas { cursor: pointer; }

.mem-still {
  position: absolute;
  top: calc(var(--barh, 64px) + var(--pad));
  bottom: var(--pad);
  left: calc(var(--gut) + var(--measure) + 32px);
  right: 3%;
  display: grid;
  place-items: center;
}
.mem-still svg { width: 100%; height: 100%; max-height: 100%; display: block; overflow: visible; }
html.mem-gl .mem-still { display: none; }

.mem-tag {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
  font: 500 var(--fs-xs, .75rem)/1.2 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  opacity: 0;
  transition: opacity .16s ease;
}
.mem-tag.on { opacity: 1; }
.mem-tag.is-green { color: var(--green); border-color: var(--green); }
.mem-tag.is-amber { color: var(--amber); border-color: var(--amber); }

.mem-lede {
  position: relative;
  z-index: 3;
  margin-left: var(--gut);
  width: var(--measure);
  display: flex;
  flex-direction: column;
  gap: 38px;
  pointer-events: none;
}
.mem-lede > * { pointer-events: auto; }

/* Instrument panel */
.mem-ctrl {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in oklch, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mem-ctrl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mem-ctrl-k {
  margin: 0;
  font: var(--label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.mem-ctrl-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mem-seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill, 999px);
  background: var(--bg);
}
.mem-seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--body);
  font: 500 var(--fs-xs, .75rem)/1 var(--sans);
  letter-spacing: .02em;
  padding: 7px 11px;
  border-radius: var(--r-pill, 999px);
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.mem-seg button:hover { color: var(--ink); }
.mem-seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.mem-seg button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.mem-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: 500 var(--fs-xs, .75rem)/1 var(--sans);
  padding: 7px 11px;
  border-radius: var(--r-pill, 999px);
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, transform .12s ease;
}
.mem-btn:hover { border-color: var(--green); color: var(--green); }
.mem-btn:active { transform: scale(.97); }
.mem-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.mem-btn.is-pulse { border-color: var(--amber); color: var(--amber); }

.mem-pause {
  appearance: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .16s ease;
}
.mem-pause:hover { border-color: var(--ink); }
.mem-pause svg { fill: currentColor; }
.mem-pause .ic-play { display: none; }
.mem-pause[aria-pressed="true"] .ic-pause { display: none; }
.mem-pause[aria-pressed="true"] .ic-play { display: block; }

.mem-stat {
  margin: 0;
  font: 400 var(--fs-xs, .75rem)/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--body);
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.mem-stat b { color: var(--green); font-weight: 500; }
.mem-stat.is-static b { color: var(--ink); }
.mem-stat.is-deopt b { color: var(--amber); }

/* Title plate */
.mem-plate .kick { margin: 0 0 14px; font: var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mem-plate .kick b { color: var(--ink); font-weight: 500; }
.mem-plate h1 { margin: 0 0 14px; font: 500 clamp(var(--fs-h3, 1.75rem), 3.2vw, var(--fs-h1, 2.75rem))/1.07 var(--sans); letter-spacing: -.022em; color: var(--ink); text-wrap: balance; }
.mem-plate .dek { margin: 0 0 16px; font: 400 var(--fs-base, 1rem)/1.55 var(--sans); color: var(--body); text-wrap: pretty; }
.mem-plate .by-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.mem-plate .by { margin: 0; font: var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Fallback SVG styles */
.mem-iso .iso-face { fill: var(--bg); stroke: var(--ink); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.mem-iso .iso-plinth .iso-face { stroke-opacity: .72; }
.mem-iso .iso-rail { stroke: var(--ink); stroke-width: 1.1; stroke-opacity: .7; }
.mem-iso .iso-tie { stroke: var(--ink); stroke-width: .9; stroke-opacity: .28; }
.mem-iso .iso-link { stroke: var(--ink); stroke-width: 1.1; stroke-opacity: .45; }
.mem-iso .iso-ghost { fill: none; stroke: var(--ink); stroke-width: 1.05; stroke-opacity: .36; stroke-linejoin: round; }
.mem-iso .iso-green .iso-face { fill: var(--bg); stroke: var(--green); stroke-width: 1.5; stroke-linejoin: round; }
.mem-iso .iso-green-pin { stroke: var(--green); stroke-width: 1.35; stroke-linecap: round; }

@media (max-width: 960px) {
  .mem-hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    padding: calc(var(--barh, 60px) + 16px) 20px 28px;
    gap: 20px;
  }
  .mem-stage { position: relative; height: 320px; order: 2; }
  .mem-still { position: relative; inset: auto; height: 100%; }
  .mem-lede { margin-left: 0; width: 100%; order: 1; gap: 24px; }
}
}