/* ==========================================================================
 * Work detail pages — shared styles
 * ========================================================================== */

/* Hero */
.work-hero {
  position: relative; padding: 140px 0 80px;
  overflow: hidden;
}
.work-hero-bg {
  position: absolute; inset: 0; z-index: 0; opacity: 0.22;
  pointer-events: none;   /* let clicks pass through to .work-back / .mf-container */
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, black 40%, transparent 85%);
}
/* Make sure hero content sits above the decorative grid and that the back-link
   is a clickable surface, not hidden under the bg layer. */
.work-hero .mf-container { position: relative; z-index: 1; }
.work-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 36px;
  transition: color 160ms ease;
  position: relative; z-index: 2;
}
.work-back:hover { color: var(--mint); }

.work-head {
  display: grid; grid-template-columns: 1.3fr 1fr;
  gap: 56px; align-items: end;
}
.work-kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 3px; color: var(--mint);
  text-transform: uppercase; margin-bottom: 20px;
  display: inline-flex; align-items: center; gap: 14px;
}
.work-kicker::before { content: ""; width: 36px; height: 1px; background: var(--mint); }
.work-title {
  font-family: 'Playfair Display','Noto Serif SC', serif;
  font-weight: 900; font-size: clamp(40px, 6vw, 96px);
  line-height: 1.02; letter-spacing: -2px; margin: 0;
  overflow-wrap: break-word;
  /* Hard-cap at 2 lines so titles never wall-of-text */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.work-title.keep {
  /* Titles with explicit <br> — keep the break, still clamp to 2 visual lines */
  display: block;
  -webkit-line-clamp: initial;
}
.work-title em { font-style: italic; font-weight: 400; }
.work-tagline {
  font-size: clamp(16px, 1.4vw, 22px);
  color: var(--ink-2); font-weight: 300; line-height: 1.5;
  margin: 22px 0 0; max-width: 620px;
}
.work-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule);
}
.work-meta .cell {
  padding: 22px 24px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.work-meta .l {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 2.5px; color: var(--ink-3);
  text-transform: uppercase; margin-bottom: 8px;
}
.work-meta .v {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.1;
}

/* Hero cover image */
.work-cover {
  margin-top: 64px;
  position: relative;
  aspect-ratio: 21/9;
  border: 1px solid var(--rule); overflow: hidden;
  background: var(--bg-2);
}
.work-cover img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}

/* Overview split */
.work-overview {
  display: grid; grid-template-columns: 1fr 1.3fr;
  gap: 72px; padding: 96px 0;
  border-top: 1px solid var(--rule);
}
.work-overview .sticky-head {
  position: sticky; top: 120px; align-self: start;
}
.work-overview .sticky-head h2 {
  font-family: 'Playfair Display','Noto Serif SC', serif;
  font-weight: 700; font-size: clamp(30px, 3.5vw, 46px);
  line-height: 1.1; letter-spacing: -0.5px; margin: 16px 0 0;
}
.work-overview .body p {
  font-size: 17px; line-height: 1.75; color: var(--ink-2);
  margin: 0 0 22px; max-width: 720px;
}
.work-overview .body p:first-child::first-letter {
  font-family: 'Playfair Display', serif;
  float: left; font-size: 72px; line-height: 0.85;
  font-weight: 900; color: var(--mint);
  padding: 6px 14px 0 0;
}

/* Pillars */
.work-pillars {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
}
.work-pillar {
  padding: 48px 36px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.work-pillar:last-child { border-right: 0; }
.work-pillar .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px; font-weight: 500; color: var(--mint); line-height: 1;
}
.work-pillar h3 {
  font-family: 'Playfair Display', serif;
  font-size: 26px; font-weight: 700;
  margin: 18px 0 10px; color: var(--ink);
}
.work-pillar p {
  font-size: 14px; line-height: 1.7; color: var(--ink-2); margin: 0;
}

/* Gallery */
.work-gallery-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 40px; flex-wrap: wrap; gap: 12px;
  padding-top: 96px;
  border-top: 1px solid var(--rule);
}
.work-gallery-head h2 {
  font-family: 'Playfair Display','Noto Serif SC', serif;
  font-weight: 700; font-size: clamp(32px, 4vw, 52px);
  line-height: 1.1; letter-spacing: -0.5px; margin: 12px 0 0;
}

.work-gallery { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.work-gallery .g {
  position: relative; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--rule); background: var(--bg-2);
  transition: transform 280ms ease, border-color 280ms ease;
}
.work-gallery .g:hover { transform: translateY(-3px); border-color: var(--mint-dim); }
.work-gallery .g img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 500ms cubic-bezier(.2,.8,.2,1);
}
.work-gallery .g:hover img { transform: scale(1.04); }

/* Size variants */
.g-12 { grid-column: span 12; aspect-ratio: 21/9; }
.g-8  { grid-column: span 8;  aspect-ratio: 4/3; }
.g-6  { grid-column: span 6;  aspect-ratio: 4/3; }
.g-4  { grid-column: span 4;  aspect-ratio: 4/5; }
.g-4-wide { grid-column: span 4; aspect-ratio: 4/3; }
.g-3  { grid-column: span 3;  aspect-ratio: 9/16; }
.g-phone { grid-column: span 3; aspect-ratio: 9/19.5; background: #0a0a0a; }
.g-phone img { object-fit: contain; }

/* Featured full-bleed */
.work-feature {
  margin-top: 96px; padding: 96px 0;
  border-top: 1px solid var(--rule);
  background: var(--bg-2);
}
.work-feature-inner {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 72px; align-items: center;
}
.work-feature img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule);
}
.work-feature h3 {
  font-family: 'Playfair Display','Noto Serif SC', serif;
  font-weight: 700; font-size: clamp(30px, 3.5vw, 44px);
  line-height: 1.12; margin: 18px 0;
}
.work-feature p {
  font-size: 16px; line-height: 1.7; color: var(--ink-2); margin: 0 0 16px;
}

/* Next work */
.work-next {
  padding: 96px 0 120px;
  border-top: 1px solid var(--rule);
}
.work-next-link {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 40px; align-items: center;
  padding: 48px 0;
  transition: opacity 220ms ease;
}
.work-next-link:hover { opacity: 0.85; }
.work-next-link .kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 2.5px; color: var(--ink-3);
  text-transform: uppercase; margin-bottom: 14px;
}
.work-next-link .title {
  font-family: 'Playfair Display','Noto Serif SC', serif;
  font-weight: 700; font-size: clamp(36px, 5vw, 72px);
  line-height: 0.98; letter-spacing: -1px; color: var(--ink);
}
.work-next-link .title .arrow {
  display: inline-block; color: var(--mint);
  margin-left: 14px; transition: transform 220ms ease;
}
.work-next-link:hover .title .arrow { transform: translateX(10px); }
.work-next-preview {
  aspect-ratio: 4/3; overflow: hidden;
  border: 1px solid var(--rule);
}
.work-next-preview img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 500ms cubic-bezier(.2,.8,.2,1);
}
.work-next-link:hover .work-next-preview img { transform: scale(1.05); }

/* Lightbox */
.mf-lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.92);
  display: none; align-items: center; justify-content: center;
  padding: 40px;
}
.mf-lightbox.open { display: flex; }
.mf-lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  border: 1px solid var(--rule-strong);
}
.mf-lb-close,
.mf-lb-prev,
.mf-lb-next {
  position: absolute;
  width: 44px; height: 44px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 160ms ease, border-color 160ms ease;
}
.mf-lb-close:hover,
.mf-lb-prev:hover,
.mf-lb-next:hover { background: rgba(26,188,156,0.2); border-color: var(--mint); }
.mf-lb-close { top: 24px; right: 24px; }
.mf-lb-prev  { left: 24px; top: 50%; transform: translateY(-50%); }
.mf-lb-next  { right: 24px; top: 50%; transform: translateY(-50%); }
.mf-lb-close svg, .mf-lb-prev svg, .mf-lb-next svg { width: 18px; height: 18px; }
.mf-lb-count {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 2.5px; color: rgba(255,255,255,0.6);
}

/* Responsive */
@media (max-width: 1040px) {
  .work-head { grid-template-columns: 1fr; gap: 36px; }
  .work-overview { grid-template-columns: 1fr; gap: 32px; }
  .work-overview .sticky-head { position: static; }
  .work-pillars { grid-template-columns: 1fr; }
  .work-pillar { border-right: 0; }
  .work-feature-inner { grid-template-columns: 1fr; gap: 36px; }
  .work-next-link { grid-template-columns: 1fr; gap: 24px; padding: 32px 0; }
  .g-8, .g-6 { grid-column: span 12; aspect-ratio: 4/3; }
  .g-4, .g-4-wide { grid-column: span 6; }
  .g-3 { grid-column: span 6; aspect-ratio: 4/5; }
  .g-phone { grid-column: span 6; aspect-ratio: 9/16; }
}
@media (max-width: 760px) {
  .work-hero { padding: 110px 0 60px; }
  .work-back { margin-bottom: 24px; }
  .work-cover { margin-top: 40px; aspect-ratio: 4/3; }
  .work-overview { padding: 64px 0; }
  .work-overview .body p:first-child::first-letter { font-size: 54px; }
  .work-pillar { padding: 32px 22px; }
  .work-gallery-head { padding-top: 64px; }
  .work-feature { padding: 64px 0; margin-top: 64px; }
  .work-next { padding: 64px 0 80px; }
  .work-gallery { gap: 10px; }
  .g-4, .g-4-wide, .g-3, .g-phone { grid-column: span 6; }
  .g-12 { aspect-ratio: 16/9; }
  .mf-lightbox { padding: 16px; }
  .mf-lb-close, .mf-lb-prev, .mf-lb-next { width: 36px; height: 36px; }
  .mf-lb-prev { left: 12px; }
  .mf-lb-next { right: 12px; }
  .mf-lb-close { top: 16px; right: 16px; }
}
