/* Load after styles.css. The document stays short until the 3D journey is ready. */
:root {
  --journey-gutter: max(56px, calc((100vw - 1320px) / 2));
}

main > section.experience {
  position: relative;
  height: 100svh;
  min-height: 0;
  padding: 0;
  pointer-events: none;
}
.experience-viewport {
  position: relative;
  height: 100svh;
  min-height: 0;
  overflow: clip;
}
body.journey-enabled .experience {
  height: calc(100svh + var(--journey-distance, 2300svh));
}
body.journey-enabled .experience-viewport {
  position: sticky;
  top: 0;
}
.catalog {
  position: relative;
  pointer-events: auto;
}
body.journey-enabled .catalog { display: none; }
.journey-panels, .journey-nav, .journey-position { display: none; }
body.journey-enabled .journey-panels { display: block; }

/* Copy is an overlay on the scene, with only the current chapter accepting input. */
.journey-panels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.journey-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, var(--panel-y, 0px), 0) scale(var(--panel-scale, 1));
  transform-origin: 50% 50%;
}
.journey-panel.is-current {
  opacity: var(--panel-opacity, 1);
  visibility: visible;
  will-change: opacity, transform;
}
.chapter-copy {
  position: absolute;
  top: 50%;
  left: var(--journey-gutter);
  width: min(42vw, 560px);
  max-width: calc(100% - 112px);
  transform: translateY(-50%);
  text-shadow: 0 2px 16px #000a;
}
.journey-panel.is-current .chapter-copy { pointer-events: auto; }
.chapter-copy h2 {
  font-size: clamp(44px, 5.2vw, 78px);
  line-height: 1.12;
  letter-spacing: -.04em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.chapter-kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  color: #b8b8b5;
  font-size: 12px;
}
.chapter-number { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.chapter-kicker .status {
  border-color: #60605e;
  color: #d2d2cd;
  font-size: 11px;
  padding: 2px 10px;
}
.chapter-kicker .released-status { border-color: #557763; color: #c2e2cd; }
.chapter-kicker .upcoming { border-color: #64758f; color: #d1dbf1; }
.chapter-category {
  margin-top: 13px;
  color: #b8b8b5;
  font-size: 13px;
  line-height: 1.5;
}
.chapter-hook {
  margin-top: 27px;
  max-width: 24ch;
  color: var(--chapter-accent, var(--ink));
  font-size: clamp(21px, 2vw, 29px);
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.chapter-description {
  margin-top: 16px;
  max-width: 45ch;
  color: #c0c0bc;
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.chapter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 17px;
  margin-top: 22px;
  color: #b2b2ae;
  font-size: 12px;
  line-height: 1.6;
}
.chapter-tags span + span::before {
  content: "/";
  margin-right: 17px;
  color: #72726f;
}
.chapter-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 27px;
  margin-top: 20px;
}
.chapter-actions .text-link {
  margin-top: 0;
  background: transparent;
  color: var(--ink);
  border-bottom-color: #84847e;
  min-height: 44px;
  text-shadow: none;
}
.chapter-actions .text-link:hover {
  color: var(--chapter-accent, var(--accent));
  border-bottom-color: currentColor;
}
.chapter-next {
  margin-top: 29px;
  color: #a9a9a5;
  font-size: 11px;
  line-height: 1.6;
}

/* Seven direct destinations remain quiet until hovered, focused, or selected. */
body.journey-enabled .journey-nav {
  position: absolute;
  z-index: 4;
  top: 50%;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateY(-50%);
  pointer-events: auto;
}
.journey-nav button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  color: #a1a19b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.journey-nav button > span:first-child {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: color .16s, border-color .16s;
}
.journey-nav .nav-label {
  position: absolute;
  right: 51px;
  white-space: nowrap;
  font-size: 12px;
  color: var(--ink);
  opacity: 0;
  transform: translateX(5px);
  transition: opacity .16s, transform .16s;
  text-shadow: 0 2px 12px #000;
  pointer-events: none;
}
.journey-nav button:is(:hover, :focus-visible, .is-current, [aria-current="true"], [aria-current="step"]) {
  color: var(--ink);
}
.journey-nav button:is(.is-current, [aria-current="true"], [aria-current="step"]) > span:first-child {
  border-color: #777772;
}
.journey-nav button:is(:hover, :focus-visible, .is-current, [aria-current="true"], [aria-current="step"]) .nav-label {
  opacity: 1;
  transform: none;
}
body.journey-enabled .journey-position {
  position: absolute;
  left: var(--journey-gutter);
  bottom: max(25px, env(safe-area-inset-bottom));
  display: flex;
  align-items: baseline;
  gap: 18px;
  max-width: calc(100% - 210px);
  color: #b4b4ae;
  font-size: 11px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
#journey-current { color: #deded8; }
#journey-count { white-space: nowrap; }
body.journey-enabled[data-journey-phase="intro"] .journey-position { visibility: hidden; }
body.journey-enabled:is([data-journey-phase="product"], [data-journey-phase="transition"], [data-journey-phase="closing"]) #motion-caption {
  display: none;
}

/* Details use the same content in a native dialog, with a static, readable layout. */
.project-dialog {
  width: min(960px, calc(100% - 32px));
  max-width: none;
  max-height: 90svh;
  margin: auto;
  padding: 0;
  border: 1px solid #41413d;
  border-radius: 16px;
  background: #101010;
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #62625d #101010;
}
.project-dialog::backdrop {
  background: #000c;
  backdrop-filter: blur(4px);
}
body.is-detail-open { overflow: hidden; }
.dialog-close {
  position: sticky;
  top: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  margin: 12px 12px 0 auto;
  padding: 0;
  border: 1px solid #63635d;
  border-radius: 50%;
  background: #181818;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}
.dialog-close:hover { background: #30302c; }
.dialog-content {
  min-width: 0;
  padding: 0 40px 42px;
  overflow-wrap: anywhere;
  pointer-events: auto;
}
.dialog-content .wrap { width: 100%; max-width: none; }
.dialog-content .game-story { padding-bottom: 0; }
.dialog-content .game-heading { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.dialog-content .game-heading h3 { font-size: clamp(30px, 3.8vw, 44px); }
.dialog-content .game-hook { font-size: 23px; }
.dialog-content .game-intro > p:not(.game-hook) { font-size: 14px; }
.dialog-content .game-stage { perspective: none; }
.dialog-content .game-world { height: 480px; box-shadow: none; }
.dialog-content :is(.game-world, .screen-shot, .dawn-lettering, .world-caption) { transform: none !important; }
.dialog-content .screen-back { width: min(24%, 170px); top: 44px; }
.dialog-content .screen-front { width: min(26%, 190px); top: 77px; }
.dialog-content .dawn-lettering { font-size: 67px; }
.dialog-content .dawn-guardians { width: min(22%, 150px); top: 48px; }
.dialog-content .dawn-trial { width: min(22%, 155px); top: 68px; }
.dialog-content .dawn-combat { width: min(26%, 185px); top: 98px; }
.dialog-content .game-details { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 30px; }
.dialog-content .game-details h4 { font-size: 18px; }
.dialog-content .game-details p { font-size: 14px; }
.dialog-content .project-row { display: block; padding: 0; border: 0; background: none; }
.dialog-content .project-row::before { display: none; }
.dialog-content .project-name h3 { font-size: clamp(30px, 5vw, 48px); }
.dialog-content .project-description { margin-top: 25px; }
.dialog-content .project-description h4 { font-size: 22px; }
.dialog-content .project-description p { max-width: 58ch; font-size: 16px; line-height: 1.85; }
.dialog-content .project-row > .status { margin-top: 23px; }

@media (max-width: 1050px) {
  :root { --journey-gutter: 36px; }
  .chapter-copy { width: 45%; max-width: calc(100% - 100px); }
  .chapter-copy h2 { font-size: clamp(39px, 5.4vw, 57px); }
  .chapter-hook { font-size: 22px; margin-top: 22px; }
  .chapter-description { font-size: 14px; line-height: 1.8; }
  .chapter-tags { font-size: 11px; gap: 6px 12px; }
  .chapter-tags span + span::before { margin-right: 12px; }
  .chapter-next { margin-top: 22px; }
  body.journey-enabled .journey-nav { right: 10px; }
}

@media (max-width: 760px) {
  :root { --journey-gutter: 20px; }
  .chapter-copy {
    top: auto;
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 68px));
    width: calc(100% - 40px);
    max-width: none;
    transform: none;
  }
  .chapter-copy h2 { font-size: clamp(32px, 8.4vw, 40px); line-height: 1.13; }
  .chapter-kicker { margin-top: 11px; gap: 12px; font-size: 10px; }
  .chapter-kicker .status { font-size: 10px; padding: 1px 9px; }
  .chapter-category { margin-top: 7px; font-size: 11px; }
  .chapter-hook { margin-top: 16px; max-width: none; font-size: 21px; line-height: 1.4; }
  .chapter-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin-top: 11px;
    max-width: 48ch;
    font-size: 14px;
    line-height: 1.7;
  }
  .chapter-tags { display: none; }
  .chapter-actions { margin-top: 13px; gap: 5px 24px; }
  .chapter-actions .text-link { font-size: 13px; gap: 12px; padding-block: 8px; }
  .chapter-next { margin-top: 16px; font-size: 10px; }
  body.journey-enabled .journey-nav {
    top: max(15px, env(safe-area-inset-top));
    left: 50%;
    right: auto;
    width: min(350px, calc(100% - 12px));
    flex-direction: row;
    justify-content: space-between;
    gap: 0;
    transform: translateX(-50%);
  }
  body.journey-enabled[data-journey-phase="intro"] .journey-nav { top: 91px; }
  .journey-nav button > span:first-child {
    width: 6px;
    height: 6px;
    border: 0;
    background: #90908a;
    font-size: 0;
    outline: 1px solid transparent;
    outline-offset: 5px;
  }
  .journey-nav button:is(:hover, :focus-visible, .is-current, [aria-current="true"], [aria-current="step"]) > span:first-child {
    background: var(--ink);
    outline-color: #999993;
  }
  .journey-nav .nav-label {
    left: 0;
    right: auto;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    opacity: 1;
    transform: none;
  }
  body.journey-enabled .journey-position {
    bottom: max(23px, env(safe-area-inset-bottom));
    max-width: calc(100% - 136px);
    flex-wrap: wrap;
    gap: 2px 13px;
    font-size: 10px;
  }
  .dialog-content { padding: 0 20px 30px; }
  .dialog-content .game-heading { display: block; margin-bottom: 28px; }
  .dialog-content .game-heading h3 { font-size: 33px; }
  .dialog-content .game-hook { font-size: 23px; }
  .dialog-content .game-world { height: 470px; }
  .dialog-content .screen-back { width: 40%; top: 153px; }
  .dialog-content .screen-front { width: 44%; top: 178px; }
  .dialog-content .dawn-lettering { top: 24px; font-size: 46px; }
  .dialog-content .dawn-guardians { width: 33%; top: 172px; }
  .dialog-content .dawn-trial { width: 33%; top: 149px; }
  .dialog-content .dawn-combat { width: 43%; top: 193px; }
  .dialog-content .game-details { display: block; padding-top: 23px; }
  .dialog-content .world-caption { left: 15px; right: 15px; font-size: 10px; }
  .dialog-content .project-description h4 { font-size: 20px; }
  .dialog-content .project-description p { font-size: 15px; }
}

@media (max-width: 760px) and (min-height: 850px) {
  .chapter-copy { bottom: max(102px, calc(env(safe-area-inset-bottom) + 88px)); }
  .chapter-description { -webkit-line-clamp: 4; }
}

/* Keep the main action visible on compact phones and landscape windows. */
@media (max-height: 620px) {
  .experience .hero-copy { bottom: 86px; }
  .experience .hero-copy h1 { font-size: 26px; }
  .experience .hero-copy > div > p { display: none; }
  .chapter-copy { top: 50%; bottom: auto; transform: translateY(-50%); }
  .chapter-copy h2 { font-size: clamp(29px, 4.1vw, 42px); }
  .chapter-kicker { margin-top: 9px; }
  .chapter-category, .chapter-tags, .chapter-next { display: none; }
  .chapter-hook { margin-top: 14px; font-size: 20px; line-height: 1.35; }
  .chapter-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.65;
  }
  .chapter-actions { margin-top: 10px; gap: 3px 20px; }
  .chapter-actions .text-link { padding-block: 7px; font-size: 12px; gap: 10px; }
  body.journey-enabled .journey-nav { gap: 0; }
  body.journey-enabled .journey-position { bottom: 15px; }
}
@media (max-width: 760px) and (max-height: 620px) {
  .chapter-copy { top: auto; bottom: 69px; transform: none; }
  .chapter-copy h2 { font-size: 31px; }
  .chapter-hook { font-size: 18px; }
  .chapter-description { -webkit-line-clamp: 2; }
}
@media (max-width: 760px) and (max-height: 440px) {
  .chapter-copy { width: 51%; bottom: 57px; }
  .chapter-copy h2 { font-size: 28px; }
  .chapter-kicker { margin-top: 6px; }
  .chapter-hook { margin-top: 9px; font-size: 17px; }
  .chapter-description { margin-top: 8px; font-size: 12px; }
  .chapter-actions { margin-top: 4px; gap: 3px 16px; }
  body.journey-enabled .journey-nav { left: auto; right: 10px; width: 44%; top: 8px; transform: none; }
  .journey-nav button { min-width: 0; width: 14.285%; }
}

/* CSS also provides a safe fallback before the preference listener runs. */
@media (prefers-reduced-motion: reduce) {
  body.journey-enabled .experience, .experience { height: 100svh; min-height: 0; }
  body.journey-enabled .experience-viewport { position: relative; }
  body.journey-enabled :is(.journey-panels, .journey-nav, .journey-position) { display: none; }
  body.journey-enabled .catalog { display: block; }
  .experience .hero-copy { opacity: 1; visibility: visible; transform: none; }
  .experience .hero-bottom { opacity: 1; visibility: visible; }
}


/* One point unfolds into the chapter; the lettering itself becomes the next entrance. */
body.journey-enabled :is(main > .about, main > .contact, body > .footer) { display: none; }
.journey-panel { transform: none; clip-path: circle(var(--panel-reveal, 0%) at 71% 50%); }
.journey-panel.is-current { will-change: clip-path, opacity; }
.chapter-title-image { display: block; width: var(--title-width); max-width: 100%; height: auto; }
.chapter-copy h2 { opacity: var(--title-opacity, 1); }
.chapter-copy > :not(h2) { opacity: var(--part-opacity, 1); transform: translateY(var(--part-y, 0px)); }
.chapter-next { display: none; }
.journey-closing { display: none; position: absolute; inset: 0; pointer-events: none; }
body.journey-enabled .journey-closing { display: block; }
.closing-statement { position: absolute; inset: 0; display: grid; place-items: center; padding: 6vw; }
.closing-statement p { text-align: center; font-size: clamp(36px, 5.3vw, 76px); font-weight: 600; line-height: 1.38; letter-spacing: -.035em; }
.closing-statement [data-letter-line] { display: block; }
.closing-letter { display: inline-block; white-space: pre; opacity: var(--letter-opacity, 0); transform: translateY(var(--letter-y, 10px)); }
.closing-card { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 64px 24px; text-align: center; opacity: var(--closing-opacity, 0); }
.closing-card h2 { width: min(64vw, 750px); }
.closing-card h2 img { display: block; width: 100%; height: auto; }
.closing-tagline { margin-top: 30px; font-size: 17px; color: #c5c9ce; opacity: var(--tagline-opacity, 0); }
.closing-card .closing-action { margin-top: 40px; opacity: var(--action-opacity, 0); }
.closing-contacts { margin-top: 46px; opacity: var(--contacts-opacity, 0); transform: translateY(calc((1 - var(--contacts-opacity, 0)) * 15px)); }
.closing-contacts p { font-size: 12px; color: #aeb9c7; margin-bottom: 10px; }
.closing-contacts a { display: block; font-size: clamp(18px, 2vw, 25px); line-height: 1.5; text-underline-offset: 6px; }
.closing-contacts a:hover { text-decoration: underline; }
.closing-contacts > span { display: block; font-size: 12px; color: #aeb9c7; margin-top: 15px; }
.closing-restart { margin-top: 40px; font-size: 12px; color: #b9c3cf; min-height: 44px; display: flex; align-items: center; gap: 12px; opacity: var(--contacts-opacity, 0); }
.closing-card.is-current :is(a,button) { pointer-events: auto; }
@media(max-width:760px) and (orientation:portrait) {
  .journey-panel { clip-path: circle(var(--panel-reveal, 0%) at 50% 27%); }
  .closing-statement { padding: 20px; }
  .closing-statement p { font-size: clamp(26px, 5.3vw, 38px); line-height: 1.6; letter-spacing: -.025em; }
  .closing-card h2 { width: 88%; }
  .closing-tagline { font-size: 13px; margin-top: 24px; }
  .closing-card .closing-action { margin-top: 30px; }
  .closing-contacts { margin-top: 36px; }
  .closing-restart { margin-top: 30px; }
}
@media(max-width:760px) and (max-height:750px) and (orientation:portrait) {
  .journey-panel { clip-path: circle(var(--panel-reveal, 0%) at 50% 21.5%); }
}
@media(max-height:500px) and (orientation:landscape) {
  .closing-card { padding: 30px 20px; }
  .closing-card h2 { width: min(44vw,420px); }
  .closing-tagline { font-size: 12px; margin-top: 12px; }
  .closing-card .closing-action { margin-top: 17px; min-height: 42px; padding: 10px 20px; }
  .closing-contacts { margin-top: 17px; }
  .closing-contacts p { display: none; }
  .closing-contacts a { font-size: 17px; }
  .closing-contacts > span { margin-top: 5px; font-size: 10px; }
  .closing-restart { position:absolute; bottom:9px; right:20px; margin-top:0; }
  .closing-statement p { font-size: 38px; }
}
@media(prefers-reduced-motion:reduce) {
  body.journey-enabled .journey-closing { display:none; }
  body.journey-enabled :is(main > .about, main > .contact, body > .footer) { display:revert; }
}
