/* =========================================
   SaplingHabit Printables System
   Visual system: FULLY ALIGNED with page-home-en.php
   Tokens reference: PROJECT-v5.md § 4.1 CSS Design System
========================================= */

/*
 * ⚠  DO NOT redefine brand tokens here.
 *    page-home-en.php <style> block is the single source of truth.
 *    These vars are fallbacks for pages that don't include that block.
 *    On printable pages all :root tokens come from the homepage <style>
 *    when it is loaded first — on standalone pages they fall back to these.
 */
:root {
  /* Brand tokens — must match page-home-en.php exactly */
  --ink:          #1C1C19;
  --ink-mid:      #5A5A55;
  --ink-soft:     #9A9A92;
  --cream:        #F8F5EF;
  --warm:         #FFFCF7;
  --sage:         #5A8C60;
  --sage-pale:    #EBF2EC;
  --sage-deep:    #3A6040;
  --amber:        #D4823A;
  --amber-pale:   #FBF0E6;
  --amber-deep:   #A85E20;
  --border:       #E6E2D8;
  --border-soft:  #F0EDE6;
  --coral:        #D4644A;
  --blue:         #4A7EA0;
  --blue-pale:    #EBF3F9;

  /* Layout tokens — must match page-home-en.php exactly */
  --gutter:       clamp(20px, 5vw, 80px);
  --content-max:  1180px;

  /* Printable-system-local tokens */
  --card-radius:  16px;
  --card-shadow:  0 4px 16px rgba(28,28,25,0.07);
  --card-shadow-hover: 0 12px 36px rgba(28,28,25,0.12);
}


/* ===== Shared layout container (mirrors homepage .section-inner) ===== */

.pbl-container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}


/* ===== 页面背景 ===== */

body.post-type-archive-printable,
body.tax-printable_category,
body.single-printable {
  background: var(--cream);
  font-family: 'Instrument Sans', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}


/* =========================================
   Shared section wrapper (mirrors homepage pattern)
========================================= */

.pbl-section {
  padding: 80px var(--gutter);
}

.pbl-section--cream  { background: var(--cream); }
.pbl-section--warm   { background: var(--warm); }
.pbl-section--sage   { background: var(--sage-pale); }
.pbl-section--amber  { background: var(--amber-pale); }


/* =========================================
   HERO — Archive & Taxonomy  (mirrors homepage .hero-wrap)
========================================= */

.pbl-hero {
  background: var(--cream);
  padding: 88px var(--gutter) 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pbl-hero::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(90,140,96,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.pbl-hero-inner {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

/* eyebrow pill — mirrors .hero-left .eyebrow */
.pbl-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sage);
  background: var(--sage-pale);
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 22px;
}

/* h1 — mirrors .hero-left h1 */
.pbl-hero h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  color: var(--ink);
}

.pbl-hero h1 strong {
  font-weight: 600;
  color: var(--sage-deep);
}

.pbl-hero p {
  font-size: 16.5px;
  color: var(--ink-mid);
  line-height: 1.72;
  margin-bottom: 0;
}

/* Taxonomy-specific: category description */
.pbl-hero .pbl-term-desc {
  font-size: 15px;
  color: var(--ink-mid);
  line-height: 1.7;
  max-width: 540px;
  margin: 0 auto;
}


/* =========================================
   Category Tabs (archive + taxonomy pages)
========================================= */

.pbl-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 48px;
}

.pbl-tabs .pbl-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  border-radius: 100px;
  background: white;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink-mid);
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.pbl-tabs .pbl-tab:hover {
  background: var(--sage-pale);
  color: var(--sage-deep);
  border-color: var(--sage-pale);
}

.pbl-tabs .pbl-tab.is-active {
  background: var(--sage);
  color: white;
  border-color: var(--sage);
  font-weight: 500;
}


/* =========================================
   Body section wrapper
========================================= */

.pbl-body {
  background: var(--warm);
  padding: 64px var(--gutter) 80px;
}


/* =========================================
   Resource Grid
========================================= */

.pbl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 56px;
}


/* =========================================
   Resource Card — mirrors homepage feature cards
========================================= */

.pbl-card {
  background: white;
  border-radius: var(--card-radius);
  border: 1px solid var(--border-soft);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
}

.pbl-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

/* Thumbnail */
.pbl-card__thumb {
  position: relative;
  background: var(--cream);
  aspect-ratio: 4/3;
  overflow: hidden;
}

.pbl-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.pbl-card:hover .pbl-card__thumb img {
  transform: scale(1.03);
}

/* Placeholder when no thumbnail */
.pbl-card__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

/* Access badge (Free / Email / Paid) */
.pbl-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}

.pbl-card__badge--free  { background: var(--sage-pale);  color: var(--sage-deep); }
.pbl-card__badge--email { background: var(--amber-pale); color: var(--amber-deep); }
.pbl-card__badge--paid  { background: var(--blue-pale);  color: var(--blue); }

/* Card body */
.pbl-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.pbl-card__title {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 6px;
}

.pbl-card__title a {
  text-decoration: none;
  color: var(--ink);
  transition: color 0.18s;
}

.pbl-card__title a:hover {
  color: var(--sage-deep);
}

.pbl-card__meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pbl-card__meta-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--ink-soft);
  flex-shrink: 0;
}

/* CTA button on card — mirrors .btn-sage */
.pbl-card__btn {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 9px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.pbl-card__btn--sage {
  background: var(--sage);
  color: white;
}
.pbl-card__btn--sage:hover {
  background: var(--sage-deep);
  transform: translateY(-1px);
}

.pbl-card__btn--amber {
  background: var(--amber);
  color: white;
}
.pbl-card__btn--amber:hover {
  background: var(--amber-deep);
  transform: translateY(-1px);
}


/* =========================================
   Pagination — mirrors homepage trust bar pill style
========================================= */

.pbl-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 0;
  margin-bottom: 0;
}

.pbl-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink-mid);
  font-size: 13.5px;
  transition: background 0.18s, color 0.18s;
}

.pbl-pagination .page-numbers:hover {
  background: var(--sage-pale);
  color: var(--sage-deep);
  border-color: var(--sage-pale);
}

.pbl-pagination .page-numbers.current {
  background: var(--sage);
  color: white;
  border-color: var(--sage);
  font-weight: 500;
}


/* =========================================
   SINGLE RESOURCE PAGE
========================================= */

/* Two-column layout */
.pbl-single-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 80px var(--gutter);
}

/* Thumbnail column */
.pbl-single__thumb {
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  box-shadow: var(--card-shadow);
}

.pbl-single__thumb img {
  width: 100%;
  height: auto;
  display: block;
}

/* Info column */
.pbl-single__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sage);
  background: var(--sage-pale);
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 18px;
  text-decoration: none;
}

.pbl-single__title {
  font-family: 'Fraunces', serif;
  font-size: clamp(26px, 3.5vw, 40px);
  font-weight: 300;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 16px;
}

.pbl-single__title strong {
  font-weight: 600;
}

.pbl-single__excerpt {
  font-size: 15.5px;
  color: var(--ink-mid);
  line-height: 1.72;
  margin-bottom: 28px;
}

.pbl-single__meta-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--ink-soft);
}

.pbl-single__meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}


/* =========================================
   Download Box (gate / open)
========================================= */

.pbl-download-box {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 28px;
  margin-bottom: 28px;
}

.pbl-download-box__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.pbl-download-box__heading {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.pbl-download-box__sub {
  font-size: 14px;
  color: var(--ink-mid);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* "Download PDF" button — amber CTA = commerce action */
.pbl-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: 100px;
  background: var(--amber);
  color: white;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.pbl-btn-download:hover {
  background: var(--amber-deep);
  transform: translateY(-1px);
}


/* =========================================
   Related Resources section
========================================= */

.pbl-related {
  background: var(--cream);
  padding: 72px var(--gutter);
}

.pbl-related__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.pbl-related__heading {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 36px;
}

.pbl-related__heading strong {
  font-weight: 600;
}


/* =========================================
   Empty state
========================================= */

.pbl-empty {
  text-align: center;
  padding: 80px var(--gutter);
  color: var(--ink-mid);
}

.pbl-empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.pbl-empty__text {
  font-size: 16px;
}


/* =========================================
   Responsive
========================================= */

@media (max-width: 1024px) {
  .pbl-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pbl-single-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }
}

@media (max-width: 640px) {
  .pbl-grid {
    grid-template-columns: 1fr;
  }

  .pbl-hero {
    padding: 56px var(--gutter) 40px;
  }

  .pbl-tabs {
    gap: 8px;
  }
}


/* =========================================
   PREVIEW STRIP (replaces single thumb col)
========================================= */

.pbl-preview-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 80px;
}

.pbl-preview-strip__page {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  background: var(--cream);
}

.pbl-preview-strip__page img,
.pbl-preview-strip__page .pbl-preview-strip__placeholder {
  width: 100%;
  height: auto;
  display: block;
}

.pbl-preview-strip__placeholder {
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: var(--cream);
}

/* Blurred pages */
.pbl-preview-strip__page--locked img {
  filter: blur(7px);
  transform: scale(1.04); /* hide blur edge artefacts */
}

/* Lock overlay */
.pbl-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(28,28,25,0.28);
}

.pbl-lock-overlay__icon {
  font-size: 26px;
  line-height: 1;
}

.pbl-lock-overlay__text {
  font-size: 12px;
  font-weight: 500;
  color: white;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Page label badge */
.pbl-preview-strip__label {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 10px;
  font-weight: 500;
  color: white;
  background: rgba(28,28,25,0.55);
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.06em;
}

.pbl-preview-strip__total {
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
  padding-top: 4px;
}


/* =========================================
   DUAL CTA (drive button + email divider)
========================================= */

.pbl-dual-cta {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pbl-btn-download--primary {
  width: 100%;
  justify-content: center;
  font-size: 15px;
  padding: 15px 28px;
  border-radius: 12px;
}

.pbl-dual-cta__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--ink-soft);
  font-size: 12px;
}

.pbl-dual-cta__divider::before,
.pbl-dual-cta__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.pbl-dual-cta__email-label {
  font-size: 13.5px;
  color: var(--ink-mid);
  margin-bottom: 12px;
  font-weight: 500;
}

.pbl-dual-cta__email-tag {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 12px;
}

@media (max-width: 768px) {
  .pbl-preview-strip {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
  }

  .pbl-preview-strip__page {
    flex: 0 0 140px;
  }
}