@layer tokens, base, components, sections, page, utility;

/* ============================================================
   PPCBud — editorial (v5.5)
   Case study archive + single, blog index + article.
   ============================================================ */

@layer page {

  /* ==========================================================
     CASE STUDY — archive
     ========================================================== */
  .pb-cs-feature {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 0;
    border: 1px solid var(--pb-line);
    border-radius: var(--pb-r-lg);
    overflow: hidden;
    text-decoration: none;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
  }
  .pb-cs-feature:hover { border-color: var(--pb-navy); box-shadow: var(--pb-shadow-lg); }
  .pb-cs-feature-body { padding: 38px 40px; }
  .pb-cs-feature-body h2 { margin: 0 0 12px; font-size: clamp(24px, 2.6vw, 34px); }
  .pb-cs-feature-body p { color: var(--pb-slate); max-width: 54ch; }

  .pb-cs-feature-metrics {
    background: var(--pb-navy);
    padding: 34px;
    display: grid;
    align-content: center;
    gap: 22px;
  }
  .pb-cs-metric b {
    display: block;
    font-family: var(--pb-font-data);
    font-size: 34px;
    font-weight: 500;
    color: var(--pb-brand);
    line-height: 1;
    letter-spacing: -.02em;
  }
  .pb-cs-metric span { display: block; margin-top: 6px; font-size: 12.5px; color: #C3D3EA; }

  .pb-cs-meta {
    font-family: var(--pb-font-data);
    font-size: 12px;
    color: var(--pb-faint);
    margin: 14px 0 16px !important;
  }

  .pb-cs-filters { display: flex; flex-wrap: wrap; gap: 9px; }
  .pb-cs-filters .pb-badge { text-decoration: none; }
  .pb-cs-filters .pb-badge.is-on {
    background: var(--pb-navy); border-color: var(--pb-navy); color: #fff;
  }

  .pb-cs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
  }
  .pb-cs-card {
    display: block;
    border: 1px solid var(--pb-line);
    border-radius: var(--pb-r);
    padding: 26px;
    background: #fff;
    text-decoration: none;
    transition: border-color .18s ease, transform .18s ease;
  }
  .pb-cs-card:hover { border-color: var(--pb-navy); transform: translateY(-2px); }
  .pb-cs-card h3 { margin: 0 0 8px; }
  .pb-cs-card p { font-size: 14.5px; color: var(--pb-slate); margin: 0; }
  .pb-cs-card-metric { margin-bottom: 16px; }
  .pb-cs-card-metric b {
    display: block;
    font-family: var(--pb-font-data);
    font-size: 30px;
    font-weight: 500;
    color: var(--pb-navy);
    line-height: 1;
    letter-spacing: -.02em;
  }
  .pb-cs-card-metric span {
    display: block; margin-top: 5px; font-size: 11.5px;
    letter-spacing: .06em; text-transform: uppercase; color: var(--pb-faint);
  }

  /* ==========================================================
     CASE STUDY — single
     ========================================================== */
  .pb-cs-result-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
  }
  .pb-cs-result b {
    display: block;
    font-family: var(--pb-font-data);
    font-size: clamp(38px, 5vw, 56px);
    font-weight: 500;
    color: var(--pb-brand);
    line-height: 1;
    letter-spacing: -.03em;
  }
  .pb-cs-result span { display: block; margin-top: 10px; font-size: 13.5px; color: #C3D3EA; }

  .pb-cs-layout { display: grid; grid-template-columns: 260px 1fr; gap: 54px; align-items: start; }
  .pb-cs-facts {
    position: sticky; top: 92px;
    border: 1px solid var(--pb-line);
    border-radius: var(--pb-r);
    padding: 24px;
    background: var(--pb-mist);
  }
  .pb-cs-facts-h { font-size: 12px !important; letter-spacing: .14em; text-transform: uppercase;
    color: var(--pb-faint); margin: 0 0 14px !important; font-family: var(--pb-font-data); font-weight: 500; }
  .pb-cs-facts dl { margin: 0 0 20px; }
  .pb-cs-facts dt {
    font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--pb-faint); margin-top: 14px;
  }
  .pb-cs-facts dd { margin: 3px 0 0; font-size: 15px; font-weight: 600; color: var(--pb-ink); }

  .pb-cs-body { max-width: 68ch; }
  .pb-cs-body h2 { margin: 42px 0 14px; font-size: clamp(23px, 2.4vw, 30px); }
  .pb-cs-body h2:first-child { margin-top: 0; }
  .pb-cs-body p { color: var(--pb-body); }

  .pb-cs-quote {
    margin: 34px 0;
    padding: 26px 30px;
    border-left: 3px solid var(--pb-brand);
    background: var(--pb-mist);
    border-radius: 0 var(--pb-r) var(--pb-r) 0;
  }
  .pb-cs-quote p { font-size: 18.5px; line-height: 1.6; color: var(--pb-ink); margin: 0 0 12px; }
  .pb-cs-quote cite { font-style: normal; font-size: 13px; color: var(--pb-faint); font-family: var(--pb-font-data); }

  /* ==========================================================
     BLOG — index
     ========================================================== */
  .pb-lead-post {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 0;
    border: 1px solid var(--pb-line);
    border-radius: var(--pb-r-lg);
    overflow: hidden;
    background: #fff;
    text-decoration: none;
    margin-bottom: 26px;
    transition: border-color .18s ease, box-shadow .18s ease;
  }
  .pb-lead-post:hover { border-color: var(--pb-navy); box-shadow: var(--pb-shadow-lg); }
  .pb-lead-post-img { overflow: hidden; }
  .pb-lead-post-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pb-lead-post-body { padding: 40px; align-self: center; }
  .pb-lead-post-body h2 { margin: 0 0 14px; font-size: clamp(24px, 2.8vw, 36px); }
  .pb-lead-post-body p { color: var(--pb-slate); max-width: 52ch; }

  .pb-post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
  }
  .pb-post-card {
    display: flex; flex-direction: column;
    border: 1px solid var(--pb-line);
    border-radius: var(--pb-r);
    overflow: hidden;
    background: #fff;
    text-decoration: none;
    transition: border-color .18s ease, transform .18s ease;
  }
  .pb-post-card:hover { border-color: var(--pb-navy); transform: translateY(-2px); }
  .pb-post-card-img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--pb-mist); }
  .pb-post-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pb-post-card-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
  .pb-post-card h3 { margin: 0 0 8px; font-size: 18px; }
  .pb-post-card p { font-size: 14.5px; color: var(--pb-slate); margin: 0; }
  .pb-post-cat {
    font-family: var(--pb-font-data); font-size: 11px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--pb-brand-deep); margin: 0 0 9px !important;
  }
  .pb-post-meta {
    font-family: var(--pb-font-data); font-size: 11.5px;
    color: var(--pb-faint); margin: 14px 0 0 !important;
  }
  .pb-post-card .pb-post-meta { margin-top: auto !important; padding-top: 14px; }

  /* ==========================================================
     BLOG — article
     ========================================================== */
  .pb-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; background: transparent; }
  .pb-progress i { display: block; height: 100%; width: 0; background: var(--pb-brand); transition: width .08s linear; }

  .pb-article-hero { padding-bottom: 34px; }
  .pb-article-hero .pb-page-h1 { max-width: 20ch; }
  .pb-article-hero .pb-lead { max-width: 60ch; }

  .pb-byline { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
  .pb-byline-av img { border-radius: 50%; display: block; }
  .pb-byline b { display: block; font-size: 14.5px; color: var(--pb-ink); }
  .pb-byline i {
    display: block; font-style: normal; font-family: var(--pb-font-data);
    font-size: 12px; color: var(--pb-faint); margin-top: 2px;
  }

  .pb-article-img { margin: 0 auto 8px; }
  .pb-article-img img { width: 100%; border-radius: var(--pb-r-lg); display: block; }

  .pb-article-body { max-width: 70ch; margin: 0 auto; padding: 44px 0 20px; font-size: 17px; line-height: 1.75; }
  .pb-article-body h2 { margin: 44px 0 14px; }
  .pb-article-body h3 { margin: 32px 0 10px; }
  .pb-article-body > p:first-child { font-size: 19px; color: var(--pb-ink); }

  .pb-article-tags { margin: 34px 0 0; }
  .pb-article-tags .pb-badge { text-decoration: none; font-size: 12.5px; padding: 7px 14px; }

  .pb-share {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--pb-line);
    font-family: var(--pb-font-data); font-size: 12.5px;
  }
  .pb-share span { color: var(--pb-faint); letter-spacing: .1em; text-transform: uppercase; }
  .pb-share a { color: var(--pb-navy); font-weight: 600; text-decoration: none; }
  .pb-share a:hover { text-decoration: underline; }

  .pb-author {
    display: flex; gap: 16px; margin-top: 34px; padding: 24px;
    background: var(--pb-mist); border-radius: var(--pb-r); align-items: flex-start;
  }
  .pb-author img { border-radius: 50%; flex: none; }
  .pb-author b { display: block; font-size: 15px; color: var(--pb-ink); margin-bottom: 5px; }
  .pb-author p { margin: 0; font-size: 14px; color: var(--pb-slate); }
}

@layer utility {
  @media (max-width: 900px) {
    .pb-cs-layout { grid-template-columns: 1fr; gap: 30px; }
    .pb-cs-facts { position: static; }
  }
  @media (max-width: 820px) {
    .pb-cs-feature, .pb-lead-post { grid-template-columns: 1fr; }
    .pb-cs-feature-body, .pb-lead-post-body { padding: 28px 24px; }
    .pb-cs-feature-metrics { padding: 26px 24px; grid-auto-flow: column; gap: 18px; }
    .pb-lead-post-img { aspect-ratio: 16 / 9; }
  }
  @media (max-width: 640px) {
    .pb-cs-grid, .pb-post-grid { grid-template-columns: 1fr; }
    .pb-cs-feature-metrics { grid-auto-flow: row; }
    .pb-cs-result-row { grid-template-columns: 1fr 1fr; gap: 20px; }
    .pb-article-body { font-size: 16.5px; padding-top: 30px; }
    .pb-article-body > p:first-child { font-size: 17.5px; }
    .pb-progress { display: none; }
  }
}
