/* ==========================================================================
   PROTOTYPE — 3D site explorer (Three.js) — Spassherz Poppenhausen
   ========================================================================== */

:root {
  --proto-navy: #1D2A62;
  --proto-sky: #87AECE;
  --proto-cream: #F5F3D8;
  --proto-cream-deep: #EBE7D2;
  --proto-cream-muted: #E3DFC8;
  --proto-green: #AFD06E;
  --proto-green-dark: #437118;
  --border-color: rgba(67, 113, 24, 0.14);
  --border-hover: rgba(67, 113, 24, 0.28);
  --border-radius: 10px;
  --bg-card: #EBE7D2;
  --bg-main: #F5F3D8;
  --text-primary: #2F3D22;
  --text-secondary: #5A6348;
  --text-tertiary: #7A8368;
  --font-title: 'Lora', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, monospace;
  --shadow-sm: 0 2px 8px rgba(47, 61, 34, 0.05);
  --shadow-md: 0 6px 20px rgba(47, 61, 34, 0.08);
  --shadow-lg: 0 12px 40px rgba(47, 61, 34, 0.1);
  --color-accent: #437118;
  --color-primary: #437118;
  --color-accent-light: rgba(175, 208, 110, 0.28);
  --transition: 0.2s ease;
}

.proto-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1400px;
}

/* --- Hero banner ---------------------------------------------------------- */
.proto-hero {
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--proto-green-dark) 0%, #5A8F28 55%, rgba(175, 208, 110, 0.45) 130%);
  border: none;
  color: var(--proto-cream);
}

.proto-hero:hover {
  transform: none;
}

.proto-hero-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #93C5FD;
  margin-bottom: 10px;
}

.proto-hero-title {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  color: #FFFFFF;
}

.proto-hero-sub {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(245, 243, 216, 0.88);
  max-width: 860px;
}

.proto-hero-sub strong {
  color: var(--proto-cream);
}

/* --- Toolbar --------------------------------------------------------------- */
.proto-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.proto-view-group,
.proto-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.proto-view-btn,
.proto-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.proto-view-btn:hover,
.proto-toggle-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.proto-view-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.proto-toggle-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFFFFF;
}

/* --- Stage layout ----------------------------------------------------------- */
.proto-stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.proto-canvas-shell {
  position: relative;
  padding: 0;
  overflow: hidden;
  height: 560px;
  min-height: 560px;
  background: linear-gradient(165deg, #E8E4C8 0%, #DDE8C4 100%);
}

.proto-canvas-shell:hover {
  transform: none;
}

#protoCanvasHost,
#protoCanvasHost canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#protoCanvasHost canvas {
  cursor: grab;
}

#protoCanvasHost canvas:active {
  cursor: grabbing;
}

.proto-canvas-hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-radius: 30px;
  background: rgba(47, 61, 34, 0.72);
  color: rgba(245, 243, 216, 0.85);
  font-size: 11px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.proto-canvas-hint strong {
  color: var(--proto-cream);
}

.proto-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  background: linear-gradient(165deg, #E8E4C8 0%, #DDE8C4 100%);
  z-index: 2;
  transition: opacity 0.4s ease;
}

.proto-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

/* --- Info panel --------------------------------------------------------------- */
.proto-info-scroll-wrap {
  position: relative;
  max-height: 560px;
}

.proto-info-scroll-wrap::after {
  content: "Scroll for more \2193";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 12px 10px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: linear-gradient(to bottom, rgba(235, 231, 210, 0), rgba(235, 231, 210, 0.96) 50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.proto-info-scroll-wrap.is-scrollable::after {
  opacity: 1;
}

.proto-info-scroll-wrap.scrolled-end::after {
  opacity: 0;
}

.proto-info-panel {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.proto-info-panel::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.proto-info-panel:hover {
  transform: none;
}

.proto-info-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-accent);
}

.proto-info-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.proto-info-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.proto-info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0;
  padding: 0;
}

.proto-info-list li {
  position: relative;
  padding: 10px 12px 10px 34px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  cursor: default;
  transition: var(--transition);
}

.proto-info-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 15px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--dot, var(--color-accent));
}

.proto-info-list li strong {
  color: var(--text-primary);
}

.proto-info-list li.clickable {
  cursor: pointer;
}

.proto-info-list li.clickable:hover,
.proto-info-list li.selected {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.proto-info-foot {
  margin-top: auto;
  font-size: 11.5px;
  color: var(--text-tertiary);
  border-top: 1px dashed var(--border-color);
  padding-top: 12px;
  line-height: 1.6;
}

/* --- Legend ---------------------------------------------------------------------- */
.proto-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.proto-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.proto-legend-chip i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

/* --- Reference strip ----------------------------------------------------------------- */
.proto-refs .ch-section-title {
  margin-bottom: 16px;
}

.proto-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.proto-ref-item {
  margin: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.proto-ref-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.proto-ref-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.proto-ref-item figcaption {
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* --- Floor focus bar (overlay on canvas) ------------------------------------- */
.proto-focus-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 16px;
  border-radius: 30px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(5px);
  color: #F8FAFC;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: calc(100% - 28px);
  flex-wrap: wrap;
  z-index: 3;
}

.proto-focus-bar.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.proto-focus-dot {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  background: #E8B04B;
  flex-shrink: 0;
}

.proto-focus-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.proto-focus-btn {
  border: none;
  border-radius: 20px;
  padding: 7px 14px;
  background: var(--color-accent);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.proto-focus-btn:hover {
  background: var(--color-accent-hover);
}

.proto-focus-btn--ghost {
  background: rgba(255, 255, 255, 0.14);
}

.proto-focus-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* --- Info panel action buttons ------------------------------------------------ */
.proto-info-actions {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.proto-info-actions.visible {
  display: flex;
}

.proto-action-btn {
  width: 100%;
  border: 1px solid var(--color-accent);
  border-radius: var(--border-radius);
  padding: 11px 14px;
  background: var(--color-accent);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.proto-action-btn:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.proto-action-btn--ghost {
  background: transparent;
  color: var(--color-accent);
}

.proto-action-btn--ghost:hover {
  background: var(--color-accent-light);
}

/* --- Immersive media modal ------------------------------------------------------ */
.proto-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(5px);
  z-index: 2100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.proto-modal-backdrop.open {
  display: flex;
  animation: protoModalIn 0.25s ease;
}

@keyframes protoModalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.proto-modal {
  position: relative;
  width: min(620px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.45);
  padding: 30px;
  animation: protoModalCard 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes protoModalCard {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.proto-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.proto-modal-close:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.proto-modal-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.proto-modal-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-right: 30px;
}

.proto-modal-media {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--proto-green-dark) 0%, #5A8F28 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #CBD5E1;
  text-align: center;
  padding: 20px;
  margin-bottom: 14px;
}

.proto-modal-media video,
.proto-modal-media iframe {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}

.proto-modal-media-icon svg {
  width: 44px;
  height: 44px;
  stroke: #93C5FD;
}

.proto-modal-media-text {
  font-size: 13px;
  line-height: 1.65;
  max-width: 420px;
}

.proto-modal-media-text code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 7px;
  color: #E2E8F0;
}

.proto-modal-open-link {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 30px;
  background: var(--color-accent);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: var(--transition);
}

.proto-modal-open-link:hover {
  background: var(--color-accent-hover);
}

.proto-modal-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-tertiary);
}

@media (prefers-reduced-motion: reduce) {
  .proto-focus-bar,
  .proto-modal-backdrop.open,
  .proto-modal {
    animation: none;
    transition: none;
  }
}

/* --- Responsive -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .proto-stage-layout {
    grid-template-columns: 1fr;
  }
  .proto-info-panel {
    min-height: 0;
  }
}

@media (max-width: 768px) {
  .proto-canvas-shell {
    min-height: 420px;
  }
  .proto-hero {
    padding: 22px;
  }
  .proto-hero-title {
    font-size: 22px;
  }
  .proto-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .proto-view-group,
  .proto-toggle-group {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .proto-canvas-shell {
    min-height: 340px;
  }
  .proto-canvas-hint {
    display: none;
  }
  .proto-focus-bar {
    top: 8px;
    padding: 6px 8px 6px 12px;
    gap: 6px;
  }
  .proto-focus-name {
    max-width: 150px;
    font-size: 11px;
  }
  .proto-modal {
    padding: 20px;
  }
  .proto-view-btn,
  .proto-toggle-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  .proto-ref-grid {
    grid-template-columns: 1fr 1fr;
  }
  .proto-ref-item img {
    height: 100px;
  }
}
