/* Fixed Stage Layout */
.stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  z-index: var(--z-bg);
}

/* Background elements */
.bg {
  position: absolute;
  inset: 0;
  background-color: var(--paper);
  z-index: var(--z-bg);
  pointer-events: none;
}

.bg__floor {
  position: absolute;
  top: 78svh;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(233, 233, 231, 0), rgba(226, 226, 223, 0.35) 100%);
}

.bg__halftone {
  position: absolute;
  top: 0;
  right: 0;
  width: 46vw;
  height: 40svh;
  opacity: 0.12;
}

/* Avatar container — Softens ONLY the outer left/right video box edges, NEVER near the hero's head, torso, or feet */
.avatar {
  position: absolute;
  top: var(--avatar-top);
  left: var(--avatar-x);
  height: var(--avatar-h);
  aspect-ratio: 1 / 1;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: var(--z-avatar);
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, rgba(0,0,0,0.55) 6%, #000 15%, #000 85%, rgba(0,0,0,0.55) 94%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 1.6%, #000 98.6%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, rgba(0,0,0,0.55) 6%, #000 15%, #000 85%, rgba(0,0,0,0.55) 94%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 1.6%, #000 98.6%, transparent 100%);
  mask-composite: intersect;
}

.avatar__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  z-index: 0;
}

.avatar__vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  z-index: 1;
  transition: opacity 200ms var(--ease-in-out);
}

.avatar__vid.is-active {
  opacity: 1;
  z-index: 2;
}

/* Track container — Top layer above video box, feathered smoothly as cards move further away & never near hero */
.track {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 55.5vw;
  right: 0;
  perspective: 1400px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: var(--z-track);
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, rgba(0,0,0,0.18) 7%, rgba(0,0,0,0.68) 17%, #000 28%, #000 88%, rgba(0,0,0,0.4) 95%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.22) 8%, #000 22%, #000 78%, rgba(0,0,0,0.22) 92%, transparent 100%),
    linear-gradient(134deg, transparent 0%, rgba(0,0,0,0.25) 14%, #000 28%, #000 72%, rgba(0,0,0,0.25) 86%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, rgba(0,0,0,0.18) 7%, rgba(0,0,0,0.68) 17%, #000 28%, #000 88%, rgba(0,0,0,0.4) 95%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.22) 8%, #000 22%, #000 78%, rgba(0,0,0,0.22) 92%, transparent 100%),
    linear-gradient(134deg, transparent 0%, rgba(0,0,0,0.25) 14%, #000 28%, #000 72%, rgba(0,0,0,0.25) 86%, transparent 100%);
  mask-composite: intersect;
}

.track--fast {
  /* Active during JOG state */
}

/* HUD System (3-Column Split: Copy | Model | Cards) */
.hud {
  position: fixed;
  inset: 0;
  padding: var(--hud-pad);
  pointer-events: none;
  font: var(--t-hud)/1.5 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  z-index: var(--z-hud);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.hud a,
.hud button {
  pointer-events: auto;
}

.hud__col-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  height: 100%;
}

.hud__col-mid {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.hud__col-right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  text-align: right;
  height: 100%;
}

/* Top-Left: MTPT Solutions Logo + Jump Chips directly below */
.hud__brand-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.hud__logo {
  width: 140px;
  height: auto;
  object-fit: contain;
  display: block;
}

.hud__chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--f-sans);
  font-weight: 800;
  font-size: 12px;
  color: var(--white);
  background: var(--ink);
  padding: 5px 11px;
  clip-path: polygon(0 8%, 100% 0, 96% 100%, 3% 92%);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  transition: transform var(--d-fast) var(--ease-back), background var(--d-fast);
}

.chip:nth-child(1) { transform: rotate(-2deg); }
.chip:nth-child(2) { transform: rotate(1.5deg); }
.chip:nth-child(3) { transform: rotate(-1deg); }

.chip:hover,
.chip:focus-visible,
.chip.is-active {
  background: var(--blue);
  transform: translateY(-2px) rotate(0);
}

.chip b {
  font-family: var(--f-impact);
  color: var(--blue-soft);
}

/* ===================================================================== */
/* Middle-Left: Reference Collage Copy Graphic (.p5-dossier)             */
/* ===================================================================== */
.p5-dossier {
  position: relative;
  width: clamp(440px, 36.5vw, 620px);
  max-height: 64svh;
  aspect-ratio: 560 / 500;
  margin: 0;
  user-select: none;
  transition: transform 160ms var(--ease-out), opacity 120ms ease;
}

.p5-dossier.is-swapping {
  opacity: 0.35;
  transform: scale(0.985) rotate(-0.8deg);
}

.p5-dossier__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  filter: drop-shadow(6px 8px 0 rgba(11, 11, 15, 0.22));
}

/* 1. Top Angled Banner Header (like [ 基 本 情 報 ! ]) */
.p5-dossier__banner {
  position: absolute;
  top: 2%;
  left: 2%;
  z-index: 5;
  display: inline-flex;
  align-items: stretch;
  transform: rotate(-8.5deg);
  background: var(--ink);
  border: 3.5px solid var(--white);
  outline: 4.5px solid var(--blue);
  box-shadow: -6px 7px 0 var(--ink);
}

.p5-dossier__banner-box {
  background: var(--blue);
  color: var(--white);
  font-family: var(--f-impact);
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 3.5px solid var(--ink);
  box-shadow: inset 3.5px 3.5px 0 var(--ink);
}

.p5-dossier__banner-bar {
  background: var(--ink);
  color: var(--white);
  font-family: var(--f-impact);
  font-size: clamp(19px, 1.85vw, 28px);
  letter-spacing: 0.12em;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* 2. Overlapping Sticker Name Badges on Upper-Right (like [NAKAMOTO] [YUTA]) */
.p5-dossier__stickers {
  position: absolute;
  top: 21%;
  right: 17%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.p5-dossier__pill-top {
  background: var(--ink);
  color: var(--white);
  font-family: var(--f-impact);
  font-size: clamp(13px, 1.25vw, 19px);
  letter-spacing: 0.08em;
  padding: 4px 13px;
  border: 3px solid var(--white);
  outline: 3.5px solid var(--blue);
  border-radius: 999px;
  transform: rotate(3deg);
  box-shadow: 3.5px 3.5px 0 var(--ink);
}

.p5-dossier__pill-main {
  background: var(--ink);
  color: var(--white);
  font-family: var(--f-impact);
  font-size: clamp(24px, 2.35vw, 36px);
  letter-spacing: 0.05em;
  line-height: 1;
  padding: 5px 15px;
  border: 3.5px solid var(--white);
  outline: 4px solid var(--blue);
  transform: rotate(8deg);
  box-shadow: 5px 5px 0 var(--ink);
}

/* 3. Body Copy inside Black Halftone Frame */
.p5-dossier__copy {
  position: absolute;
  top: 30%;
  left: 23%;
  width: 53%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--white);
  font-family: var(--f-sans);
  font-weight: 800;
  text-transform: uppercase;
}

.p5-dossier__lead {
  margin: 0;
  font-size: clamp(11.5px, 1.05vw, 15.5px);
  line-height: 1.32;
  letter-spacing: 0.03em;
  color: var(--white);
}

.p5-dossier__desc {
  margin: 0;
  font-size: clamp(11.5px, 1.05vw, 15.5px);
  line-height: 1.36;
  letter-spacing: 0.02em;
  color: var(--blue-soft);
}

/* 4. Stacked White Cutout Side-Tags on Middle-Right */
.p5-dossier__side-tags {
  position: absolute;
  top: 45%;
  right: 2%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.p5-dossier__side-tag {
  background: var(--white);
  color: var(--ink);
  font-family: var(--f-impact);
  font-size: clamp(11px, 0.98vw, 14.5px);
  letter-spacing: 0.06em;
  padding: 4px 11px;
  border: 2.5px solid var(--ink);
  box-shadow: 3.5px 3.5px 0 var(--blue);
  white-space: nowrap;
}

/* 5. Bottom Row: Starburst Badge + Bowtie Dual Photos + 3 Stat Lines */
.p5-dossier__bottom-row {
  position: absolute;
  bottom: 16%;
  left: 9%;
  right: 12%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.p5-dossier__star-badge {
  background: var(--ink);
  color: var(--white);
  border: 3px solid var(--blue);
  padding: 9px 12px;
  clip-path: polygon(10% 0%, 100% 14%, 92% 94%, 0% 100%, 4% 48%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(-5deg);
  flex-shrink: 0;
  box-shadow: 4px 4px 0 var(--ink);
}

.p5-dossier__star-badge b {
  font-family: var(--f-impact);
  font-size: clamp(24px, 2.25vw, 34px);
  line-height: 0.95;
}

.p5-dossier__star-badge span {
  font-family: var(--f-sans);
  font-weight: 800;
  font-size: clamp(8.5px, 0.75vw, 10.5px);
  letter-spacing: 0.05em;
}

.p5-dossier__bowtie {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  background: var(--blue);
  border: 3px solid var(--white);
  clip-path: polygon(0 0, 50% 10%, 100% 0, 96% 100%, 50% 90%, 4% 100%);
  width: 44%;
  aspect-ratio: 2.05 / 1;
  flex-shrink: 0;
}

.p5-dossier__photo-slot {
  background: var(--ink);
  overflow: hidden;
  border: 1.5px solid var(--ink);
}

.p5-dossier__photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.p5-dossier__stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--f-sans);
  font-weight: 900;
  font-size: clamp(10.5px, 0.95vw, 14px);
  color: var(--white);
  letter-spacing: 0.03em;
}

/* 6. Bottom Slanted < BACK and NEXT > Comic Buttons */
.p5-dossier__nav {
  position: absolute;
  bottom: 2%;
  left: 19%;
  right: 16%;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.p5-dossier__nav-btn {
  background: var(--white);
  padding: 3.5px;
  clip-path: polygon(0 12%, 100% 0, 92% 100%, 6% 92%);
  cursor: pointer;
  transition: transform var(--d-fast) var(--ease-back);
}

.p5-dossier__nav-btn span {
  display: block;
  background: var(--blue);
  color: var(--white);
  font-family: var(--f-impact);
  font-size: clamp(13px, 1.15vw, 17px);
  letter-spacing: 0.08em;
  padding: 5px 20px;
  box-shadow: -3.5px 3.5px 0 var(--ink);
}

.p5-dossier__nav-btn:hover {
  transform: translateY(-2px) scale(1.05);
}

/* Bottom-Left: Email Me CTA + Clean Clock */
.hud__footer-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.hud__btn-mail {
  background: var(--blue);
  color: var(--white);
  font-family: var(--f-sans);
  font-weight: 800;
  font-size: 12px;
  padding: 8px 14px;
  clip-path: polygon(0 0, 100% 8%, 95% 100%, 4% 92%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform var(--d-fast) var(--ease-back);
}

.hud__btn-mail:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.hud__btn-mail svg {
  width: 14px;
  height: 14px;
}

.hud__clock {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
}

/* Top-Center: SHAM Ransom Wordmark + Subhead */
.hud__identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.hud__wordmark {
  font-size: 32px;
  margin-bottom: 6px;
}

.hud__subhead {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.38;
  letter-spacing: 0.05em;
}

/* Bottom-Center: Scroll Hint only (status removed per request) */
.hud__mid-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hud__hint {
  color: var(--muted);
  font-size: 10px;
  transition: opacity 400ms;
}

/* Right Column: Available Indicator & Copyright */
.hud__avail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.hud__avail-title {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.06em;
}

.hud__avail-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
}

.hud__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  animation: pulse-dot 1.6s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.hud__copyright {
  color: var(--muted);
  font-size: 10px;
}

/* Mobile & Portrait Adjustment:
   1. SHAM (topside) centered in the middle column directly above the model
   2. Cards shifted UP into the upper-right zone (white UP arrow)
   3. Copy (.p5-dossier) shifted DOWN into the lower-left zone (white DOWN arrow)
   Everything else remains untouched. */
@media (max-width: 1023px), (orientation: portrait) {
  .track {
    left: 52vw;
    right: 0;
    -webkit-mask-image:
      linear-gradient(to right, transparent 0%, rgba(0,0,0,0.2) 6%, rgba(0,0,0,0.75) 16%, #000 26%, #000 90%, rgba(0,0,0,0.4) 96%, transparent 100%),
      linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.35) 4%, #000 11%, #000 72%, rgba(0,0,0,0.22) 86%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
      linear-gradient(to right, transparent 0%, rgba(0,0,0,0.2) 6%, rgba(0,0,0,0.75) 16%, #000 26%, #000 90%, rgba(0,0,0,0.4) 96%, transparent 100%),
      linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.35) 4%, #000 11%, #000 72%, rgba(0,0,0,0.22) 86%, transparent 100%);
    mask-composite: intersect;
  }

  /* Move copy (.p5-dossier) DOWN into the lower-left space above EMAIL ME */
  .p5-dossier {
    margin-top: auto;
    margin-bottom: 4.5svh;
    width: clamp(210px, 43vw, 415px);
  }
}

@media (max-width: 767px) {
  .hud {
    gap: 8px;
  }

  .hud__logo {
    width: 96px;
  }

  .chip {
    font-size: 9.5px;
    padding: 4px 7px;
  }

  .hud__wordmark {
    font-size: 22px;
  }

  .hud__subhead {
    font-size: 8.5px;
  }

  .p5-dossier {
    width: clamp(190px, 46vw, 310px);
    margin-bottom: 3svh;
  }

  .p5-dossier__banner-box {
    font-size: 13px;
    padding: 5px 7px;
  }

  .p5-dossier__banner-bar {
    font-size: 11px;
    padding: 5px 9px;
  }

  .p5-dossier__pill-top {
    font-size: 8px;
    padding: 2px 6px;
  }

  .p5-dossier__pill-main {
    font-size: 14px;
    padding: 3px 8px;
  }

  .p5-dossier__lead,
  .p5-dossier__desc {
    font-size: 8px;
    line-height: 1.25;
  }

  .p5-dossier__side-tag {
    font-size: 7.5px;
    padding: 2px 6px;
  }

  .p5-dossier__star-badge b {
    font-size: 14px;
  }

  .p5-dossier__star-badge span {
    font-size: 6px;
  }

  .p5-dossier__stats {
    font-size: 7px;
  }

  .p5-dossier__nav-btn span {
    font-size: 9px;
    padding: 3px 9px;
  }
}
