/* Interactive STL lesson viewer used by IED Lesson 1.2. */
.stl-viewer-card {
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid #cbd5e1 !important;
}

.stl-viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  min-height: 610px;
}

.stl-viewer-stage {
  position: relative;
  min-height: 610px;
  overflow: hidden;
  background-color: #eef3f8;
  background-image:
    linear-gradient(rgba(11, 31, 58, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 31, 58, 0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  border-right: 1px solid #cbd5e1;
}

.stl-viewer-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 610px;
  cursor: grab;
  touch-action: none;
  outline-offset: -4px;
}

.stl-viewer-canvas:active {
  cursor: grabbing;
}

.stl-viewer-status,
.stl-viewer-hint,
.stl-viewer-dimensions {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(148, 163, 184, 0.72);
  background: rgba(255, 255, 255, 0.92);
  color: #0b1f3a;
  box-shadow: 0 8px 20px rgba(2, 10, 28, 0.12);
  backdrop-filter: blur(8px);
}

.stl-viewer-status {
  top: 1rem;
  left: 1rem;
  max-width: calc(100% - 2rem);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 850;
}

.stl-viewer-status[data-state="error"] {
  border-color: #dc2626;
  background: rgba(254, 226, 226, 0.96);
  color: #991b1b;
}

.stl-viewer-hint {
  left: 1rem;
  bottom: 1rem;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 750;
}

.stl-viewer-dimensions {
  right: 1rem;
  bottom: 1rem;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 900;
}

.stl-viewer-controls {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  padding: 1.25rem;
  background: #ffffff;
  color: #102033;
}

.stl-control-group {
  display: grid;
  gap: 0.55rem;
}

.stl-control-group + .stl-control-group {
  padding-top: 1rem;
  border-top: 1px solid #d7dee9;
}

.stl-control-label {
  color: #0b1f3a;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.stl-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.stl-view-button,
.stl-mode-button,
.stl-action-button {
  min-height: 42px;
  border: 1px solid #b9c5d3;
  border-radius: 10px;
  background: #f8fafc;
  color: #0b1f3a;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 850;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.stl-mode-button {
  width: 100%;
  padding: 0.62rem 0.72rem;
  text-align: left;
}

.stl-view-button:hover,
.stl-view-button:focus-visible,
.stl-mode-button:hover,
.stl-mode-button:focus-visible,
.stl-action-button:hover,
.stl-action-button:focus-visible {
  border-color: #c8a24a;
  background: #fff8e8;
  outline: 3px solid rgba(200, 162, 74, 0.28);
  outline-offset: 1px;
}

.stl-view-button[aria-pressed="true"],
.stl-mode-button[aria-pressed="true"] {
  border-color: #0b1f3a;
  background: #0b1f3a;
  color: #ffffff;
}

.stl-action-button {
  padding: 0.62rem 0.72rem;
}

.stl-action-button.primary {
  border-color: #c8a24a;
  background: #c8a24a;
  color: #0b1f3a;
}

.stl-switch-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 42px;
  border: 1px solid #d7dee9;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
  color: #0b1f3a;
  font-weight: 800;
  cursor: pointer;
}

.stl-switch-row input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #0b1f3a;
}

.stl-line-legend {
  display: grid;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #334155;
}

.stl-line-legend span {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.stl-line-sample {
  display: inline-block;
  width: 44px;
  height: 0;
  border-top: 3px solid #0b1f3a;
}

.stl-line-sample.hidden {
  border-top-width: 2px;
  border-top-style: dashed;
  border-top-color: #64748b;
}

.stl-viewer-note {
  border-left: 4px solid #c8a24a;
  border-radius: 8px;
  background: #fff8e8;
  padding: 0.8rem;
  color: #334155 !important;
  font-size: 0.82rem;
}

.stl-viewer-card:fullscreen {
  width: 100vw;
  height: 100vh;
  overflow: auto;
  border-radius: 0;
  background: #ffffff;
}

.stl-viewer-card:fullscreen .stl-viewer-layout,
.stl-viewer-card:fullscreen .stl-viewer-stage,
.stl-viewer-card:fullscreen .stl-viewer-canvas {
  min-height: 100vh;
}

@media (max-width: 900px) {
  .stl-viewer-layout {
    grid-template-columns: 1fr;
  }

  .stl-viewer-stage,
  .stl-viewer-canvas {
    min-height: 500px;
  }

  .stl-viewer-stage {
    border-right: 0;
    border-bottom: 1px solid #cbd5e1;
  }

  .stl-viewer-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stl-control-group + .stl-control-group {
    padding-top: 0;
    padding-left: 1rem;
    border-top: 0;
    border-left: 1px solid #d7dee9;
  }
}

@media (max-width: 620px) {
  .stl-viewer-stage,
  .stl-viewer-canvas {
    min-height: 410px;
  }

  .stl-viewer-controls {
    grid-template-columns: 1fr;
  }

  .stl-control-group + .stl-control-group {
    padding-top: 1rem;
    padding-left: 0;
    border-top: 1px solid #d7dee9;
    border-left: 0;
  }

  .stl-viewer-hint {
    display: none;
  }

  .stl-viewer-dimensions {
    left: 1rem;
    right: auto;
  }
}

/* Orthographic reference drawings paired with the interactive model. */
.orthographic-reference {
  padding: 1.5rem;
  border-top: 1px solid #cbd5e1;
  background: #f8fafc;
}

.orthographic-reference-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.orthographic-reference-header h3 {
  margin: 0.2rem 0 0.35rem;
  color: #0b1f3a !important;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.orthographic-reference-header p {
  max-width: 760px;
  margin: 0;
  color: #475569 !important;
}

.orthographic-reference-header .tag {
  flex: 0 0 auto;
  margin-top: 0.1rem;
  white-space: nowrap;
}

.orthographic-view-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.orthographic-view-card {
  display: flex;
  min-width: 0;
  margin: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
}

.orthographic-image-frame {
  display: grid;
  min-height: 230px;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid #dbe3ec;
  background: #ffffff;
}

.orthographic-image-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
}

.orthographic-view-card figcaption {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem;
  color: #0b1f3a;
}

.orthographic-view-card figcaption strong {
  font-size: 1rem;
}

.orthographic-view-card figcaption span {
  min-height: 2.5em;
  color: #475569;
  font-size: 0.84rem;
}

.orthographic-match-button {
  width: 100%;
  min-height: 40px;
  margin-top: 0.35rem;
  border: 1px solid #b9c5d3;
  border-radius: 9px;
  background: #f8fafc;
  color: #0b1f3a;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.orthographic-match-button:hover,
.orthographic-match-button:focus-visible {
  border-color: #c8a24a;
  background: #fff8e8;
  outline: 3px solid rgba(200, 162, 74, 0.28);
  outline-offset: 1px;
}

.orthographic-study-prompt {
  margin-top: 1rem;
  border-left: 4px solid #c8a24a;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.85rem 1rem;
  color: #334155;
}

@media (max-width: 900px) {
  .orthographic-view-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orthographic-view-card:last-child {
    grid-column: 1 / -1;
    width: min(100%, 420px);
    justify-self: center;
  }
}

@media (max-width: 620px) {
  .orthographic-reference {
    padding: 1rem;
  }

  .orthographic-reference-header {
    display: grid;
  }

  .orthographic-reference-header .tag {
    justify-self: start;
  }

  .orthographic-view-grid {
    grid-template-columns: 1fr;
  }

  .orthographic-view-card:last-child {
    grid-column: auto;
    width: 100%;
  }

  .orthographic-image-frame {
    min-height: 190px;
  }
}

/* Lesson 1.2 model discoverability */
.model-jump-button {
  border-color: #f3c95c !important;
  box-shadow: inset 0 0 0 1px rgba(243, 201, 92, 0.3);
}

.model-explorer-section {
  scroll-margin-top: 96px;
}

.model-explorer-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.9rem;
  margin: 0 0 1.1rem;
  padding: 0.9rem 1rem;
  border: 2px solid #d9ab3d;
  border-radius: 14px;
  background: #fff8dc;
  color: #102033;
}

.model-explorer-banner strong,
.model-explorer-banner span {
  color: #102033 !important;
  -webkit-text-fill-color: #102033 !important;
}

.model-explorer-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #061b31;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
