/* ==========================================================================
   Case study pages (work/<slug>/index.html)
   Layout follows the home page: sticky meta sidebar + content column.
   ========================================================================== */

/* Breadcrumb replaces the filter tabs */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.crumbs a { color: inherit; text-decoration: none; transition: color 0.15s; }
.crumbs a:hover { color: var(--fg); }
.crumbs [aria-current] { color: var(--fg); }

/* Sidebar meta */
.case-meta { display: flex; flex-direction: column; gap: 22px; }
.case-meta dt { color: var(--faint); font-size: 13px; line-height: 18px; }
.case-meta dd { margin: 0; font-size: 13px; line-height: 18px; }

.toc { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 18px;
  text-decoration: none;
  transition: color 0.2s;
}
.toc a::before {
  content: "";
  width: 12px;
  height: 1px;
  background: currentColor;
  transition: width 0.3s var(--ease-out);
}
.toc a:hover { color: var(--muted); }
.toc a.is-active { color: var(--fg); }
.toc a.is-active::before { width: 20px; }

/* Content column */
.case { min-width: 0; padding-bottom: 160px; }
.case > * + * { margin-top: 96px; }
.case-section { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* Two-column text block: heading left, body right (like the reference) */
.text-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 48px;
  row-gap: 16px;
}
.eyebrow {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.text-block h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.text-block .body { max-width: 520px; font-size: 15px; line-height: 1.55; }
.text-block .body p { margin: 0 0 1em; }
.text-block .body p:last-child { margin-bottom: 0; }
.text-block .body strong { font-weight: 600; }
.text-block .body a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.text-block .body a:hover { color: var(--muted); }
.case-lede { font-size: 28px !important; font-weight: 600; line-height: 1.2 !important; letter-spacing: -0.02em; }

/* Media + embeds */
.media {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--hover);
}
.media img, .media video { width: 100%; height: auto; }

.figure { margin: 0; }
.figure + .text-block, .text-block + .figure, .figure + .figure, .callouts + .figure, .figure + .callouts { margin-top: 40px; }
.figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}
.figcaption a { color: var(--fg); text-decoration: none; white-space: nowrap; }
.figcaption a:hover { text-decoration: underline; text-underline-offset: 3px; }

.stage {
  position: relative;
  padding: clamp(16px, 4vw, 56px);
  border-radius: 4px;
  background: #eef0f3;
  transition: background-color 0.4s;
  overflow: hidden;
}
.stage.stage--dark { background: #0d0d0d; transition: background-color 0.4s; }
.stage--blue { background: linear-gradient(180deg, #2c98ff 0%, #1677e6 100%); }
.stage--lime { background: #f5ffb0; }

/* A scaled iframe that renders the prototype at its real size */
.embed {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 30px 60px -20px rgba(16, 24, 40, 0.35);
  transition: box-shadow 0.3s;
}
.stage--dark .embed { background: #171717; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 60px -20px rgba(0, 0, 0, 0.8); }
.embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  transform-origin: 0 0;
  background: transparent;
}
.embed.is-bare { background: transparent; box-shadow: none; border-radius: 0; }
.embed.is-ipad { border-radius: 18px; box-shadow: 0 0 0 10px #1c1c1e, 0 0 0 11px #3a3a3c, 0 40px 80px -24px rgba(16, 24, 40, 0.5); }
.embed.is-flash { animation: flash 1.2s ease-out; }
@keyframes flash {
  0% { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 0 0 0 rgba(44, 152, 255, 0.6); }
  40% { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 0 0 10px rgba(44, 152, 255, 0); }
}
.embed-badge {
  position: absolute;
  top: clamp(16px, 4vw, 56px);
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.75);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  transform: translate(-50%, -140%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}
.stage:hover .embed-badge { opacity: 1; transform: translate(-50%, -125%); }
.embed-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.25); }

/* Controls under an embed */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--hover);
}
.seg button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04); }
.controls__label { margin-right: 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }

/* Research library: interview recordings shown as a session grid */
.library {
  padding: clamp(16px, 3vw, 32px);
  border-radius: 4px;
  background: #1a1a1a;
  color: #fff;
}
.library__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; font-size: 15px; font-weight: 600; }
.library__note { color: rgba(255, 255, 255, 0.45); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.library__hero { overflow: hidden; border-radius: 10px; background: #000; }
.library__hero img { width: 100%; height: auto; display: block; }
.library__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); margin-top: clamp(16px, 2vw, 24px); }
.session__thumb { overflow: hidden; border-radius: 10px; aspect-ratio: 611 / 342; background: #000; }
.session__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s var(--ease-out); }
.session:hover .session__thumb img { transform: scale(1.03); }
.session__title { margin: 12px 0 2px; font-size: 15px; font-weight: 600; }
.session__date { margin: 0; color: rgba(255, 255, 255, 0.5); font-size: 13px; }
.media--bordered { border: 1px solid var(--line); background: #f5f5f5; }

/* Numbered "how it works" callouts */
.callouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: c;
}
.callouts li { counter-increment: c; font-size: 14px; line-height: 1.5; color: var(--muted); }
.callouts li::before {
  content: counter(c, decimal-leading-zero);
  display: block;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
}
.callouts strong { display: block; margin-bottom: 4px; color: var(--fg); font-weight: 600; }

/* Placeholders for visuals Nik adds later */
.slot {
  display: grid;
  place-items: center;
  gap: 6px;
  aspect-ratio: var(--ratio, 16 / 9);
  padding: 24px;
  border: 1px dashed #d4d4d4;
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, rgba(0, 0, 0, 0.018) 10px 20px),
    #fafafa;
  color: var(--faint);
  text-align: center;
}
.slot strong { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.slot code { font-family: var(--font-mono); font-size: 11px; }
.slot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slot-grid .slot { --ratio: 4 / 3; }

/* Before / after */
.versions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.version { padding: 20px; border-radius: 4px; background: var(--hover); }
.version h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.version p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.version ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Next project */
.next {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.next span { color: var(--faint); font-size: 13px; }
.next strong { font-size: 20px; font-weight: 600; transition: transform 0.3s var(--ease-out); }
.next:hover strong { transform: translateX(-6px); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
.reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  .text-block { grid-template-columns: 1fr; }
  .callouts { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 760px) {
  .case > * + * { margin-top: 64px; }
  .case-lede { font-size: 22px !important; }
  .slot-grid, .versions { grid-template-columns: 1fr; }
  .library__grid { grid-template-columns: 1fr; }
  .figcaption { flex-direction: column; gap: 6px; }
  .embed.is-ipad { box-shadow: 0 0 0 5px #1c1c1e, 0 20px 40px -16px rgba(16, 24, 40, 0.5); border-radius: 10px; }
  .case-sidebar .toc { display: none; }
  .crumbs { display: none; }
  .embed-badge { display: none; }
}

/* Intro: logo + headline only */
.text-block--lede { grid-template-columns: minmax(0, 1fr); }
.text-block--lede .case-lede { max-width: 720px; }
