/* Portfolio integration for the locally bundled React Bits components. */
#header-navigation.navigation {
  position:absolute; display:block; width:auto; height:auto; padding:0; border:0;
  left:50%; right:auto; top:29px; transform:translateX(-50%); border-radius:0;
  background:none; box-shadow:none; backdrop-filter:none;
}
#header-navigation.navigation[data-mode="mobile"] { position:static; width:0; height:0; left:auto; top:auto; transform:none; }
#header-navigation .gooey-nav { --gn-x:12px; --gn-font:12px; }
#header-navigation .gooey-nav__link { display:inline-flex; gap:8px; padding:var(--gn-y) var(--gn-x); border-radius:999px; background:none; font-size:var(--gn-font); line-height:1.2; }
#header-navigation .gooey-nav__link:hover,#header-navigation .gooey-nav__link[aria-current="page"] { background:none; }
#header-navigation .gooey-nav__list { flex-wrap:nowrap; }
#header-navigation .gooey-nav__list--active .gooey-nav__link { color:var(--gn-active-ink); }
#header-navigation .gooey-nav--framed { box-shadow:var(--shadow); }
body.compact-navigation #home-link,body.compact-navigation .header-tools { display:none !important; }
#header-navigation .portfolio-menu { height:100dvh; pointer-events:none; }
#header-navigation .staggered-menu-header { justify-content:flex-end; padding:29px 40px; }
#header-navigation .sm-toggle { margin-left:auto; }
#header-navigation .staggered-menu-wrapper:not([data-open]) .sm-header-leading { display:none; }
#header-navigation .sm-toggle {
  display:inline-flex; align-items:center; gap:12px; padding:14px 18px;
  min-height:46px; border:1px solid #858c91; border-radius:999px;
  background:#3e4850; color:#f2eee6; font-size:13px; line-height:1;
  box-shadow:var(--shadow); transition:background .2s;
}
#header-navigation .sm-toggle:hover { background:#4a5660; }
#header-navigation .sm-toggle:focus-visible { outline:3px solid var(--focus); outline-offset:4px; }
#header-navigation .staggered-menu-panel,
#header-navigation .sm-prelayers { width:min(380px,100vw); left:auto; right:0; }
#header-navigation .staggered-menu-panel {
  padding:100px 30px 30px; background:var(--paper); color:var(--ink);
  border-left:1px solid var(--line); overscroll-behavior:contain;
  scrollbar-width:thin; scrollbar-color:var(--line) transparent;
}
#header-navigation .staggered-menu-panel[aria-hidden="true"] { pointer-events:none; }
#header-navigation .sm-panel-inner { flex:1 0 auto; gap:26px; }
#header-navigation .sm-panel-list { gap:12px; }
#header-navigation .sm-panel-item {
  display:inline-flex; align-items:flex-start; width:auto; padding:4px 0 6px;
  font-size:clamp(26px,3vw,34px); line-height:1.15; letter-spacing:-1px;
  font-weight:550; text-transform:none; color:var(--ink);
}
#header-navigation .sm-panel-item:hover { color:var(--ink); background:var(--hover-bg); }
#header-navigation .sm-panel-item[aria-current="page"] .sm-panel-itemLabel { text-decoration:underline; text-decoration-color:var(--sm-accent); text-underline-offset:7px; }
#header-navigation .sm-panel-item::after { position:static; display:inline-block; margin:1px 0 0 6px; font:12px var(--mono); color:#5227ff; }
body.evening #header-navigation .sm-panel-item::after { color:#b49aff; }
#header-navigation .sm-socials { margin-top:auto; padding-top:22px; border-top:1px solid var(--line); }
#header-navigation .sm-socials-title { font:11px var(--mono); color:var(--muted); }
#header-navigation .sm-socials-link { font-size:14px; color:var(--ink); }
#header-navigation .sm-socials-link:hover { text-decoration:underline; }
#header-navigation .sm-socials-list .sm-socials-link { opacity:1; }
.header-tools { position:fixed; top:35px; right:40px; }
@media(max-width:900px) { #header-navigation .staggered-menu-header { padding:24px; } .header-tools { top:30px; right:24px; } }
@media(max-width:560px) {
  #header-navigation .staggered-menu-header { padding:12px; }
  #header-navigation .sm-toggle { min-height:44px; padding:12px 16px; }
  #header-navigation .staggered-menu-panel { padding:80px 24px 24px; }
  #header-navigation .sm-panel-item { font-size:30px; }
}
body.mobile-layout #header-navigation .staggered-menu-header { padding:12px; }
@media(max-height:620px) {
  #header-navigation .staggered-menu-panel { padding-top:80px; }
  #header-navigation .sm-panel-list { gap:5px; }
  #header-navigation .sm-panel-item { font-size:26px; }
}
@media(max-width:1050px) and (min-width:721px) {
  #header-navigation.navigation[data-mode="desktop"] { top:88px; }
  body:not(.compact-navigation) .hero { top:max(155px,22vh); }
}
/* Opaque, themed chrome keeps the signal, speed and tour legible over any lighting. */
.map-heading { padding:7px 8px; margin-bottom:5px; border:1px solid var(--chrome-border); border-radius:8px; background:var(--paper); color:var(--ink); }
.map-heading small,.map-heading .tour-link { color:var(--ink); }
.mini-signal i { background:currentColor; }
.tour-link:hover { text-decoration:underline; text-underline-offset:3px; }
.tour-link:focus-visible { outline-offset:3px; }
/* A four-row chooser stays close to the dock and remembers the selected car. */
dialog.car-picker {
  position:fixed; inset:auto 0 max(110px,calc(env(safe-area-inset-bottom) + 110px));
  margin:0 auto; width:min(270px,calc(100vw - 32px)); max-height:calc(100dvh - 130px);
  padding:14px; border:1px solid var(--chrome-border); border-radius:16px;
  background:var(--paper); color:var(--ink); box-shadow:var(--shadow); overflow-y:auto;
}
dialog.car-picker::backdrop { background:#24292e24; }
.car-picker-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.car-picker-heading h2 { margin:0; font-size:14px; font-weight:600; }
.car-picker-heading .icon-button { width:30px; height:30px; padding:5px; }
.car-picker-heading .icon { width:16px; height:16px; }
.car-picker-list { display:grid; gap:5px; }
.car-choice { display:flex; align-items:center; gap:12px; width:100%; min-height:48px; padding:5px 10px; border:1px solid transparent; border-radius:9px; background:var(--surface-soft); font-size:13px; text-align:left; }
.car-choice:hover { background:var(--hover-bg); border-color:var(--line); }
.car-choice[aria-pressed="true"] { border-color:var(--ink); background:var(--hover-bg); }
.car-choice>img,.car-choice>svg:not(.icon) { width:48px; height:34px; flex:none; object-fit:contain; }
.car-choice>.icon,.car-choice-empty { margin-left:auto; width:16px; height:16px; }

#control-dock.control-dock {
  position:fixed;
  left:50%;
  bottom:max(10px, env(safe-area-inset-bottom));
  width:min(640px, calc(100vw - 24px));
  height:90px;
  display:block;
  padding:0;
  border:0;
  border-radius:0;
  background:none;
  box-shadow:none;
  backdrop-filter:none;
  transform:translateX(-50%);
  pointer-events:none;
  z-index:7;
}
#control-dock .portfolio-dock { pointer-events:auto; }
#control-dock .dock-face .icon { width:1em; height:1em; stroke-width:1.8; }
#control-dock .dock-separator { margin:0; border:0; }
.primary-button { color:var(--button-ink); }
.hero.hero-driving {
  opacity:0 !important;
  visibility:hidden !important;
  pointer-events:none !important;
}
.hero.hero-driving :is(button,a) { pointer-events:none !important; }

/* Lift the atlas without consuming the translate property used for dragging. */
dialog#panel.portfolio-panel[data-view="map"] {
  --map-top:90px;
  --map-bottom:24px;
  inset:max(8px, calc(var(--map-top) - 7.5vh)) 24px auto;
  width:min(1220px, calc(100vw - 48px));
  max-width:calc(100vw - 48px);
  height:calc(100dvh - var(--map-top) - var(--map-bottom));
  max-height:calc(100dvh - 24px);
}
dialog#panel[data-view="map"] .travel-map-layout {
  grid-template-columns:minmax(0, 760px) minmax(200px, 240px);
  gap:24px;
  justify-content:center;
}
dialog#panel[data-view="map"] .large-map.top-view-map,
dialog#panel[data-view="map"] .top-view-map>svg {
  background:transparent;
  border:0;
  border-radius:0;
}
dialog#panel[data-view="map"] .large-map.top-view-map { margin:0; }
.atlas-north { color:var(--ink); background:var(--chrome); border-color:var(--line); }
.atlas-zoom { border-color:var(--line); }
.atlas-zoom button { background:var(--chrome); color:var(--ink); }
.atlas-zoom button:hover { background:var(--hover-bg); }
dialog#panel.portfolio-panel::backdrop { background:#00000040; }

/* Project pages have square surfaces, with these control exceptions. */
dialog#panel[data-view="project"],
dialog#panel[data-view="project"] * { border-radius:0 !important; }
dialog#panel[data-view="project"] .language-switch,
dialog#panel[data-view="project"] .language-option { border-radius:999px !important; }
dialog#panel[data-view="project"] #panel-close { border-radius:50% !important; }
.project-detail { --project-color:var(--ink) !important; --project-bg:var(--surface-soft) !important; }
.project-card { --project-bg:var(--surface-soft) !important; }

@media(max-width:720px) {
  dialog#panel.portfolio-panel[data-view="map"] {
    --map-top:18px; --map-bottom:18px; inset:8px 12px auto;
    width:calc(100vw - 24px); max-width:calc(100vw - 24px); height:calc(100dvh - 36px);
  }
  dialog#panel[data-view="map"] .travel-map-layout { grid-template-columns:minmax(0, 1fr); }
}
@media(max-height:620px) and (min-width:721px) {
  dialog#panel.portfolio-panel[data-view="map"] { --map-top:28px; --map-bottom:20px; }
}
@media(max-width:560px) { .minimap-wrap { bottom:118px; } }
@media(prefers-reduced-motion:reduce) {
  .hero.hero-driving { transition:none; }
}

#header-language { font-family:var(--mono); font-weight:700; }
.panel-tools .panel-theme { color:var(--ink); }
.project-detail .case-meta { grid-template-columns:repeat(2,minmax(0,1fr)); }
.project-video-wrap { position:relative; }
.video-toggle {
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  display:grid; place-items:center; width:58px; height:58px; padding:0;
  background:#343d45e6; color:#f4f0e8; border:1px solid #ece7dc80;
  backdrop-filter:blur(8px); z-index:2; transition:opacity .2s,background .2s;
}
.video-toggle .icon { width:25px; height:25px; }
.video-playing .video-toggle { opacity:.18; }
.project-video-wrap:hover .video-toggle,.video-toggle:focus-visible { opacity:1; background:#3e4851; }
.topography-scene { position:relative; width:100%; height:600px; min-height:280px; flex-shrink:0; overflow:hidden; background:#080b12; border:1px solid var(--line); }
[data-topography] { position:absolute; inset:0; }
.topography-fallback { position:absolute; inset:0; width:100%; height:100%; fill:none; stroke:#4f7cff; stroke-width:1.2; opacity:.75; }
.stage-about .topography-scene { margin:18px 0; }
.portfolio-panel[data-view="contact"] .panel-layout { display:block; height:auto; min-height:100%; }
.portfolio-panel[data-view="contact"] #panel-content { overflow-y:auto; }
.portfolio-panel[data-view="contact"] .panel-reader { overflow:visible; max-width:none; width:100%; }
.contact-content { max-width:1040px; margin:0 auto; }
.tilt-settings { padding:18px 0; border-bottom:1px solid var(--line); }
.tilt-settings .secondary-button { margin:4px 6px 4px 0; }
body.mobile-layout #home-link,body.mobile-layout .header-tools { display:none !important; }
body.mobile-layout .site-header { min-height:65px; padding:12px; }
@media(max-width:560px) {
  #home-link,.header-tools { display:none !important; }
  .site-header { min-height:65px; padding:12px; }
  .hero { top:max(104px,18vh); }
  .video-toggle { width:48px; height:48px; }
  .video-playing .video-toggle { opacity:.8; }
  .topography-scene { height:380px; }
  .portfolio-panel .panel-topbar { padding-right:14px; padding-left:14px; }
  .panel-tools { gap:6px; }
}
@media(max-height:620px) {
  .stage-about .topography-scene { height:380px; }
}
@media(prefers-reduced-motion:reduce) { .video-toggle { transition:none; } }

/* The flight canvas spans the project stage, behind its normal content. */
.panel-stage.stage-projects { isolation:isolate; }
.panel-stage.stage-projects>:not(.stage-cta) { position:relative; z-index:2; }
.panel-stage.stage-projects .stage-cta { position:static; pointer-events:none; }
[data-flying-project] { width:100%; pointer-events:none; }
[data-flying-project][data-flight-mode="on"] { height:44px; position:static; }
[data-flying-project] .project-flying-button { position:absolute; inset:0; z-index:1; width:100%; height:var(--project-flight-height,100%); min-height:0; background:transparent; pointer-events:none; }
.project-flying-button .flying-button__smoke { background:transparent; }
.project-flying-button .flying-button__label { display:inline-flex; align-items:center; gap:8px; font-size:11px; }
.project-flying-button.flying-button[data-trigger='hover'] .flying-button__craft,
.project-flying-button .flying-button__craft { cursor:pointer; pointer-events:auto; border-radius:999px; }
.project-flying-button .flying-button__face { background:linear-gradient(180deg,#ffffff14,transparent 46%); }
.project-flying-button .flying-button__craft:focus-visible { outline:3px solid var(--focus); outline-offset:3px; }
[data-flying-project] .project-action-fallback { pointer-events:auto; border-radius:999px; }

/* Avoid repeatedly filtering the live canvas on constrained devices. */
body.low-power :is(.explore-status,.nearby-project,.minimap,.world-settings-button,.panel-topbar,.video-toggle) {
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
body.low-power dialog#panel.portfolio-panel::backdrop {
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
