:root {
  --bg: #0c0b0a;
  --ink: #efe6d6;
  --muted: #b3a894;
  --subtle: #7a7164;
  --line: #3a342c;
  --accent: #d7b07a;
  --neon: #7af7ff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
}
body {
  font: 16px/1.5 "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  /* clip avoids the overflow-x:hidden → overflow-y:auto scrollport that crops card tops in browser fullscreen */
  overflow-x: clip;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 1.25rem 0;
}
.back {
  color: var(--ink);
  font: 500 0.7rem/1 system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.7rem 0.85rem;
  background: rgba(22,20,16,0.82);
}
.back:hover { text-decoration: none; background: rgba(239,230,214,0.08); }
.kicker {
  margin: 0;
  font-family: system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--subtle);
}

main {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1.4rem 1.25rem 3rem;
}
.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin: 0.4rem 0 0.35rem;
}
.title-row h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.03em;
}
.lede {
  margin: 0 0 1rem;
  color: var(--muted);
  max-width: 36rem;
}
.lede-phone {
  display: none;
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 300;
  font-style: normal;
  letter-spacing: 0.02em;
  color: var(--muted);
  max-width: none;
}
.lede-desk { margin: 0 0 1rem; }

.board {
  position: relative;
  width: 100%;
  isolation: isolate;
}
.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: min(84vh, 860px);
  perspective: 1600px;
  perspective-origin: 50% 38%;
  touch-action: manipulation;
  overflow: hidden;
}

/* Selected front card: CSS top = center; --open-anchor is lede bottom (px from stage top).
   After translate(-50%,-50%), card top sits on the instructional line bottom. */
.stage.is-open {
  overflow: visible;
  height: min(88dvh, 920px);
}
.stage.is-open .tile {
  top: calc(var(--open-anchor, 0px) + (var(--tile-h, 0px) * var(--open-scale, 1) / 2));
}

.tile {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(230px, 42vw);
  aspect-ratio: 9 / 19.5;
  margin: 0;
  padding: 0;
  border-radius: 1.7rem;
  overflow: hidden;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  background: #090909;
  border: 1px solid rgba(239, 230, 214, 0.18);
  box-shadow:
    0 24px 60px -18px rgba(0,0,0,0.85),
    0 0 0 1px rgba(239, 230, 214, 0.05),
    inset 0 0 0 1px rgba(239, 230, 214, 0.04);
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
}
/* FlyHypno: face sits center-right in the square; phone tile crops sides */
.tile[data-id="flyhypno"] img {
  object-position: 75% 42%;
}

.tile .caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.2rem 0.8rem 0.75rem;
  background: linear-gradient(transparent, rgba(8,7,6,0.92) 62%);
  font: 500 0.68rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  pointer-events: none;
}
.tile.is-front {
  border-color: rgba(122, 247, 255, 0.9);
  box-shadow:
    0 30px 80px -12px rgba(0,0,0,0.9),
    0 0 0 1.5px rgba(122, 247, 255, 0.82),
    0 0 18px rgba(122, 247, 255, 0.58),
    0 0 42px rgba(80, 220, 255, 0.34),
    inset 0 0 0 1px rgba(180, 252, 255, 0.38);
}
.tile:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 4px;
}

.glow {
  position: absolute;
  /* Desk: align panel top with selected card top (lede bottom via --open-anchor) */
  top: var(--open-anchor, 6%);
  width: min(280px, 36vw);
  z-index: 20;
  padding: 0.2rem 0.1rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--neon);
  text-shadow:
    0 0 6px rgba(122, 247, 255, 0.85),
    0 0 22px rgba(80, 220, 255, 0.45);
  pointer-events: auto;
}
.glow[hidden] { display: none; }
.glow.side-right { left: calc(50% + 168px); }
.glow.side-left { right: calc(50% + 168px); left: auto; }
.glow-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.7;
}
.glow h2 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.glow p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.55;
  font-weight: 300;
  color: inherit;
  opacity: 0.92;
}
.icons {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.9rem;
}
.icon {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: inherit;
  background: rgba(8, 18, 22, 0.45);
  box-shadow: 0 0 12px rgba(122, 247, 255, 0.28);
  text-decoration: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.icon:hover {
  text-decoration: none;
  background: rgba(122, 247, 255, 0.12);
}
.icon.is-open {
  background: rgba(122, 247, 255, 0.18);
}
.icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brief {
  margin-top: 1.4rem;
  padding: 1.3rem 0 0.4rem;
  border-top: 1px solid var(--line);
  max-width: 40rem;
  position: relative;
  z-index: 5;
}
.brief[hidden] { display: none; }
.brief-kicker,
#brief-title {
  scroll-margin-top: 4.5rem;
}
.brief-kicker {
  margin: 0 0 0.35rem;
  font-family: system-ui, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--subtle);
}
.brief h2 {
  margin: 0 0 0.7rem;
  font-size: 1.55rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
}
.brief p { margin: 0 0 0.85rem; color: var(--muted); }
.brief .why h3 {
  margin: 1.1rem 0 0.4rem;
  font-family: system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--subtle);
}
.brief-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.brief-links button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.brief-links button:hover { text-decoration: underline; }
.brief-links button.is-open { color: var(--ink); }

.ledger {
  margin-top: 1.6rem;
  padding: 1.3rem 0 0.4rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
  position: relative;
  z-index: 5;
}
.ledger[hidden] { display: none; }
.ledger h2 {
  margin: 0 0 0.7rem;
  font-size: 1.55rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
}
.ledger p { margin: 0 0 0.95rem; color: var(--muted); }
.ledger-list {
  margin: 0;
  padding: 0 0 0 1.2rem;
  color: var(--muted);
}
.ledger-list li {
  margin: 0 0 0.7rem;
  padding-left: 0.35rem;
  line-height: 1.5;
}
.ledger-list li:last-child { margin-bottom: 0; }

footer {
  padding: 0 1.25rem 2.4rem;
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
}

@media (min-width: 721px) {
  html, body { min-height: 100dvh; }
  body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }
  .top { padding: 1.1rem 3vw 0; }
  main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.8rem 3vw 1.4rem;
  }
  .title-row { margin-bottom: 0.2rem; }
  .lede { max-width: none; }
  .lede-desk { margin-bottom: 0.85rem; }
  .board {
    flex: 1;
    min-height: 0;
  }
  .stage {
    height: calc(100dvh - 10.5rem);
    min-height: 520px;
  }
  .tile { width: min(300px, 18vw); }
  .glow { width: min(320px, 28vw); }
  .glow.side-right { left: calc(50% + min(22vw, 280px)); }
  .glow.side-left { right: calc(50% + min(22vw, 280px)); left: auto; }
  .brief, .ledger { max-width: none; }
  footer { padding: 0 3vw 1.8rem; }
}

@media (max-width: 720px) {
  .top { padding: 0.75rem 0.9rem 0; }
  .back { padding: 0.62rem 0.7rem; }
  main {
    display: flex;
    flex-direction: column;
    padding: 0.7rem 0.9rem 1.6rem;
  }
  .title-row {
    margin: 0.25rem 0 0.55rem;
    align-items: center;
  }
  .title-row h1 { font-size: 1.55rem; }
  .lede-phone {
    display: inline;
    font-size: 0.78rem;
    line-height: 1.25;
    flex: 0 1 auto;
  }
  .lede-desk { display: none; }
  /* Flatten board so glow can reorder after brief in main flow */
  .board { display: contents; }
  .stage {
    order: 1;
    height: min(68dvh, 560px);
    min-height: 420px;
    perspective: 1100px;
    overflow: hidden;
  }
  .stage.is-open {
    overflow: visible;
    height: min(72dvh, 600px);
  }
  /* open tile top still from --open-anchor (lede-phone bottom); no magic % */
  .tile { width: min(148px, 36vw); top: 48%; }
  .tile .caption { font-size: 0.58rem; padding: 1.6rem 0.55rem 0.55rem; }
  .brief {
    order: 2;
    margin-top: 0.6rem;
    padding-top: 1rem;
  }
  /* One #glow: in-flow under brief on narrow — not absolute sides, not hidden */
  .glow {
    order: 3;
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 40rem;
    z-index: 5;
    margin-top: 1.1rem;
    padding: 1rem 0 0.4rem;
    border-top: 1px solid var(--line);
    text-shadow:
      0 0 6px color-mix(in srgb, currentColor 70%, transparent),
      0 0 22px color-mix(in srgb, currentColor 35%, transparent);
  }
  .glow.side-right,
  .glow.side-left {
    left: auto;
    right: auto;
  }
  .glow[hidden] { display: none; }
  .ledger {
    order: 4;
    margin-top: 1.1rem;
    padding-top: 1rem;
  }
  .glow h2 { font-size: 0.92rem; }
  .glow p { font-size: 0.68rem; }
  .icon { width: 2.4rem; height: 2.4rem; }
  footer { padding: 0 0.9rem 1.4rem; }
}

@media (max-width: 420px) {
  .stage { height: min(66dvh, 520px); min-height: 400px; }
  .title-row h1 { font-size: 1.35rem; }
  .lede-phone { font-size: 0.72rem; }
}


/* App UI shots under selected-card brief */
.shot-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.35rem 0 0.15rem;
  padding: 0.15rem 0 0.25rem;
}
.shot-strip[hidden] { display: none; }
.shot {
  margin: 0;
  flex: 0 0 auto;
  width: clamp(4.6rem, 18vw, 6.4rem);
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid rgba(90, 28, 36, 0.55);
  background: #1a1412;
  box-shadow: 0 0 0 1px rgba(215, 176, 122, 0.08), 0 8px 22px rgba(0,0,0,0.35);
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 19.5;
  object-fit: cover;
  object-position: top center;
  background: #0c0b0a;
}
@media (min-width: 720px) {
  .shot { width: 7.1rem; }
}
@media (max-width: 719px) {
  .shot { width: clamp(4.4rem, 26vw, 5.6rem); }
}


/* Karyon: first macOS app. Same phone-tile footprint as the family, with a Mac window,
   chromosome-band rods in the Karyon palette, and a Mac badge. */
.tile.tile-mac {
  --neon: #9cf2c4;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(156, 242, 196, 0.10), transparent 60%),
    linear-gradient(180deg, #0f1312 0%, #090909 70%);
  border-color: rgba(156, 242, 196, 0.32);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  padding: 0.85rem 0.7rem 0;
  text-align: left;
}
.tile.tile-mac.is-front {
  border-color: rgba(156, 242, 196, 0.92);
  box-shadow:
    0 30px 80px -12px rgba(0,0,0,0.9),
    0 0 0 1.5px rgba(156, 242, 196, 0.82),
    0 0 18px rgba(156, 242, 196, 0.55),
    0 0 42px rgba(110, 230, 170, 0.32),
    inset 0 0 0 1px rgba(200, 255, 225, 0.32);
}
.mac-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  padding: 0.28rem 0.55rem 0.28rem 0.45rem;
  border: 1px solid rgba(156, 242, 196, 0.55);
  border-radius: 999px;
  color: var(--neon);
  font: 500 0.56rem/1 system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(10, 24, 18, 0.6);
  box-shadow: 0 0 12px rgba(156, 242, 196, 0.22);
}
.mac-badge svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.mac-badge b { font-weight: 600; }
.mac-badge i { font-style: normal; opacity: 0.7; letter-spacing: 0.1em; }
.mac-window {
  display: block;
  border-radius: 0.55rem;
  overflow: hidden;
  border: 1px solid rgba(239, 230, 214, 0.16);
  background: #000;
  box-shadow: 0 14px 30px -14px rgba(0,0,0,0.9);
}
.mac-bar {
  display: flex;
  gap: 0.28rem;
  padding: 0.32rem 0.4rem;
  background: #1b1a18;
  border-bottom: 1px solid rgba(239, 230, 214, 0.08);
}
.mac-bar i { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: #ff5f57; }
.mac-bar i:nth-child(2) { background: #febc2e; }
.mac-bar i:nth-child(3) { background: #28c840; }
.tile.tile-mac .mac-window img {
  height: auto;
  aspect-ratio: 787 / 675;
  object-fit: cover;
  object-position: center;
}
.mac-bands {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
  height: 22%;
  padding: 0 0.15rem;
}
.mac-bands i {
  flex: 1;
  height: var(--h);
  border-radius: 999px;
  background:
    repeating-linear-gradient(180deg, transparent 0 14%, rgba(0,0,0,0.55) 14% 19%),
    var(--c);
  box-shadow: 0 0 6px color-mix(in srgb, var(--c) 45%, transparent);
  opacity: 0.88;
  transform-origin: 50% 100%;
  animation: karyon-breathe 4.2s ease-in-out var(--d) infinite;
}
@keyframes karyon-breathe {
  0%, 100% { transform: scaleY(0.92); opacity: 0.72; }
  50% { transform: scaleY(1); opacity: 0.95; }
}
@media (prefers-reduced-motion: reduce) { .mac-bands i { animation: none; } }
.mac-soon {
  font: 400 0.55rem/1.3 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.04em;
  color: var(--neon);
  opacity: 0.85;
  text-shadow: 0 0 8px rgba(156, 242, 196, 0.45);
}
.tile.tile-mac .caption small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82em;
  letter-spacing: 0.18em;
  color: var(--neon);
  opacity: 0.85;
}
.brief-links .soon { color: #9cf2c4; }
.shot.shot-wide { width: clamp(9rem, 34vw, 15rem); border-color: rgba(156, 242, 196, 0.3); }
.shot.shot-wide img { aspect-ratio: 16 / 10; object-position: center; }
@media (max-width: 720px) {
  .tile.tile-mac { padding: 0.55rem 0.45rem 0; gap: 0.45rem; }
  .mac-badge { font-size: 0.48rem; padding: 0.2rem 0.4rem 0.2rem 0.32rem; }
  .mac-badge i { display: none; }
  .mac-soon { display: none; }
  .mac-bands { height: 18%; }
}
