/* =============================================================================
   SCG Portfolio grid + lightbox
   Design tokens are scoped under .scg-pf so they never leak into PBF globals.
   Ported from the Search Click Grow design system (Montserrat 400/600/800).
   ============================================================================= */

.scg-pf {
  /* Brand trio */
  --scg-blue: #1D73B9;
  --scg-green: #8EC74F;
  --scg-orange: #FFA300;
  --scg-tangerine: #E34325;
  --scg-amber: #F3A91C;

  /* Neutrals */
  --scg-graphite: #3A3A3A;
  --scg-white: #FFFFFF;
  --scg-ink-900: #1A1A1A;
  --scg-ink-500: #6B6C6E;
  --scg-ink-300: #98999B;
  --scg-ink-200: #C9CACB;
  --scg-ink-100: #E7E8E9;
  --scg-ink-50:  #F4F5F6;

  /* Tints */
  --scg-blue-tint: #E8F1F8;
  --scg-green-tint: #EEF6E4;

  /* Hover */
  --scg-blue-hover: #185F99;
  --scg-tangerine-hover: #C7361B;

  /* Semantic */
  --text-heading: #000;
  --text-body: var(--scg-graphite);
  --text-muted: var(--scg-ink-500);
  --brand-primary: var(--scg-blue);
  --surface-card: var(--scg-white);
  --surface-subtle: var(--scg-ink-50);
  --border-subtle: var(--scg-ink-100);
  --border-default: var(--scg-ink-200);

  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(26,26,26,.08), 0 1px 2px rgba(26,26,26,.04);
  --shadow-md: 0 4px 12px rgba(26,26,26,.08), 0 2px 4px rgba(26,26,26,.04);
  --shadow-lg: 0 12px 32px rgba(26,26,26,.10), 0 4px 8px rgba(26,26,26,.04);
  --ease: cubic-bezier(.4,0,.2,1);

  font-family: 'Montserrat','Helvetica Neue',Arial,sans-serif;
  color: var(--text-body);
}

.scg-pf *, .scg-pf *::before, .scg-pf *::after { box-sizing: border-box; }

.scg-pf-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(40px,6vw,72px) clamp(20px,5vw,32px);
}

/* ---- Intro ---- */
.scg-pf-intro { max-width: 680px; margin-bottom: 28px; }
.scg-pf-eyebrow {
  display: inline-block;
  font-weight: 600; font-size: 14px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--brand-primary);
}
.scg-pf-eyebrow--green { color: var(--scg-green); }
.scg-pf-h2 {
  font-size: clamp(28px,4vw,38px); font-weight: 800; line-height: 1.15;
  color: var(--text-heading); margin: 12px 0 10px;
}
.scg-pf-lead { font-size: 17px; line-height: 1.55; color: var(--text-body); margin: 0; }

/* ---- Filter pills ---- */
.scg-pf-filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 32px; overflow-x: auto; padding-bottom: 4px;
}
.scg-pf-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-pill);
  font-family: inherit; font-weight: 600; font-size: 15px; white-space: nowrap;
  cursor: pointer; border: 2px solid var(--brand-primary);
  background: transparent; color: var(--brand-primary);
  transition: background .12s var(--ease), color .12s var(--ease);
}
.scg-pf-pill:hover { background: var(--scg-blue-tint); }
.scg-pf-pill.is-active { background: var(--brand-primary); color: var(--scg-white); }
.scg-pf-count {
  font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-pill);
  background: var(--scg-blue-tint); color: var(--brand-primary);
}
.scg-pf-pill.is-active .scg-pf-count { background: rgba(255,255,255,.22); color: var(--scg-white); }

/* ---- Grid + cards ---- */
.scg-pf-grid {
  display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 24px;
}
.scg-pf-card {
  display: flex; flex-direction: column; text-align: left;
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  overflow: hidden; cursor: pointer; padding: 0; font-family: inherit;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.scg-pf-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }

.scg-pf-media { height: 200px; border-bottom: 1px solid var(--border-subtle); }

/* Website card media — faux browser + screenshot top-crop */
.scg-pf-media--web { display: flex; flex-direction: column; }
.scg-pf-browser-bar {
  height: 32px; flex: none; display: flex; align-items: center; gap: 7px;
  padding: 0 12px; background: var(--surface-card); border-bottom: 1px solid var(--border-subtle);
}
.scg-pf-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--scg-ink-200); }
.scg-pf-url {
  margin-left: 8px; flex: 1; font-size: 11px; color: var(--text-muted);
  background: var(--surface-subtle); border-radius: var(--radius-pill);
  padding: 3px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scg-pf-shot {
  flex: 1; background: var(--scg-blue-tint) center top / cover no-repeat;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.scg-pf-shot-fallback { font-weight: 800; font-size: 21px; line-height: 1.2; color: var(--brand-primary); text-align: center; }

/* Branding card media — logo tile on tint */
.scg-pf-media--brand {
  display: flex; align-items: center; justify-content: center;
  background: var(--scg-ink-50);
}
.scg-pf-logo-tile {
  width: 74px; height: 74px; border-radius: var(--radius-md); background: var(--surface-card);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); padding: 12px;
}
.scg-pf-media--brand .scg-pf-logo-tile { width: auto; min-width: 74px; max-width: 70%; height: auto; max-height: 120px; }
.scg-pf-logo-tile img { max-width: 100%; max-height: 96px; object-fit: contain; display: block; }
.scg-pf-logo-fallback { font-weight: 800; font-size: 30px; color: var(--scg-pf-brand, var(--brand-primary)); }

/* Case study card media — dark outcome field */
.scg-pf-media--case {
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 24px; background: var(--scg-ink-900);
}
.scg-pf-stat { font-weight: 800; font-size: 36px; line-height: 1.02; color: var(--scg-white); }
.scg-pf-stat-label { font-size: 14px; color: var(--scg-ink-200); }

/* Card body */
.scg-pf-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.scg-pf-tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scg-pf-badge {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill);
  text-transform: none;
}
.scg-pf-badge--info { background: var(--scg-blue-tint); color: var(--brand-primary); }
.scg-pf-badge--success { background: var(--scg-green-tint); color: #5a8a2f; }
.scg-pf-badge--neutral { background: var(--scg-ink-100); color: var(--scg-ink-500); }
.scg-pf-tier { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.scg-pf-card-title { font-size: 20px; font-weight: 600; line-height: 1.2; color: var(--text-heading); margin: 2px 0 0; }
.scg-pf-card-meta { font-size: 14px; color: var(--text-muted); line-height: 1.45; }
.scg-pf-cta-link { margin-top: auto; padding-top: 8px; font-weight: 600; font-size: 15px; color: var(--brand-primary); }
.scg-pf-empty { color: var(--text-muted); }

/* ---- Lightbox ---- */
.scg-pf-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(26,26,26,.62); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(16px,4vw,48px); overflow-y: auto;
}
.scg-pf-lightbox[hidden] { display: none; }
.scg-pf-lb-panel {
  position: relative; width: 100%; max-width: 860px; margin: auto;
  background: var(--surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.scg-pf-lb-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.92); color: var(--text-heading);
  font-size: 24px; line-height: 1; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm);
}

/* Lightbox media — website */
.scg-pf-lb-browser { display: flex; flex-direction: column; border-bottom: 1px solid var(--border-subtle); }
.scg-pf-lb-browser-bar {
  height: 42px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px;
  background: var(--surface-subtle); border-bottom: 1px solid var(--border-subtle);
}
.scg-pf-lb-browser-bar .scg-pf-dot { width: 11px; height: 11px; }
.scg-pf-lb-url {
  margin-left: 10px; flex: 1; max-width: 360px; font-size: 12px; color: var(--text-muted);
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  padding: 5px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scg-pf-lb-shot-wrap { max-height: 60vh; overflow-y: auto; background: var(--scg-ink-50); }
.scg-pf-lb-shot-wrap img { display: block; width: 100%; height: auto; }

/* Lightbox media — branding */
.scg-pf-lb-brand {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: clamp(36px,6vw,60px) 24px; border-bottom: 1px solid var(--border-subtle); background: var(--scg-ink-50);
}
.scg-pf-lb-logo-tile {
  background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  padding: 24px; display: flex; align-items: center; justify-content: center;
}
.scg-pf-lb-logo-tile img { max-width: 280px; max-height: 160px; object-fit: contain; display: block; }

/* Lightbox body */
.scg-pf-lb-body { padding: clamp(22px,3vw,34px); display: flex; flex-direction: column; gap: 14px; }
.scg-pf-lb-tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scg-pf-lb-title { font-size: clamp(24px,3.4vw,30px); font-weight: 800; line-height: 1.15; color: var(--text-heading); margin: 0; }
.scg-pf-lb-meta { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.scg-pf-lb-blurb { font-size: 16px; line-height: 1.6; color: var(--text-body); margin: 0; }
.scg-pf-lb-gallery { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: 12px; }
.scg-pf-lb-gallery img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: var(--surface-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
}
.scg-pf-lb-note {
  display: flex; align-items: center; gap: 10px; background: var(--surface-subtle);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: 12px 14px; font-size: 13.5px; color: var(--text-body);
}
.scg-pf-lb-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

/* Buttons */
.scg-pf-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px; border-radius: var(--radius-md); border: none;
  font-family: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  text-decoration: none; transition: background .12s var(--ease);
}
.scg-pf-btn--accent { background: var(--scg-tangerine); color: #fff; text-transform: uppercase; letter-spacing: .04em; }
.scg-pf-btn--accent:hover { background: var(--scg-tangerine-hover); color: #fff; }
.scg-pf-btn--primary { background: var(--brand-primary); color: #fff; }
.scg-pf-btn--primary:hover { background: var(--scg-blue-hover); color: #fff; }

@media (max-width: 600px) {
  .scg-pf-grid { grid-template-columns: 1fr; }
}


/* === v1.2.1 full-width branding overrides === */
.scg-pf-media--brand { display: block; background: var(--surface-subtle); }
.scg-pf-media--brand .scg-pf-logo-tile { width:100%; height:100%; min-width:0; max-width:none; max-height:none; padding:0; border-radius:0; background:transparent; box-shadow:none; display:flex; align-items:center; justify-content:center; }
.scg-pf-media--brand .scg-pf-logo-tile img { width:100%; height:100%; max-width:none; max-height:none; object-fit:cover; display:block; }
.scg-pf-lb-brand { padding:0; }
.scg-pf-lb-logo-tile { width:100%; padding:0; border-radius:0; background:transparent; box-shadow:none; display:block; }
.scg-pf-lb-logo-tile img { width:100%; max-width:none; max-height:none; height:auto; object-fit:contain; display:block; }


/* === v1.2.2 gallery sizing === */
.scg-pf-lb-gallery { grid-template-columns: repeat(auto-fit, minmax(140px, 200px)); justify-content: start; }


/* === v1.2.4 featured mini-grid === */
.scg-pf-grid--featured { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.scg-pf-featured-cta { margin-top: 28px; text-align: center; }
