/* ════════════════════════════════════════════════════════════════
   TRU CASE STUDY — project.css
   Same shell as Warmlyn: sidebar section nav, plain undecorated
   media slots, neutral tokens, no project accent color. The one
   real departure is media: TRU is a phone app, so screenshots live
   in swipeable phone-shaped carousels instead of a single wide
   frame. Multiple carousel instances run down the page, one per
   feature, via the shared [data-gallery] component below.
   ════════════════════════════════════════════════════════════════ */

:root {
  --tru-content:  760px;
  --tru-sidebar:  180px;
}

html { scroll-behavior: smooth; }
body { overflow-x: clip; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── HERO ───────────────────────────────────────────────────────
   Same mechanism as Warmlyn: full-bleed scenic background, fixed
   dark tint that never lightens in light mode, contained frames
   floating on top. Here it's 3 phone frames side by side instead
   of one video frame. On mobile, only 1 frame shows, edge-to-edge,
   no background around it, same "watching a video on YouTube in
   portrait" logic as Warmlyn's mobile hero. ────────────────────── */

:root {
  --tru-hero-image: url("https://res.cloudinary.com/g5cnxha1/image/upload/v1788252054/bg-image-1.png");
  --tru-hero-tint:  #0C0C0C;
}

.cs-hero {
  position: relative;
  min-height: min(78vh, 720px);
  padding: calc(var(--nav-height) + var(--space-8)) var(--space-8) var(--space-10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

.cs-hero__background {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(to bottom,
      color-mix(in srgb, var(--tru-hero-tint) 20%, transparent),
      color-mix(in srgb, var(--tru-hero-tint) 42%, transparent)),
    var(--tru-hero-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: var(--tru-hero-tint);
}

.cs-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--tru-hero-tint) 6%, transparent),
    transparent 55%,
    color-mix(in srgb, var(--tru-hero-tint) 30%, transparent));
  pointer-events: none;
}

.cs-hero__top {
  width: min(100%, var(--container));
  margin-inline: auto;
  margin-bottom: 0.01rem;
}

.cs-back {
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cs-back:hover { opacity: 0.7; }

.cs-hero__phones {
  flex: 1;
  width: min(100%, var(--container));
  margin-inline: auto;
  display: flex;
  /* align-items: center; */
  justify-content: center;
  gap: var(--space-6);
}

.cs-hero__phone {
  width: min(230px, 22vw);
  aspect-ratio: 375 / 812;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-lg);
  background: #111;
}

.cs-hero__phone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: inherit;
}

.cs-hero__phone:not(:has(img)) {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: var(--space-3);
}

/* Only 2 of the 3 hero phones show on tablet, all 3 need too much
   width once the viewport narrows this far. */
.cs-hero__phone--3 { display: block; }

@media (max-width: 900px) {
  .cs-hero__phone { width: min(230px, 28vw); }
}

/* ─── MOBILE HERO ─────────────────────────────────────────────────
   Capped to a real height budget instead of letting a 9:16 phone
   at 100% width dictate the hero's height (that math alone blows
   past 60vh on most phones). Background stays visible, contained
   single phone scales to fit the band instead of the band growing
   to fit the phone. ─────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* All three phones stay, sized to share the width */
  .cs-hero {
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 16px 16px 36px;
  }
  .cs-hero__top { margin-bottom: 20px; }
  .cs-hero__phones { gap: 8px; align-items: flex-start; }
  .cs-hero__phone {
    width: calc((100% - 16px) / 3);
    max-width: 180px;
    height: auto;
    aspect-ratio: 375 / 812;
    border-radius: clamp(12px, 4vw, 20px);
  }
  .cs-layout { padding-top: var(--space-10); }
}

/* ─── PAGE LAYOUT (sidebar + content) ────────────────────────── */

.cs-layout {
  width: min(100%, 1240px);
  margin: auto;
  padding: var(--space-16) var(--space-8) 0;
  display: grid;
  grid-template-columns: var(--tru-sidebar) minmax(0, var(--tru-content));
  gap: clamp(3rem, 8vw, 8rem);
  align-items: start;
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */

.cs-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-8));
  align-self: start;
}

.cs-sidebar__project {
  display: inline-block;
  margin-bottom: var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-primary);
}

.cs-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cs-sidebar__nav a {
  display: block;
  padding: 0.15rem 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-muted);
  transition: color var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
}

.cs-sidebar__nav a:hover,
.cs-sidebar__nav a.is-active {
  color: var(--text-primary);
}

.cs-sidebar__nav a.is-active { transform: translateX(5px); }

/* ─── CONTENT / SECTIONS ─────────────────────────────────────── */

.cs-content { min-width: 0; }

.cs-section {
  padding-block: var(--space-24);
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-height) + var(--space-8));
}

.cs-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.cs-label {
  margin-bottom: var(--space-6);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cs-title {
  margin-bottom: var(--space-6);
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.045em;
}

.cs-heading {
  max-width: 720px;
  margin-bottom: var(--space-8);
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.035em;
}

.cs-subheading {
  max-width: 640px;
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-primary);
}

.cs-subheading:first-of-type { margin-top: var(--space-8); }

.cs-bullets {
  margin-top: var(--space-4);
  padding-left: var(--space-5);
}

.cs-bullets li {
  position: relative;
  max-width: 600px;
  padding-left: var(--space-4);
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.cs-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

.cs-intro {
  max-width: 680px;
  margin-bottom: var(--space-12);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.5;
  color: var(--text-secondary);
}

.cs-section > p:not(.cs-label):not(.cs-intro) {
  max-width: 680px;
  margin-top: var(--space-6);
}

.cs-section > p:first-of-type { margin-top: 0; }

/* ─── META STRIP ─────────────────────────────────────────────── */

.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: var(--space-16);
  border-top: 1px solid var(--border);
}

.cs-meta > div {
  padding: var(--space-5) var(--space-5) var(--space-5) 0;
  border-bottom: 1px solid var(--border);
}

.cs-meta > div:not(:first-child) {
  padding-left: var(--space-5);
  border-left: 1px solid var(--border);
}

.cs-meta span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.cs-meta strong {
  display: block;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5;
}

/* ─── PLAIN MEDIA SLOTS (hero product image, e-commerce shot) ────
   Same as Warmlyn: undecorated, no card, no shadow. Used only for
   non-phone imagery here, the hero photo and the web e-commerce
   screenshot. Phone screens use the gallery component instead. ── */

.media-slot {
  margin-top: var(--space-10);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.media-slot:not(:has(img)) {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.media-slot--wide:not(:has(img)) { min-height: 420px; }

.media-slot img {
  display: block;
  width: 100%;
  height: auto;
}

/* ─── RESEARCH: REFERENCE LOGOS ──────────────────────────────── */

.reference-list {
  margin-top: var(--space-10);
  border-top: 1px solid var(--border);
}

.reference {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--space-5);
  align-items: center;
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.reference__logo {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.reference__logo img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.reference h3 {
  margin-bottom: 0.2rem;
  font-size: var(--text-md);
  font-weight: 500;
}

.reference p { font-size: var(--text-sm); }

/* ─── TESTING: WHAT WAS TESTED LIST ──────────────────────────── */

.cs-steps {
  margin-top: var(--space-8);
  border-top: 1px solid var(--border);
  counter-reset: step;
}

.cs-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--space-5);
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.cs-steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.cs-steps li p {
  max-width: 560px;
  margin: 0;
}

/* ─── PULLQUOTE ──────────────────────────────────────────────── */

.cs-pullquote {
  position: relative;
  margin-top: var(--space-10);
  padding-left: var(--space-6);
  max-width: 600px;
  border-left: 2px solid var(--text-primary);
}

.cs-pullquote p {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.85;
  letter-spacing: 0.01em;
  margin: 0;
}

/* ─── PENDING-DATA NOTE ──────────────────────────────────────────
   Honest placeholder, not fabricated numbers. Swap this whole
   block out once real Maze results are in. ────────────────────── */

.cs-pending-note {
  margin-top: var(--space-8);
  padding: var(--space-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  line-height: 1.6;
}

/* ─── QUANTITATIVE VALIDATION ────────────────────────────────── */

.cs-quant {
  margin-top: var(--space-16);
}

.cs-quant__intro {
  max-width: 620px;
  margin-bottom: var(--space-12);
}

.cs-quant__cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-10);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--border);
}

.cs-quant__col h4 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.cs-quant__col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cs-quant__col li {
  position: relative;
  padding-left: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
}

.cs-quant__col li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

.cs-quant__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-10);
  margin-top: var(--space-12);
}

.cs-stat__count,
.cs-stat__suffix {
  font-family: var(--font-body);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
}

.cs-stat__label {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .cs-quant__cols  { grid-template-columns: 1fr; gap: var(--space-8); }
  .cs-quant__stats { grid-template-columns: 1fr; gap: var(--space-8); }
}

/* ═══════════════════════════════════════════════════════════════
   PHONE SCREENSHOT GALLERY — native swipe/scroll, no buttons.
   Each [data-gallery] block is a horizontally scrollable strip
   with scroll-snap, the browser handles the swiping, JS only
   wires up the click-to-lightbox behavior. Multiple independent
   instances run down the page; all share one lightbox since only
   one can be open at a time.
   ═══════════════════════════════════════════════════════════════ */

.cs-gallery { margin-top: var(--space-8); }

.cs-gallery__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cs-gallery__viewport::-webkit-scrollbar { display: none; }

.cs-gallery__track {
  display: flex;
  gap: var(--space-5);
  width: max-content;
}

.cs-gallery__item {
  scroll-snap-align: start;
  width: min(220px, 62vw);
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  padding: 0;
  cursor: pointer;
  transition: border-color var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
  aspect-ratio: 375 / 812;
}

.cs-gallery__item:hover { border-color: var(--accent-border); transform: translateY(-3px); }

.cs-gallery__item img {
  width: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.cs-gallery__item:not(:has(img)) {
  aspect-ratio: 9 / 18;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: var(--space-3);
  cursor: default;
}

.cs-gallery__item:not(:has(img)):hover { transform: none; border-color: var(--border); }

/* ─── LIGHTBOX (shared, single instance) ──────────────────────── */

.cs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-out), visibility 0.3s var(--ease-out);
}

.cs-lightbox.is-open { opacity: 1; visibility: visible; }

.cs-lightbox__stage { max-width: 90vw; max-height: 86vh; display: flex; align-items: center; justify-content: center; }

.cs-lightbox__stage img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}

.cs-lightbox__close,
.cs-lightbox__arrow {
  position: absolute;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-out);
}

.cs-lightbox__close:hover,
.cs-lightbox__arrow:hover { background: rgba(255, 255, 255, 0.14); }

.cs-lightbox__close { top: var(--space-6); right: var(--space-6); width: 44px; height: 44px; }
.cs-lightbox__arrow { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.cs-lightbox__arrow--prev { left: var(--space-6); }
.cs-lightbox__arrow--next { right: var(--space-6); }

.cs-lightbox__count {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
}

/* ─── NEXT PROJECT ───────────────────────────────────────────── */

.cs-next {
  padding-block: var(--space-24);
  border-top: 1px solid var(--border);
}

.cs-next__link {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.2rem var(--space-5);
}

.cs-next__label {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cs-next__link strong {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.035em;
}

.cs-next__arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out);
}

.cs-next__link:hover .cs-next__arrow { transform: translateX(6px); }

/* ─── MOBILE JUMP NAV (hidden until <980px) ──────────────────── */

.cs-mobile-jump,
.cs-mobile-panel { display: none; }

@media (max-width: 980px) {
  .cs-layout {
    display: block;
    padding-top: var(--space-20);
  }

  .cs-sidebar { display: none; }

  .cs-mobile-jump {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 300;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
  }

  .cs-mobile-jump__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-primary);
  }

  .cs-mobile-panel {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: block;
    padding: var(--space-6);
    background: var(--bg-primary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition:
      opacity var(--duration-base) var(--ease-out),
      transform var(--duration-base) var(--ease-out),
      visibility var(--duration-base);
  }

  .cs-mobile-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .cs-mobile-panel__inner {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .cs-mobile-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--nav-height);
  }

  .cs-mobile-panel__head button {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.62rem;
  }

  .cs-mobile-panel nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: auto 0;
    overflow-y: auto;
  }

  .cs-mobile-panel nav a {
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 5.5vw, 1.6rem);
    font-weight: 500;
  }

  .cs-mobile-panel nav a.is-active { color: var(--text-primary); }

  .cs-gallery__track { gap: var(--space-4); }
  .cs-lightbox__arrow { width: 42px; height: 42px; }
  .cs-lightbox__arrow--prev { left: var(--space-3); }
  .cs-lightbox__arrow--next { right: var(--space-3); }
  .cs-lightbox__close { top: var(--space-4); right: var(--space-4); }
}

@media (max-width: 640px) {
  .cs-layout { padding-inline: var(--space-5); }
  .cs-section { padding-block: var(--space-20); }
  .cs-meta { grid-template-columns: repeat(2, 1fr); }

  .cs-meta > div:nth-child(2n + 1) {
    padding-left: 0;
    border-left: 0;
  }

  .cs-meta > div:nth-child(2n) {
    padding-left: var(--space-5);
    border-left: 1px solid var(--border);
  }

  .media-slot:not(:has(img)) { min-height: 240px; }
  .media-slot--wide:not(:has(img)) { min-height: 300px; }

  .cs-gallery__item { width: 68vw; }
}

@media (max-width: 400px) {
  .cs-layout { padding-inline: var(--space-4); }
  .cs-section { padding-block: var(--space-16); }
  .cs-meta { grid-template-columns: 1fr; }
  .cs-meta > div,
  .cs-meta > div:nth-child(2n) {
    padding-left: 0;
    border-left: 0;
  }
  .reference { grid-template-columns: 44px 1fr; gap: var(--space-4); }
  .reference__logo { width: 44px; height: 44px; }
}