/* ═══════════════════════════════════════════════════════════════
   resources.css — LiquidPixels Resources page styles
   ═══════════════════════════════════════════════════════════════
   Loading order: global.css → hero.css → closing-section.css → this
   global.css owns: tokens, reset, .wrap, .rv, nav, footer
   hero.css owns:   .page-hero (DO NOT override)
   closing-section.css owns: .closing-section (DO NOT override)
   This file owns:  buttons, library, reader, print, responsive
   ─────────────────────────────────────────────────────────────── */

/* ── Horizontal-scroll safety net ──────────────────────────────── */
html, body { max-width: 100%; overflow-x: hidden; }

/* ═══════════════════════════════════════════════════════
   HEADING BASELINE
   global.css has no bare h1/h2/h3 rules — without this the
   browser would pick Times New Roman. Every f-serif rule
   below also pins font-weight: 400 because Instrument Serif
   ships only at weight 400 — anything else triggers fake bold.
   ═══════════════════════════════════════════════════════ */
h1, h2, h3, h4 {
  font-family: var(--f-serif);
  font-weight: 400;
  color: var(--ink-900);
  line-height: 1.1;
  letter-spacing: -.02em;
}

/* ═══════════════════════════════════════════════════════
   SHARED COMPONENTS not in global.css
   home.css defines these on the homepage; pages not loading
   home.css need them defined locally.
   ═══════════════════════════════════════════════════════ */
.btn-primary {
  font-family: var(--f-sans);
  font-size: 13.5px; font-weight: 500; letter-spacing: -.01em;
  padding: 11px 28px; border-radius: var(--r-sm);
  background: var(--navy); color: #fff; border: none;
  box-shadow: 0 1px 2px rgba(12,31,61,.2), 0 4px 16px rgba(12,31,61,.16);
  transition: background .2s, transform .1s, box-shadow .2s;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  min-height: 44px;--amber:#f59e0b;}
.btn-primary:hover { background: var(--navy-mid);--amber:#f59e0b;}
.btn-primary:active { transform: scale(.98); }
.btn-primary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.btn-secondary {
  font-family: var(--f-sans);
  font-size: 13.5px; font-weight: 400; letter-spacing: -.01em;
  padding: 11px 28px; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-600);
  border: 1px solid var(--warm-300);
  transition: color .18s, border-color .18s, background .18s;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  min-height: 44px;
}
.btn-secondary:hover { color: var(--ink-900); border-color: var(--warm-400); background: var(--warm-50); }
.btn-secondary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.section-tag {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase;
  display: block; margin-bottom: 10px; color: var(--amber);
}

.hc-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink-900); border: 2px solid var(--warm-300);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  transition: background .2s, border-color .2s, transform .15s;--amber:#f59e0b;}
.hc-btn:hover { transform: scale(1.08); border-color: var(--white); }
.hc-btn svg { width: 18px; height: 18px; color: var(--warm-200); }

/* ═══════════════════════════════════════════════════════
   LIBRARY
   ═══════════════════════════════════════════════════════ */
.wp-library {
  padding: 80px 0 100px;
  background: var(--off-white);
  position: relative;
  overflow: hidden;
}

.wp-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 48px;
}
.wp-filter-label {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-400);
  margin-right: 4px;
}
.wp-filter-btn {
  font-family: var(--f-sans); font-size: 12px; font-weight: 500;
  padding: 8px 14px; border-radius: 20px;
  border: 1px solid var(--warm-200); background: var(--white);
  color: var(--ink-500); cursor: pointer; transition: all .15s;
  min-height: 36px;
}
.wp-filter-btn:hover { border-color: var(--warm-300); color: var(--ink-900); }
.wp-filter-btn.active { background: var(--ink-900); border-color: var(--ink-900); color: var(--white);--amber:#f59e0b;}
.wp-filter-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.wp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.wp-grid-empty {
  grid-column: 1 / -1;
  font-size: 14px; font-weight: 300;
  color: var(--ink-400); padding: 40px 0;
}

.wp-card {
  background: var(--white); border: 1px solid var(--warm-200);
  border-radius: var(--r-xl); overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  min-width: 0;
}
.wp-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--warm-300); }
.wp-card:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.wp-card-cover {
  height: 144px; position: relative;
  display: flex; align-items: flex-end; padding: 20px;
  overflow: hidden; flex-shrink: 0;
}
.wp-card-cover-pattern {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 24px 24px;
}
.wp-card-cover-accent {
  position: absolute; top: -30px; right: -30px;
  width: 140px; height: 140px; border-radius: 50%; opacity: .15;
}
.wp-card-tag {
  position: relative; z-index: 2;
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.65); background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14); padding: 4px 10px; border-radius: 3px;
}
.wp-card-body {
  padding: 22px 24px 24px;
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
}
.wp-card-title {
  font-family: var(--f-serif); font-weight: 400;
  font-size: 18px; line-height: 1.2; color: var(--ink-900);
  margin-bottom: 10px;
  word-wrap: break-word; overflow-wrap: break-word;
}
.wp-card-desc {
  font-size: 13px; font-weight: 300; line-height: 1.65;
  color: var(--ink-500); flex: 1; margin-bottom: 20px;
}
.wp-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; border-top: 1px solid var(--warm-100);
  gap: 12px;
}
.wp-card-date {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-400);
}
.wp-card-read {
  font-size: 11px; font-weight: 500; color: var(--amber);
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.wp-card-read svg { width: 10px; height: 10px; }

/* ═══════════════════════════════════════════════════════
   READER
   ═══════════════════════════════════════════════════════ */
.wp-reader {
  display: none;
  position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
  z-index: 900; background: var(--off-white);
  overflow: hidden;
}
.wp-reader.open { display: flex; flex-direction: column; }

.wp-reader-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.wp-toc {
  width: 260px; background: var(--white);
  border-right: 1px solid var(--warm-200);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
}
.wp-reader-back {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 14px 20px;
  font-family: var(--f-sans);
  font-size: 12px; font-weight: 500; color: var(--ink-500);
  background: none; border: none; border-bottom: 1px solid var(--warm-100);
  cursor: pointer; transition: color .15s, background .15s;
  text-align: left; flex-shrink: 0;
  min-height: 44px;
}
.wp-reader-back:hover { color: var(--ink-900); background: var(--warm-50); }
.wp-reader-back svg { width: 12px; height: 12px; flex-shrink: 0; }
.wp-toc-label { display: none; }
.wp-toc-items { flex: 1; overflow-y: auto; padding: 6px 0; }
.wp-toc-section {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 10px 20px;
  cursor: pointer; transition: background .12s;
  border-left: 2px solid transparent;
  text-decoration: none;
  min-height: 44px;
}
.wp-toc-section:hover { background: var(--warm-50); }
.wp-toc-section.active { border-left-color: var(--amber); background: var(--amber-soft); }
.wp-toc-num {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  color: var(--ink-400); padding-top: 3px; flex-shrink: 0; width: 16px;
}
.wp-toc-text {
  font-family: var(--f-sans);
  font-size: 12.5px; font-weight: 400; color: var(--ink-600); line-height: 1.45;
}
.wp-toc-section.active .wp-toc-text { color: var(--ink-900); font-weight: 500; }
.wp-toc-section.active .wp-toc-num { color: var(--amber); }

.wp-toc-actions {
  flex-shrink: 0;
  border-top: 1px solid var(--warm-100);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.wp-toc-action-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px;
  border-radius: var(--r-sm);
  font-family: var(--f-sans); font-size: 12px; font-weight: 400; color: var(--ink-600);
  background: none; border: none; cursor: pointer;
  transition: background .12s, color .12s; text-align: left;
  min-height: 40px;
}
.wp-toc-action-btn:hover { background: var(--warm-50); color: var(--ink-900); }
.wp-toc-action-btn svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--ink-400); }

/* ── Mobile TOC trigger (hidden on desktop) ── */
.wp-toc-mobile-toggle {
  display: none;
  position: absolute; top: 12px; left: 16px; z-index: 5;
  align-items: center; gap: 8px;
  padding: 10px 14px;
  font-family: var(--f-sans); font-size: 12px; font-weight: 500;
  background: var(--white); color: var(--ink-700);
  border: 1px solid var(--warm-200); border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm); cursor: pointer;
  min-height: 40px;
}
.wp-toc-mobile-toggle svg { width: 13px; height: 13px; }

.wp-content-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.wp-document {
  max-width: 800px; margin: 0 auto;
  padding: 64px 72px 120px;
  word-wrap: break-word; overflow-wrap: break-word;
}

/* ═══════════════════════════════════════════════════════
   DOCUMENT — cover, sections, callouts, code, metrics, etc.
   ═══════════════════════════════════════════════════════ */
.wp-doc-cover {
  background: var(--navy); border-radius: var(--r-xl);
  padding: 56px 60px; margin-bottom: 64px;
  position: relative; overflow: hidden;--amber:#f59e0b;}
.wp-doc-cover::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 32px 32px;
}
.wp-doc-cover::after {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 280px; height: 280px; border-radius: 50%;
  background: var(--amber); opacity: .08; pointer-events: none;
}
.wp-doc-cover-inner { position: relative; z-index: 1; }
.wp-doc-cover-tag {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--amber);
  margin-bottom: 20px; display: block;
}
.wp-doc-cover h1 {
  font-family: var(--f-serif); font-weight: 400;
  font-size: clamp(28px, 3.6vw, 46px); line-height: 1.06;
  color: var(--white); margin-bottom: 20px; max-width: 560px;
}
.wp-doc-cover-desc {
  font-size: 14px; font-weight: 300; line-height: 1.7;
  color: rgba(255,255,255,.82); max-width: 520px; margin-bottom: 28px;
}
.wp-doc-cover-meta {
  display: flex; align-items: center; gap: 28px;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1);
  flex-wrap: wrap;
}
.wp-doc-cover-meta-item { display: flex; flex-direction: column; gap: 4px; }
.wp-doc-cover-meta-label {
  font-family: var(--f-mono); font-size: 8px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.45);
}
.wp-doc-cover-meta-value {
  font-family: var(--f-sans);
  font-size: 13px; font-weight: 400; color: rgba(255,255,255,.92);
}

.wp-section {
  scroll-margin-top: 80px;
  margin-bottom: 56px; padding-bottom: 56px;
  border-bottom: 1px solid var(--warm-100);
}
.wp-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.wp-section-header {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 28px; padding-bottom: 16px;
  border-bottom: 1px solid var(--warm-100);
}
.wp-section-num {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .1em; color: var(--amber); flex-shrink: 0; padding-top: 4px;
}
.wp-section h2 {
  font-family: var(--f-serif); font-weight: 400;
  font-size: clamp(24px, 2.8vw, 34px); line-height: 1.08;
  color: var(--ink-900);
}
.wp-section p {
  font-size: 15px; font-weight: 300; line-height: 1.8;
  color: var(--ink-700); margin-bottom: 20px;
}
.wp-section p:last-child { margin-bottom: 0; }
.wp-section-subhead {
  font-family: var(--f-serif); font-weight: 400;
  font-size: 19px; color: var(--ink-900);
  margin: 32px 0 12px; line-height: 1.2;
}

.wp-callout {
  background: var(--warm-50); border-left: 3px solid var(--amber);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 22px 28px; margin: 32px 0;
}
.wp-callout p {
  font-family: var(--f-serif); font-weight: 400;
  font-size: 20px; line-height: 1.5; color: var(--ink-900);
  margin: 0;
}

.wp-code-block {
  background: var(--ink-900); border-radius: var(--r-lg);
  padding: 24px 28px; margin: 24px 0;
  position: relative; overflow: hidden;--amber:#f59e0b;}
.wp-code-block::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg, var(--amber) 0%, transparent 60%);
}
.wp-code-label {
  display: block;
  font-family: var(--f-mono); font-size: 8px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.3); margin-bottom: 14px;
}
.wp-code-block code {
  font-family: var(--f-mono); font-size: 12.5px; font-weight: 400;
  color: rgba(255,255,255,.85); line-height: 1.75;
  display: block; white-space: pre-wrap; word-break: break-all;
}

.wp-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; margin: 28px 0;
}
.wp-insight-card {
  background: var(--white); border: 1px solid var(--warm-200);
  border-radius: var(--r-lg); padding: 24px;
  min-width: 0;
}
.wp-insight-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--amber-soft);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; color: var(--amber);
}
.wp-insight-icon svg { width: 16px; height: 16px; }
.wp-insight-title {
  font-family: var(--f-sans);
  font-size: 13px; font-weight: 600; color: var(--ink-900);
  margin-bottom: 7px; line-height: 1.3;
}
.wp-insight-body {
  font-size: 13px; font-weight: 300; line-height: 1.65; color: var(--ink-600);
}

.wp-signal-list { display: flex; flex-direction: column; gap: 8px; margin: 24px 0; }
.wp-signal-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px;
  background: var(--white); border: 1px solid var(--warm-200);
  border-radius: var(--r-md);
}
.wp-signal-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber); flex-shrink: 0; margin-top: 8px;
}
.wp-signal-text { font-size: 14px; font-weight: 300; line-height: 1.7; color: var(--ink-600); }
.wp-signal-text strong { font-weight: 600; color: var(--ink-900); }

.wp-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin: 28px 0;
}
.wp-metric {
  background: var(--navy); border-radius: var(--r-lg);
  padding: 28px 22px; text-align: center;
  position: relative; overflow: hidden;
  min-width: 0;--amber:#f59e0b;}
.wp-metric::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--amber); opacity: .1;
}
.wp-metric-num {
  font-family: var(--f-serif); font-weight: 400;
  font-size: 40px; line-height: 1;
  color: var(--white); margin-bottom: 10px;
}
.wp-metric-label {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.48); line-height: 1.55;
}
.wp-metrics-note {
  font-size: 11px; font-weight: 300; line-height: 1.6;
  color: var(--ink-400); margin-top: -16px; margin-bottom: 28px;
}

/* ── Print preview modal ── */
.wp-print-preview {
  display: none;
  position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
  z-index: 950;
  background: rgba(14,14,12,.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 32px;
}
.wp-print-preview.open { display: flex; }
.wp-print-preview-panel {
  background: var(--white); border-radius: var(--r-xl);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.wp-print-preview-header {
  padding: 24px 28px; border-bottom: 1px solid var(--warm-100);
  display: flex; align-items: center; justify-content: space-between;
}
.wp-print-preview-header h3 {
  font-family: var(--f-serif); font-weight: 400;
  font-size: 21px; color: var(--ink-900);
}
.wp-preview-close {
  width: 36px; height: 36px;
  background: var(--warm-50); border: none; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--ink-500); transition: background .15s;
}
.wp-preview-close:hover { background: var(--warm-100); }
.wp-preview-close svg { width: 12px; height: 12px; }
.wp-print-options {
  padding: 20px 28px;
  display: flex; flex-direction: column; gap: 10px;
}
.wp-print-option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px;
  border: 1px solid var(--warm-200); border-radius: var(--r-lg);
  cursor: pointer; transition: all .15s;
  min-width: 0;
}
.wp-print-option:hover { border-color: var(--warm-300); background: var(--warm-50); }
.wp-print-option.selected { border-color: var(--ink-900); background: var(--warm-50); }
.wp-print-option-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--warm-100);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--ink-600);
}
.wp-print-option.selected .wp-print-option-icon { background: var(--ink-900); color: var(--white);--amber:#f59e0b;}
.wp-print-option-icon svg { width: 16px; height: 16px; }
.wp-print-option-title {
  font-family: var(--f-sans);
  font-size: 13px; font-weight: 600; color: var(--ink-900);
  margin-bottom: 3px;
}
.wp-print-option-desc {
  font-size: 12px; font-weight: 300; line-height: 1.5; color: var(--ink-500);
}
.wp-print-actions {
  padding: 20px 28px; border-top: 1px solid var(--warm-100);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── Metrics block (case studies) ──
   Uses parent scoping so .wp-metric inside .wp-metrics-block
   gets bordered-block styling instead of the navy card style.   */
.wp-metrics-block {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px; margin: 0 0 40px;
  border: 1px solid var(--warm-200); border-radius: var(--r-lg);
  overflow: hidden;
}
.wp-metrics-block .wp-metric {
  padding: 28px 24px; background: var(--white);
  border-radius: 0;
  text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}
.wp-metrics-block .wp-metric::before { display: none; }
.wp-metrics-block .wp-metric + .wp-metric { border-left: 1px solid var(--warm-200); }
.wp-metrics-block .wp-metric-num {
  font-family: var(--f-serif); font-weight: 400;
  font-size: 56px; line-height: 1; color: var(--ink-900);
  margin-bottom: 0;
}
.wp-metrics-block .wp-metric-label {
  font-family: var(--f-sans);
  font-size: 12px; font-weight: 400; line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-600); max-width: 180px;
}

/* ── Render grid placeholder ── */
.wp-render-grid-placeholder {
  margin: 24px 0 0;
  border: 1px dashed var(--warm-300); border-radius: var(--r-md);
  background: var(--warm-50);
  padding: 16px 20px;
  display: flex; align-items: center;
}
.wp-render-grid-placeholder-inner { text-align: center; }
.wp-render-grid-label {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400);
}

/* ── Pull quote (case studies) ── */
.wp-quote-block {
  margin: 40px 0;
  padding: 32px 36px;
  background: var(--navy); border-radius: var(--r-xl);--amber:#f59e0b;}
.wp-quote-text {
  font-family: var(--f-serif); font-weight: 400;
  font-size: clamp(19px, 2.2vw, 26px); line-height: 1.45;
  color: var(--white); margin: 0 0 20px;
}
.wp-quote-attr {
  font-family: var(--f-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.5);
}

/* ── Client logo slot ── */
.wp-client-logo {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 32px; padding-bottom: 32px;
  border-bottom: 1px solid var(--warm-200);
  flex-wrap: wrap;
}
.wp-client-logo img { height: 32px; width: auto; display: block; max-width: 100%; }
.wp-client-logo-placeholder { height: 32px; display: flex; align-items: center; }
.wp-client-logo-placeholder span {
  font-family: var(--f-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400);
  border: 1px dashed var(--warm-300); padding: 6px 12px; border-radius: var(--r-sm);
}

/* ═══════════════════════════════════════════════════════
   AVE DEMO IFRAME
   ═══════════════════════════════════════════════════════ */
.wp-ave-iframe-wrap {
  margin: 32px 0 36px;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--warm-200);
  box-shadow: var(--shadow-md); background: var(--white);
}
.wp-ave-iframe-wrap iframe {
  display: block; width: 100%;
  height: 838px; border: none;
  transition: height .2s ease;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════
   CARD COVER IMAGE
   ═══════════════════════════════════════════════════════ */
.wp-card-cover-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  z-index: 0;
}
.wp-card-cover.has-card-image::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    rgba(12, 31, 61, .65) 0%,
    rgba(12, 31, 61, .2) 50%,
    rgba(12, 31, 61, .08) 100%
  );
  z-index: 1; pointer-events: none;
}
.wp-card-cover.has-card-image .wp-card-cover-pattern,
.wp-card-cover.has-card-image .wp-card-cover-accent { display: none; }

/* ═══════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════ */
@media print {
  /* Hide chrome */
  header, .wp-library, .wp-toc, .wp-toc-actions,
  .wp-toc-mobile-toggle, .wp-print-preview,
  .closing-section, .hc-btn, footer { display: none !important; }

  /* Unfold reader so it prints as normal flow */
  .wp-reader { display: block !important; position: static !important; overflow: visible !important; top: 0 !important; }
  .wp-reader-body { display: block !important; overflow: visible !important; }
  .wp-content-scroll { overflow: visible !important; }
  .wp-document { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }

  /* Full document — preserve dark backgrounds */
  .wp-doc-cover {
    background: #0c1f3d !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    border-radius: 0 !important; margin-bottom: 40px; page-break-after: always;--amber:#f59e0b;}
  .wp-metric, .wp-code-block, .wp-callout, .wp-quote-block {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .wp-section, .wp-callout, .wp-code-block, .wp-insight-card { page-break-inside: avoid; break-inside: avoid; }

  /* Text version — strip dark elements */
  body.print-compact .wp-doc-cover {
    background: #ffffff !important; border: 1px solid #ccc !important;
    border-radius: 0 !important; margin-bottom: 32px; page-break-after: always;
  }
  body.print-compact .wp-doc-cover h1,
  body.print-compact .wp-doc-cover-tag,
  body.print-compact .wp-doc-cover-desc,
  body.print-compact .wp-doc-cover-meta-label,
  body.print-compact .wp-doc-cover-meta-value { color: #000000 !important; }
  body.print-compact .wp-doc-cover-meta { border-top-color: #cccccc !important; }

  body.print-compact .wp-code-block {
    background: #f5f5f5 !important; border: 1px solid #ddd !important; border-radius: 4px !important;
  }
  body.print-compact .wp-code-block::before { display: none !important; }
  body.print-compact .wp-code-label { color: #666 !important; }
  body.print-compact .wp-code-block code { color: #111 !important; }

  body.print-compact .wp-metric { background: #f5f5f5 !important; border: 1px solid #ddd !important; }
  body.print-compact .wp-metric::before { display: none !important; }
  body.print-compact .wp-metric-num { color: #000000 !important; }
  body.print-compact .wp-metric-label { color: #444 !important; }

  body.print-compact .wp-callout { background: #fafafa !important; border-left-color: #999 !important; }
  body.print-compact .wp-callout p { color: #000 !important; }

  body.print-compact .wp-insight-card { border: 1px solid #ddd !important; }
  body.print-compact .wp-insight-icon { background: #eee !important; color: #333 !important; }

  body.print-compact .wp-quote-block { background: #fafafa !important; border: 1px solid #ddd !important; }
  body.print-compact .wp-quote-text { color: #000 !important; }
  body.print-compact .wp-quote-attr { color: #555 !important; }
}

/* ═══════════════════════════════════════════════════════
   HIGH CONTRAST
   ═══════════════════════════════════════════════════════ */
body.hc .wp-doc-cover { background: #00102a;--amber:#f59e0b;}
body.hc .wp-metric { background: #00102a;--amber:#f59e0b;}
body.hc .wp-quote-block { background: #00102a;--amber:#f59e0b;}
body.hc .wp-code-block { background: #000000;--amber:#f59e0b;}
body.hc .wp-callout { background: var(--warm-100); }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   Mobile-first safety: every grid uses minmax(0, 1fr) so
   long words and inline code can never push the layout
   past the viewport edge.
   ═══════════════════════════════════════════════════════ */

/* ── Tablet ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .wp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wp-toc { width: 240px; }
  .wp-document { padding: 52px 48px 100px; }
  .wp-library { padding: 64px 0 80px; }
  .wp-doc-cover { padding: 44px 44px; }
}

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .wp-library { padding: 52px 0 72px; }
  .wp-grid { grid-template-columns: 1fr; gap: 16px; }
  .wp-filters { gap: 6px; margin-bottom: 32px; }
  .wp-filter-btn { font-size: 12px; padding: 8px 12px; }

  /* Reader becomes single-column with TOC as drawer */
  .wp-toc {
    position: absolute; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 85vw;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 6;
    box-shadow: var(--shadow-lg);
  }
  .wp-toc.open { transform: translateX(0); }
  .wp-toc-mobile-toggle { display: inline-flex; }
  .wp-content-scroll { padding-top: 56px; }
  .wp-document { padding: 16px 20px 80px; }

  /* Cover compresses */
  .wp-doc-cover { padding: 36px 28px; margin-bottom: 40px; }
  .wp-doc-cover-meta { gap: 20px; }

  /* Code block tightens */
  .wp-code-block { padding: 18px 20px; }
  .wp-code-block code { font-size: 11.5px; }

  /* Stacked grids */
  .wp-insight-grid { grid-template-columns: 1fr; }
  .wp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wp-metrics-block { grid-template-columns: 1fr; }
  .wp-metrics-block .wp-metric + .wp-metric {
    border-left: none;
    border-top: 1px solid var(--warm-200);
  }

  /* Quote tightens */
  .wp-quote-block { padding: 24px 24px; }

  /* Callout tightens */
  .wp-callout { padding: 18px 22px; }
  .wp-callout p { font-size: 17px; }

  /* Print modal full-width on small screens */
  .wp-print-preview { padding: 16px; }
  .wp-print-actions { justify-content: stretch; }
  .wp-print-actions .btn-primary,
  .wp-print-actions .btn-secondary { flex: 1; justify-content: center; }
}

/* ── Small mobile ──────────────────────────────────── */
@media (max-width: 480px) {
  .wp-library { padding: 40px 0 56px; }
  .wp-filters { margin-bottom: 24px; }
  .wp-metrics { grid-template-columns: 1fr; }
  .wp-document { padding: 16px 16px 64px; }
  .wp-doc-cover { padding: 28px 20px; }
  .wp-doc-cover-meta { gap: 14px; }
  .wp-doc-cover-meta-item { flex-basis: calc(50% - 7px); }
  .wp-section { margin-bottom: 40px; padding-bottom: 40px; }
  .wp-section-header { flex-wrap: wrap; gap: 8px; }
  .wp-card-cover { height: 124px; padding: 16px; }
  .wp-card-body { padding: 18px 20px 20px; }
  .wp-quote-block { padding: 20px; margin: 28px 0; }
  .wp-quote-text { font-size: 17px; }
}
