:root {
  --bg: #08111a;
  --surface: rgba(9, 20, 30, 0.88);
  --surface-solid: #0c1823;
  --line: rgba(151, 177, 198, 0.22);
  --line-strong: rgba(151, 177, 198, 0.38);
  --text: #f3f6f8;
  --muted: #99a8b6;
  --blue: #1686b3;
  --amber: #e1a73d;
  --sky-top: #07131f;
  --sky-glow: rgba(24, 64, 88, 0.24);
  --sun-x: 50%;
  --sun-y: 18%;
  --sun-opacity: 0.72;
  --header-height: 84px;
  font-family: "Inter", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.site-shell {
  min-height: 100%;
  background:
    radial-gradient(circle at var(--sun-x) var(--sun-y), var(--sky-glow), transparent 42%),
    linear-gradient(180deg, var(--sky-top), var(--bg) 76%);
  transition: background 500ms ease;
}

.site-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 3.2vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 13, 21, 0.9);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.14em;
  font-size: clamp(19px, 2vw, 28px);
  font-weight: 500;
}

.brand strong {
  color: var(--amber);
  font-weight: 400;
  letter-spacing: 0.04em;
}

nav {
  align-self: stretch;
  display: flex;
  gap: clamp(12px, 2.7vw, 42px);
}

.nav-link {
  border: 0;
  padding: 3px 4px 0;
  background: transparent;
  color: #bdc6ce;
  cursor: pointer;
  position: relative;
  font-size: 15px;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  transform: scaleX(0);
  background: var(--amber);
  transition: transform 180ms ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  color: var(--text);
}

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

.viewer-stage {
  position: relative;
  height: calc(100vh - var(--header-height));
  min-height: 520px;
  isolation: isolate;
  overflow: hidden;
}

#yardley-viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: transparent;
  touch-action: none;
}

#yardley-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.sun-orb {
  position: absolute;
  left: var(--sun-x);
  top: var(--sun-y);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: var(--sun-opacity);
  background: #fff3c4;
  box-shadow:
    0 0 18px rgba(255, 211, 119, 0.72),
    0 0 54px rgba(244, 166, 68, 0.34);
  transition: left 350ms ease, top 350ms ease, opacity 350ms ease;
}

.blueprint-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(69, 113, 142, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 113, 142, 0.12) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.model-loading {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.model-loading span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--amber);
  transition: width 120ms ease;
}

.tool-rail,
.info-panel {
  z-index: 5;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.tool-rail {
  position: absolute;
  top: 40px;
  left: clamp(18px, 3vw, 48px);
  display: flex;
  flex-direction: column;
  padding: 9px;
}

.tool-button {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #c5d0d8;
  transition: color 160ms ease, background 160ms ease;
}

.tool-button:hover,
.tool-button:focus-visible,
.tool-button.is-active {
  color: var(--amber);
  background: rgba(225, 167, 61, 0.08);
}

.tool-button svg,
.primary-button svg,
.interaction-hint svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-divider {
  height: 1px;
  margin: 7px 7px;
  background: var(--line);
}

.info-panel {
  position: absolute;
  top: 28px;
  right: clamp(18px, 3vw, 48px);
  width: min(330px, calc(100vw - 36px));
  padding: 23px;
}

.panel-view {
  display: none;
}

.panel-view.is-visible {
  display: block;
  animation: panel-in 180ms ease both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

dl {
  margin: 0;
}

dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 0;
  text-align: right;
  color: #d5dde3;
  font-size: 14px;
}

dd strong {
  color: var(--amber);
  font-size: 24px;
  font-weight: 500;
  margin-right: 3px;
}

.panel-heading {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 500;
}

.project-copy {
  margin: 0 0 18px;
  color: #b2bec8;
  font-size: 13px;
  line-height: 1.65;
}

.download-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--amber);
  text-underline-offset: 4px;
  font-size: 13px;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--amber);
  background: rgba(225, 167, 61, 0.03);
  color: var(--amber);
  cursor: pointer;
  font-size: 13px;
  transition: color 160ms ease, background 160ms ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  color: #08111a;
  background: var(--amber);
}

.primary-button svg {
  width: 17px;
  height: 17px;
}

.interaction-hint {
  position: absolute;
  z-index: 5;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 11px;
  color: #c0cad2;
  pointer-events: none;
  font-size: 13px;
  white-space: nowrap;
  text-shadow: 0 2px 12px #000;
}

.interaction-hint svg {
  color: var(--amber);
}

.interaction-hint i {
  color: #5c6f7e;
  font-style: normal;
  margin: 0 6px;
}

.sun-simulator {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(430px, calc(100vw - 180px));
  padding: 14px 18px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 17, 26, 0.9);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
}

.sun-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sun-header > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.sun-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sun-header strong {
  color: #f5c66e;
  font-size: 17px;
  font-weight: 500;
}

.sun-play-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(225, 167, 61, 0.55);
  border-radius: 50%;
  background: rgba(225, 167, 61, 0.08);
  color: var(--amber);
  cursor: pointer;
}

.sun-play-button:hover,
.sun-play-button:focus-visible,
.sun-play-button.is-playing {
  color: #08111a;
  background: var(--amber);
}

.sun-play-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.sun-slider {
  width: 100%;
  height: 4px;
  display: block;
  margin: 0;
  appearance: none;
  border-radius: 2px;
  outline: none;
  background: linear-gradient(90deg, #cb6a35, #f1c95d 48%, #f6e8a2 55%, #d87842);
  cursor: pointer;
}

.sun-slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 2px solid #fff2bf;
  border-radius: 50%;
  background: #e1a73d;
  box-shadow: 0 0 0 4px rgba(225, 167, 61, 0.16);
}

.sun-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #fff2bf;
  border-radius: 50%;
  background: #e1a73d;
}

.sun-scale {
  display: flex;
  justify-content: space-between;
  padding-top: 7px;
  color: #778b9a;
  font-size: 9px;
}

@media (max-width: 760px) {
  :root {
    --header-height: 68px;
  }

  .site-header {
    padding: 0 18px;
  }

  .brand {
    font-size: 18px;
    gap: 6px;
  }

  nav {
    gap: 10px;
  }

  .nav-link {
    font-size: 12px;
  }

  .viewer-stage {
    min-height: 420px;
  }

  #yardley-viewer {
    bottom: auto;
    height: 64%;
  }

  .blueprint-grid {
    bottom: 34%;
  }

  .tool-rail {
    top: 16px;
    left: 12px;
    padding: 5px;
  }

  .tool-button {
    width: 40px;
    height: 40px;
  }

  .tool-button svg {
    width: 20px;
    height: 20px;
  }

  .info-panel {
    top: auto;
    right: 12px;
    bottom: 54px;
    width: calc(100vw - 76px);
    padding: 15px 17px;
  }

  dl {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
  }

  dl > div {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  dt {
    display: block;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  dd {
    text-align: left;
    font-size: 10px;
    white-space: nowrap;
  }

  dd strong {
    display: block;
    font-size: 17px;
  }

  .primary-button {
    min-height: 40px;
    margin-top: 14px;
  }

  .interaction-hint {
    display: none;
  }

  .sun-simulator {
    bottom: 12px;
    width: calc(100vw - 88px);
    padding: 11px 14px 10px;
  }

  .sun-label {
    font-size: 9px;
  }

  .sun-header strong {
    font-size: 15px;
  }

  .sun-scale {
    font-size: 11px;
  }
}

@media (max-width: 600px) {
  .brand span {
    letter-spacing: 0.08em;
  }

  .nav-link[data-view="solar"],
  .nav-link[data-view="project"] {
    display: none;
  }

  .info-panel {
    width: calc(100vw - 70px);
  }

  .panel-view[data-panel="model"] dl {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-view[data-panel="model"] dl > div:nth-child(3) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
