/* ============================================================
   case-study.css — Generic Case Study Page
   ============================================================ */

/* ── Hero ───────────────────────────────────────────────────── */
.cs-hero {
  padding-top: clamp(72px, 9vw, 120px);
  padding-bottom: clamp(56px, 7vw, 96px);
  border-bottom: 1px solid var(--line-soft);
}

.cs-hero__back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); transition: color .2s, gap .2s var(--ease);
  margin-bottom: clamp(32px, 4vw, 56px);
}
.cs-hero__back:hover { color: var(--text); gap: 12px; }
.cs-hero__back svg { width: 14px; height: 14px; }

.cs-hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
  margin-top: clamp(32px, 4vw, 56px);
}
@media (max-width: 960px) { .cs-hero__inner { grid-template-columns: 1fr; } }

.cs-hero__kicker { margin-bottom: 20px; }

.cs-hero__h1 {
  font-size: clamp(48px, 8vw, 112px);
  font-weight: 700; letter-spacing: -0.04em; line-height: 0.92;
  margin-bottom: clamp(20px, 2.5vw, 32px);
}

.cs-hero__sub {
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.6; color: var(--text-2);
  max-width: 46ch; text-wrap: pretty;
  margin-bottom: clamp(28px, 3.5vw, 44px);
}

.cs-hero__stats {
  display: flex; align-items: center; gap: 0;
  margin-bottom: clamp(32px, 4vw, 48px);
  border: 1px solid var(--line);
  width: fit-content;
}
.cs-hero__stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 24px;
}
.cs-hero__stat-divider {
  width: 1px; align-self: stretch;
  background: var(--line);
}
.cs-hero__stat-n {
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 600; letter-spacing: -0.02em;
  color: var(--accent); font-variant-numeric: tabular-nums;
  line-height: 1; display: inline-block; min-width: 4ch;
}
.cs-hero__stat-unit { color: var(--accent); }
.cs-hero__stat-k {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}

.cs-hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero SVG viz */
.cs-hero__viz {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 24px 100%;
  overflow: hidden;
}
.cs-hero__svg { display: block; width: 100%; height: auto; }
.cs-hero__viz-label {
  position: absolute; left: 16px; bottom: 14px;
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.06em;
}

/* Hero meta row */
.cs-hero__meta {
  display: flex; gap: 0; flex-wrap: wrap;
  margin-top: clamp(36px, 5vw, 64px);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.cs-hero__meta-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 32px 20px 0;
  margin-right: 32px;
  border-right: 1px solid var(--line-soft);
  flex: none;
}
.cs-hero__meta-item:last-child { border-right: none; }
.cs-hero__meta-key {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.cs-hero__meta-val { font-size: 14px; color: var(--text-2); }
.cs-hero__meta-live {
  display: flex; align-items: center; gap: 7px; color: var(--accent);
}

/* ── Section Wrapper ─────────────────────────────────────────── */
.cs-section {
  padding-top: clamp(64px, 8vw, 112px);
  padding-bottom: clamp(48px, 6vw, 80px);
  border-bottom: 1px solid var(--line-soft);
}
.cs-section:last-of-type { border-bottom: none; }

.cs-section__num {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 14px;
}
.cs-section__h2 {
  font-size: clamp(28px, 4vw, 58px);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1.02;
}
.cs-section__lead {
  margin-top: 20px; font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.65; color: var(--text-2);
  max-width: 56ch; text-wrap: pretty;
}
.cs-section__header { margin-bottom: clamp(40px, 5vw, 64px); }

/* ── Problem cards ───────────────────────────────────────────── */
.cs-problems {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
}
@media (max-width: 860px) { .cs-problems { grid-template-columns: 1fr; } }

.cs-problem {
  padding: clamp(28px, 3vw, 44px);
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  transition: background .3s var(--ease);
}
.cs-problem:last-child { border-right: none; }
@media (max-width: 860px) {
  .cs-problem { border-right: none; border-bottom: 1px solid var(--line); }
  .cs-problem:last-child { border-bottom: none; }
}
.cs-problem:hover { background: var(--surface); }

.cs-problem__icon {
  width: 36px; height: 36px; color: var(--accent);
  margin-bottom: 20px;
}
.cs-problem__icon svg { width: 100%; height: 100%; }

.cs-problem__label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}
.cs-problem__title {
  font-size: clamp(17px, 1.6vw, 21px);
  font-weight: 600; letter-spacing: -0.015em;
  margin-bottom: 14px; line-height: 1.2;
}
.cs-problem__body {
  font-size: 14px; line-height: 1.65; color: var(--text-2);
}

/* ── Solution ────────────────────────────────────────────────── */
.cs-solution {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 860px) { .cs-solution { grid-template-columns: 1fr; } }

.cs-viz-frame {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 24px 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cs-viz-frame svg { display: block; width: auto; height: auto; max-height: 460px; max-width: 100%; }
.cs-viz-frame__bar {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; border-top: 1px solid var(--line); background: var(--bg-2);
}
.cs-viz-frame__label {
  display: block; padding: 10px 16px;
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.05em;
}
.cs-viz-replay {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none;
  background: none; border: none; border-left: 1px solid var(--line);
  cursor: pointer; color: var(--muted); transition: color .2s;
}
.cs-viz-replay:hover { color: var(--accent); }
.cs-viz-replay .lottie-icon { width: 16px; height: 16px; pointer-events: none; }

.cs-features { list-style: none; display: flex; flex-direction: column; }
.cs-feature {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 18px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 14px; line-height: 1.6; color: var(--text-2);
}
.cs-feature:first-child { border-top: 1px solid var(--line-soft); }
.cs-feature strong { color: var(--text); font-weight: 500; }

.cs-feature__icon {
  width: 18px; height: 18px; color: var(--accent);
  flex: none; margin-top: 1px;
}
.cs-feature__icon svg { width: 100%; height: 100%; }

/* ── Design Principles ───────────────────────────────────────── */
.cs-principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line);
}
@media (max-width: 860px) { .cs-principles { grid-template-columns: 1fr; } }

.cs-principle {
  background: var(--bg-2);
  padding: clamp(28px, 3vw, 44px);
  transition: background .3s var(--ease);
}
.cs-principle:hover { background: var(--surface); }
.cs-principle--accent {
  background: rgba(191,255,0,0.05);
  border-left: 2px solid var(--accent);
}
.cs-principle--accent:hover { background: rgba(191,255,0,0.08); }

.cs-principle__icon {
  width: 32px; height: 32px; color: var(--accent); margin-bottom: 20px;
}
.cs-principle__icon svg { width: 100%; height: 100%; }
.cs-principle__label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.cs-principle__title {
  font-size: clamp(17px, 1.5vw, 20px);
  font-weight: 600; letter-spacing: -0.015em;
  margin-bottom: 12px; line-height: 1.2;
}
.cs-principle__body {
  font-size: 14px; line-height: 1.65; color: var(--text-2);
}

/* ── Visual System ───────────────────────────────────────────── */
.cs-design {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 860px) { .cs-design { grid-template-columns: 1fr; } }

.cs-swatches {
  display: flex; flex-direction: row; gap: 16px; flex-wrap: wrap;
}
.cs-swatch { display: flex; flex-direction: column; gap: 4px; }
.cs-swatch__dot {
  width: 52px; height: 52px; border: 1px solid var(--line);
}
.cs-swatch__name {
  font-family: var(--mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.04em;
}
.cs-swatch__hex {
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.04em;
}

.cs-type-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(20px, 2.5vw, 36px);
}
.cs-type-card__specimen {
  font-size: 40px; font-weight: 700;
  letter-spacing: -0.025em; margin-bottom: 12px;
  color: var(--text);
}
.cs-type-card__label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.cs-type-card__desc {
  font-size: 14px; line-height: 1.65; color: var(--text-2);
}

/* Plugin / embed UI — inline SVG or iframe */
.cs-plugin-ui {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.cs-plugin-ui svg {
  width: 100%;
  max-width: 444px;
  height: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}

/* AnchorLabs-specific coordinate dot animation — keep al- prefix */
@keyframes al-dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.al-coord-dot {
  animation: al-dot-pulse 2.2s ease-in-out infinite;
}
.al-coord-dot:nth-of-type(2) { animation-delay: .4s; }
.al-coord-dot:nth-of-type(3) { animation-delay: .8s; }
.al-coord-dot:nth-of-type(4) { animation-delay: 1.2s; }
.al-coord-dot:nth-of-type(5) { animation-delay: 1.6s; }

/* Plugin UI placeholder */
.cs-plugin-placeholder {
  border: 1px solid var(--line);
  background: var(--surface);
  aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  margin: 0;
}
.cs-plugin-placeholder__inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center; padding: 24px;
}
.cs-plugin-placeholder__icon {
  width: 40px; height: 40px; color: var(--faint);
}
.cs-plugin-placeholder__text {
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}
.cs-plugin-placeholder__sub {
  font-family: var(--mono); font-size: 10px;
  color: rgba(255,255,255,0.15); letter-spacing: 0.05em;
}
.cs-plugin-placeholder::before {
  content: ""; position: absolute; inset: 8px;
  border: 1px dashed var(--line);
  pointer-events: none;
}

/* ── Version Timeline ────────────────────────────────────────── */
.cs-versions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 860px) { .cs-versions { grid-template-columns: 1fr; } }

.cs-timeline { display: flex; flex-direction: column; gap: 0; }

.cs-timeline__item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.cs-timeline__item:first-child { border-top: 1px solid var(--line-soft); }

/* Vertical connector line */
.cs-timeline__item:not(:last-child) .cs-timeline__marker::after {
  content: ""; position: absolute;
  left: 23px; top: calc(24px + 48px);
  width: 1px; height: calc(100% - 48px);
  background: var(--line);
}

.cs-timeline__marker {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  display: grid; place-items: center;
  flex: none; position: relative;
  color: var(--muted);
}
.cs-timeline__marker svg { width: 16px; height: 16px; }
.cs-timeline__marker--accent {
  border-color: rgba(191,255,0,0.3);
  background: rgba(191,255,0,0.08);
  color: var(--accent);
}
.cs-timeline__marker--warn {
  border-color: rgba(255,160,0,0.3);
  background: rgba(255,160,0,0.06);
  color: #ffa500;
}

.cs-timeline__version {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.cs-timeline__version--warn { color: #ffa500; }
.cs-timeline__title {
  font-size: 15px; font-weight: 500;
  letter-spacing: -0.01em; margin-bottom: 8px; color: var(--text);
}
.cs-timeline__item--bug .cs-timeline__title { color: #ffa500; }
.cs-timeline__desc {
  font-size: 14px; line-height: 1.65; color: var(--muted);
}

/* Learnings */
.cs-versions__learnings {
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid var(--line);
}
.cs-learning {
  display: flex; align-items: flex-start; gap: 16px;
  padding: clamp(20px, 2.5vw, 32px);
  border-bottom: 1px solid var(--line);
  font-size: 14px; line-height: 1.65;
}
.cs-learning:last-child { border-bottom: none; }
.cs-learning strong {
  display: block; font-size: 15px; font-weight: 500;
  color: var(--text); margin-bottom: 6px;
}
.cs-learning p { color: var(--text-2); margin: 0; }
.cs-learning__icon {
  width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 2px;
}
.cs-learning__icon svg { width: 100%; height: 100%; }

/* ── Result cards ────────────────────────────────────────────── */
.cs-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin-bottom: clamp(36px, 5vw, 56px);
}
@media (max-width: 1024px) { .cs-results { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .cs-results { grid-template-columns: repeat(2, 1fr); } }

.cs-result {
  padding: clamp(24px, 2.8vw, 40px);
  border-right: 1px solid var(--line);
  background: var(--bg-2);
}
.cs-result:last-child { border-right: none; }
@media (max-width: 1024px) {
  .cs-result:nth-child(3) { border-right: none; }
  .cs-result:nth-child(1),
  .cs-result:nth-child(2),
  .cs-result:nth-child(3) { border-bottom: 1px solid var(--line); }
}

.cs-result--accent { background: rgba(191,255,0,0.05); }

.cs-result__label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}
.cs-result__n {
  font-size: clamp(28px, 3.5vw, 48px);
  font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
  margin-bottom: 12px;
  color: var(--text);
}
.cs-result--accent .cs-result__n { color: var(--accent); }
.cs-result__unit { color: var(--accent); }
.cs-result__desc {
  font-size: 13px; line-height: 1.6; color: var(--muted);
}

.cs-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Bottom navigation (prev / next) ─────────────────────────── */
.cs-nav {
  display: flex; align-items: stretch; justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: clamp(40px, 6vw, 72px);
}
.cs-nav__link {
  display: flex; flex-direction: column; gap: 6px;
  padding: clamp(20px, 3vw, 36px) 0;
  flex: 1;
  color: var(--text-2);
  transition: color .2s;
}
.cs-nav__link:hover { color: var(--text); }
.cs-nav__link.text-right { text-align: right; align-items: flex-end; }
.cs-nav__label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.cs-nav__title {
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 600; letter-spacing: -0.02em;
}
