/*
 * The scroll-driven cylinder.
 *
 * .track is tall — one viewport per frame. Inside it, .stage is sticky and
 * pulled back out of flow with a negative margin equal to its own height, so
 * the .panels that follow scroll *over* a pinned carousel rather than after it.
 *
 * Card and ring transforms are written by js/carousel.js; the geometry lives in
 * js/lib/carousel-math.js, not here.
 */

.track { position: relative; }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  margin-bottom: -100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.stage__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 50% 45%, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0) 70%);
}

/* Feathered left/right edges so cards dissolve rather than clip at the viewport. */
.stage__edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(11, 11, 12, 0.9),
    rgba(11, 11, 12, 0) 22%,
    rgba(11, 11, 12, 0) 78%,
    rgba(11, 11, 12, 0.9)
  );
}

.stage__wrap {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 700ms ease;
  /* `perspective` is set from JS to the cylinder radius. */
}
.stage__wrap[data-ready='true'] { opacity: 1; }

.ring {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--cw);
  aspect-ratio: 3 / 4;
  transform-style: preserve-3d;
}

.card__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg-raise);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.55);
}

.card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-raise);
  filter: saturate(0.92) contrast(1.05);
}

.card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 11, 12, 0) 45%, rgba(11, 11, 12, 0.75) 100%);
}

.card__meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-80);
}

/* --- Overlay panels -------------------------------------------------------- */

.panels {
  position: relative;
  z-index: var(--z-panels);
  pointer-events: none;
}

.panel {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 0 var(--gutter);
}

.panel__inner {
  position: relative;
  text-align: center;
  max-width: min(900px, 90vw);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms var(--ease), transform 520ms var(--ease);
}
.panel[data-active='true'] .panel__inner { opacity: 1; transform: translateY(0); }

/*
 * The panel text sits directly on top of the front carousel frame, and a bright
 * photograph leaves the blurb and eyebrow barely readable. This soft radial
 * scrim darkens only the area behind the copy, so the image still reads through
 * everywhere else. `opacity` on the parent creates a stacking context, so
 * z-index:-1 stays inside the panel instead of sliding behind the whole layer.
 */
.panel__inner::before {
  content: '';
  position: absolute;
  inset: -10% -16%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    closest-side,
    rgba(11, 11, 12, 0.78),
    rgba(11, 11, 12, 0.55) 55%,
    rgba(11, 11, 12, 0) 100%
  );
}

.panel__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.panel__title {
  font-size: clamp(48px, 9vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-weight: 600;
  text-wrap: balance;
  text-shadow: 0 12px 60px rgba(0, 0, 0, 0.65);
}

.panel__blurb {
  margin: 22px auto 0;
  max-width: 46ch;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(242, 240, 236, 0.82);
  text-wrap: pretty;
}

.panel__cta {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  padding: 13px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease);
}
.panel__cta:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* An invisible panel must not be a click target or a tab stop. */
.panel[data-active='false'] .panel__cta { pointer-events: none; }

/*
 * Degraded mode: if the carousel fails to boot, un-pin the stage so the panels
 * read as ordinary stacked sections instead of six blank screens.
 */
body[data-carousel='failed'] .stage { position: relative; height: auto; margin-bottom: 0; }
body[data-carousel='failed'] .stage__wrap { display: none; }
body[data-carousel='failed'] .panel { height: auto; padding: 96px var(--gutter); }
body[data-carousel='failed'] .panel__inner { opacity: 1; transform: none; }
body[data-carousel='failed'] .panel__cta { pointer-events: auto; }
body[data-carousel='failed'] .hud { display: none; }
