/**
 * flipbook-library.css
 * Florentis Learning — Readers Library
 *
 * All selectors scoped under .fl-lib — zero collision with other engines or themes.
 * Matches the Florentis brand palette from the landing page.
 */

/* ── Variables (matches landing page) ───────────────────────────────────────── */

.fl-lib {
  --fl-olive:       #596c10;
  --fl-olive-dark:  #47570d;
  --fl-navy:        #172830;
  --fl-cream:       #f1e5da;
  --fl-cream-light: #faf7f3;
  --fl-sage:        #c7c79d;
  --fl-muted:       #4a5568;
  --fl-white:       #ffffff;
  --radius-card:    14px;
  --shadow-card:    0 2px 12px rgba(23,40,48,.08);
  --shadow-hover:   0 8px 28px rgba(23,40,48,.14);
  --font-display:   'Playfair Display', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;

  font-family: var(--font-body);
  color: var(--fl-navy);
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── Intro block ─────────────────────────────────────────────────────────────── */

.fl-lib-intro {
  padding: 48px 0 40px;
  max-width: 700px;
}

.fl-lib-label {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fl-olive);
  background: rgba(89,108,16,.1);
  padding: 4px 14px;
  border-radius: 50px;
  margin-bottom: 14px;
}

.fl-lib-heading {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  line-height: 1.15;
  color: var(--fl-navy);
  margin-bottom: 16px;
  white-space: nowrap;          /* one line on desktop */
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 700px) {
  .fl-lib-heading {
    white-space: normal;        /* allow wrap on narrow screens */
    font-size: clamp(1.3rem, 5vw, 1.6rem);
  }
}

.fl-lib-lead {
  font-size: 1.05rem;
  color: var(--fl-muted);
  margin-bottom: 10px;
}

.fl-lib-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fl-lib-bullets li {
  font-size: 1rem;
  color: var(--fl-muted);
  padding-left: 20px;
  position: relative;
}

.fl-lib-bullets li::before {
  content: '•';
  position: absolute;
  left: 6px;
  color: var(--fl-olive);
  font-weight: 700;
}

.fl-lib-browse-hint {
  font-size: .92rem;
  color: var(--fl-muted);
  font-style: italic;
}

.fl-readers-seo-text {
  max-width: 720px;
  font-size: 15px;
  line-height: 1.6;
  color: #4a5560;
  margin-top: 10px;
}

/* ── Filters ─────────────────────────────────────────────────────────────────── */

.fl-lib-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
  padding: 20px 24px;
  background: var(--fl-white);
  border-radius: 12px;
  border: 1px solid rgba(199,199,157,.5);
  box-shadow: var(--shadow-card);
}

.fl-lib-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fl-lib-filter-label {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fl-muted);
  min-width: 48px;
}

.fl-lib-filter-btn {
  padding: 6px 16px;
  border-radius: 50px;
  border: 1.5px solid rgba(89,108,16,.25);
  background: var(--fl-cream-light);
  color: var(--fl-navy);
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
}

.fl-lib-filter-btn:hover {
  background: rgba(89,108,16,.08);
  border-color: var(--fl-olive);
}

.fl-lib-filter-btn--active {
  background: var(--fl-olive);
  border-color: var(--fl-olive);
  color: var(--fl-white);
}

/* Level colour accents on filter buttons */
.fl-lib-level--prea1 { border-color: #7c3aed; color: #5b21b6; }
.fl-lib-level--prea1.fl-lib-filter-btn--active { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.fl-lib-level--a1    { border-color: #2563eb; color: #1e40af; }
.fl-lib-level--a1.fl-lib-filter-btn--active    { background: #2563eb; border-color: #2563eb; color: #fff; }
.fl-lib-level--a2    { border-color: #059669; color: #065f46; }
.fl-lib-level--a2.fl-lib-filter-btn--active    { background: #059669; border-color: #059669; color: #fff; }
.fl-lib-level--b1    { border-color: #d97706; color: #92400e; }
.fl-lib-level--b1.fl-lib-filter-btn--active    { background: #d97706; border-color: #d97706; color: #fff; }
.fl-lib-level--b2    { border-color: #dc2626; color: #991b1b; }
.fl-lib-level--b2.fl-lib-filter-btn--active    { background: #dc2626; border-color: #dc2626; color: #fff; }
.fl-lib-level--c1    { border-color: #374151; color: #1f2937; }
.fl-lib-level--c1.fl-lib-filter-btn--active    { background: #374151; border-color: #374151; color: #fff; }

/* ── Card grid ───────────────────────────────────────────────────────────────── */

.fl-lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1100px) { .fl-lib-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .fl-lib-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 440px)  { .fl-lib-grid { grid-template-columns: 1fr; } }

/* ── Card ────────────────────────────────────────────────────────────────────── */

.fl-lib-card {
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,.06);
  background: var(--fl-white);
  transition: transform .2s, box-shadow .2s;
}

.fl-lib-card:not(.fl-lib-card--locked):hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.fl-lib-card--locked {
  opacity: .88;
}

.fl-lib-card--locked:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.fl-lib-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

/* ── Card cover image ────────────────────────────────────────────────────────── */

.fl-lib-card-cover {
  position: relative;
  aspect-ratio: 3 / 4;   /* portrait book proportion */
  overflow: hidden;
  background: var(--fl-cream);
  flex-shrink: 0;
}

.fl-lib-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform .3s;
}

.fl-lib-card:not(.fl-lib-card--locked):hover .fl-lib-card-cover img {
  transform: scale(1.03);
}

/* Fallback when image fails to load */
.fl-lib-card-cover-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--fl-sage), var(--fl-olive));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: rgba(255,255,255,.7);
  font-weight: 700;
}

/* Level badge — top-left corner.
   Solid dark background + white text = always legible on any image.
   Coloured left border provides level differentiation without relying on
   background tints that blend into the illustration. */
.fl-lib-card-level {
  position: absolute;
  top: 10px; left: 10px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px 4px 8px;
  border-radius: 50px;
  background: rgba(23,40,48,.82);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  border-left: 3px solid currentColor;
  backdrop-filter: blur(4px);
}

/* Per-level accent colour (used for the left border) */
.fl-lib-level--prea1 { color: #a78bfa !important; }
.fl-lib-level--a1    { color: #60a5fa !important; }
.fl-lib-level--a2    { color: #34d399 !important; }
.fl-lib-level--b1    { color: #fbbf24 !important; }
.fl-lib-level--b2    { color: #f87171 !important; }
.fl-lib-level--c1    { color: #e5e7eb !important; }

/* Access badge — top-right corner */
.fl-lib-card-access {
  position: absolute;
  top: 10px; right: 10px;
  font-size: .65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  white-space: nowrap;
}

.fl-lib-card-access--lock {
  background: var(--fl-navy);
  color: var(--fl-cream);
}

.fl-lib-card-access--member {
  background: var(--fl-olive);
  color: var(--fl-white);
}

/* Lock overlay on locked premium cards */
.fl-lib-card-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(23,40,48,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.85);
  backdrop-filter: blur(2px);
  transition: opacity .2s;
}

.fl-lib-card--locked:hover .fl-lib-card-lock-overlay {
  opacity: .85;
}

/* ── Card body ───────────────────────────────────────────────────────────────── */

.fl-lib-card-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.fl-lib-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.3;
  color: var(--fl-navy);
  margin: 0;
  /* Prevent theme link styles from styling the title */
  text-decoration: none !important;
}

/* Override any theme link colour on the entire card link */
.fl-lib-card-link,
.fl-lib-card-link:hover,
.fl-lib-card-link:visited,
.fl-lib-card-link:focus {
  text-decoration: none !important;
  color: inherit !important;
  outline: none;
}

.fl-lib-card-subtitle {
  font-size: .8rem;
  color: var(--fl-muted) !important;
  margin: 0;
  line-height: 1.4;
  text-decoration: none !important;
}

.fl-lib-card-desc {
  font-size: .82rem;
  color: var(--fl-muted) !important;
  margin: 0;
  line-height: 1.5;
  text-decoration: none !important;
}

.fl-lib-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.fl-lib-card-meta-item {
  font-size: .72rem;
  color: var(--fl-muted) !important;
  text-decoration: none !important;
}

.fl-lib-card-cta {
  margin-top: auto;
  padding-top: 10px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--fl-olive);
  display: flex;
  align-items: center;
  gap: 4px;
}

.fl-lib-card--locked .fl-lib-card-cta {
  color: #9ca3af;
}

/* ── Empty / no-results states ───────────────────────────────────────────────── */

.fl-lib-empty,
.fl-lib-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--fl-muted);
  font-size: .97rem;
}

/* ── Responsive tweaks ───────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .fl-lib {
    padding: 0 16px 48px;
  }
  .fl-lib-intro {
    padding: 32px 0 28px;
  }
  .fl-lib-filters {
    padding: 16px;
  }
}
