/* Case study header — back-only floating pill */

:root {
  --content-w: min(1200px, 92%);
  --text: #09090b;
  --muted: #52525b;
  --border: rgba(9, 9, 11, 0.08);
  --display: "Space Grotesk", system-ui, sans-serif;
  --serif: "Archivo", system-ui, sans-serif;
  --radius-pill: 999px;
  --shadow-sm: 0 4px 20px rgba(9, 9, 11, 0.06);
}

.progress-track {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--content-w);
  height: 2px;
  z-index: 1100;
  pointer-events: none;
}

.progress-track #progress,
.progress-track .cs-progress__bar {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 0.08s linear;
}

.header {
  position: sticky;
  top: 0.875rem;
  z-index: 1000;
  isolation: isolate;
  width: fit-content;
  max-width: var(--content-w);
  margin: 0.875rem 0 0 max(0.875rem, calc((100% - var(--content-w)) / 2));
  padding: 0;
  /* Opaque enough to avoid backdrop-filter seams over imagery */
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transform: translateZ(0);
}

.header__bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: auto;
  height: clamp(2.85rem, 5vw, 3.25rem);
  padding-inline: 0.25rem 0.35rem;
  box-sizing: border-box;
}

.header__brand {
  display: none;
}

.header__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--display);
  font-size: clamp(0.8125rem, 1.1vw, 0.9375rem);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.02em;
  padding: 0.45rem 0.95rem 0.45rem 0.7rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.header__back svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.header__back:hover {
  color: var(--text);
  background: rgba(9, 9, 11, 0.06);
}

.header__back:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Clear stuck :hover transforms while the page is scrolling */
html.is-scrolling,
html.is-scrolling * {
  pointer-events: none !important;
}

@media (max-width: 768px) {
  .header {
    top: 0.5rem;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
  }

  .header__bar {
    padding-inline: 0.2rem 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header__back {
    transition: none;
  }
}
