:root {
  --color-1: rgba(0, 0, 0, 1);
  --color-2: rgba(60, 60, 60, 1);
  --color-3: rgba(255, 255, 255, 1);
  --color-4: rgba(219, 8, 18, 1);
  --color-5: rgba(135, 135, 135, 1);
  --hero-max-width: 1360px;
  --hero-side-padding: clamp(24px, 4vw, 40px);
  --header-block-padding: 40px;
  --nav-width: 882px;
  --hero-visual-width: clamp(900px, 70vw, 1180px);
  --model-frame-width: var(--hero-visual-width);
  --model-frame-height: clamp(620px, 76vh, 900px);
  --model-canvas-width: max(var(--model-frame-width), 160vw);
  --model-canvas-height: max(var(--model-frame-height), 115vh);
  --model-canvas-bleed-x: calc(
    (var(--model-canvas-width) - var(--model-frame-width)) / 2
  );
  --model-canvas-bleed-y: calc(
    (var(--model-canvas-height) - var(--model-frame-height)) / 2
  );
}

@font-face {
  font-family: "Soul Signature";
  src: url("./assets/fonts/SoulSignature.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  /* Fill the iframe height; hide page scrollbars only */
  overflow-x: hidden;
  overflow-y: hidden;
}

body {
  background: transparent;
  color: var(--color-3);
  font-family: "Ubuntu", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.hero-shell {
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: 100vh;
  background: transparent;
  /* Keep visible so the 3D model is not cropped */
  overflow: visible;
}

.site-header {
  padding: var(--header-block-padding) 4%;
}

.header-row,
.hero-row {
  width: min(100%, var(--hero-max-width));
  margin: 0 auto;
}

.header-row {
  display: grid;
  grid-template-columns: 25% 1fr;
  align-items: center;
}

.header-spacer {
  min-height: 1px;
}

.site-nav {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  gap: 0;
  width: min(100%, var(--nav-width));
  margin: 5px 0 0 auto;
  padding: 7px 0 6.8px 15px;
  text-align: right;
}

.site-nav a {
  position: relative;
  padding-left: 30px;
  color: var(--color-3);
  font-family: "Ubuntu", sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 30px;
  right: 0;
  bottom: -10px;
  height: 4px;
  background: var(--color-3);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 200ms ease;
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after,
.site-nav a.is-active::after {
  transform: scaleX(1);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  outline: none;
  opacity: 0.9;
}

.caret {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  transform: translateY(-1px);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1.33333px solid rgba(255, 255, 255, 0.45);
  border-radius: 3px;
  background: transparent;
  color: var(--color-3);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 5px auto;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hero-row {
  display: grid;
  grid-template-columns: minmax(0, 5.2fr) minmax(520px, 6.8fr);
  align-items: center;
  gap: 0;
  padding: clamp(40px, 7vh, 82px) var(--hero-side-padding)
    clamp(48px, 6vh, 80px);
  overflow: visible;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 680px;
  padding-top: 76px;
  padding-bottom: 80px;
  padding-right: 15px;
}

.hero-eyebrow {
  margin: 0 0 6px;
  color: var(--color-3);
  font-family: "Soul Signature", cursive;
  /* Script face: keep size generous, spacing tight so glyphs connect cleanly */
  font-size: clamp(30px, 3.8vw, 44px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  word-spacing: 0.02em;
  text-transform: none;
  text-shadow: none;
}

.hero-title {
  margin: 4px 0 0;
  color: var(--color-3);
  font-family: "Ubuntu", sans-serif;
  font-size: clamp(38px, 5vw, 55px);
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  text-shadow: 0 2px 10px var(--color-4), 0 4px 20px var(--color-4), 0 0 40px var(--color-4);
}

#rotating-word {
  display: inline-block;
  opacity: 1;
  transition: opacity 300ms ease;
  white-space: nowrap;
}

.hero-description {
  margin: 8px 0 0;
  max-width: 680px;
  color: var(--color-3);
  font-size: clamp(18px, 2vw, 20px);
  font-weight: 400;
  line-height: 1.5;
  text-shadow: 0 0 10px var(--color-4), 0 0 20px var(--color-4), 0 0 40px var(--color-4);
}

.hero-actions {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  width: min(100%, 450px);
  padding-top: 20px;
  pointer-events: auto;
}

.hero-button {
  position: relative;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 16px 0;
  border: 1.33333px solid transparent;
  border-radius: 3px;
  font-family: "Ubuntu", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    text-shadow 180ms ease,
    transform 180ms ease,
    filter 180ms ease;
  box-shadow: 0 0 20px var(--color-4), 0 0 40px var(--color-4);
  text-shadow: 0 0 10px var(--color-4);
}

.hero-button-primary {
  width: 220px;
  background: var(--color-3);
  border-color: var(--color-3);
  color: var(--color-2);
  text-shadow: none;
}

.hero-button-secondary {
  width: 200px;
  background: transparent;
  border-color: var(--color-3);
  color: var(--color-3);
}

.hero-button:active {
  transform: translateY(0);
  filter: brightness(0.94);
}

@media (hover: hover) and (pointer: fine) {
  .hero-button-primary:hover,
  .hero-button-primary:focus-visible {
    background: transparent;
    border-color: var(--color-3);
    color: var(--color-3);
    outline: none;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(219, 8, 18, 0.55), 0 0 36px var(--color-4);
  }

  .hero-button-secondary:hover,
  .hero-button-secondary:focus-visible {
    background: var(--color-3);
    color: var(--color-1);
    outline: none;
    transform: translateY(-3px);
    box-shadow: none;
    text-shadow: none;
  }
}

.hero-button-primary:focus-visible,
.hero-button-secondary:focus-visible {
  outline: 2px solid var(--color-3);
  outline-offset: 3px;
}

.hero-visual {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
  padding-left: 15px;
  margin-block: auto;
  overflow: visible;
}

.model-stage {
  position: relative;
  flex: 0 0 auto;
  width: var(--model-canvas-width);
  max-width: none;
  height: var(--model-canvas-height);
  margin: calc(var(--model-canvas-bleed-y) * -1)
    calc(var(--model-canvas-bleed-x) * -1);
  isolation: isolate;
  overflow: visible;
  transform: none;
  pointer-events: none;
}

.model-stage::before {
  content: "";
  position: absolute;
  inset: 5% 4% 20%;
  z-index: 0;
  border-radius: 46%;
  background:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.18) 0%,
      rgba(255, 255, 255, 0.09) 16%,
      rgba(255, 255, 255, 0) 70%
    );
  filter: blur(38px);
  pointer-events: none;
}

.model-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  cursor: default;
  pointer-events: none;
  filter: drop-shadow(0 0 30px var(--color-4)) drop-shadow(0 0 90px var(--color-4));
}

.model-canvas:active {
  cursor: default;
}

@media (min-width: 1025px) {
  .model-stage {
    transform: translateX(200px);
  }
}

.model-loader {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at 58% 43%,
      rgba(255, 255, 255, 0.16) 0%,
      rgba(255, 255, 255, 0.08) 24%,
      rgba(60, 60, 60, 0.28) 58%,
      rgba(60, 60, 60, 0.08) 100%
    );
  color: var(--color-3);
  pointer-events: none;
  transition:
    opacity 360ms ease,
    visibility 360ms ease;
}

.model-loader__panel {
  display: grid;
  grid-template-columns: auto minmax(180px, 260px);
  align-items: center;
  gap: 16px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.74);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.model-loader__ring {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--color-3);
  border-radius: 50%;
  animation: model-loader-spin 900ms linear infinite;
}

.model-loader__ring span {
  display: block;
  width: 10px;
  height: 10px;
  margin: 5px 0 0 36px;
  border-radius: 50%;
  background: var(--color-4);
}

.model-loader__copy {
  display: grid;
  gap: 7px;
}

.model-loader__label,
.model-loader__percent {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.model-loader__percent {
  color: rgba(255, 255, 255, 0.72);
}

.model-loader__bar {
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.model-loader__bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--color-4);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 220ms ease;
}

.model-loader.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.model-loader.has-error .model-loader__ring {
  animation: none;
  border-color: rgba(255, 255, 255, 0.22);
  border-top-color: var(--color-4);
}

@keyframes model-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.model-status {
  position: absolute;
  left: 50%;
  bottom: 7%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
  color: var(--color-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  pointer-events: none;
}

.model-status.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

.debug-dock {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.debug-dock > * {
  pointer-events: auto;
}

.debug-launch {
  appearance: none;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(12, 12, 12, 0.74);
  color: var(--color-3);
  font-family: "Ubuntu", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.debug-launch:hover,
.debug-launch:focus-visible,
.debug-panel__button:hover,
.debug-panel__button:focus-visible {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(26, 26, 26, 0.9);
  outline: none;
  transform: translateY(-1px);
}

.debug-panel {
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100vw - 24px));
  max-height: min(72vh, 620px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(28, 28, 28, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.debug-panel.is-hidden {
  display: none;
}

.debug-panel__header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.debug-panel__eyebrow {
  margin: 0;
  color: rgba(255, 255, 255, 0.44);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.debug-panel__title {
  margin: 4px 0 0;
  color: var(--color-3);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.debug-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 6px 0 0;
}

.debug-panel__loading {
  margin: 0;
  padding: 6px 14px 14px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.debug-controls {
  display: flex;
  flex-direction: column;
  padding-bottom: 10px;
}

.debug-section {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
  overflow: hidden;
}

.debug-section:first-child {
  border-top: 0;
}

.debug-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  list-style: none;
  cursor: pointer;
}

.debug-section summary::-webkit-details-marker {
  display: none;
}

.debug-section__title {
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.debug-section__hint {
  color: rgba(255, 255, 255, 0.34);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.debug-section__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px 12px;
}

.debug-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.debug-field__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.debug-field__label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.debug-field__value {
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
}

.debug-field__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
}

.debug-range {
  width: 100%;
  margin: 0;
  accent-color: rgb(219, 8, 18);
}

.debug-number {
  width: 100%;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.54);
  color: var(--color-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  font-size: 11px;
}

.debug-number:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.22);
}

.debug-panel__footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(28, 28, 28, 0.96);
}

.debug-panel__button {
  appearance: none;
  flex: 1 1 calc(33.333% - 6px);
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-3);
  font-family: "Ubuntu", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

@media (prefers-reduced-motion: reduce) {
  #rotating-word,
  .site-nav a::after,
  .hero-button,
  .nav-toggle span,
  .model-status {
    transition: none;
    transform: none;
  }

  .model-loader,
  .model-loader__bar span {
    transition: none;
  }

  .model-loader__ring {
    animation: none;
  }
}

@media (max-width: 1024px) {
  .header-row {
    grid-template-columns: 1fr;
  }

  .header-spacer {
    display: none;
  }

  .site-nav {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .hero-shell {
    /* Content-driven height — avoid a tall empty band below the hero */
    height: auto;
    min-height: 0;
  }

  .hero-row {
    grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.15fr);
    align-items: center;
    gap: 12px;
    padding: clamp(20px, 3vh, 36px) var(--hero-side-padding)
      clamp(24px, 3vh, 40px);
  }

  .hero-copy {
    padding-top: 12px;
    padding-bottom: 12px;
    padding-right: 8px;
  }

  .hero-visual {
    /* Match stage to content — do not force 100vh canvas (creates dead space) */
    --model-frame-width: clamp(420px, 48vw, 640px);
    --model-frame-height: clamp(360px, 48vw, 520px);
    --model-canvas-width: var(--model-frame-width);
    --model-canvas-height: var(--model-frame-height);
    --model-canvas-bleed-x: 0px;
    --model-canvas-bleed-y: 0px;
    padding-left: 0;
    margin-block: 0;
  }

  .model-stage {
    width: 100%;
    max-width: 100%;
    margin: 0;
    transform: none;
  }
}

@media (max-width: 900px) {
  .hero-shell {
    background: transparent;
    height: auto;
    min-height: 0;
  }

  html,
  body {
    height: auto;
    min-height: 0;
    /* Allow natural page height inside the embed iframe on stacked layouts */
    overflow-x: hidden;
    overflow-y: auto;
  }

  .site-header {
    padding: 12px var(--hero-side-padding);
  }

  .nav-toggle {
    display: inline-block;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    margin: 18px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    text-align: left;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding-left: 0;
  }

  .site-nav a::after {
    left: 0;
  }

  .hero-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    align-content: start;
    gap: 0;
    width: 100%;
    padding: 0;
  }

  .hero-copy {
    order: 2;
    width: 100%;
    max-width: none;
    /* Tight stack under the model — less empty red between blocks */
    padding: 12px var(--hero-side-padding) 20px;
    background: transparent;
  }

  .hero-title {
    margin-top: 2px;
  }

  .hero-description {
    margin-top: 6px;
  }

  .hero-actions {
    width: 100%;
    gap: 10px;
    padding-top: 14px;
  }

  .hero-visual {
    --model-frame-width: 100vw;
    /* Tall enough for a big house, short enough to avoid a blank band */
    --model-frame-height: clamp(260px, 62vw, 360px);
    --model-canvas-width: var(--model-frame-width);
    --model-canvas-height: var(--model-frame-height);
    --model-canvas-bleed-x: 0px;
    --model-canvas-bleed-y: 0px;
    order: 1;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 0;
    height: var(--model-frame-height);
    margin: 0;
    background: transparent;
    padding: 0;
    overflow: hidden;
  }

  .model-stage {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    transform: none;
  }

  .model-loader,
  .model-status {
    left: 50vw;
    max-width: calc(100vw - 48px);
  }

  .model-loader {
    left: 0;
    max-width: none;
  }

  .model-loader__panel {
    grid-template-columns: auto minmax(0, 1fr);
    width: min(340px, calc(100vw - 32px));
    padding: 14px;
  }

  .hero-button-primary,
  .hero-button-secondary {
    width: min(100%, 240px);
    min-height: 52px;
    padding: 14px 0;
  }

  .debug-panel {
    width: min(300px, calc(100vw - 24px));
  }
}

@media (max-width: 560px) {
  .hero-copy {
    padding: 10px var(--hero-side-padding) 16px;
  }

  .hero-eyebrow {
    font-size: clamp(28px, 8vw, 36px);
    letter-spacing: 0;
    word-spacing: 0.02em;
  }

  .hero-title {
    font-size: 34px;
    line-height: 1.15;
  }

  #rotating-word.is-long-word {
    font-size: clamp(28px, 7.7vw, 31px);
  }

  .hero-description {
    font-size: 15px;
    line-height: 1.45;
  }

  .hero-actions {
    flex-direction: column;
    padding-top: 12px;
    gap: 10px;
  }

  .hero-button-primary,
  .hero-button-secondary {
    width: 100%;
    min-height: 50px;
  }

  .hero-visual {
    --model-frame-height: clamp(240px, 68vw, 320px);
    height: var(--model-frame-height);
  }

  .debug-dock {
    top: 14px;
    right: 14px;
  }

  .debug-launch {
    min-height: 34px;
    padding-inline: 12px;
  }

  .debug-panel {
    width: min(292px, calc(100vw - 16px));
  }
}
