/* ==========================================================================
   Systems Lab / Experiments Section
   ========================================================================== */

.systems-lab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px var(--page-padding);  /* 40px 24px */
  background: var(--color-bg-surface-alt);  /* #f3f3f3 */
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.systems-lab__header {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0 16px;
  width: 100%;
  max-width: 1377px;
}

.systems-lab__header-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
}

.systems-lab__eyebrow {

  font-size: var(--eyebrow-font-size);       /* 14px */
  font-weight: var(--eyebrow-font-weight);   /* 400 */
  line-height: var(--eyebrow-line-height);   /* 15.4px */
  color: var(--eyebrow-color);               /* rgba(39,39,39,0.5) */
  margin: 0;
}

.systems-lab__headline {

  font-size: var(--heading-xl-font-size);         /* 40px */
  font-weight: var(--heading-xl-font-weight);     /* 500 */
  line-height: var(--heading-xl-line-height);     /* 44px */
  letter-spacing: var(--heading-xl-letter-spacing); /* -0.8px */
  color: var(--color-text-primary);
  max-width: 680px;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Mat Panel (collage container)
   -------------------------------------------------------------------------- */

.systems-lab__mat {
  width: 100%;
  max-width: 1377px;
  border-radius: var(--radius-md);  /* 24px */
  background: var(--color-bg-surface);  /* #e7e7e7 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 24px 16px;
  overflow: visible;
}

/* --------------------------------------------------------------------------
   Image Collage
   -------------------------------------------------------------------------- */

.systems-lab__collage {
  position: relative;
  width: 100%;
  max-width: 1329px;
  /* Maintain aspect ratio: 886 / 1329 */
  aspect-ratio: 1329 / 886;
}

/* Grid background */
.systems-lab__collage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* All collage items are absolutely positioned */
.systems-lab__collage-item {
  position: absolute;
  overflow: hidden;
  border-radius: var(--radius-xs);  /* 8px */
}

.systems-lab__collage-item img,
.systems-lab__collage-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/*
  Positions from DOM map (absolute within 1329x886 container).
  Using percentage-based positioning for responsive scaling.

  | # | Width  | Height | Top  | Left |
  |---|--------|--------|------|------|
  | 1 | 400    | 149    | 24   | 24   |  — glasses front
  | 2 | 432    | 102    | 198  | 24   |  — glasses arm
  | 3 | 374    | 219    | 652  | 16   |  — 3D glasses perspective
  | 4 | 170    | 173    | 372  | 24   |  — camera front (yellow)
  | 5 | 219    | 360    | 511  | 762  |  — small devices photo
  | 6 | 198    | 254    | 592  | 1037 |  — camera close-up
  | 7 | 251    | 180    | 24   | 704  |  — e-ink display (side)
  | 8 | 222    | 199    | 54   | 625  |  — e-ink display (front)
*/

.systems-lab__collage-item--1 {
  width: 30.10%;    /* 400/1329 */
  height: 16.82%;   /* 149/886 */
  top: 2.71%;       /* 24/886 */
  left: 1.81%;      /* 24/1329 */
  z-index: 10;
}

.systems-lab__collage-item--2 {
  width: 32.51%;    /* 432/1329 */
  height: 11.51%;   /* 102/886 */
  top: 22.35%;      /* 198/886 */
  left: 1.81%;      /* 24/1329 */
  z-index: 7;
}

.systems-lab__collage-item--3 {
  width: 28.14%;    /* 374/1329 */
  height: 24.72%;   /* 219/886 */
  top: 73.59%;      /* 652/886 */
  left: 1.20%;      /* 16/1329 */
  z-index: 7;
}

.systems-lab__collage-item--4 {
  width: 12.79%;    /* 170/1329 */
  height: 19.52%;   /* 173/886 */
  top: 41.99%;      /* 372/886 */
  left: 1.81%;      /* 24/1329 */
  z-index: 7;
}

.systems-lab__collage-item--5 {
  width: 16.48%;    /* 219/1329 */
  height: 40.63%;   /* 360/886 */
  top: 57.67%;      /* 511/886 */
  left: 57.34%;     /* 762/1329 */
  z-index: 4;
}

.systems-lab__collage-item--6 {
  width: 14.90%;    /* 198/1329 */
  height: 28.67%;   /* 254/886 */
  top: 66.82%;      /* 592/886 */
  left: 78.03%;     /* 1037/1329 */
  z-index: 4;
}

.systems-lab__collage-item--7 {
  width: 18.89%;    /* 251/1329 */
  height: 20.32%;   /* 180/886 */
  top: 2.71%;       /* 24/886 */
  left: 52.97%;     /* 704/1329 */
  z-index: 4;
}

.systems-lab__collage-item--8 {
  width: 16.71%;    /* 222/1329 */
  height: 22.46%;   /* 199/886 */
  top: 6.09%;       /* 54/886 */
  left: 47.03%;     /* 625/1329 */
  z-index: 4;
}

/* --------------------------------------------------------------------------
   Footer Quote
   -------------------------------------------------------------------------- */

.systems-lab__quote {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
  max-width: 1329px;
}

.systems-lab__quote p {

  font-size: var(--quote-font-size);         /* 12px */
  font-weight: var(--quote-font-weight);     /* 400 */
  line-height: var(--quote-line-height);     /* 15.6px */
  color: var(--quote-color);                 /* rgba(39,39,39,0.5) */
  font-style: italic;
  margin: 0;
}

.reasoning-status-panel {
  justify-self: end;
  width: 100%;
  max-width: 560px;
  padding: 24px;
  border: 1px solid rgba(39, 39, 39, 0.08);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0%, rgba(243, 243, 243, 0.9) 100%);
}

.reasoning-status-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.reasoning-status-panel__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.reasoning-status-panel__header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
}

.reasoning-status-panel__title {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  color: var(--color-text-primary);
}

.reasoning-status-panel__meter {
  display: inline-flex;
  align-items: end;
  gap: 4px;
  flex-shrink: 0;
}

.reasoning-status-panel__meter-bar {
  width: 4px;
  height: var(--bar-height);
  border-radius: 999px;
  background: var(--color-accent-orange);
  animation: reasoning-meter 2.6s ease-in-out infinite;
}

.reasoning-status-panel__meter-bar:nth-child(2) {
  animation-delay: 0.16s;
}

.reasoning-status-panel__meter-bar:nth-child(3) {
  background: var(--color-accent-green);
  animation-delay: 0.32s;
}

.reasoning-status-panel__meter-bar:nth-child(4) {
  animation-delay: 0.48s;
}

.reasoning-status-panel__card {
  padding: 20px;
  border: 1px solid rgba(39, 39, 39, 0.1);
  border-radius: 16px;
  background: var(--color-bg-page);
  box-shadow: 0 12px 28px rgba(39, 39, 39, 0.05);
}

.reasoning-status-panel__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reasoning-status-panel__step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reasoning-status-panel__step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 6px;
}

.reasoning-status-panel__step-icon[data-state="complete"] {
  background: var(--color-accent-green);
  color: var(--color-text-on-dark);
}

.reasoning-status-panel__step-icon[data-state="active"] {
  background: var(--color-accent-orange);
  color: var(--color-text-on-dark);
  animation: reasoning-pulse 2.2s ease-in-out infinite;
}

.reasoning-status-panel__step-icon[data-state="pending"] {
  background: var(--color-bg-surface);
  color: rgba(39, 39, 39, 0.45);
}

.reasoning-status-panel__step-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.35;
  color: var(--color-text-primary);
}

.reasoning-status-panel__footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(39, 39, 39, 0.08);
}

.reasoning-status-panel__footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.reasoning-status-panel__progress-track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(39, 39, 39, 0.08);
}

.reasoning-status-panel__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent-green) 0%, var(--color-accent-orange) 100%);
}

.reasoning-status-panel__note {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--color-text-secondary);
  font-style: italic;
}

@keyframes reasoning-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(248, 146, 74, 0);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(248, 146, 74, 0.18);
  }
}

@keyframes reasoning-meter {
  0%,
  100% {
    transform: scaleY(0.92);
    opacity: 0.7;
  }

  50% {
    transform: scaleY(1.08);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   Responsive: < 1100px
   -------------------------------------------------------------------------- */

@media (max-width: 1099.98px) {
  .systems-lab {
    padding: 40px 16px;
  }

  .systems-lab__header {
    padding: 0;
  }

  .systems-lab__headline {
    font-size: 28px;
    line-height: 34px;
    max-width: 100%;
  }

  .reasoning-status-panel {
    justify-self: stretch;
    max-width: none;
  }
}

@media (max-width: 639.98px) {
  .systems-lab__headline {
    font-size: 24px;
    line-height: 30px;
    max-width: 100%;
  }
}

@media (max-width: 519.98px) {
  .systems-lab__headline {
    font-size: 22px;
    line-height: 28px;
  }

  .systems-lab__mat {
    padding: 16px 16px 12px;
    border-radius: 16px;
  }

  .reasoning-status-panel {
    padding: 18px;
  }

  .reasoning-status-panel__card {
    padding: 16px;
  }

  .reasoning-status-panel__step {
    align-items: start;
  }

  .reasoning-status-panel__step-label {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reasoning-status-panel__meter-bar,
  .reasoning-status-panel__step-icon[data-state="active"] {
    animation: none;
  }
}
