/* ==========================================
   LAB PAGE — page-specific styles
   Load with global.css on html/lab.html
   ========================================== */

.lab-page {
  min-height: 100vh;
  padding-top: 100px;
  background: #ffffff;
}

.lab-hero {
  padding: 24px 0 80px;
  background: #ffffff;
}

.lab-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Title + intro sit above the nav/image row */
.lab-intro {
  margin: 0 0 40px;
}

.lab-body-text {
  margin: 0;
  padding: 0;
  max-width: 46ch;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.55);
}

/* Nav + media side by side under the intro */
.lab-workspace {
  display: grid;
  /* Fixed nav track so active (20px) labels don't widen and squeeze the media */
  grid-template-columns: 15rem minmax(0, 1fr);
  column-gap: 96px;
  align-items: start;
}

/* Each experiment is its own spaced row (not one shared white pill) */
.lab-side-nav {
  /* Match media frame height so links sit mid-image, not mid-(image+copy) */
  width: 100%;
  max-width: none;
  height: min(52vh, 520px);
  min-height: 240px;
  display: flex;
  align-items: center;
}

.lab-side-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.lab-side-nav-link {
  display: block;
  margin: 0;
  /* Padding brings the tap target to >=44px tall without changing visual gap between labels */
  padding: 12px 4px;
  min-height: 44px;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.38);
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  transform-origin: left center;
  transition:
    color 200ms ease,
    transform 200ms ease,
    font-size 200ms ease,
    font-weight 200ms ease;
}

.lab-side-nav-link:hover {
  color: #2B2B2B;
  transform: scale(1.08);
}

.lab-side-nav-link.active {
  color: #2B2B2B;
  font-size: 20px;
  font-weight: 600;
}

.lab-side-nav-link:focus-visible {
  outline: 2px solid #333;
  outline-offset: 4px;
  border-radius: 2px;
}

.lab-side-nav-link--soon {
  cursor: default;
}

.lab-panels {
  min-width: 0;
}

.lab-panel[hidden] {
  display: none !important;
}

.lab-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lab-panel-media {
  /* Shared frame for every experiment (matches Modeling my desk) */
  width: 100%;
  height: min(52vh, 520px);
  min-height: 240px;
  flex-shrink: 0;
  background: var(--grid-box, #E4E8F2);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.06);
}

.lab-panel-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.lab-panel-video {
  background: #000000;
}

/* YouTube facade — thumbnail until click, then inline embed */
.lab-youtube {
  position: relative;
  background: #000000;
}

.lab-youtube-facade {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000000;
  cursor: pointer;
}

.lab-youtube-facade .lab-panel-image {
  pointer-events: none;
}

.lab-youtube-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.lab-youtube-play::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 52%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #2B2B2B;
  transform: translate(-50%, -50%);
}

.lab-youtube-facade:hover .lab-youtube-play {
  background: #ffffff;
  transform: translate(-50%, -50%) scale(1.08);
}

.lab-youtube-facade:focus-visible {
  outline: 2px solid #333;
  outline-offset: -4px;
}

.lab-youtube-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.lab-panel-copy {
  margin: 0;
  max-width: none;
  width: 100%;
}

.lab-panel-copy p {
  margin: 0 0 0.35em;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.55);
}

.lab-panel-copy p:last-child {
  margin-bottom: 0;
}

/* ── Arduino multi-page carousel ── */
.lab-carousel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.lab-carousel-stage {
  position: relative;
  width: 100%;
}

.lab-carousel-slide {
  width: 100%;
}

.lab-carousel-slide[hidden] {
  display: none !important;
}

.lab-carousel-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: #2B2B2B;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.lab-carousel-arrow--prev {
  left: 14px;
}

.lab-carousel-arrow--next {
  right: 14px;
}

.lab-carousel-arrow span {
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.lab-carousel-arrow--prev span {
  transform: rotate(135deg);
  margin-left: 3px;
}

.lab-carousel-arrow--next span {
  transform: rotate(-45deg);
  margin-right: 3px;
}

.lab-carousel-arrow:hover {
  background: #ffffff;
  transform: translateY(-50%) scale(1.08);
}

.lab-carousel-arrow:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
}

.lab-carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transform: translateX(-50%);
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Button itself is the tap target (32px); visible dot is a smaller centered pseudo-element */
.lab-carousel-dot {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lab-carousel-dot::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.lab-carousel-dot.is-active::after {
  background: #2B2B2B;
  transform: scale(1.15);
}

.lab-carousel-dot:hover::after {
  background: rgba(0, 0, 0, 0.4);
}

.lab-carousel-dot.is-active:hover::after {
  background: #2B2B2B;
}

.lab-carousel-dot:focus-visible {
  outline: 2px solid #333;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .lab-workspace {
    grid-template-columns: 1fr;
    row-gap: 28px;
    align-items: start;
  }

  .lab-side-nav {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    display: block;
  }

  .lab-side-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  .lab-side-nav-link {
    transform-origin: center center;
  }
}

@media (max-width: 600px) {
  .lab-page {
    padding-top: 88px;
  }

  .lab-hero {
    padding: 20px 0 64px;
  }

  .lab-intro {
    margin-bottom: 28px;
  }

  .lab-panel-media {
    border-radius: 16px;
    height: min(42vh, 360px);
    min-height: 200px;
  }

  .lab-side-nav-link {
    font-size: 16px;
  }
}

@media (hover: none), (pointer: coarse) {
  .lab-side-nav-link:hover {
    transform: none;
  }

  .lab-side-nav-link:hover:not(.active) {
    color: rgba(0, 0, 0, 0.38);
  }

  .lab-carousel-arrow:hover {
    transform: translateY(-50%);
  }

  .lab-youtube-facade:hover .lab-youtube-play {
    transform: translate(-50%, -50%);
  }
}
