/* ============================================
   CASESTUDY.CSS
   All styles for project case study pages
   ============================================ */

/* ── COVER ── */
.cs-cover {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  position: relative;
  background: #0B0B0B;
}
.cs-cover img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.7s var(--ease-out), transform 0.9s var(--ease-out);
}
.cs-cover img.loaded { opacity: 1; }
.cs-cover:hover img  { transform: scale(1.02); }

/* ── INTRO ── */
.cs-intro {
  padding: clamp(48px, 7vw, 84px) 0;
  border-bottom: 1px solid var(--border);
}
.cs-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(36px, 5vw, 72px);
  align-items: start;
}
.cs-eyebrow {
  display: flex; align-items: center;
  gap: 10px; margin-bottom: 18px;
}
.cs-eyebrow-line { width: 20px; height: 1px; background: var(--muted); flex-shrink: 0; }

.cs-title {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 400; letter-spacing: -0.04em; line-height: 1.0;
  margin-bottom: 14px;
}
.cs-tagline {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 400; letter-spacing: -0.04em; line-height: 1.0;
  color: var(--muted);
}
.cs-desc {
  font-size: 0.9375rem; color: var(--muted);
  line-height: 1.8; margin-top: 20px; max-width: 500px;
}
.cs-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 24px; }
.cs-tag {
  height: 27px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-pill);
  font-size: 0.75rem; color: var(--muted);
  display: flex; align-items: center;
}

/* ── META TABLE ── */
.cs-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
}
.cs-meta-item {
  padding: 16px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cs-meta-item:nth-child(2n)       { border-right: none; }
.cs-meta-item:nth-last-child(-n+2) { border-bottom: none; }
.cs-meta-item--full { grid-column: 1 / -1; border-right: none; }
.cs-meta-label {
  font-size: 0.6875rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px;
}
.cs-meta-val { font-size: 0.875rem; letter-spacing: -0.01em; }

/* ── SECTION LAYOUT ── */
.cs-section {
  padding: clamp(52px, 7vw, 84px) 0;
  border-bottom: 1px solid var(--border);
}
.cs-section-inner {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: clamp(36px, 5vw, 64px);
  align-items: start;
}
.cs-section-label {
  font-size: 0.75rem; color: var(--muted);
  padding-top: 4px;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
}

/* ── BODY TEXT ── */
.cs-body h2 {
  font-size: clamp(1.5rem, 3vw, 2.375rem);
  font-weight: 400; letter-spacing: -0.03em;
  line-height: 1.1; margin-bottom: 22px;
}
.cs-body p {
  font-size: 0.9375rem; color: var(--muted);
  line-height: 1.85; margin-bottom: 14px; max-width: 620px;
}
.cs-body p:last-child { margin-bottom: 0; }
.cs-body h3 {
  font-size: 0.875rem; font-weight: 400;
  letter-spacing: -0.01em; margin: 28px 0 8px;
}

/* ── PULL QUOTE ── */
.cs-quote {
  margin: 32px 0;
  padding: 24px 28px;
  border-left: 1.5px solid var(--fg);
}
.cs-quote p {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: var(--fg);
  line-height: 1.55; letter-spacing: -0.02em;
  margin-bottom: 12px; max-width: none;
}
.cs-quote cite {
  font-size: 0.75rem; color: var(--muted);
  font-style: normal; letter-spacing: 0.04em;
}

/* ── VALUES GRID ── */
.cs-values {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); margin: 28px 0;
}
.cs-value-cell {
  background: var(--bg); padding: 22px 24px;
  transition: background var(--fast);
}
.cs-value-cell:hover { background: var(--card); }
.cs-value-label {
  font-size: 0.6875rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px;
}
.cs-value-text { font-size: 0.875rem; color: var(--fg); line-height: 1.65; }

/* ═══════════════════════════════════════════
   IMAGE SYSTEM
   All images use position:relative on the
   wrapper and absolute fill on the img tag
   so object-fit:cover always works correctly.
═══════════════════════════════════════════ */

/* Base image block */
.cs-img {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
}
.cs-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out), transform 0.7s var(--ease-out);
}
.cs-img img.loaded { opacity: 1; }
.cs-img:hover img  { transform: scale(1.04); }

/* ── Aspect ratio modifiers (cover/photo images) ── */
.cs-img--ultra    { aspect-ratio: 21/9; }
.cs-img--wide     { aspect-ratio: 16/9; }
.cs-img--land     { aspect-ratio: 4/3; }
.cs-img--square   { aspect-ratio: 1/1; }
.cs-img--portrait { aspect-ratio: 3/4; }

/*
  Contain variant — for diagrams, logos, and graphic assets
  that must show at their true proportions without any crop.
  Overrides the absolute-fill system: the img sits static
  so the wrapper naturally sizes to the image's height.
  No aspect-ratio is forced — the image dictates the box.
*/
.cs-img--contain {
  aspect-ratio: unset;
}
.cs-img--contain img {
  position: static;
  width: 100%;
  height: auto;
  object-fit: unset;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out), transform 0.7s var(--ease-out);
}
.cs-img--contain img.loaded { opacity: 1; }
.cs-img--contain:hover img  { transform: scale(1.02); }

/* Dark background variant */
.cs-img--dark { background: #0B0B0B; border-color: #1a1a18; }

/*
  Width constraints — left-aligned.
  Apply to .cs-img alongside --contain to limit how large
  a diagram image grows inside the cs-body column.
    sm  — small diagrams / icon-scale assets  (~380px)
    med — mid-size diagrams / specimens       (~560px)
  Without either modifier the image spans the full column width.
*/
.cs-img--sm  { max-width: 380px; }
.cs-img--med { max-width: 560px; }

/* ── IMAGE GRIDS ── */
.cs-img-wrap { margin: clamp(32px, 4vw, 52px) 0; }
.cs-img-wrap:first-child { margin-top: 0; }
.cs-img-wrap:last-child  { margin-bottom: 0; }

.cs-img-1up{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cs-img-2up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cs-img-3up {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* ── TYPOGRAPHY SECTION LAYOUT ── */
/* Image sits above the heading at a reduced size */
.cs-type-block { margin-bottom: 24px; }
.cs-type-block .cs-img {
  max-width: 460px;
  margin-bottom: 28px;
}

/* ── PROCESS IMAGE GRID ── */
/* Three square blocks, full-fill images */
.cs-process-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: clamp(24px, 3vw, 36px) 0;
}
.cs-process-grid .cs-img { aspect-ratio: 1/1; }

/* ── CAPTION ── */
.cs-caption {
  margin-top: 10px; font-size: 0.75rem; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center;
}
.cs-caption-num { color: var(--border); font-size: 0.6875rem; }

/* ── VIDEO ── */
.cs-video-wrap {
  position: relative;
  background: #0B0B0B;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-video-wrap video {
  display: block;
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
}
.cs-video-label {
  position: absolute; bottom: 16px; left: 16px;
  font-size: 0.6875rem; color: rgba(255,255,255,0.28);
  letter-spacing: 0.1em; text-transform: uppercase;
  pointer-events: none;
}
.cs-video-sound {
  position: absolute; bottom: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast);
  color: rgba(255,255,255,0.6);
}
.cs-video-sound:hover {
  border-color: rgba(255,255,255,0.5);
  color: #fff;
  background: rgba(0,0,0,0.7);
}
.cs-video-sound svg { flex-shrink: 0; }
/* Icon swap via data attribute */
.cs-video-sound[data-muted="false"] .icon-muted   { display: none; }
.cs-video-sound[data-muted="true"]  .icon-unmuted { display: none; }

.cs-img--illus{
  background-color: white;
}

/* -Contributors- */
.cs-detail-body{
  display: flex; flex-direction: column;
  gap: 2rem;
}
.cs-contributor-container{
height: 3rem; width: 3rem;
border-radius: 50%;
background: none;
display: flex; align-items: center; justify-content: center;
flex-direction: column;
overflow: hidden;
}
.cs-contributor-container img{
  width: 100%; height: 100%;
  object-fit: cover;
}
.cs-contributors{
  display: flex;
  gap: 20px;
}
.cs-contributor-set{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.cs-contributor-tag
{
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}


/* ── NEXT PROJECT ── */
.cs-next {
  padding: clamp(48px, 6vw, 80px) 0;
  border-top: 1px solid var(--border);
}
.cs-next-inner {
  display: flex; align-items: center;
  justify-content: space-between; gap: 28px;
}
.cs-next-kicker { font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; }
.cs-next-title  {
  font-size: clamp(1.5rem, 3.5vw, 2.75rem);
  font-weight: 400; letter-spacing: -0.04em; line-height: 1.05;
}
.cs-next-sub    { color: var(--muted); }
.cs-next-cta    {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: inherit; flex-shrink: 0;
}
.cs-next-cta span { font-size: 0.8125rem; color: var(--muted); }
.cs-next-arrow {
  width: 48px; height: 48px; border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--fast), border-color var(--fast),
              transform var(--mid) var(--ease-spring);
}
.cs-next-cta:hover .cs-next-arrow { background: var(--fg); border-color: var(--fg); transform: rotate(45deg); }
.cs-next-cta:hover .cs-next-arrow svg { color: var(--bg); }
.cs-next-arrow svg { color: var(--muted); transition: color var(--fast); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .cs-intro-grid    { grid-template-columns: 1fr; }
  .cs-section-inner { grid-template-columns: 1fr; }
  .cs-section-label { position: static; }
  .cs-values        { grid-template-columns: 1fr; }
  .cs-type-block .cs-img { max-width: 100%; }
  .cs-img--sm,
  .cs-img--med      { max-width: 100%; }
  .cs-meta          { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .cs-img-2up       { grid-template-columns: 1fr; }
  .cs-img-3up       { grid-template-columns: 1fr; }
  .cs-process-grid  { grid-template-columns: 1fr 1fr; }
  .cs-cover         { aspect-ratio: 4/3; }
  .cs-meta          { grid-template-columns: 1fr; }
  .cs-meta-item     { border-right: none; }
  .cs-next-inner    { flex-direction: column; align-items: flex-start; }
  .cs-contributors   { align-items: center; justify-content: center;}
}
@media (max-width: 400px) {
  .cs-process-grid  { grid-template-columns: 1fr; }
  .cs-contributors   { align-items: center; justify-content: space-between;}
}
