/* The origin story is contained in the hero; the established page stays on paper. */
/* The header scrolls with the hero, so section anchors need no fixed-header offset. */
html {
  scroll-padding-top: 0;
  background: #04070f;
  scrollbar-color: #394250 #04070f;
}
.origin-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 680px;
  height: 100svh;
  background: #04070f;
  color: #f2f7ff;
}
.origin-visual,
#origin-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.origin-visual {
  z-index: 0;
}
.origin-seed {
  position: absolute;
  left: 72%;
  top: 51%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  background: #ffdca0;
  box-shadow:
    0 0 14px #ffb34a72,
    0 0 45px #ffb34a24;
}
.origin-hero[data-mode="desktop"] .origin-seed,
.origin-hero[data-mode="fallback"] .origin-seed,
.origin-hero[data-mode="mobile"] .origin-seed,
html:not(.js) .origin-seed {
  display: none;
}
/* While the scene loads the seed breathes; after 5 s without a scene the
   poster takes over (data-mode is still "loading"). */
@keyframes seed-breathe {
  0%,
  100% {
    scale: 0.8;
    opacity: 0.7;
  }
  50% {
    scale: 1.15;
    opacity: 1;
  }
}
@keyframes seed-out {
  to {
    opacity: 0;
  }
}
@keyframes poster-late {
  from {
    opacity: 0;
    visibility: hidden;
  }
  to {
    opacity: 1;
    visibility: visible;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .origin-hero[data-mode="loading"] .origin-seed {
    animation:
      seed-breathe 2.4s ease-in-out infinite,
      seed-out 0.5s ease 5s forwards;
  }
}
.origin-copy {
  position: absolute;
  left: max(6%, var(--gutter));
  top: 50%;
  transform: translateY(-50%);
  width: 34%;
  max-width: 650px;
  z-index: 2;
}
.origin-copy .kicker {
  color: #b3b6bf;
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.14em;
  margin-bottom: 32px;
}
.origin-copy .kicker-mark {
  background: #ffb34a;
}
.origin-copy h1 {
  font:
    700 clamp(48px, 5.6vw, 110px)/1.02 "Space Grotesk",
    sans-serif;
  letter-spacing: -0.067em;
  margin: 0;
}
.origin-copy h1 > span {
  color: transparent;
  -webkit-text-stroke: 1px #c9cbd4;
}
.origin-description {
  margin: 30px 0 34px;
  font-size: clamp(15px, 1.2vw, 19px);
  line-height: 1.75;
  color: #a3a8b6;
}
.origin-hero .origin-cta {
  background: #f2f4f7;
  color: #0b1019;
  border: 1px solid #f2f4f7;
  min-height: 52px;
  padding: 0 22px;
  gap: 20px;
  box-shadow: none;
}
.origin-hero .origin-cta:hover {
  background: #ffdb9d;
  border-color: #ffdb9d;
  transform: translateY(-2px);
}
/* The 2x2 pixel mark in the night palette (spreads on hover/focus). */
.origin-cta .btn-pixel {
  background: #131821;
  box-shadow:
    6px 0 0 #ffb34a,
    0 6px 0 #57a9ff,
    6px 6px 0 #131821;
}
.origin-hero .origin-cta:hover .btn-pixel,
.origin-hero .origin-cta:focus-visible .btn-pixel {
  box-shadow:
    8px -2px 0 #ffb34a,
    -2px 8px 0 #57a9ff,
    9px 9px 0 transparent;
}
.site-header .brand-logo,
.site-header .site-nav a {
  color: #edf0f6;
}
.site-header .site-nav a:hover {
  color: #ffdca0;
}
.site-header .brand-symbol {
  filter: none;
}
.site-header .brand-word strong {
  color: #aeb7c8;
}
.origin-footer {
  position: absolute;
  z-index: 3;
  bottom: 32px;
  left: max(6%, var(--gutter));
  right: max(4%, var(--gutter));
  display: flex;
  align-items: center;
  gap: 28px;
  font: 11px var(--font-mono);
  letter-spacing: 0.08em;
  color: #9ba2b3;
}
.origin-footer > span {
  margin-left: auto;
  font-size: 10px;
  color: #7a8396;
}
.origin-footer a,
.origin-footer button {
  color: #bac1cf;
}
.origin-footer a {
  padding: 12px 0;
  text-decoration: none;
}
.origin-footer button {
  border: 1px solid #79879b60;
  border-radius: 2px;
  padding: 10px 12px;
  min-height: 42px;
  cursor: pointer;
  font: inherit;
  background: transparent;
}
.origin-hero a:focus-visible,
.origin-hero button:focus-visible,
.origin-debug input:focus-visible,
.origin-debug select:focus-visible,
.site-header a:focus-visible {
  outline: 2px solid #ffb34a;
  outline-offset: 5px;
}
.origin-fallback {
  position: absolute;
  right: 10%;
  top: 50%;
  transform: translateY(-50%);
  width: min(29%, 390px);
  margin: 0;
  z-index: 1;
}
.origin-media-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 2px;
}
.origin-fallback img,
.origin-fallback video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 2px;
}
.origin-fallback figcaption {
  font: 11px/1.6 var(--font-mono);
  margin-top: 16px;
  color: #939eb0;
}
@media (min-width: 768px) {
  .js .origin-hero[data-mode="desktop"] .origin-fallback,
  .js .origin-hero[data-mode="loading"] .origin-fallback {
    display: none;
  }
}
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .js .origin-hero[data-mode="loading"] .origin-fallback {
    display: block;
    animation: poster-late 0.8s ease 5s both;
  }
}
/* The shared portrait now enters with Capture; it still flows into the theme gallery. */
.journey-visual > .portal-monitor,
.journey-visual > .portal-placeholder {
  display: none;
}
.origin-hero ~ .journey {
  border-top: 1px solid #d4d4d0;
}
.journey,
.worlds {
  scroll-margin-top: 0;
}
.origin-debug {
  --studio-line: #283344;
  --studio-muted: #a6b3c6;
  position: fixed;
  right: 16px;
  top: 90px;
  bottom: 16px;
  z-index: 60;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: fit-content;
  max-height: calc(100svh - 106px);
  overflow: hidden;
  border: 1px solid #3b475b;
  background: #101722;
  color: #e9eef8;
  border-radius: 14px;
  box-shadow: 0 12px 50px #0007;
  font: 12px/1.5 var(--font-sans, sans-serif);
  text-align: left;
}
.origin-debug > summary {
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  background: #151f2d;
}
.origin-debug > summary::-webkit-details-marker {
  display: none;
}
.origin-debug summary small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #ffcc82;
}
.origin-debug summary strong {
  font-size: 18px;
  font-weight: 600;
}
.studio-collapse::after {
  content: "Open controls +";
  color: #b7c3d4;
  font-size: 10px;
}
.origin-debug[open] .studio-collapse::after {
  content: "Collapse −";
}
.studio-body {
  display: flex;
  flex-direction: column;
  max-height: calc(100svh - 184px);
}
.studio-transport {
  flex: none;
  padding: 13px 18px 15px;
  border-bottom: 1px solid var(--studio-line);
  background: #141d2b;
}
.studio-now {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}
.studio-now output {
  flex: none;
  color: #aebdd1;
  font-variant-numeric: tabular-nums;
}
.studio-playback {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.studio-playback [data-play] {
  min-width: 74px;
  border-color: #cc994d;
  color: #ffce8c;
}
.studio-playback [data-play-state] {
  margin-left: auto;
  color: var(--studio-muted);
  font-size: 10px;
}
.studio-scroll {
  overflow-y: auto;
  min-height: 0;
  padding: 16px 18px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #4e6079 #141d2b;
}
.studio-presets {
  background: #182332;
  border: 1px solid var(--studio-line);
  border-radius: 9px;
  padding: 12px;
}
.studio-preset-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.studio-preset-heading > strong {
  font-size: 12px;
  font-weight: 600;
}
.studio-preset-heading > span {
  color: #b6decf;
  background: #163c34;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
}
.studio-preset-heading > span[data-edited="true"] {
  color: #ffd29a;
  background: #45351e;
}
.studio-preset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 12px 0 8px;
}
.studio-presets .studio-help {
  margin-top: 10px;
}
.studio-status {
  margin: 8px 0 0;
  color: #c8d5e6;
  font-size: 11px;
  min-height: 16px;
}
.origin-debug .studio-export {
  padding: 0;
  margin-top: 9px;
  border: 0;
  background: none;
  color: #9fbce1;
  font-size: 10px;
  min-height: 26px;
  text-align: left;
}
.studio-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  margin: 19px 0;
  padding: 4px;
  background: #080e17;
  border-radius: 8px;
}
.origin-debug .studio-tabs button {
  border: 1px solid transparent;
  background: transparent;
  color: #a1adc0;
  padding: 7px 1px;
  font-size: 10px;
}
.studio-tabs small {
  display: block;
  font-size: 9px;
  margin-bottom: 2px;
  opacity: 0.65;
}
.origin-debug .studio-tabs [aria-selected="true"] {
  background: #26313e;
  border-color: #546275;
  color: #ffe0af;
}
.studio-section-title h3 {
  font-size: 17px;
  margin: 0 0 4px;
  font-weight: 550;
  letter-spacing: -0.02em;
}
.studio-section-title p {
  color: var(--studio-muted);
  margin: 0 0 14px;
  font-size: 11px;
}
.studio-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.origin-debug .studio-preview {
  color: #edcb99;
  border-color: #5c4b31;
  background: #2b251d;
}
.studio-preview > span {
  font-size: 9px;
  margin-right: 3px;
}
.studio-checkpoints {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0 18px;
}
.origin-debug .studio-checkpoints button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px;
  gap: 2px;
  background: #151f2d;
  border-color: #344154;
  font-size: 10px;
}
.studio-checkpoints small {
  color: #95a9c3;
  font: 10px/1.5 var(--font-mono);
}
.origin-debug .studio-checkpoints [aria-pressed="true"] {
  border-color: #dda651;
  background: #30291f;
}
.studio-phase {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 20px 0 14px;
  padding-top: 16px;
  border-top: 1px solid var(--studio-line);
}
.studio-phase > span {
  color: #efb86a;
  font-size: 10px;
}
.studio-phase h4 {
  font-size: 12px;
  margin: 0;
  font-weight: 600;
}
.studio-phase > small {
  color: #95a9c3;
  margin-left: auto;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.studio-control {
  margin: 16px 0 20px;
}
.studio-control-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}
.studio-control label {
  font-size: 12px;
  font-weight: 500;
}
.studio-control output {
  margin-left: auto;
  color: #d3dfef;
  font: 11px/1.5 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.studio-control[data-edited="true"] output {
  color: #ffc16f;
}
.origin-debug .studio-reset {
  padding: 0;
  min-height: 24px;
  width: 24px;
  background: transparent;
  border-color: #665132;
  color: #ffd69e;
  font-size: 15px;
}
.studio-help {
  font-size: 11px;
  line-height: 1.55;
  color: var(--studio-muted);
  margin: 4px 0 0;
}
.origin-debug input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 5px 0 0;
  accent-color: #f1b963;
  cursor: pointer;
}
.origin-debug .studio-archive {
  display: inline-block;
  margin-top: 10px;
  border-top: 1px solid var(--studio-line);
  padding-top: 15px;
  color: #9fbce1;
  font-size: 11px;
  text-decoration: none;
  width: 100%;
}
.origin-debug [hidden] {
  display: none !important;
}
.origin-debug :is(button, select, input, summary, a):focus-visible {
  outline: 2px solid #ffcd81;
  outline-offset: 3px;
}
.origin-debug button:hover {
  filter: brightness(1.2);
}
.origin-debug button:active {
  transform: translateY(1px);
}
.origin-debug button:disabled {
  opacity: 0.45;
  cursor: default;
}
.origin-debug select {
  max-width: 170px;
  margin-left: auto;
}
.origin-debug [data-preset="save"] {
  background: #e5b46e;
  color: #20170a;
  border-color: #e5b46e;
  font-weight: 600;
}
@media (min-width: 768px) and (max-width: 1099px) {
  .origin-debug {
    width: 336px;
    top: 82px;
    max-height: calc(100svh - 98px);
  }
  .studio-body {
    max-height: calc(100svh - 176px);
  }
}
.origin-debug button,
.origin-debug select {
  font: inherit;
  font-size: 11px;
  background: #253244;
  border: 1px solid #4c5b70;
  border-radius: 6px;
  padding: 7px 8px;
  min-height: 34px;
  color: #e9eef8;
  cursor: pointer;
}
@media (min-width: 1100px) {
  /* Give the open artist panel its own space; the public composition is unchanged. */
  .origin-hero:has(.origin-debug[open]:not([hidden])) {
    width: calc(100% - 402px);
    box-shadow: 410px 0 0 #04070f;
  }
  .origin-hero:has(.origin-debug[open]:not([hidden])) .origin-copy h1 {
    font-size: clamp(38px, 3.95vw, 100px);
  }
}
@media (min-width: 768px) and (max-width: 1050px) {
  .origin-copy {
    left: 5%;
    width: 37%;
  }
  .origin-copy h1 {
    font-size: 5.9vw;
  }
  .origin-copy .kicker {
    max-width: 260px;
    font-size: 11px;
  }
  .origin-description {
    font-size: 15px;
  }
  .site-nav li.nav-external {
    display: none;
  }
}
@media (max-width: 767px), (pointer: coarse) and (max-height: 500px) {
  .origin-hero {
    height: auto;
    min-height: 100svh;
    padding: 142px 7% 26px;
  }
  .origin-copy {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    max-width: 520px;
  }
  .origin-copy .kicker {
    font-size: 11px;
    margin-bottom: 20px;
  }
  .origin-copy h1 {
    font-size: clamp(48px, 13vw, 80px);
  }
  .origin-description {
    margin: 22px 0 24px;
    font-size: 16px;
  }
  .origin-fallback {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: min(100%, 360px);
    margin: 48px auto 36px;
    display: block !important;
  }
  .origin-fallback figcaption {
    font-size: 11px;
  }
  .origin-footer {
    position: relative;
    inset: auto;
    flex-wrap: wrap;
    gap: 12px;
  }
  .origin-footer > span {
    display: none;
  }
  .origin-seed {
    display: none;
  }
  .site-header {
    height: 88px;
    align-items: center;
  }
  .site-header .site-nav {
    display: block;
  }
  .site-nav ul {
    gap: 16px;
  }
  .site-nav a {
    font-size: 9px;
  }
  .site-nav li.nav-external,
  .site-nav li:last-child {
    display: none;
  }
  .site-header .brand-word {
    font-size: 20px;
  }
  .site-header .brand-symbol {
    width: 23px;
    height: 23px;
  }
}
@media (max-width: 370px) {
  .site-header .site-nav li:nth-child(3) {
    display: none;
  }
  .site-nav ul {
    gap: 12px;
  }
  .origin-copy .kicker {
    max-width: 230px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .origin-hero .origin-cta {
    transition: none;
  }
  .js .origin-hero[data-mode="loading"] .origin-fallback {
    display: block;
  }
  .origin-hero[data-mode="loading"] .origin-seed {
    display: none;
  }
}

.origin-fallback video {
  position: absolute;
  inset: 0;
  height: 100%;
  opacity: var(--video-mix, 0);
}
html:not(.js) .origin-fallback video {
  display: none;
}

/* Portrait tablets: the copy stacks at the top and the portrait gets the lower
   field. Fallback (CSS-positioned poster) and the WebGL scene
   (data-composition="stacked", set by the controller) both stack; loading
   stacks too, so the headline is already in place at the first HTML paint and
   does not move when the scene starts. */
@media (min-width: 768px) and (max-aspect-ratio: 4/5) {
  .origin-hero:is(
      [data-mode="fallback"],
      [data-mode="loading"],
      [data-composition="stacked"]
    )
    .origin-copy {
    top: clamp(112px, 12svh, 170px);
    transform: none;
    width: min(78%, 640px);
    max-width: none;
  }
  .origin-hero:is(
      [data-mode="fallback"],
      [data-mode="loading"],
      [data-composition="stacked"]
    )
    .origin-copy
    h1 {
    font-size: clamp(56px, 9.5vw, 112px);
  }
  .origin-hero:is(
      [data-mode="fallback"],
      [data-mode="loading"],
      [data-composition="stacked"]
    )
    .origin-copy
    .kicker {
    max-width: none;
  }
  .origin-hero[data-mode="fallback"] .origin-fallback {
    top: auto;
    right: auto;
    left: 50%;
    bottom: clamp(104px, 10svh, 150px);
    transform: translateX(-50%);
    /* Sized from the height left under the copy (4:5 + caption). */
    width: clamp(220px, calc((100svh - 650px) * 0.76), 460px);
  }
}

/* A scene that arrives after the 5 s poster fades the poster out over it
   instead of cutting. The hero controller sets data-scene="ready" (and
   --poster-from, the poster's opacity at that moment) only in that case. */
@keyframes poster-out {
  from {
    opacity: var(--poster-from, 1);
    visibility: visible;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .js .origin-hero[data-mode="desktop"][data-scene="ready"] .origin-fallback {
    display: block;
    animation: poster-out 0.8s ease-in-out both;
  }
}

/* Phones: keep the photo hidden until the hero script takes over, so the
   first paint does not flash photo → dark → seed. boot.js removes .js after
   3.5 s if the entry module fails, and the photo then shows. */
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  .js .origin-hero[data-mode="loading"] .origin-media-frame img {
    visibility: hidden;
  }
}
