/* ============================================================
   CASE STUDY pages — shared styles for /projects/<slug>.html
   Inherits design tokens from ../styles.css
   ============================================================ */

/* CDN base — repeated for clarity in CSS, but URLs live in HTML */
.cs-hero {
  position: relative;
  padding: calc(var(--s-11) + 20px) 0 var(--s-9);
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
}
.cs-hero-aura {
  position: absolute; inset: -20%;
  background:
    radial-gradient(45% 35% at 18% 28%, oklch(0.89 0.08 80 / 0.16), transparent 60%),
    radial-gradient(38% 28% at 82% 72%, oklch(0.55 0.1 30 / 0.18), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}
.cs-hero .wrap { position: relative; z-index: 2; }

.cs-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--bone-400);
  padding: 8px 0;
  margin-bottom: var(--s-7);
  transition: color .3s var(--ease-out);
}
.cs-back:hover { color: var(--accent); }

.cs-hero-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--s-7);
}
.cs-hero-meta .field { display: flex; flex-direction: column; gap: 4px; }
.cs-hero-meta .field .label {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--bone-400);
}
.cs-hero-meta .field .val {
  font-family: var(--f-mono); font-size: 12px; color: var(--bone-200);
}
@media (max-width: 760px) {
  .cs-hero-meta { grid-template-columns: repeat(2, 1fr); }
}

.cs-title {
  font-family: var(--f-display);
  font-size: clamp(48px, 8vw, 112px);
  font-weight: 500; letter-spacing: -0.035em; line-height: 0.94;
  margin-bottom: var(--s-6);
}
.cs-title em { font-family: var(--f-serif); font-style: italic; color: var(--accent); font-weight: 400; }

.cs-sub {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--s-9);
  align-items: end;
  margin-top: var(--s-6);
}
.cs-sub .lead {
  max-width: 620px;
  font-size: 19px; line-height: 1.55;
  color: var(--bone-200);
}
.cs-sub .lead .dash { color: var(--accent); margin-right: 10px; }
.cs-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
@media (max-width: 860px) {
  .cs-sub { grid-template-columns: 1fr; }
}

/* ---- Featured image (right under hero) ---- */
.cs-feature {
  padding: var(--s-9) 0;
  border-bottom: 1px solid var(--hairline);
}
.cs-feature .frame {
  border-radius: var(--r-3);
  overflow: hidden;
  background: var(--ink-100);
  box-shadow: var(--shadow-2);
  position: relative;
}
.cs-feature .frame::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 12px);
  mix-blend-mode: overlay;
  pointer-events: none;
}
.cs-feature img {
  width: 100%; height: auto;
  display: block;
}

/* ---- Results strip — big metrics row right under hero image ---- */
.cs-results {
  padding: var(--s-7) 0;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(232,198,140,0.04) 0%, transparent 100%);
}
.cs-results .row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
}
.cs-results .metric {
  display: flex; flex-direction: column; gap: 4px;
  padding-left: var(--s-3);
  border-left: 2px solid var(--accent);
}
.cs-results .metric .v {
  font-family: var(--f-display);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--bone-100);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cs-results .metric .l {
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--bone-400);
  margin-top: 6px;
}
@media (max-width: 760px) {
  .cs-results .row { grid-template-columns: repeat(2, 1fr); gap: var(--s-5); }
}

/* ---- Body section: widget-style stacked blocks ---- */
.cs-body {
  padding: var(--s-9) 0;
  border-bottom: 1px solid var(--hairline);
}
.cs-body .widget-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}
.cs-widget {
  border: 1px solid var(--hairline);
  border-radius: var(--r-3);
  background: var(--ink-100);
  padding: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-4);
}
.cs-widget.span-2 { grid-column: span 2; }
.cs-widget .w-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--hairline);
}
.cs-widget .w-tag {
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.cs-widget .w-title {
  font-family: var(--f-display);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--bone-100);
}
.cs-widget p {
  color: var(--bone-300);
  font-size: 15px; line-height: 1.6;
}
.cs-widget p strong { color: var(--bone-100); font-weight: 500; }
.cs-widget p em { font-family: var(--f-serif); color: var(--accent); font-style: italic; }
.cs-widget .quote-block {
  padding: var(--s-4) var(--s-5);
  background: var(--ink-200);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-family: var(--f-display);
  font-size: 17px; line-height: 1.5;
  color: var(--bone-100);
  font-style: italic;
}
.cs-widget .stack-list {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.cs-widget .stack-list li {
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: .08em;
  color: var(--bone-300);
  padding: 8px 12px;
  background: var(--ink-200);
  border-radius: var(--r-full);
  text-align: center;
}
@media (max-width: 760px) {
  .cs-body .widget-stack { grid-template-columns: 1fr; }
  .cs-widget.span-2 { grid-column: auto; }
  .cs-widget .stack-list { grid-template-columns: 1fr; }
}

/* ---- Gallery — preserves each image's natural aspect ratio ---- */
.cs-gallery {
  padding: var(--s-9) 0;
  border-bottom: 1px solid var(--hairline);
}
.cs-gallery .head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-5); flex-wrap: wrap;
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--hairline);
}
.cs-gallery .head .label {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--bone-400);
  display: flex; align-items: center; gap: var(--s-2);
}
.cs-gallery .head .label::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.cs-gallery .head .note { color: var(--bone-400); font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

/* CSS columns gives a clean masonry where each image keeps its natural
   aspect ratio. Safari/Firefox/Chrome all balance columns the same way. */
.cs-gallery .grid {
  column-count: 2;
  column-gap: var(--s-5);
}
.cs-gallery .grid .item {
  break-inside: avoid;
  margin: 0 0 var(--s-5);
  border-radius: var(--r-3);
  overflow: hidden;
  background: var(--ink-100);
  box-shadow: var(--shadow-2);
  position: relative;
  display: block;
}
.cs-gallery .grid .item::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 12px);
  mix-blend-mode: overlay;
  pointer-events: none;
}
.cs-gallery .grid img {
  width: 100%; height: auto;
  display: block;
  transition: transform .8s var(--ease-out);
}
.cs-gallery .grid .item:hover img { transform: scale(1.015); }

/* When a gallery has a single item, let it span the full column */
.cs-gallery .grid.single { column-count: 1; }

@media (max-width: 700px) {
  .cs-gallery .grid { column-count: 1; }
}

/* ---- Next-project nav ---- */
.cs-next {
  padding: var(--s-10) 0;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--ink-050), #0c0c0e);
}
.cs-next .row {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-5); flex-wrap: wrap;
}
.cs-next .label {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--bone-400);
  margin-bottom: 8px;
}
.cs-next .name {
  font-family: var(--f-display); font-size: clamp(32px, 4.5vw, 64px);
  font-weight: 500; letter-spacing: -0.025em; line-height: 1;
  color: var(--bone-100);
  display: inline-flex; align-items: baseline; gap: 14px;
  transition: color .3s var(--ease-out);
}
.cs-next .name:hover { color: var(--accent); }
.cs-next .name .arrow { font-size: 0.6em; color: var(--accent); }
.cs-next a.back-home {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--bone-300);
  padding: 12px 18px; border: 1px solid var(--hairline-2);
  border-radius: var(--r-full);
  transition: border-color .3s var(--ease-out), color .3s var(--ease-out);
}
.cs-next a.back-home:hover { border-color: var(--accent); color: var(--accent); }
