:root {
  --bg-void: #05070b;
  --bg-ambient: #0c1322;
  --ink-primary: #eef2f8;
  --ink-secondary: rgba(226, 234, 246, 0.76);
  --ink-muted: rgba(182, 196, 218, 0.5);
  --accent: #7dd3fc;
  --accent-soft: rgba(125, 211, 252, 0.22);
  --glass-bg: rgba(8, 12, 20, 0.66);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Inter", "SF Pro Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-void);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.environment {
  position: fixed;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  background: radial-gradient(ellipse at 48% 42%, rgba(20, 31, 51, 0.55) 0%, var(--bg-void) 74%);
}

/* Always-present static fallback matching the opening frame */
.video-backdrop {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  background-color: var(--bg-void);
  background-image: url("poster.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-video {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.85s var(--ease-out);
  pointer-events: none;
}

.hero-video.is-ready {
  opacity: 1;
}

.hero-video.is-failed {
  display: none;
}

/* Delicate perimeter-only gradients so center subject & video captions stay untouched */
.edge-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(
      to bottom,
      rgba(5, 7, 11, 0.68) 0%,
      rgba(5, 7, 11, 0.24) 11%,
      transparent 24%
    ),
    linear-gradient(
      to top,
      rgba(5, 7, 11, 0.72) 0%,
      rgba(5, 7, 11, 0.22) 10%,
      transparent 22%
    );
  transition: background 0.45s var(--ease-out);
}

.environment[data-view]:not([data-view="home"]) .edge-scrim {
  background:
    radial-gradient(circle at 72% 50%, rgba(5, 7, 11, 0.42) 0%, rgba(5, 7, 11, 0.22) 65%),
    linear-gradient(to bottom, rgba(5, 7, 11, 0.72) 0%, transparent 25%),
    linear-gradient(to top, rgba(5, 7, 11, 0.76) 0%, transparent 24%);
}

/* Top Bar: Identity + Minimal Navigation */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding:
    calc(env(safe-area-inset-top, 0px) + clamp(18px, 3vh, 34px))
    calc(env(safe-area-inset-right, 0px) + clamp(20px, 3.5vw, 52px))
    12px
    calc(env(safe-area-inset-left, 0px) + clamp(20px, 3.5vw, 52px));
}

.identity {
  font-size: clamp(0.82rem, 0.76rem + 0.3vw, 1rem);
  font-weight: 300;
  letter-spacing: 0.22em;
  line-height: 1;
}

.identity-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink-primary);
  text-decoration: none;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.85);
  transition: color 0.25s ease, opacity 0.25s ease, background-color 0.25s ease;
}

.identity-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.75);
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.primary-nav {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(8, 12, 20, 0.52);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, background-color 0.25s ease;
}

.nav-toggle:hover {
  color: var(--ink-primary);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-toggle-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 3.5px;
  width: 12px;
}

.nav-toggle-icon span {
  display: block;
  height: 1px;
  width: 100%;
  background: currentColor;
  transition: transform 0.25s var(--ease-out);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:first-child {
  transform: translateY(2.25px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:last-child {
  transform: translateY(-2.25px) rotate(-45deg);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: clamp(0.45rem, 1vw, 0.85rem);
  list-style: none;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(8, 12, 20, 0.36);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-sep {
  color: var(--ink-muted);
  font-size: 0.7rem;
  user-select: none;
}

.nav-link {
  position: relative;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 5px 4px;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: clamp(0.72rem, 0.68rem + 0.15vw, 0.82rem);
  font-weight: 400;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 1px;
  height: 1px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.nav-link:hover {
  color: var(--ink-primary);
}

.nav-link.is-active {
  color: var(--ink-primary);
}

.nav-link.is-active::after {
  opacity: 0.85;
  transform: scaleX(1);
}

/* Spatial Interaction Layer (keeps person on left visible on desktop) */
.spatial-stage {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding:
    calc(env(safe-area-inset-top, 0px) + 74px)
    calc(env(safe-area-inset-right, 0px) + clamp(20px, 4.5vw, 68px))
    calc(env(safe-area-inset-bottom, 0px) + 72px)
    calc(env(safe-area-inset-left, 0px) + 20px);
  pointer-events: none;
}

.glass-panel {
  width: min(100%, 490px);
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  padding: clamp(22px, 3vw, 34px);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 var(--glass-highlight);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}

.glass-panel.is-open {
  opacity: 1;
  transform: translateY(0);
}

.glass-panel[hidden] {
  display: none;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-eyebrow {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.88;
}

.panel-title {
  margin-top: 0.35rem;
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.45rem);
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--ink-primary);
}

.panel-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-secondary);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.panel-close:hover {
  color: var(--ink-primary);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.panel-lead {
  margin-top: 0.85rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.index-list {
  list-style: none;
  margin-top: 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.index-item {
  padding: 0.95rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.index-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.index-name {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--ink-primary);
}

.index-meta {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.82;
  white-space: nowrap;
}

.index-desc {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.about-body {
  margin-top: 1.15rem;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

.ethos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.ethos-item dt {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
}

.ethos-item dd {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  color: var(--ink-primary);
  font-weight: 300;
}

/* Quiet Bottom Perimeter */
.bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding:
    12px
    calc(env(safe-area-inset-right, 0px) + clamp(20px, 3.5vw, 52px))
    calc(env(safe-area-inset-bottom, 0px) + clamp(16px, 3vh, 32px))
    calc(env(safe-area-inset-left, 0px) + clamp(20px, 3.5vw, 52px));
  pointer-events: none;
}

.ambient-note {
  font-size: clamp(0.72rem, 0.68rem + 0.16vw, 0.84rem);
  font-weight: 300;
  letter-spacing: 0.06em;
  color: rgba(232, 238, 247, 0.72);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
  transition: opacity 0.35s ease;
}

.environment[data-view]:not([data-view="home"]) .ambient-note {
  opacity: 0.32;
}

.ambient-controls {
  pointer-events: auto;
}

.motion-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 20, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.motion-btn:hover {
  color: var(--ink-primary);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(8, 12, 20, 0.62);
}

.motion-icon {
  position: relative;
  width: 8px;
  height: 9px;
}

.motion-icon::before,
.motion-icon::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: currentColor;
  border-radius: 1px;
}

.motion-icon::before {
  left: 1px;
}

.motion-icon::after {
  right: 1px;
}

.motion-btn[aria-pressed="true"] .motion-icon::before {
  left: 1px;
  width: 0;
  height: 0;
  background: transparent;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 7px solid currentColor;
}

.motion-btn[aria-pressed="true"] .motion-icon::after {
  display: none;
}

/* Accessible visible focus rings */
:is(a, button):focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
}

/* Mobile navigation collapse & portrait framing */
@media (max-width: 680px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-list {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    min-width: 170px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(8, 12, 20, 0.86);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out);
  }

  .primary-nav.is-menu-open .nav-list {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-sep {
    display: none;
  }

  .nav-link {
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    border-radius: 8px;
  }

  .nav-link::after {
    display: none;
  }

  .nav-link.is-active {
    background: rgba(125, 211, 252, 0.1);
    color: var(--ink-primary);
  }

  .spatial-stage {
    justify-content: center;
    padding:
      calc(env(safe-area-inset-top, 0px) + 70px)
      16px
      calc(env(safe-area-inset-bottom, 0px) + 74px);
  }

  .bottom-bar {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .ambient-note {
    max-width: calc(100% - 95px);
    line-height: 1.4;
  }
}

/* Narrower landscape / tablet screens: bias focal point slightly left
   so the person and the laptop screen both stay comfortably in frame */
@media (max-aspect-ratio: 17/10) and (min-aspect-ratio: 5/4) {
  .video-backdrop {
    background-position: 28% center;
  }

  .hero-video {
    object-position: 28% center;
  }
}

/* Upright and near-square screens: preserve the full 16:9 composition
   so neither the person on the left nor the in-video captions are cropped out */
@media (max-aspect-ratio: 5/4) {
  .video-backdrop,
  .hero-video {
    inset: auto 0;
    top: 48%;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    transform: translateY(-50%);
    -webkit-mask-image: linear-gradient(transparent, #000 11%, #000 89%, transparent);
            mask-image: linear-gradient(transparent, #000 11%, #000 89%, transparent);
  }

  .video-backdrop {
    background-size: contain;
    background-position: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }

  .hero-video,
  .glass-panel,
  .nav-list,
  .nav-link::after {
    transition: none;
  }
}
