/* ==========================================================================
   Mindglass — Case study page (Rolling Stone × Fabri Fibra)
   Layout styles for the project case study. Design tokens, header, footer,
   theme toggle and the .mg-logo rule are shared from styles.css — this file
   only adds the article-specific layout, and it is fully responsive
   (one document, desktop → mobile via the media query at the bottom).
   ========================================================================== */

/* --------------------------------------------------------- Header bits -- */
/* Sticky only on case study pages (this file is not loaded on homepage)  */
/* Reuses .site-header / .hdr-logo / .hdr-nav from styles.css. The center
   slot is a breadcrumb instead of the tagline.                            */
.cs-crumb {
  grid-column: 4 / span 5;
  align-self: center;
  color: var(--mg-mute);
}

.cs-crumb b {
  font-weight: 400;
  color: var(--mg-ink);
}

/* --------------------------------------------------------------- Shell -- */
.cs {
  width: 100%;
  background: var(--mg-paper);
  color: var(--mg-ink);
  font-family: var(--mg-mono);
}

/* Generic full-width section with the page gutter */
.cs-section {
  padding: 0 40px;
}

.cs-rule-top {
  border-top: 1px solid var(--mg-rule);
}

.cs-rule-bottom {
  border-bottom: 1px solid var(--mg-rule);
}

.cs-kicker {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mg-mute);
}

/* ---------------------------------------------------------- Title block - */
.cs-title {
  padding: 120px 40px 100px;
}

.cs-title .cs-kicker {
  margin-bottom: 18px;
}

.cs-headline {
  margin: 0;
  font-family: var(--mg-mono);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.45;
  letter-spacing: 0;
  max-width: 720px;
}

.cs-accent {
  color: var(--mg-accent);
}

/* ----------------------------------------------------------- Meta strip - */
.cs-meta {
  padding: 32px 40px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  font-size: 12px;
}

.cs-meta-key {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mg-mute);
  margin-bottom: 6px;
}

/* -------------------------------------------------------------- Images -- */
.cs-figures {
  padding: 48px 40px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* a row that splits into two equal columns (the cover alternates / pull-out) */
.cs-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cs-frame {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: oklch(0.92 0.04 14);
}

.cs-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ar-wide    { aspect-ratio: 16 / 9; }
.ar-portrait { aspect-ratio: 3 / 4; }
.ar-square   { aspect-ratio: 1 / 1; }

/* caption pill, floated over the image (same vocabulary as the home rows) */
.cs-cap {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 16px;
  border-radius: 4px;
  border: 1px solid var(--mg-rule);
  background: color-mix(in oklab, var(--mg-paper) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--mg-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.cs-cap-left {
  display: flex;
  gap: 14px;
  align-items: baseline;
  min-width: 0;
}

.cs-cap-n {
  color: var(--mg-mute);
}

.cs-cap-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-cap-right {
  color: var(--mg-mute);
  white-space: nowrap;
}

/* ---------------------------------------------------- Notes / Spec rows - */
/* Two-part rows: a kicker label on the left, content on the right.        */
.cs-row {
  padding: 40px 40px 80px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.cs-row-label {
  grid-column: 1 / span 3;
}

.cs-prose {
  grid-column: 4 / span 7;
  font-family: var(--mg-mono);
  font-size: 14px;
  line-height: 1.65;
}

.cs-prose p {
  margin: 0 0 1.25em;
}

.cs-prose p:last-child {
  margin: 0;
}

.cs-prose .muted {
  color: var(--mg-mute);
}

/* spec sheet — two columns of key/value lines */
.cs-spec {
  grid-column: 4 / span 8;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 32px;
  font-size: 12px;
}

.cs-spec-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--mg-rule);
  padding-bottom: 10px;
}

.cs-spec-item span:first-child {
  color: var(--mg-mute);
}

/* --------------------------------------------------------------- Next --- */
.cs-next {
  padding: 40px 40px 80px;
  background: color-mix(in oklab, var(--mg-ink) 5%, var(--mg-paper));
}

.cs-next-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  color: var(--mg-ink);
  font-weight: 600;
}

/* ─── Hero full-bleed ────────────────────────────────────────────────── */
.cs-hero {
  width: 100%;
  overflow: hidden;
  cursor: pointer;
}
.cs-hero img {
  width: 100%;
  display: block;
}

/* ─── Captions below images ──────────────────────────────────────────── */
.cs-hero-cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 40px;
  font-family: var(--mg-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.cs-cap-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  font-family: var(--mg-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.cs-cap-row-left {
  display: flex;
  gap: 14px;
  align-items: baseline;
}
.cs-cap-row-n { color: var(--mg-mute); }
.cs-cap-row-right { color: var(--mg-mute); white-space: nowrap; }

/* ─── Notes row with side metadata column ────────────────────────────── */
.cs-row--has-meta .cs-prose {
  grid-column: 4 / span 5;
}

.cs-side-meta {
  grid-column: 9 / span 4;
  font-family: var(--mg-mono);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cs-side-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-side-meta-key {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mg-mute);
}

.cs-frame-col {
  display: flex;
  flex-direction: column;
}
.cs-lb-trigger { cursor: pointer; }

.cs-prose a {
  color: var(--mg-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── Gallery strip ──────────────────────────────────────────────────── */
.cs-gallery {
  padding: 0 40px 64px;
}
.cs-gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 32px 0 16px;
}
.cs-gallery-viewport { overflow: hidden; }
.cs-gallery-track {
  display: flex;
  gap: 16px;
  transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.cs-gallery-item {
  flex: none;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: oklch(0.92 0.04 14);
}
.cs-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}
.cs-gallery-item:hover img { opacity: 0.8; }
.cs-gallery-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.cs-gal-btn {
  background: none;
  border: none;
  color: var(--mg-ink);
  font-family: var(--mg-mono);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: opacity 0.15s;
}
.cs-gal-btn:disabled { opacity: 0.25; cursor: default; }
.cs-gal-count {
  font-family: var(--mg-mono);
  font-size: 12px;
  color: var(--mg-mute);
  letter-spacing: 0.06em;
  min-width: 48px;
  text-align: center;
}

/* ─── Lightbox ───────────────────────────────────────────────────────── */
.mg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklab, var(--mg-paper) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.mg-lightbox[hidden] { display: none; }
.mg-lb-img {
  max-width: min(90vw, 1200px);
  max-height: 82vh;
  display: block;
  border-radius: 4px;
  object-fit: contain;
}
.mg-lb-close,
.mg-lb-prev,
.mg-lb-next {
  position: fixed;
  background: none;
  border: none;
  color: var(--mg-ink);
  font-family: var(--mg-mono);
  cursor: pointer;
  padding: 12px;
  opacity: 0.5;
  transition: opacity 0.15s;
  line-height: 1;
  font-size: 18px;
}
.mg-lb-close:hover,
.mg-lb-prev:hover,
.mg-lb-next:hover { opacity: 1; }
.mg-lb-prev:disabled,
.mg-lb-next:disabled { opacity: 0.15; cursor: default; }
.mg-lb-close { top: 20px; right: 24px; font-size: 13px; letter-spacing: 0.1em; }
.mg-lb-prev  { left: 24px;  top: 50%; transform: translateY(-50%); }
.mg-lb-next  { right: 24px; top: 50%; transform: translateY(-50%); }
.mg-lb-count {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mg-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mg-mute);
}

/* ======================================================== Responsive === */
@media (max-width: 760px) {

  .cs-section,
  .cs-meta,
  .cs-row,
  .cs-next {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* breadcrumb hidden, nav trimmed (same behaviour as the home header) */
  .cs-crumb {
    display: none;
  }

  .cs-title {
    padding: 56px 20px 44px;
  }

  .cs-headline {
    font-size: 14px;
    line-height: 1.5;
  }

  .cs-meta {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 20px;
    padding-bottom: 24px;
  }

  /* show only the first four meta items on mobile */
  .cs-meta > div:nth-child(n + 5) {
    display: none;
  }

  .cs-figures {
    padding: 32px 20px 36px;
    gap: 12px;
  }

  .cs-pair {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cs-cap {
    top: 12px;
    left: 12px;
    right: 12px;
    padding: 8px 12px;
    font-size: 11px;
  }

  /* notes & spec collapse to a single column with the label stacked on top */
  .cs-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 24px 20px 36px;
  }

  .cs-row-label,
  .cs-prose,
  .cs-side-meta,
  .cs-spec {
    grid-column: auto;
  }

  /* arrow → becomes ↓ on mobile */
  .cs-row-label {
    font-size: 0;
  }
  .cs-row-label::before {
    content: "notes ↓";
    font-size: 11px;
  }

  /* has-meta: label full-width on top, prose + meta side by side below */
  .cs-row--has-meta {
    grid-template-columns: 7fr 3fr;
    gap: 12px 16px;
  }

  .cs-row--has-meta .cs-row-label {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .cs-row--has-meta .cs-prose {
    grid-column: 1;
    grid-row: 2;
  }

  .cs-row--has-meta .cs-side-meta {
    grid-column: 2;
    grid-row: 2;
    gap: 12px;
    font-size: 11px;
  }

  .cs-prose {
    font-size: 13px;
    line-height: 1.6;
  }

  .cs-spec {
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 11px;
  }

  .cs-spec-item {
    padding-bottom: 6px;
  }

  .cs-next {
    padding: 24px 20px 36px;
  }

  .cs-hero-cap {
    padding-left: 20px;
    padding-right: 20px;
  }

  .cs-gallery {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Mobile gallery: native horizontal scroll + snap */
  .cs-gallery-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cs-gallery-viewport::-webkit-scrollbar { display: none; }

  .cs-gallery-item {
    aspect-ratio: 3 / 2;
    min-width: calc(100vw - 40px);
    scroll-snap-align: start;
  }

  /* Keep next-project caption anchored to the bottom on mobile */
  .cs-next .cs-cap {
    top: auto;
    bottom: 12px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
