/* Landing scenes (docs/assets/js/scenes): the hero flight, the sticky scroll
   scenes and the illustrations. Motion runs from JS on transforms, SVG
   attributes and one canvas; everything here also lays out as a still page
   under prefers-reduced-motion. */

/* Hero flight */

.flow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
}
.hero .hero-grid {
  z-index: 1;
}
[data-hero-flow] .flow-mark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
[data-hero-flow].is-mark .flow-mark {
  opacity: 1;
}
.flow-tile {
  fill: color-mix(in srgb, var(--accent) 5%, transparent);
  stroke: var(--accent);
  stroke-width: 0.32;
  stroke-opacity: 0.5;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.9s var(--ease);
}
.flow-head {
  stroke: var(--accent-2);
  stroke-width: 0.28;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.9s var(--ease) 0.15s;
}
.flow-head-fill {
  fill: var(--accent);
  opacity: 0;
  transition: opacity 0.8s var(--ease) 0.3s;
}
[data-hero-flow].is-mark .flow-tile,
[data-hero-flow].is-mark .flow-head {
  stroke-dashoffset: 0;
}
[data-hero-flow].is-mark .flow-head-fill {
  opacity: 0.14;
}
[data-hero-flow] .hero-mascot {
  inset: 0;
  right: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0.985);
  transform-origin: 50% 60%;
  transition: opacity 1s var(--ease), transform 1.4s var(--spring);
}
[data-hero-flow].is-fenn .hero-mascot {
  opacity: 1;
  transform: none;
  transition-delay: 0.7s;
}
[data-hero-flow] .hero-mascot path:not(.fill) {
  stroke: var(--accent);
  stroke-width: 0.32;
  stroke-opacity: 0.32;
}
/* Short laptop screens: keep the whole of Fenn above the fold. */
@media (min-width: 901px) and (max-height: 800px) {
  .hero {
    padding-top: 36px;
  }
  .hero-stage {
    max-width: min(600px, calc(100svh - 230px));
  }
}
[data-hero-flow] .hero-mascot .fill {
  opacity: 0.07;
}
[data-hero-flow] .hero-mascot .fill:nth-of-type(n + 2) {
  opacity: 0.12;
}
/* Grid scene */

.grid-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.grid-specs li {
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font: 500 12.5px var(--mono);
  color: var(--text-2);
  background: var(--panel);
}
.grid-stage {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1;
  justify-self: center;
}
.grid-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g-lines path {
  stroke: var(--text);
  stroke-opacity: 0.14;
  stroke-width: 0.05;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}
.g-lines path.strong {
  stroke-opacity: 0.3;
  stroke-width: 0.07;
}
.g-pad {
  stroke: var(--accent);
  stroke-width: 0.08;
  stroke-dasharray: 0.4 0.3;
  stroke-opacity: 0.8;
  opacity: 0;
}
.g-keys {
  stroke: var(--accent);
  stroke-width: 0.05;
  stroke-opacity: 0.45;
  opacity: 0;
}
.g-keys path {
  stroke: var(--text-3);
  stroke-opacity: 0.5;
}
.g-body {
  stroke: var(--text);
  stroke-width: 2;
  opacity: 0.22;
  transition: opacity 0.5s var(--ease);
}
.g-icon.built .g-body {
  opacity: 0.94;
}
.g-spine {
  stroke: var(--accent);
  stroke-width: 0.09;
}
.g-fill {
  fill: var(--accent);
  opacity: 0;
}
.g-node {
  fill: var(--bg);
  stroke: var(--accent);
  stroke-width: 0.08;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.grid-code {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -2px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  min-width: 0;
  font: 500 12px/1.4 var(--mono);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.grid-code b {
  flex: none;
  color: var(--accent-text);
  font-weight: 600;
}
.grid-code span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Weight scene */

.weight-board {
  display: grid;
  gap: 16px;
}
.wt-hero {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 62%), var(--icon-bg);
  overflow: hidden;
}
.wt-spec {
  display: grid;
  place-items: center;
  color: var(--text);
}
.wt-spec svg {
  width: clamp(110px, 15vw, 190px);
  height: auto;
}
.wt-px {
  position: absolute;
  right: 18px;
  bottom: 14px;
  font: 600 13px var(--mono);
  color: var(--accent-text);
}
.wt-px::after {
  content: ' w';
  color: var(--text-3);
}
.wt-axis {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  fill: none;
  stroke-linecap: round;
}
.wt-base {
  stroke: var(--line-2);
  stroke-width: 3;
}
.wt-fill {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0.5;
}
.wt-tick {
  stroke: var(--line-3);
  stroke-width: 1;
}
.wt-tick.major {
  stroke: var(--text-3);
}
.wt-axis text {
  font: 500 10px var(--mono);
  fill: var(--text-3);
  stroke: none;
}
.wt-needle path {
  stroke: var(--accent);
  stroke-width: 1.5;
}
.wt-needle circle {
  fill: var(--bg);
  stroke: var(--accent);
  stroke-width: 2.5;
}
.wt-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 10px);
}
.wt-strip .tile {
  border-radius: 12px;
}
.wt-strip .tile svg {
  width: 56%;
  height: 56%;
}
.wt-strip .tile.hot {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Morph chain */

.morph-icon .mc-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: none;
  transform-origin: 50% 50%;
}
.morph-icon {
  transition: color 0.5s var(--ease);
}
.morph-icon.is-love {
  color: var(--accent);
}
.mc-trail path {
  stroke: var(--accent);
}
.mc-dots circle {
  fill: var(--accent);
  stroke: none;
}
.mc-fill {
  opacity: 0;
}
.morph-ring {
  will-change: transform;
}
.chain-list li {
  gap: 7px;
}
.chain-list li.done {
  color: var(--text-2);
  border-color: var(--line-2);
}

/* Sync scene */

.sync-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
}
.sync-stage {
  display: grid;
  gap: 16px;
}
.sy-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 10px);
}
.sy-icon {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--icon-bg);
  color: var(--text-3);
  transition: color 0.45s var(--ease), border-color 0.45s var(--ease);
}
.sy-icon.on {
  color: var(--text);
  border-color: var(--line-2);
}
.sy-icon svg {
  display: block;
  width: 70%;
  max-width: 48px;
  height: auto;
  aspect-ratio: 1;
  overflow: visible;
  opacity: 0.4;
  transition: opacity 0.45s var(--ease);
}
.sy-icon.on svg {
  opacity: 1;
}
.sy-icon small {
  font: 500 11px var(--mono);
  color: var(--text-3);
}
.sy-icon.on small {
  color: var(--accent-text);
}
.sy-seq {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.sy-line {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 4px;
}
.sy-line i {
  height: 12px;
  border-radius: 3px;
  background: var(--line);
}
.sy-line i:nth-child(4n + 1) {
  background: var(--line-2);
}
.sy-line i.hit {
  background: var(--line-3);
}
.sy-line.on i.hit {
  background: var(--accent);
  opacity: 0.85;
}
.sy-head {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 12px;
  width: calc((100% - 24px) / 16);
  border-radius: 6px;
  background: color-mix(in srgb, var(--text) 9%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent) inset;
}
.sync-stage.is-still .sy-head {
  display: none;
}

/* Modifiers scene */

.mods-stage {
  display: grid;
  gap: 16px;
  justify-items: center;
  width: min(100%, 470px);
  justify-self: center;
}
.md-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) center / calc(100% / 26) calc(100% / 26),
    linear-gradient(90deg, var(--line) 1px, transparent 1px) center / calc(100% / 26) calc(100% / 26),
    var(--icon-bg);
}
.md-board svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  color: var(--text);
}
.md-pad {
  stroke: var(--accent);
  stroke-width: 0.06;
  stroke-opacity: 0.4;
  stroke-dasharray: 0.35 0.3;
}
.md-ring {
  fill: color-mix(in srgb, var(--accent) 9%, transparent);
  stroke: var(--accent);
  stroke-width: 0.07;
  stroke-dasharray: 0.3 0.25;
  opacity: 0;
}
.md-badge {
  stroke: var(--accent);
}
.md-spec {
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel);
  font: 600 13.5px var(--mono);
  color: var(--text-2);
  transition: color 0.3s, border-color 0.3s;
}
.md-spec.on {
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.md-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.md-chips .tile {
  width: 52px;
  border-radius: 12px;
}
.md-chips .tile svg {
  width: 58%;
  height: 58%;
}
.md-chips .tile.hot {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Fusion scene */

.fusion-stage .fz-svg {
  position: absolute;
  inset: 15%;
  width: 70%;
  height: 70%;
  overflow: visible;
  color: var(--text);
}
.fz-fused {
  color: var(--accent);
  opacity: 0;
}
.fz-fill {
  opacity: 0;
}
.fz-flash {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.12;
  opacity: 0;
}
.fusion-stage {
  transition: border-color 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.fusion-stage.is-fused {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 0 80px -30px var(--glow);
}
.fz-spec {
  display: block;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12.5px;
}

/* Illustrations */

.art-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.art-card {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 12px 12px 18px;
}
.art-canvas {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(circle at 50% 42%, var(--accent-soft), transparent 68%), var(--icon-bg);
  overflow: hidden;
}
.art-card figcaption {
  display: grid;
  gap: 4px;
  padding: 0 6px;
}
.art-card figcaption b {
  font-size: 16px;
  letter-spacing: -0.015em;
}
.art-card figcaption span {
  color: var(--text-2);
  font-size: 14px;
}
.art-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text);
}
.art-canvas {
  position: relative;
}
.art-canvas > .art-svg {
  transition: opacity 0.9s var(--ease), transform 1.2s var(--spring);
}
.art-canvas:not(.in) > .art-svg {
  opacity: 0;
  transform: scale(0.94);
}
.fx-tile {
  color: var(--text);
}
.fx-tile.accent {
  color: var(--accent);
}
.fx-outline path {
  stroke: var(--accent);
  stroke-width: 0.3;
  stroke-opacity: 0.5;
}
.fx-eye {
  fill: var(--text);
  stroke: none;
}
.art-canvas[data-art-piece='constellation'] {
  background: radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--icon-bg);
}
.sk-field circle {
  fill: var(--text);
  stroke: none;
}
.sk-dim {
  color: var(--text-3);
  stroke-width: 1.6;
}
.sk-lines path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.3;
  stroke-opacity: 0.6;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 2.6s var(--ease) 0.4s;
}
.art-canvas.in .sk-lines path {
  stroke-dashoffset: 0;
}
.sk-star {
  color: var(--text);
  stroke-width: 1.7;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.6s var(--ease) var(--d, 0s), transform 0.9s var(--spring) var(--d, 0s);
}
.art-canvas:not(.in) .sk-star {
  opacity: 0;
  transform: scale(0.3);
}
.sk-star.accent {
  color: var(--accent);
}
.sk-halo {
  stroke: none;
}
.sk-star.accent .sk-halo {
  color: var(--accent);
}
.sk-disc {
  fill: var(--icon-bg);
  stroke: none;
}
.sk-twinkle {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sk-twinkle i {
  position: absolute;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 8px 2px color-mix(in srgb, var(--accent) 60%, transparent);
  opacity: 0;
}
.art-canvas.live .sk-twinkle i {
  animation: sk-twinkle 3.6s ease-in-out var(--d, 0s) infinite alternate;
}
@keyframes sk-twinkle {
  0%,
  40% {
    opacity: 0;
    transform: scale(0.4);
  }
  100% {
    opacity: 0.9;
    transform: scale(1);
  }
}
.ex-stack {
  position: relative;
  width: 100%;
  aspect-ratio: 100 / 84;
  transition: opacity 0.9s var(--ease);
}
.art-canvas:not(.in) .ex-stack {
  opacity: 0;
}
.ex-stack > svg {
  position: absolute;
  inset: 0;
}
.ex-layer {
  transition: transform 1.3s var(--spring) calc(var(--i) * 0.09s + 0.2s);
}
.art-canvas:not(.in) .ex-layer {
  transform: translateY(calc(var(--i) * 17.86%));
}
.art-canvas.live.settled .ex-layer {
  animation: ex-float 4.8s ease-in-out calc(var(--i) * -1.1s) infinite alternate;
}
@keyframes ex-float {
  to {
    transform: translateY(-1.6%);
  }
}
.ex-plate {
  fill: color-mix(in srgb, var(--panel) 55%, transparent);
  stroke: var(--line-3);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.ex-lines {
  stroke: var(--line-2);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}
.ex-pad {
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}
.ex-keys circle,
.ex-keys rect:not(.ex-plate) {
  stroke: var(--accent);
  stroke-opacity: 0.65;
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}
.ex-duo {
  fill: var(--accent);
  stroke: none;
  opacity: 0.38;
}
.ex-stroke {
  stroke: var(--text);
  stroke-width: 2.6;
  vector-effect: non-scaling-stroke;
}
.ex-node {
  fill: var(--accent);
  stroke: none;
}
.ex-wires path {
  stroke: var(--text-3);
  stroke-opacity: 0.6;
  stroke-width: 0.25;
  stroke-dasharray: 0.8 0.8;
}

/* Phones and tablets: one column, stages sized to the visible height. */

@media (max-width: 900px) {
  .sync-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .grid-stage,
  .morph-stage,
  .fusion-stage {
    width: min(100%, 46svh);
  }
  .mods-stage {
    width: min(100%, 40svh);
  }
  .grid-specs {
    display: none;
  }
  .wt-hero {
    aspect-ratio: 2 / 1;
  }
  .wt-spec svg {
    width: 96px;
  }
  .sy-icon {
    padding: 12px 2px 8px;
    border-radius: 12px;
  }
  .sy-line i {
    height: 9px;
  }
  .art-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin: 0 auto;
  }
}
@media (max-width: 560px) {
  .sy-icon small {
    display: none;
  }
  .md-chips .tile {
    width: 44px;
  }
  .scene .lead {
    font-size: 0.95rem;
    line-height: 1.55;
  }
}

/* Reduced motion: every scene is a complete still section. */

.reduced .flow-mark {
  display: none;
}
.reduced .grid-stage,
.reduced .mods-stage {
  margin-bottom: 8px;
}
