/* =========================================================
   Work page v5: calmer grid, satin-themed cards,
   and a full case study inside the project viewer
   ========================================================= */

/* ---------- Grid: a little more air ---------- */
.work-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  grid-auto-rows: clamp(160px, 12.5vw, 290px);
  gap: clamp(14px, 1.6vw, 28px);
}

/* ---------- Cards: artwork presented on brown satin ---------- */
.wcard-media {
  background:
    radial-gradient(90% 70% at 50% 112%, rgba(182,154,88,.30), transparent 70%),
    linear-gradient(180deg, rgba(8,6,5,.22), rgba(8,6,5,.6)),
    url("../img/portfolio-decoration/p01-decoration-64-800.webp?v=9") 50% 50% / cover,
    var(--espresso);
}
.wcard-media img {
  position: absolute; inset: 8% 8% 31% 8%; width: 84%; height: 61%;
  object-fit: contain; padding: 0;
  filter: drop-shadow(0 22px 30px rgba(0,0,0,.6));
  transition: transform 1s var(--ease-out);
}
.wcard a:hover .wcard-media img, .wcard a:focus-visible .wcard-media img { transform: translateY(-2%) scale(1.03); }
.wcard-media--device img { inset: 5% 4% 27% 4%; width: 92%; height: 68%; }

/* emails: a tall window that scrolls on hover */
.wcard-media--email img {
  inset: 7% auto auto 50%; width: 50%; height: 62%; translate: -50% 0;
  object-fit: cover; object-position: 50% 0; filter: none; border-radius: 6px;
  box-shadow: 0 26px 50px -18px rgba(0,0,0,.9), 0 0 0 1px rgba(251,231,178,.08);
  transition: object-position 6s linear, transform 1s var(--ease-out);
}
.wcard a:hover .wcard-media--email img, .wcard a:focus-visible .wcard-media--email img { transform: none; object-position: 50% 100%; }

/* FASS social: a fanned trio of posts */
.wcard-media--stack img {
  inset: auto; top: 37%; left: 50%; width: 40%; height: auto; aspect-ratio: 1;
  object-fit: cover; filter: none; border-radius: 10px;
  translate: -50% -50%; box-shadow: 0 26px 50px -18px rgba(0,0,0,.9);
}
.wcard-media--stack img:nth-child(1) { transform: translate(-62%, 4%) rotate(-9deg); }
.wcard-media--stack img:nth-child(2) { transform: translate(62%, 4%) rotate(9deg); }
.wcard-media--stack img:nth-child(3) { z-index: 1; }
.wcard a:hover .wcard-media--stack img:nth-child(1) { transform: translate(-76%, 2%) rotate(-13deg); }
.wcard a:hover .wcard-media--stack img:nth-child(2) { transform: translate(76%, 2%) rotate(13deg); }
.wcard a:hover .wcard-media--stack img:nth-child(3) { transform: translateY(-4%) scale(1.05); }

/* softer scrim: the satin carries the title */
.wcard a::after { inset: 55% 0 0; background: linear-gradient(180deg, transparent, rgba(8,6,5,.82)); }
.wcard-kind .status { margin-right: 8px; vertical-align: 1px; }
.wcard-flag { display: none; }

/* ---------- Project viewer: now a full case study ---------- */
@media (min-width: 960px) {
  .viewer--case .viewer-shell { grid-template-columns: minmax(0, 1.4fr) minmax(400px, 1fr); }
}
.viewer--case .viewer-stage {
  background:
    radial-gradient(70% 70% at 50% 60%, rgba(182,154,88,.16), transparent 70%),
    linear-gradient(180deg, rgba(8,6,5,.55), rgba(8,6,5,.8)),
    url("../img/portfolio-decoration/p01-decoration-64-800.webp?v=9") 50% 50% / cover,
    var(--black);
}
.viewer--case .viewer-info { gap: 0; padding-bottom: 0; }
.viewer--case .viewer-info > * + * { margin-top: 14px; }
.viewer-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.viewer-chips .work-tag { margin: 0; padding: 4px 12px; font-size: .76rem; }
.chip-cat { padding: 4px 12px; border-radius: var(--radius-pill); background: rgba(241,238,227,.06); color: var(--text-dim); font-size: .76rem; }
.viewer--case .viewer-title { font-size: clamp(1.7rem, 1.1rem + 1.8vw, 2.8rem); line-height: .98; margin-top: 18px; }
.viewer--case .viewer-sub { color: var(--text-dim); font-size: var(--step-0); line-height: 1.5; }

.viewer-body { display: grid; gap: 0; }
.vb-sec { display: grid; gap: 12px; padding: 22px 0; border-top: 1px solid var(--line); }
.vb-sec:first-child { border-top: 0; padding-top: 8px; }
.vb-h { font-family: var(--font-display); font-stretch: 125%; font-weight: 700; text-transform: uppercase; font-size: .86rem; letter-spacing: .04em; color: var(--gold-light); }
.vb-p { color: var(--cream); line-height: 1.65; }
.vb-challenge { padding: 14px 16px; border-left: 2px solid var(--gold); background: linear-gradient(90deg, rgba(182,154,88,.12), transparent); line-height: 1.5; }
.vb-challenge small { display: block; color: var(--gold-light); font-size: .74rem; font-weight: 600; margin-bottom: 4px; }
.vb-note { color: var(--text-dim); font-size: .86rem; padding-left: 14px; border-left: 2px solid var(--line-strong); }

/* live / launching soon */
.vb-live {
  display: grid; gap: 10px; justify-items: start;
  padding: 18px; border-radius: 16px;
  background: linear-gradient(150deg, rgba(182,154,88,.2), rgba(34,26,20,.6));
  border: 1px solid var(--glass-edge);
}
.vb-live-title { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; text-transform: uppercase; font-size: 1.15rem; line-height: 1.05; }
.vb-live p { color: var(--text-dim); font-size: .9rem; line-height: 1.55; }
.vb-live .vb-fine { color: var(--text-faint); font-size: .76rem; }
.vb-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.vb-btns .btn { min-height: 44px; padding: 0 18px; font-size: .9rem; }

/* stat */
.vb-stat { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px 18px; border-radius: 16px; background: rgba(46,36,28,.7); border: 1px solid var(--line); }
.vb-stat b {
  font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: clamp(2.2rem, 1.6rem + 1.6vw, 3.2rem); line-height: .9;
  background: linear-gradient(180deg, var(--gold-light), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.vb-stat span { color: var(--text-dim); font-size: .9rem; line-height: 1.45; }

/* lists */
.vb-list { display: grid; }
.vb-list li { position: relative; padding: 9px 0 9px 18px; border-bottom: 1px solid var(--line); font-size: .94rem; }
.vb-list li:last-child { border-bottom: 0; }
.vb-list li::before { content: ""; position: absolute; left: 0; top: 1.15em; width: 8px; height: 1px; background: var(--gold); }
.vb-cards { display: grid; gap: 8px; }
.vb-cards li { padding: 14px 16px; border-radius: 12px; background: rgba(46,36,28,.6); border: 1px solid var(--line); }
.vb-cards b { display: block; font-weight: 600; margin-bottom: 4px; }
.vb-cards span { color: var(--text-dim); font-size: .88rem; line-height: 1.55; }
.vb-steps { display: grid; gap: 8px; counter-reset: s; }
.vb-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 4px 12px; align-items: start; }
.vb-steps li::before {
  counter-increment: s; content: counter(s); grid-row: span 2;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--gold); color: var(--gold-light); font-size: .8rem; font-weight: 600;
}
.vb-steps b { font-weight: 600; }
.vb-steps span { color: var(--text-dim); font-size: .88rem; }

/* site map */
.vb-map { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vb-map > li { padding: 12px 14px; border-radius: 12px; background: rgba(46,36,28,.6); border: 1px solid var(--line); }
.vb-map > li > b { display: block; font-family: var(--font-display); font-stretch: 125%; font-weight: 700; text-transform: uppercase; font-size: .8rem; color: var(--gold-light); margin-bottom: 6px; }
.vb-map ul { display: grid; gap: 3px; }
.vb-map ul li { font-size: .8rem; color: var(--text-dim); line-height: 1.4; }

/* details */
.vb-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; font-size: .9rem; }
.vb-meta dt { color: var(--text-faint); font-size: .78rem; margin-bottom: 2px; }

/* thumbs */
.viewer--case .viewer-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer--case .viewer-thumbs button { width: 58px; height: 58px; }

/* previous / next project: always reachable */
.viewer--case .viewer-projects {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 8px; padding: 14px 0 18px;
  background: linear-gradient(180deg, rgba(29,22,17,0), #1d1611 30%);
}
.viewer-pos { color: var(--text-faint); font-size: .82rem; font-variant-numeric: tabular-nums; }
.viewer--case .viewer-projects .btn { min-height: 44px; padding: 0 16px; font-size: .88rem; }
.viewer--case .viewer-shell { background: #1d1611; }

/* phones + tablets: one scroll, image on top, case study below */
@media (max-width: 959px) {
  .viewer--case .viewer-shell { display: block; overflow-y: auto; overscroll-behavior: contain; }
  .viewer--case .viewer-stage { height: 52vh; height: 52svh; }
  .viewer--case .viewer-info { max-height: none; overflow: visible; border-top: 1px solid var(--line); }
  .viewer--case .viewer-close { position: fixed; top: 22px; right: 22px; }
}

/* =========================================================
   v6: richer case studies in the viewer
   ========================================================= */
/* caption under the current image */
.viewer--case .viewer-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0;
  padding: 40px clamp(16px, 2vw, 28px) 14px; padding-right: 90px;
  background: linear-gradient(180deg, transparent, rgba(8,6,5,.85));
  color: var(--cream); font-size: .86rem; line-height: 1.45; pointer-events: none;
}
.viewer--case .viewer-caption:empty { display: none; }
.viewer--case .viewer-count { left: auto; right: 16px; translate: none; bottom: 12px; z-index: 3; }

/* bigger, easier thumbnails */
.viewer--case .viewer-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.viewer--case .viewer-thumbs button { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; }

.vb-p--dim { color: var(--text-dim); font-size: .95rem; }

/* headline / attribute chips */
.vb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vb-chips li { padding: 7px 14px; border-radius: var(--radius-pill); border: 1px solid rgba(251,231,178,.28); background: rgba(182,154,88,.08); font-size: .84rem; color: var(--cream); }

/* palette swatches */
.vb-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.vb-palette li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(46,36,28,.6); border: 1px solid var(--line); }
.vb-swatch { flex: none; width: 38px; height: 38px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.vb-swatch-text { display: grid; min-width: 0; line-height: 1.25; }
.vb-swatch-text b { font-weight: 600; font-size: .82rem; }
.vb-swatch-text code { font-family: var(--font-body); color: var(--text-faint); font-size: .76rem; letter-spacing: .02em; }

/* typography specimens */
.vb-type { display: grid; gap: 8px; }
.vb-type li { display: flex; align-items: center; gap: 16px; padding: 12px 14px; border-radius: 12px; background: rgba(46,36,28,.6); border: 1px solid var(--line); }
.vb-type-aa { flex: none; width: 52px; text-align: center; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; line-height: 1; color: var(--gold-light); }
.vb-type b { display: block; font-weight: 600; }
.vb-type small { color: var(--text-dim); font-size: .84rem; }

/* email structure and process steps read as a numbered flow */
.vb-steps li { padding-bottom: 6px; }

/* artwork always fits the stage; very tall pieces scroll */
.viewer--case .viewer-scroll { display: flex; align-items: center; justify-content: center; }
.viewer--case .viewer-img { max-width: 100%; max-height: 100%; }
.viewer--case .viewer-img.is-tall { align-self: flex-start; max-height: none; }
/* dark-ink logos get a cream backdrop */
.viewer--case .viewer-stage.is-light .viewer-scroll { background: radial-gradient(80% 80% at 50% 45%, #fbf9f2, var(--cream) 60%, #e2d9c3); }
