/* ============================================================
   GovPaid — Library Page Styles
   ============================================================ */

/* ── Hero ─────────────────────────────────────────────────── */
.lib-hero {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: calc(var(--ticker-height) + var(--nav-height) + 4rem) 0 3.5rem;
  overflow: hidden;
}

.lib-hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.lib-hero-text .section-label { margin-bottom: 1rem; }

.lib-hero-text h1 {
  color: var(--white);
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4vw, 3rem);
}
.lib-hero-text h1 em { color: var(--gold); font-style: italic; }

.lib-hero-text p {
  color: rgba(255,255,255,.68);
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 500px;
  margin-bottom: 2rem;
}

.lib-hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Document Stack Visual ────────────────────────────────── */
.lib-hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lib-doc-stack {
  position: relative;
  width: 280px;
  height: 320px;
}

.lib-doc-preview {
  position: absolute;
  background: var(--white);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.lib-doc-preview--back {
  width: 220px; height: 260px;
  bottom: 0; left: 0;
  transform: rotate(-6deg);
  opacity: .6;
}
.lib-doc-preview--mid {
  width: 230px; height: 270px;
  bottom: 10px; left: 20px;
  transform: rotate(-3deg);
  opacity: .8;
}
.lib-doc-preview--front {
  width: 240px; height: 280px;
  bottom: 20px; left: 35px;
  transform: rotate(1deg);
}
.lib-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lib-doc-badge-free {
  font-size: .6rem;
  font-weight: 800;
  background: var(--gold);
  color: var(--white);
  padding: .15rem .45rem;
  border-radius: 4px;
  letter-spacing: .06em;
}
.lib-doc-icon { font-size: 2.5rem; text-align: center; }
.lib-doc-lines { display: flex; flex-direction: column; gap: .4rem; }
.lib-doc-line {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 4px;
  width: 60%;
}
.lib-doc-line--wide { width: 100%; }
.lib-doc-line--med  { width: 75%; }

/* ── Tier Banner ─────────────────────────────────────────── */
.lib-tier-banner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}
.lib-tier-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 200px;
}
.lib-tier-icon { font-size: 1.5rem; }
.lib-tier-item strong { display: block; color: var(--white); font-size: .92rem; }
.lib-tier-item span   { font-size: .8rem; color: rgba(255,255,255,.55); }
.lib-tier-divider {
  color: rgba(255,255,255,.3);
  font-size: 1.25rem;
  font-weight: 300;
}
.lib-tier-pro strong { color: var(--gold); }
.lib-tier-cta { margin-left: auto; white-space: nowrap; }

/* ── Filter Bar ──────────────────────────────────────────── */
.lib-filter-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  padding: .75rem 0;
  position: sticky;
  top: calc(var(--ticker-height) + var(--nav-height));
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.lib-filter-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: .5rem;
}

.lib-tab {
  padding: .4rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font: 600 .8rem/1 var(--font-sans);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  white-space: nowrap;
}
.lib-tab:hover { border-color: var(--gold); color: var(--text-primary); }
.lib-tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.lib-filter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lib-doc-count { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

.lib-access-key { display: flex; gap: .75rem; }
.lib-key-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.lib-key-free { color: var(--green); }
.lib-key-pro  { color: var(--gold-dark); }

/* ── Document Grid ───────────────────────────────────────── */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ── Document Card ───────────────────────────────────────── */
.doc-card {
  background: var(--white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  transition: var(--transition);
  position: relative;
}
.doc-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.doc-card--pro {
  border-color: var(--border-light);
}
.doc-card--pro::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.doc-card--free::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.doc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.doc-icon-wrap {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.doc-icon--cap        { background: rgba(37,99,235,.1); }
.doc-icon--proposal   { background: rgba(124,58,237,.1); }
.doc-icon--vehicle    { background: rgba(21,128,61,.1); }
.doc-icon--compliance { background: rgba(180,83,9,.1); }

.doc-access-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .25rem .65rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.doc-badge--free {
  background: rgba(21,128,61,.1);
  color: var(--green);
  border: 1px solid rgba(21,128,61,.2);
}
.doc-badge--pro {
  background: rgba(37,99,235,.12);
  color: var(--gold-dark);
  border: 1px solid rgba(37,99,235,.25);
}

.doc-type-badges { display: flex; gap: .4rem; align-items: center; }
.doc-type-badge {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--navy);
  color: var(--white);
  padding: .15rem .45rem;
  border-radius: 3px;
}
.doc-size-badge {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.doc-title {
  font-size: .97rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0;
}

.doc-desc {
  font-size: .84rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

.doc-tags { display: flex; gap: .35rem; flex-wrap: wrap; }
.doc-tag {
  font-size: .7rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-secondary);
  padding: .2rem .55rem;
  border-radius: var(--radius-full);
}

.doc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}
.doc-download-count {
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Pro download button */
.btn--pro {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem 1rem;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-light));
  color: var(--white);
  font-weight: 700;
  font-size: .82rem;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn--pro:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

/* ── Category Blocks ─────────────────────────────────────── */
.lib-category-block {
  margin-bottom: 3.5rem;
}
.lib-category-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light);
}
.lib-category-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.lib-category-header h3 { margin: 0 0 .25rem; font-size: 1.3rem; }
.lib-category-header p  { margin: 0; font-size: .88rem; color: var(--text-secondary); }

/* ── Upgrade Gate ────────────────────────────────────────── */
.upgrade-gate {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius-xl);
  padding: 3.5rem;
  text-align: center;
  color: var(--white);
}
.upgrade-gate-inner { max-width: 640px; margin: 0 auto; }
.upgrade-icon { font-size: 3rem; margin-bottom: 1rem; }
.upgrade-gate h2 { color: var(--white); margin-bottom: .75rem; }
.upgrade-gate p  { color: rgba(255,255,255,.7); max-width: 480px; margin: 0 auto 1.5rem; }

.upgrade-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  margin: 1.75rem 0;
  text-align: left;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.upgrade-feature {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .88rem;
  color: rgba(255,255,255,.8);
}
.upgrade-check {
  color: var(--gold);
  font-weight: 800;
  font-size: .9rem;
  flex-shrink: 0;
}

/* ── Custom Cap Statement ─────────────────────────────────── */
.custom-request-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 3rem;
  align-items: start;
}

.custom-request-info h4 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  color: var(--navy);
}
.custom-include-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.custom-include-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.custom-include-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.custom-include-list strong { display: block; font-size: .92rem; margin-bottom: .2rem; }
.custom-include-list p { font-size: .84rem; color: var(--text-secondary); margin: 0; }

.custom-turnaround {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}
.custom-turnaround-icon { font-size: 1.5rem; }
.custom-turnaround strong { display: block; font-size: .9rem; color: var(--navy); }
.custom-turnaround span  { font-size: .8rem; color: var(--text-muted); }

.pro-gate-check {
  background: rgba(37,99,235,.07);
  border: 1.5px solid rgba(37,99,235,.25);
  border-radius: var(--radius-md);
  padding: .9rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.pro-gate-badge {
  font-size: .75rem;
  font-weight: 800;
  background: var(--gold);
  color: var(--white);
  padding: .2rem .6rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: .05rem;
}
.pro-gate-check p { font-size: .85rem; color: var(--text-secondary); margin: 0; }

.custom-request-form-wrap {
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.req { color: var(--red-breaking); }
.link-gold { color: var(--gold-dark); text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 960px) {
  .lib-hero-inner { grid-template-columns: 1fr; }
  .lib-hero-visual { display: none; }
  .custom-request-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .lib-tier-banner { flex-direction: column; align-items: flex-start; }
  .lib-tier-cta { width: 100%; text-align: center; }
  .upgrade-gate { padding: 2rem 1.25rem; }
  .upgrade-features { grid-template-columns: 1fr; }
  .custom-request-form-wrap { padding: 1.25rem; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-2 [style*="grid-column"] { grid-column: 1; }
  .lib-filter-tabs { gap: .35rem; }
  .lib-tab { font-size: .73rem; padding: .35rem .7rem; }
}

/* ============================================================
   DARK MODE — Library
   ============================================================ */
[data-theme="dark"] .lib-hero {
  background: #070710;
}
[data-theme="dark"] .lib-hero h1 {
  color: #f1f5f9;
}
[data-theme="dark"] .lib-hero p {
  color: #94a3b8;
}
[data-theme="dark"] .lib-filter-bar {
  background: #111119;
  border-bottom-color: #2a2a3a;
}
[data-theme="dark"] .lib-tab {
  color: #94a3b8;
  border-color: #2a2a3a;
  background: #1a1a2e;
}
[data-theme="dark"] .lib-tab:hover,
[data-theme="dark"] .lib-tab.active {
  background: #2563EB;
  color: #fff;
  border-color: #2563EB;
}
[data-theme="dark"] .lib-card {
  background: #161622;
  border-color: #2a2a3a;
}
[data-theme="dark"] .lib-card:hover {
  border-color: #3b82f6;
}
[data-theme="dark"] .lib-card h3 {
  color: #e2e8f0;
}
[data-theme="dark"] .lib-card p {
  color: #94a3b8;
}
[data-theme="dark"] .lib-card-meta {
  color: #64748b;
}
[data-theme="dark"] .lib-item h3 {
  color: #e2e8f0;
}
[data-theme="dark"] .lib-item p {
  color: #94a3b8;
}
[data-theme="dark"] .lib-result-item {
  color: #e2e8f0;
  background: #161622;
  border-color: #2a2a3a;
}
[data-theme="dark"] .lib-search input {
  background: #1a1a2e;
  border-color: #2a2a3a;
  color: #e2e8f0;
}
[data-theme="dark"] .lib-tier-banner {
  background: #161622;
  border-color: #2a2a3a;
}
[data-theme="dark"] .lib-tier-banner p {
  color: #94a3b8;
}
[data-theme="dark"] .upgrade-gate {
  background: #161622;
  border-color: #2a2a3a;
}
[data-theme="dark"] .upgrade-gate h3 {
  color: #e2e8f0;
}
[data-theme="dark"] .upgrade-gate p {
  color: #94a3b8;
}
[data-theme="dark"] .custom-turnaround strong {
  color: #e2e8f0;
}
[data-theme="dark"] .custom-request-form-wrap {
  background: #161622;
  border-color: #2a2a3a;
}
[data-theme="dark"] .custom-request-form-wrap label {
  color: #cbd5e1;
}

/* Paid card accent */
.doc-card--paid::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563EB, #7c3aed);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Doc cards */
[data-theme="dark"] .doc-card {
  background: #161622;
  border-color: #2a2a3a;
}
[data-theme="dark"] .doc-card:hover {
  border-color: #3b82f6;
}
[data-theme="dark"] .doc-title {
  color: #e2e8f0;
}
[data-theme="dark"] .doc-desc {
  color: #94a3b8;
}
[data-theme="dark"] .doc-tag {
  background: #1a1a2e;
  color: #94a3b8;
}
[data-theme="dark"] .doc-card-footer {
  border-top-color: #2a2a3a;
}
[data-theme="dark"] .doc-download-count {
  color: #64748b;
}
[data-theme="dark"] .doc-type-badge {
  background: #e2e8f0;
  color: #0a0a0a;
}
[data-theme="dark"] .doc-size-badge {
  color: #64748b;
}
[data-theme="dark"] .lib-category-header h3 {
  color: #e2e8f0;
}
[data-theme="dark"] .lib-category-header p {
  color: #94a3b8;
}
[data-theme="dark"] .lib-tier-item strong {
  color: #e2e8f0;
}
[data-theme="dark"] .lib-tier-item span {
  color: #94a3b8;
}
[data-theme="dark"] .lib-tier-divider {
  color: #475569;
}
[data-theme="dark"] .lib-doc-count {
  color: #64748b;
}
[data-theme="dark"] .lib-key-item {
  color: #94a3b8;
}
[data-theme="dark"] .lib-filter-meta {
  color: #64748b;
}
