/* ═══════════════════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════════════════ */
:root {
  --purple-primary: #ab9ff2;
  --purple-dark:    #3c315b;
  --purple-deep:    #1a1525;
  --lavender-light: #e8e5f2;
  --lavender-mid:   #e2dffe;
  --card-bg:        #f5f3ff;
  --white:          #ffffff;
  --phone-w:        375px;
  --phone-h:        812px;
  --phone-r:        46px;
  --font:           'Caveat', cursive;
  --font-display:   'Syne', sans-serif;
  --font-body:      'DM Sans', sans-serif;
  --phone-scale:    1;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; }
body {
  background: var(--purple-deep);
  font-family: var(--font);
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════
   GHOST TRAIL (fixed left)
═══════════════════════════════════════════════════════════ */
#ghost-trail {
  position: fixed;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
}

.ghost-dot {
  width: 22px;
  height: 22px;
  opacity: 0.12;
  transition: opacity 0.3s ease;
}

.ghost-dot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.ghost-trail-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  writing-mode: vertical-rl;
  letter-spacing: 3px;
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════
   SCENE LABEL (fixed right)
═══════════════════════════════════════════════════════════ */
#scene-label {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  pointer-events: none;
}

#scene-label-text {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  writing-mode: vertical-rl;
  letter-spacing: 3px;
  text-transform: lowercase;
}

/* ═══════════════════════════════════════════════════════════
   SCROLL CONTAINER + STICKY STAGE
═══════════════════════════════════════════════════════════ */
#scroll-container {
  height: 7200px;
  position: relative;
}

#sticky-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* ═══════════════════════════════════════════════════════════
   PAGE BACKGROUND
═══════════════════════════════════════════════════════════ */
#page-bg {
  position: absolute;
  inset: 0;
  background: var(--purple-deep);
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════
   PHONE SCALE WRAPPER
═══════════════════════════════════════════════════════════ */
#phone-scale-wrapper {
  transform: scale(var(--phone-scale));
  transform-origin: center center;
  position: relative;
  z-index: 10;
}

/* ═══════════════════════════════════════════════════════════
   PHONE OUTER (position context for bubbles)
═══════════════════════════════════════════════════════════ */
#phone-outer {
  position: relative;
  width: var(--phone-w);
  height: var(--phone-h);
}

/* ═══════════════════════════════════════════════════════════
   PHONE BEZEL
═══════════════════════════════════════════════════════════ */
#phone-bezel {
  position: absolute;
  inset: 0;
  background: #0a0a0e;
  border-radius: var(--phone-r);
  overflow: hidden;
  box-shadow:
    0 40px 80px rgba(0,0,0,0.6),
    0 0 0 2px rgba(255,255,255,0.06),
    inset 0 0 0 1px rgba(255,255,255,0.04);
}

.notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 28px;
  background: #0a0a0e;
  border-radius: 0 0 18px 18px;
  z-index: 30;
}

.ghost-corner {
  position: absolute;
  top: 38px;
  right: 10px;
  z-index: 25;
  width: 70px;
  height: 70px;
  background: var(--purple-dark);
  border-radius: 52% 48% 50% 50% / 58% 58% 42% 42%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(60,49,91,0.5);
}

.ghost-corner img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

/* ═══════════════════════════════════════════════════════════
   MOCKUP LAYERS
═══════════════════════════════════════════════════════════ */
.mockup-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
}

#light-mockup {
  opacity: 0;
  /* clip-path animated by GSAP in Scene 5 — NOT pre-set here */
}

#dark-mockup {
  opacity: 0;
}

/* ═══════════════════════════════════════════════════════════
   PHONE INTERIOR — SHARED
═══════════════════════════════════════════════════════════ */
.phone-inner {
  width: 100%;
  height: 100%;
  background: var(--white);
  display: flex;
  flex-direction: column;
  position: relative;
}

.dark-inner { background: var(--purple-dark); }

.status-bar {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 22px 8px;
  position: relative;
  z-index: 5;
}

.time { font-size: 15px; font-weight: 700; color: var(--purple-dark); }
.dark-status .time { color: var(--white); }
.signal { font-size: 12px; color: var(--purple-dark); opacity: 0.6; letter-spacing: 1px; }

.search-wrap { flex-shrink: 0; padding: 4px 84px 10px 20px; }

.search-bar {
  height: 46px;
  border: 2px solid var(--purple-primary);
  border-radius: 23px;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}

.dark-search {
  border-color: rgba(171,159,242,0.35);
  background: rgba(255,255,255,0.07);
}

.search-icon { width: 17px; height: 17px; object-fit: contain; opacity: 0.65; flex-shrink: 0; }
.search-ph { font-size: 17px; color: var(--purple-primary); opacity: 0.8; }
.dark-ph { color: rgba(255,255,255,0.35); opacity: 1; }

.balance-section {
  flex-shrink: 0;
  padding: 10px 24px 12px;
  border-bottom: 1.5px dashed var(--lavender-mid);
}

.dark-balance-section { border-bottom-color: rgba(255,255,255,0.18); }

.balance-icons-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.wallet-chip {
  width: 28px;
  height: 28px;
  border-radius: 52% 48% 50% 50% / 58% 58% 42% 42%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.light-chip { background: var(--purple-primary); }
.dark-chip  { background: rgba(171,159,242,0.35); }
.wallet-chip img { width: 22px; height: 22px; object-fit: contain; }

.eye-icon { width: 34px; height: 34px; object-fit: contain; opacity: 0.75; }

.balance-amt {
  font-size: 58px;
  font-weight: 700;
  color: var(--purple-dark);
  line-height: 1.05;
  transition: filter 0.4s ease;
}

.dark-amt { color: var(--white); }

.section-row {
  flex-shrink: 0;
  padding: 12px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px dashed var(--lavender-mid);
}

.dark-row { border-bottom-color: rgba(255,255,255,0.18); }
.tokens-row { padding: 10px 24px 14px; }

.row-lbl { font-size: 30px; font-weight: 600; color: var(--purple-dark); }
.dark-lbl { color: var(--white); }
.row-icon { width: 62px; height: 44px; object-fit: contain; }

.expand-hint { display: flex; align-items: center; gap: 6px; }
.expand-text { font-size: 14px; color: var(--purple-primary); opacity: 0.55; font-style: italic; letter-spacing: 0.3px; }
.expand-arrow { font-size: 20px; color: var(--purple-primary); opacity: 0.65; }

.card-grid {
  flex: 1;
  padding: 14px 14px 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  overflow: hidden;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 20px;
  padding: 6px 8px;
}

.light-card { background: var(--card-bg); border: 1.5px solid var(--lavender-mid); }
.dark-card  { background: rgba(255,255,255,0.07); border: 1.5px solid rgba(255,255,255,0.1); }

.card img { width: 72px; height: 72px; object-fit: contain; }
.card span { font-size: 18px; font-weight: 600; color: var(--purple-primary); }
.dark-card span { color: rgba(255,255,255,0.85); }

/* tokens overlay — covers the card grid section only (below card grid top to above nav) */
#tokens-overlay {
  position: absolute;
  top: 362px;      /* start of card grid area */
  left: 0;
  right: 0;
  bottom: 88px;    /* stop above the nav bar */
  z-index: 22;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}

#tokens-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px 12px 0 0;
}

.bottom-nav {
  height: 88px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 44px 14px;
  position: relative;
  border-top: 1.5px solid var(--lavender-mid);
}

.light-nav { background: var(--white); }
.dark-nav  { background: rgba(0,0,0,0.22); border-top-color: rgba(255,255,255,0.1); }

.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.nav-item img { width: 28px; height: 28px; object-fit: contain; }
.nav-item span { font-size: 13px; color: var(--purple-primary); }
.dark-nav .nav-item span { color: rgba(255,255,255,0.7); }

.fab {
  position: absolute;
  right: 18px;
  bottom: 50px;
  width: 52px;
  height: 52px;
  background: var(--purple-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  padding-bottom: 2px;
  box-shadow: 0 6px 20px rgba(171,159,242,0.55);
  font-family: var(--font);
}

.dark-filter { filter: brightness(0) invert(1); opacity: 0.85; }
.card-icon-dark { filter: brightness(2.5) saturate(0.4); opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   THEME TOGGLE
═══════════════════════════════════════════════════════════ */
#theme-toggle {
  position: absolute;
  top: 38px;
  right: -88px;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

#toggle-pill {
  width: 72px;
  height: 34px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(171,159,242,0.5);
  border-radius: 17px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

#toggle-thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  background: var(--purple-primary);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(171,159,242,0.6);
}

.tog-icon { font-size: 14px; line-height: 1; position: relative; z-index: 2; }
.tog-sun  { opacity: 1; }
.tog-moon { opacity: 0.35; }
.tog-lbl  { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.55); letter-spacing: 1px; }

/* ═══════════════════════════════════════════════════════════
   SPEECH BUBBLES — BASE
═══════════════════════════════════════════════════════════ */
.bubble {
  position: absolute;
  /* LEFT-side default: bubble appears to the left of phone */
  right: 395px;
  width: 195px;
  opacity: 0;
  transform: scale(0);
  transform-origin: right center;
  pointer-events: none;
  z-index: 50;
  filter: drop-shadow(3px 3px 0 rgba(60,49,91,0.12));
}

/* RIGHT-side bubbles: appear to the right of phone */
.bubble-right {
  left: calc(var(--phone-w) + 20px);
  right: auto;
  transform-origin: left center;
}

/* Vertical positions — aligned to phone elements */
#bubble-1 { top: 40px;  }  /* ghost top-right */
#bubble-2 { top: 105px; }  /* eye icon */
#bubble-3 { top: 200px; }  /* cash row */
#bubble-4 { top: 450px; }  /* card grid */

/* Text bubble body */
.bubble-body {
  background: var(--white);
  border: 3px solid var(--purple-dark);
  border-radius: 14px;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  color: var(--purple-dark);
  position: relative;
}

/* RIGHT-pointing tail (for left-side bubbles) */
.bubble-tail {
  position: absolute;
  right: -19px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
}

.bubble-tail::before {
  content: '';
  display: block;
  width: 0; height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 19px solid var(--purple-dark);
}

.bubble-tail::after {
  content: '';
  display: block;
  position: absolute;
  top: -7px;
  left: -17px;
  width: 0; height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 14px solid var(--white);
}

/* LEFT-pointing tail (for right-side bubbles → point toward phone) */
.bubble-tail-left {
  position: absolute;
  left: -19px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
}

.bubble-tail-left::before {
  content: '';
  display: block;
  width: 0; height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 19px solid var(--purple-dark);
}

.bubble-tail-left::after {
  content: '';
  display: block;
  position: absolute;
  top: -7px;
  left: 5px;
  width: 0; height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 14px solid var(--white);
}

/* Image-only bubble variant */
.bubble-img {
  width: 200px;
}

.bubble-img img {
  width: 100%;
  border-radius: 14px;
  border: 3px solid var(--purple-dark);
  display: block;
  background: var(--white);
}

/* No tail variant */
.bubble-notail .bubble-tail,
.bubble-notail .bubble-tail-left {
  display: none;
}

/* Eye icon inline in bubble 2 text */
.bubble-eye-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
  margin: 0 3px;
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════
   ICONS OVERLAY (inside phone — FAB expanded with blur bg)
═══════════════════════════════════════════════════════════ */
#icons-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(200, 188, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#icons-overlay img {
  max-height: 72%;
  max-width: 90%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(171,159,242,0.4));
}

/* ═══════════════════════════════════════════════════════════
   HOTSPOT RINGS (end state)
═══════════════════════════════════════════════════════════ */
.hspot {
  position: absolute;
  border: 2px solid rgba(171,159,242,0.6);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  z-index: 40;
  background: rgba(171,159,242,0.05);
}

.hspot.active {
  pointer-events: all;
  animation: ring-pulse 2s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(171,159,242,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(171,159,242,0); }
}

/* Positions match actual phone layout (based on 812px phone height)
   Status(44) + Search(60) = 104 | Balance(118) = 222 | Cash(72) = 294 | Tokens(68) = 362 */
#hspot-ghost  { top: 34px;  right: 6px;  width: 76px;  height: 76px;  border-radius: 52% 48% 50% 50% / 58% 58% 42% 42%; }
#hspot-eye    { top: 112px; left: 48px;  width: 40px;  height: 40px; }
#hspot-cash   { top: 222px; left: 14px;  width: 170px; height: 70px;  border-radius: 10px; }
#hspot-tokens { top: 293px; left: 14px;  width: 170px; height: 66px;  border-radius: 10px; }
#hspot-grid   { top: 360px; left: 12px;  width: 355px; height: 356px; border-radius: 20px; }
#hspot-fab    { top: 710px; right: 12px; width: 58px;  height: 58px; }

/* ═══════════════════════════════════════════════════════════
   SCROLL HINT (inside phone-outer, below the bezel)
═══════════════════════════════════════════════════════════ */
#scroll-hint {
  position: absolute;
  bottom: -52px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  color: rgba(171,159,242,0.6);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 20;
}

/* ═══════════════════════════════════════════════════════════
   END LABEL
═══════════════════════════════════════════════════════════ */
#end-label {
  position: absolute;
  bottom: -36px;
  left: 0;
  font-size: 20px;
  font-weight: 600;
  color: rgba(171,159,242,0.5);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 20;
}

/* ═══════════════════════════════════════════════════════════
   CTA BLOCK
═══════════════════════════════════════════════════════════ */
#cta-block {
  position: absolute;
  left: calc(var(--phone-w) + 36px);
  top: 50%;
  transform: translateY(-50%);
  text-align: left;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 200px;
}

.cta-ghost { width: 36px; height: 36px; object-fit: contain; opacity: 0.7; }
.cta-head  { font-size: 28px; font-weight: 700; color: var(--white); }
.cta-sub   { font-size: 18px; color: rgba(171,159,242,0.7); }

#cta-btn {
  margin-top: 6px;
  background: var(--purple-dark);
  border: 2px solid var(--purple-primary);
  border-radius: 30px;
  padding: 12px 28px;
  font-family: var(--font);
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(171,159,242,0.35);
}

/* ═══════════════════════════════════════════════════════════
   VIEWPORT SCALE
═══════════════════════════════════════════════════════════ */
@media (max-height: 820px) { :root { --phone-scale: 0.88; } }
@media (max-height: 740px) { :root { --phone-scale: 0.80; } }
@media (max-height: 660px) { :root { --phone-scale: 0.72; } }

/* ═══════════════════════════════════════════════════════════
   CTA NOTE (end-state block)
═══════════════════════════════════════════════════════════ */
.cta-note {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(171, 159, 242, 0.4);
  line-height: 1.5;
}

.cta-type-link {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  color: var(--purple-primary);
  text-decoration: none;
  background: rgba(171, 159, 242, 0.08);
  border: 1.5px solid rgba(171, 159, 242, 0.35);
  border-radius: 100px;
  padding: 9px 16px;
  width: 100%;
  text-align: center;
  animation: type-pulse 2.8s ease-in-out infinite;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  cursor: pointer;
}

.cta-type-link:hover {
  background: rgba(171, 159, 242, 0.16);
  border-color: var(--purple-primary);
  color: var(--white);
  transform: translateY(-1px);
  animation: none;
}

@keyframes type-pulse {
  0%, 100% { border-color: rgba(171, 159, 242, 0.35); }
  50%       { border-color: rgba(171, 159, 242, 0.75); box-shadow: 0 0 14px rgba(171,159,242,0.2); }
}

/* ═══════════════════════════════════════════════════════════
   PORTFOLIO HEADER
═══════════════════════════════════════════════════════════ */
#portfolio-header {
  position: relative;
  width: 100%;
  background:
    radial-gradient(ellipse 130% 55% at 50% 0%, rgba(171, 159, 242, 0.14) 0%, transparent 65%),
    var(--purple-deep);
  padding: 0 24px 80px;
}

/* ─── Nav ─── */
.ph-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 0 28px;
  border-bottom: 1px solid rgba(171, 159, 242, 0.1);
}

.ph-nav-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
}

.ph-nav-contact {
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(171, 159, 242, 0.55);
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: color 0.2s ease;
}

.ph-nav-contact:hover {
  color: var(--purple-primary);
}

/* ─── Badge row (right-aligned, close to nav) ─── */
.ph-badge-row {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 0;
}

.ph-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  border: 1px solid rgba(171, 159, 242, 0.28);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 400;
  color: rgba(171, 159, 242, 0.8);
  letter-spacing: 0.2px;
  background: rgba(171, 159, 242, 0.05);
}

/* ─── Hero block ─── */
.ph-hero-block {
  max-width: 1000px;
  margin: 0 auto;
  padding: 44px 0 0;
}

.ph-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple-primary);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(171, 159, 242, 0.6);
}

.ph-label-sm {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(171, 159, 242, 0.38);
  letter-spacing: 4.5px;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.ph-title {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.9;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ph-title-main {
  font-size: clamp(72px, 10.5vw, 104px);
  color: var(--white);
  display: block;
  letter-spacing: -2px;
}

.ph-title-sub {
  font-size: clamp(32px, 4.8vw, 56px);
  color: var(--purple-primary);
  display: block;
  letter-spacing: -1px;
  font-weight: 700;
}

.ph-subtitle {
  font-family: var(--font-body);
  font-size: clamp(15px, 1.4vw, 18px);
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.65;
  max-width: 680px;
  margin-bottom: 44px;
}

/* ─── Demo CTA button ─── */
.ph-demo-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 30px;
  background: transparent;
  border: 1.5px solid rgba(171, 159, 242, 0.38);
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: rgba(171, 159, 242, 0.85);
  text-decoration: none;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
  margin-bottom: 80px;
}

.ph-demo-btn:hover {
  border-color: var(--purple-primary);
  color: var(--white);
  background: rgba(171, 159, 242, 0.07);
}

/* ─── Intro text block (2-column) ─── */
.ph-intro-block {
  max-width: 1000px;
  margin: 0 auto;
  padding: 56px 0 52px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  border-top: 1px solid rgba(171, 159, 242, 0.09);
}

.ph-intro-text {
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.6);
}

/* ─── Thesis cards ─── */
.ph-thesis-grid {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-bottom: 64px;
}

.ph-evidence-note {
  max-width: 1000px;
  margin: 0 auto 62px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  align-items: start;
  border: 1px solid rgba(171, 159, 242, 0.12);
  border-left: 3px solid rgba(171, 159, 242, 0.55);
  border-radius: 0 14px 14px 0;
  background: rgba(171, 159, 242, 0.035);
}

.ph-evidence-label {
  padding-top: 2px;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: rgba(171, 159, 242, 0.58);
}

.ph-evidence-note p {
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.46);
}

.ph-card {
  background: rgba(171, 159, 242, 0.035);
  border: 1px solid rgba(171, 159, 242, 0.1);
  border-top: 2px solid rgba(171, 159, 242, 0.32);
  border-radius: 16px;
  padding: 28px 22px 32px;
}

.ph-card-num {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: rgba(171, 159, 242, 0.35);
  letter-spacing: 2.5px;
  display: block;
  margin-bottom: 18px;
}

.ph-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 14px;
  line-height: 1.3;
}

.ph-card-body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.55);
}

.ph-card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ph-card-list li {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.55);
  padding-left: 18px;
  position: relative;
}

.ph-card-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: rgba(171, 159, 242, 0.45);
  font-size: 11px;
  top: 3px;
}

/* ─── Demo divider ─── */
.ph-demo-divider {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
}

.ph-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(171, 159, 242, 0.12);
}

.ph-divider-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: rgba(171, 159, 242, 0.35);
  letter-spacing: 3.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   PORTFOLIO FOOTER
═══════════════════════════════════════════════════════════ */
#portfolio-footer {
  background: var(--purple-deep);
  border-top: 1px solid rgba(171, 159, 242, 0.1);
  padding: 32px 24px;
}

.pf-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.pf-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pf-ghost {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.45;
  filter: brightness(0) invert(1);
}

.pf-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}

.pf-role {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(171, 159, 242, 0.45);
  margin-top: 2px;
}

.pf-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pf-link {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(171, 159, 242, 0.55);
  text-decoration: none;
  transition: color 0.2s ease;
}

.pf-link:hover { color: var(--purple-primary); }

.pf-sep {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(171, 159, 242, 0.25);
}

.pf-note {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.25);
  max-width: 380px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   PORTFOLIO RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .ph-intro-block {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 44px 0 44px;
  }

  .ph-thesis-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ph-evidence-note {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ph-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 24px 0;
  }

  .ph-hero-block {
    padding: 48px 0 0;
  }

  .pf-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE DEMO OPTIMIZATIONS  ≤600px
   Desktop layout/flow: untouched.
   Phone scale: handled in JS (setPhoneScale) to reserve caption space.
═══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ─── Sticky stage: full viewport, no padding — phone fills the screen ─── */
  #sticky-stage {
    height: 100dvh;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
  }

  /* ─── Phone bezel: full-bleed on mobile — remove device frame illusion ─── */
  #phone-bezel {
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  /* ─── Notch: device decoration — hide on mobile full-bleed ─── */
  .notch {
    display: none !important;
  }

  /* ─── Off-screen chrome: hide ─── */
  #ghost-trail,
  #scene-label,
  #scroll-hint,
  #end-label,
  .hspot {
    display: none !important;
  }

  /* ─── Theme toggle: reposition to left of ghost corner for mobile ─── */
  /* Ghost corner: top:38px, right:10px, 70×70px → toggle sits left of it */
  #theme-toggle {
    top: 46px !important;
    right: 90px !important;
    flex-direction: row !important;
    gap: 6px !important;
  }
  /* Hide text label — pill only on mobile */
  #theme-toggle .tog-lbl {
    display: none !important;
  }

  /* ─── BUBBLES: position:fixed, coordinates set by JS positionMobileBubbles() ─── */
  /* JS sets left/top/max-width based on phone scale + phone element position on screen */
  .bubble,
  .bubble-right {
    position: fixed !important;
    bottom: auto !important;
    left: 0 !important;      /* JS overrides with !important — this is just a safe default */
    top: 0 !important;       /* JS overrides with !important */
    right: auto !important;
    width: auto !important;
    margin: 0 !important;
    z-index: 300 !important;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5)) !important;
  }

  .bubble-tail,
  .bubble-tail-left {
    display: none !important;
  }

  .bubble-body {
    font-size: 13px !important;
    padding: 9px 12px !important;
    line-height: 1.45 !important;
    border-radius: 10px !important;
    border-width: 2px !important;
  }

  .bubble-eye-icon {
    width: 14px !important;
    height: 14px !important;
  }

  /* ─── CTA block: position:fixed, coordinates set by JS ─── */
  #cta-block {
    position: fixed !important;
    bottom: auto !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 5px !important;
    z-index: 260 !important;
    background: rgba(16, 12, 26, 0.96) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(171, 159, 242, 0.22) !important;
    border-radius: 14px !important;
    padding: 14px 16px !important;
  }

  .cta-ghost { display: none !important; }
  .cta-head  { font-size: 16px !important; }
  .cta-sub   { font-size: 12px !important; }
  .cta-note  { display: none !important; }

  #cta-btn {
    width: 100% !important;
    text-align: center !important;
    padding: 9px 14px !important;
    font-size: 14px !important;
    margin-top: 2px !important;
  }

  /* ─── Portfolio header: title must fit in ~358px content column ─── */
  /* Syne 800 "Phantom" at 72px overflows; ~50px fits cleanly */
  #portfolio-header {
    padding: 0 16px 48px;
  }

  .ph-title-main {
    font-size: clamp(36px, 13vw, 52px) !important;
    letter-spacing: -1px !important;
  }

  .ph-title-sub {
    font-size: clamp(22px, 7.5vw, 32px) !important;
    letter-spacing: -0.5px !important;
  }

  .ph-title {
    gap: 2px !important;
    margin-bottom: 20px !important;
  }

  /* Badge: left-align on mobile (right-align with wrapping text looks off) */
  .ph-badge-row {
    justify-content: flex-start !important;
    padding-top: 10px;
  }

  .ph-badge {
    font-size: 11.5px !important;
  }

  .ph-hero-block {
    padding: 28px 0 0;
  }

  .ph-subtitle {
    font-size: 15px !important;
    margin-bottom: 28px !important;
  }

  .ph-demo-btn {
    margin-bottom: 36px;
    font-size: 13px;
    padding: 11px 22px;
  }

  .ph-intro-block {
    padding: 32px 0 32px;
  }

  .ph-thesis-grid {
    padding-bottom: 36px;
  }

  .ph-evidence-note {
    margin-bottom: 38px;
    padding: 16px;
  }

  /* ─── Footer: compact, email right-aligned ─── */
  #portfolio-footer {
    padding: 18px 16px;
  }

  .pf-inner {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
  }

  .pf-left {
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
  }

  .pf-ghost {
    width: 20px;
    height: 20px;
  }

  .pf-name {
    font-size: 11px;
  }

  .pf-role {
    font-size: 9.5px;
    line-height: 1.4;
  }

  .pf-right {
    flex-shrink: 0;
    text-align: right;
  }

  .pf-link {
    font-size: 10.5px;
    color: rgba(171, 159, 242, 0.65) !important;
  }
}


/* Native opening and interactive controls. Phantom's existing artwork is retained. */
#launch-layer { position: absolute; inset: 0; z-index: 26; background: #ab9ff2; }
.launch-screen { position: absolute; inset: 0; display: grid; place-items: center; background: #ab9ff2; }
.splash-ghost { width: 44%; height: auto; object-fit: contain; }
#login-screen { opacity: 0; visibility: hidden; }
.login-copy { font: 400 27px/1.3 var(--font-body); color: var(--purple-dark); }
#login-screen.is-active .login-copy { animation: login-pulse 1.3s ease-in-out 2; }
@keyframes login-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.privacy-btn { position: relative; width: 34px; height: 34px; padding: 0; border: 0; background: transparent; cursor: pointer; flex-shrink: 0; }
.privacy-btn::before { content: ''; position: absolute; inset: -5px; }
.privacy-btn .eye-icon { display: block; }
.privacy-btn[aria-pressed='true']::after { content: ''; position: absolute; width: 28px; height: 2px; left: 3px; top: 16px; background: var(--purple-dark); transform: rotate(-45deg); }
.dark-inner .privacy-btn[aria-pressed='true']::after { background: var(--white); }
button.tokens-row { width: 100%; background: transparent; border: 0; border-bottom: 1.5px dashed var(--lavender-mid); font-family: var(--font); text-align: left; cursor: pointer; }
button.tokens-row.dark-row { border-bottom-color: rgba(255,255,255,.18); }
.expand-arrow { display: inline-block; }
button.fab { border: 0; cursor: pointer; }
#theme-toggle { border: 0; padding: 0; background: transparent; font-family: var(--font); cursor: pointer; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--purple-primary); outline-offset: 4px; }
.privacy-btn:focus-visible, .tokens-row:focus-visible { outline-color: var(--purple-dark); outline-offset: -3px; }
.dark-inner .privacy-btn:focus-visible, .dark-inner .tokens-row:focus-visible { outline-color: var(--purple-primary); }
#tokens-overlay { z-index: 24; bottom: 118px; overflow-y: auto; overscroll-behavior-y: contain; pointer-events: auto; background: var(--lavender-light); }
#tokens-overlay img { height: auto; min-height: 100%; object-fit: contain; display: block; }
#icons-overlay { z-index: 28; pointer-events: auto; }
.action-art { position: relative; width: 90%; aspect-ratio: 2 / 3; }
#icons-overlay .action-art img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
#close-actions { position: absolute; left: 65%; top: 80%; width: 22%; height: 14%; border: 0; border-radius: 50%; padding: 0; background: transparent; cursor: pointer; }
#close-actions:focus-visible { outline-color: white; outline-offset: -3px; }
#phone-scale-wrapper { flex-shrink: 0; }
#scene-label { opacity: 1; }
#scroll-hint { display: none; }
.skip-walkthrough { position: absolute; z-index: 1000; top: 8px; left: 8px; padding: 12px 18px; background: var(--purple-deep); color: white; font: 14px var(--font-body); transform: translateY(-160%); }
.skip-walkthrough:focus { transform: none; }
.walkthrough-guide { display: flex; justify-content: center; gap: 44px; max-width: 1000px; margin: 24px auto 0; color: rgba(255,255,255,.65); font: 13px/1.5 var(--font-body); }
.walkthrough-guide strong { display: block; color: var(--purple-primary); font-weight: 500; }
#mobile-caption, #mobile-closing-slot { display: none; }
.cta-note.show-status { display: block !important; }

/* Keep annotation text readable and controls clear on narrow viewports.
   The phone retains its design size; scaling leaves a 32px page-scroll gutter. */
@media (max-width: 860px) {
  #sticky-stage { height: 100dvh; padding: 0 0 108px; align-items: center; }
  #phone-bezel { border-radius: 0 !important; box-shadow: none !important; }
  .notch, #ghost-trail, #scene-label, #end-label, .bubble { display: none !important; }
  #theme-toggle { top: 46px !important; right: 90px !important; flex-direction: row !important; }
  #theme-toggle .tog-lbl { display: none !important; }
  #mobile-caption { display: flex; align-items: center; justify-content: center; position: absolute; left: 32px; right: 32px; bottom: 12px; height: 76px; padding: 10px 16px; z-index: 50; border: 2px solid var(--purple-dark); border-radius: 12px; background: white; color: var(--purple-dark); text-align: center; font: 600 18px/1.35 var(--font); }
  #mobile-closing-slot { display: grid; place-items: center; min-height: 210px; padding: 24px; background: var(--purple-deep); }
  #cta-block { position: relative !important; left: auto !important; right: auto !important; top: auto !important; bottom: auto !important; transform: none !important; width: 100% !important; max-width: 380px; margin: 0 auto !important; align-items: center !important; text-align: center !important; gap: 5px !important; }
  .cta-ghost { display: none; }
  .cta-head { font-size: 22px !important; }
  .cta-sub { font-size: 16px !important; }
  #cta-btn { width: 100%; min-height: 44px; padding: 9px 14px !important; font-size: 18px !important; }
  .cta-type-link { min-height: 44px; }
  .walkthrough-guide { gap: 20px; justify-content: space-between; }
  .ph-divider-label { white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
  .balance-amt { transition: none; }
}

/* The closing controls stay legible when the visitor returns to light mode. */
#scroll-container[data-mode='light'] #cta-block .cta-head { color: var(--purple-dark); }
#scroll-container[data-mode='light'] #cta-block .cta-sub,
#scroll-container[data-mode='light'] #cta-block .cta-note,
#scroll-container[data-mode='light'] #cta-block .cta-type-link,
#scroll-container[data-mode='light'] .tog-lbl { color: var(--purple-dark); }
