/**
 * Full-page 3D aircraft viewer (model-viewer + .glb).
 */

.tf-plane3d {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-canvas);
  color: var(--color-text-default);
}

/*
 * Align title + hint with .tf-site-header__inner (same centered bar as primary nav).
 * Viewport is full-width; model-viewer below stays edge-to-edge.
 */
.tf-plane3d__header {
  flex-shrink: 0;
  box-sizing: border-box;
  padding-top: 20px;
  padding-bottom: 16px;
  padding-left: calc((100vw - min(var(--site-header-max, 1200px), 100vw)) / 2 + var(--site-header-inset-x, calc(16px + 64px)));
  padding-right: calc((100vw - min(var(--site-header-max, 1200px), 100vw)) / 2 + var(--site-header-inset-x, calc(16px + 64px)));
  border-bottom: 1px solid rgb(255 255 255 / 0.15);
}

.tf-plane3d__title {
  margin: 0 0 8px;
  font-family: var(--font-family-headline);
  font-weight: var(--font-weight-headline);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.tf-plane3d__hint {
  margin: 0;
  font-family: var(--font-family-body);
  font-size: var(--type-body-xs);
  line-height: var(--type-body-leading);
  color: var(--color-text-muted);
  max-width: 42rem;
}

.tf-plane3d__file-warning {
  margin: 16px 0 0;
  padding: 14px 16px;
  max-width: 48rem;
  font-family: var(--font-family-body);
  font-size: var(--type-body-xs);
  line-height: 1.5;
  color: var(--color-text-default);
  background: rgb(255 115 0 / 0.12);
  border: 1px solid rgb(255 115 0 / 0.45);
  border-radius: 8px;
}

.tf-plane3d__file-warning code {
  font-size: 0.95em;
  word-break: break-all;
}

.tf-plane3d__file-cmd {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgb(0 0 0 / 0.35);
  border-radius: 4px;
  white-space: pre-wrap;
}

/* Reserve bottom space for fixed .tf-plane3d__opacity-toggle so the canvas centers in the visible band */
.tf-plane3d__viewport {
  --plane3d-ui-reserve: calc(80px + env(safe-area-inset-bottom, 0px));

  flex: 1;
  min-height: 0;
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--plane3d-ui-reserve);
}

.tf-plane3d__viewport model-viewer {
  display: block;
  flex: 1 1 0%;
  width: 100%;
  min-height: 0;
  background: var(--color-black);
  --poster-color: transparent;
}

.tf-plane3d__missing {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: var(--plane3d-ui-reserve);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 24px;
  text-align: center;
  font-family: var(--font-family-body);
  font-size: var(--type-body-s);
  line-height: var(--type-body-leading);
  color: var(--color-text-muted);
  background: var(--color-black);
  border: 1px dashed rgb(255 255 255 / 0.25);
}

.tf-plane3d__missing[hidden] {
  display: none !important;
}

.tf-plane3d__missing code {
  font-size: 0.9em;
  color: var(--color-text-default);
}

/* Solid / Transparent — fixed bottom-center, 64px tall (sliding orange thumb) */
.tf-plane3d__opacity-toggle {
  position: fixed;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 50;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  width: min(368px, calc(100vw - 24px));
  max-width: min(368px, calc(100vw - 24px));
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  margin: 0;
  padding: 4px;
  background-color: #000000;
  border: 1px solid rgb(255 255 255 / 0.4);
  border-radius: 0;
  isolation: isolate;
  color-scheme: dark;
  transform: translateX(-50%);
}

.tf-plane3d__opacity-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background-color: #ff7300;
  border-radius: 0;
  pointer-events: none;
  z-index: 0;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.tf-plane3d__opacity-toggle[data-mode="transparent"] .tf-plane3d__opacity-thumb {
  transform: translateX(100%);
}

@media (prefers-reduced-motion: reduce) {
  .tf-plane3d__opacity-thumb {
    transition: none;
  }
}

/* Strip UA / WebKit button chrome so Figma colors show (otherwise white btn + black text) */
.tf-plane3d__opacity-seg {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 0;
  height: 100%;
  padding: 0 12px;
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  font-family: var(--font-family-body), ui-monospace, monospace;
  font-weight: 500;
  font-size: var(--type-body-s);
  line-height: 1.2;
  color: #ffffff;
  text-align: center;
  background: transparent;
  background-color: transparent;
}

.tf-plane3d__opacity-seg::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.tf-plane3d__opacity-seg:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
  z-index: 2;
}

@media (max-width: 380px) {
  .tf-plane3d__opacity-seg {
    padding: 0 8px;
    font-size: var(--type-body-xs);
  }
}
