/* Mode Transition Overlay Curtain */
.site-mode-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  overflow: hidden;
}

.site-mode-transition-overlay::before,
.site-mode-transition-overlay::after {
  content: "";
  position: absolute;
  inset-block: 0;
  width: calc(50% + 1px);
  background:
    linear-gradient(rgba(43, 31, 20, .035) 1px, transparent 1px),
    var(--ivory, #FAF4E8);
  background-size: 100% 5.5rem;
  transform: scaleX(0);
  transition: transform .22s cubic-bezier(.76, 0, .24, 1);
}

.site-mode-transition-overlay::before {
  left: 0;
  transform-origin: left;
  border-right: 1px solid rgba(43, 31, 20, .16);
}

.site-mode-transition-overlay::after {
  right: 0;
  transform-origin: right;
  border-left: 1px solid rgba(43, 31, 20, .16);
}

[data-site-mode="professional"] .site-mode-transition-overlay::before,
[data-site-mode="professional"] .site-mode-transition-overlay::after {
  background-color: #fbfbfa;
}

.site-mode-transition-overlay.is-active::before,
.site-mode-transition-overlay.is-active::after {
  transform: scaleX(1);
}

.site-mode-transition-overlay.is-active {
  pointer-events: all;
}

/* View transition container smoothing */
[data-site-mode] {
  transition: background-color 0.3s ease;
}

#professional-portfolio-view,
.hero-objects,
#cinematic-experience,
#living-index,
#about-contact-experience,
#interactive-game-2048 {
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}


.site-mode-toggle-container {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 99990;
  pointer-events: auto;
  transition: opacity .3s ease, transform .45s cubic-bezier(.16, 1, .3, 1);
}

html[data-site-mode="creative"] body.portfolio-utility-muted .site-mode-toggle-container,
html[data-site-mode="creative"] body.project-open .site-mode-toggle-container {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

/* Contact is the decision point where a visitor is most likely to ask for the
   concise résumé view. Other immersive rooms may withdraw the utility, but the
   final room restores it as a genuinely global, operable control. */
html[data-site-mode="creative"] body.portfolio-utility-muted[data-active-room="contact"] .site-mode-toggle-container {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.pro-header-inner > .site-mode-toggle-container {
  position: static;
  flex: 0 0 auto;
}

.site-mode-toggle {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: rgba(43, 31, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.12);
  transition:
    background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-site-mode="professional"] .site-mode-toggle {
  background: rgba(255, 255, 255, 0.92);
  border-color: #bdbdb6;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.site-mode-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

[data-site-mode="professional"] .site-mode-option {
  color: #6b6b67;
}

.site-mode-option:hover {
  color: #ffffff;
  transform: translateY(-1px);
}

[data-site-mode="professional"] .site-mode-option:hover {
  color: #171717;
}

.site-mode-option:focus-visible {
  outline: 2px solid #C46A2B;
  outline-offset: 2px;
}

[data-site-mode="professional"] .site-mode-option:focus-visible {
  outline-color: #174ea6;
}

.site-mode-option.is-active {
  background: #7A2F0A;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(122, 47, 10, 0.38);
  font-weight: 700;
}

[data-site-mode="professional"] .site-mode-option.is-active {
  background: #174ea6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(23, 78, 166, 0.3);
}

.site-mode-icon {
  width: 0.62rem;
  height: 0.62rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0;
  line-height: 1;
}

.site-mode-option[data-mode="professional"] .site-mode-icon {
  border-radius: 2px;
}

.site-mode-option.is-active .site-mode-icon {
  background: currentColor;
  box-shadow: inset 0 0 0 2px #7A2F0A;
}

[data-site-mode="professional"] .site-mode-option.is-active .site-mode-icon {
  box-shadow: inset 0 0 0 2px #174ea6;
}

.site-mode-return .site-mode-option[aria-current="page"] {
  pointer-events: none;
}

.site-mode-icon--professional {
  border-radius: 2px;
}

@media (max-width: 680px) {
  .site-mode-toggle-container {
    /* Top-right collided with the header CONTACT pill and then the name on
       375px screens. Bottom-left keeps it in the thumb zone, clear of the
       assistant launcher (bottom-right) and out of the hero's hierarchy. */
    top: auto;
    right: auto;
    left: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    opacity: .62;
  }

  .site-mode-toggle-container:focus-within,
  .site-mode-toggle-container:hover {
    opacity: 1;
  }

  .site-mode-option {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 0;
    gap: 4px;
    font-size: 0;
  }

  .site-mode-icon { width: .58rem; height: .58rem; }

  .site-mode-option::after {
    font-size: .6875rem;
    font-weight: 700;
  }

  .site-mode-option[data-mode="creative"]::after { content: "C"; }
  .site-mode-option[data-mode="professional"]::after { content: "P"; }

  /* Inside the pinned Skills chamber the bottom-left pill overlapped the
     orbit field; step it out while the pin owns the viewport. */
  body.skills-orbit-active .site-mode-toggle-container {
    opacity: 0;
    pointer-events: none;
  }

  /* The final form occupies the full mobile reading column. Dock the restored
     global switch into the unused top-right header slot instead of floating it
     over fields near the thumb edge. Compact C/P labels keep both 44px targets
     explicit within that narrow utility bay. */
  html[data-site-mode="creative"] body[data-active-room="contact"] .site-mode-toggle-container {
    top: 14px;
    right: 12px;
    bottom: auto;
    left: auto;
    opacity: 1;
  }

  body[data-active-room="contact"] .site-mode-toggle {
    padding: 2px;
  }

  body[data-active-room="contact"] .site-mode-option {
    width: 44px;
    min-width: 44px;
    padding: 0;
    gap: 4px;
    font-size: 0;
  }

}
