/* ================================================================
   5minReading — Design System
   Premium digital library: Deep Navy × Warm Gold × Ink × Teal
   Typefaces: Playfair Display (display) + DM Sans (body)
   ================================================================ */

/* ─── Google Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300;1,9..40,400&display=swap');

/* ─── CSS Variables — Light Mode ────────────────────────────────────────────── */
:root {
  /* Brand palette */
  --navy-950:  #060e1c;
  --navy-900:  #0a1628;
  --navy-800:  #0f2845;
  --navy-700:  #163556;
  --navy-600:  #1e4876;
  --navy-500:  #2a5f96;
  --navy-400:  #4a80b8;
  --navy-300:  #7aabda;
  --navy-200:  #b0cfe8;
  --navy-100:  #dceaf5;
  --navy-50:   #f0f6fb;

  --gold-600:  #9a6800;
  --gold-500:  #c28a00;
  --gold-400:  #d9a520;
  --gold-300:  #e8c060;
  --gold-200:  #f2d98a;
  --gold-100:  #faf0cc;
  --gold-50:   #fdf8ee;

  --teal-600:  #006666;
  --teal-500:  #008080;
  --teal-400:  #1a9999;
  --teal-200:  #99d6d6;
  --teal-100:  #ccecec;

  --ink-900:   #111827;
  --ink-800:   #1f2937;
  --ink-700:   #374151;
  --ink-600:   #4b5563;
  --ink-500:   #6b7280;
  --ink-400:   #9ca3af;
  --ink-300:   #d1d5db;
  --ink-200:   #e5e7eb;
  --ink-100:   #f3f4f6;
  --ink-50:    #f9fafb;

  /* Semantic tokens — Light */
  --color-bg:           #fafaf8;
  --color-bg-secondary: #f4f2ee;
  --color-bg-card:      #ffffff;
  --color-bg-glass:     rgba(255,255,255,0.85);
  --color-surface:      #ffffff;
  --color-surface-alt:  #f7f6f2;
  --color-border:       #e2ddd6;
  --color-border-light: #f0ece4;

  --color-text-primary:   #1a1510;
  --color-text-secondary: #5a5248;
  --color-text-tertiary:  #8a847a;
  --color-text-inverse:   #ffffff;
  --color-text-muted:     #a89f94;

  --color-accent-primary:   #0f2845;
  --color-accent-primary-h: #163556;
  --color-accent-gold:      #c28a00;
  --color-accent-gold-h:    #9a6800;
  --color-accent-teal:      #008080;
  --color-accent-teal-h:    #006666;

  --color-link:       var(--color-accent-primary);
  --color-link-hover: var(--color-accent-gold);

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(15,40,69,0.06);
  --shadow-sm:  0 2px 6px rgba(15,40,69,0.08), 0 1px 2px rgba(15,40,69,0.04);
  --shadow-md:  0 4px 16px rgba(15,40,69,0.10), 0 2px 4px rgba(15,40,69,0.06);
  --shadow-lg:  0 8px 32px rgba(15,40,69,0.12), 0 4px 8px rgba(15,40,69,0.06);
  --shadow-xl:  0 16px 48px rgba(15,40,69,0.16), 0 6px 12px rgba(15,40,69,0.08);
  --shadow-card:  var(--shadow-sm);
  --shadow-card-h: var(--shadow-lg);

  /* Typography */
  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-body:    'DM Sans', 'system-ui', sans-serif;
  --font-mono:    'Fira Code', 'Consolas', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;

  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.6;
  --leading-relaxed:1.75;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radii */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --container-max:  1320px;
  --container-wide: 1080px;
  --container-text: 720px;
  --sidebar-width:  280px;
  --header-height:  68px;
  --gutter:         clamp(1rem, 4vw, 2.5rem);
}

/* ─── Dark Mode ──────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg:           #0c1420;
  --color-bg-secondary: #101b2c;
  --color-bg-card:      #131f33;
  --color-bg-glass:     rgba(13, 24, 45, 0.85);
  --color-surface:      #16243a;
  --color-surface-alt:  #1a2b42;
  --color-border:       #1e2e44;
  --color-border-light: #172234;

  --color-text-primary:   #f0ece4;
  --color-text-secondary: #b8b0a4;
  --color-text-tertiary:  #7a7266;
  --color-text-inverse:   #0c1420;
  --color-text-muted:     #5a5248;

  --color-accent-primary:   #4a80b8;
  --color-accent-primary-h: #7aabda;
  --color-accent-gold:      #d9a520;
  --color-accent-gold-h:    #e8c060;
  --color-accent-teal:      #1a9999;
  --color-accent-teal-h:    #99d6d6;

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm:  0 2px 6px rgba(0,0,0,0.35);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.6);
}

/* ─── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: var(--leading-normal);
  min-height: 100dvh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--color-link); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-link-hover); }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
svg { display: inline-block; }

/* ─── Typography ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
  font-weight: 600;
}

h1 { font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl)); }
h2 { font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl)); }
h3 { font-size: clamp(var(--text-xl), 3vw, var(--text-3xl)); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); font-family: var(--font-body); font-weight: 600; }
h6 { font-size: var(--text-base); font-family: var(--font-body); font-weight: 600; }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }
em { font-style: italic; }

/* ─── Layout ──────────────────────────────────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide  { max-width: var(--container-wide); margin-inline: auto; padding-inline: var(--gutter); }
.container--text  { max-width: var(--container-text); margin-inline: auto; padding-inline: var(--gutter); }

.section {
  padding-block: clamp(var(--space-12), 6vw, var(--space-20));
}

/* ─── Header ──────────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--color-border-light);
  transition: box-shadow var(--transition-base), background var(--transition-slow);
}
.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}
.site-logo__mark {
  width: 36px;
  height: 36px;
  background: var(--color-accent-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent-gold);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1;
  transition: transform var(--transition-spring);
}
.site-logo:hover .site-logo__mark { transform: rotate(-3deg) scale(1.05); }
.site-logo__text {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}
.site-logo__text span { color: var(--color-accent-gold); }

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}
.nav-link {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-link:hover, .nav-link.active {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Notification bell */
.notification-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.notification-btn:hover { background: var(--color-bg-secondary); color: var(--color-text-primary); }
.notification-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--color-accent-gold);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg);
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.theme-toggle:hover { background: var(--color-bg-secondary); color: var(--color-text-primary); }

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border: none; background: transparent;
  border-radius: var(--radius-md);
  flex-direction: column; justify-content: center;
  align-items: center; gap: 5px;
  color: var(--color-text-secondary);
}
.mobile-menu-btn span {
  display: block;
  width: 20px; height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform var(--transition-base), opacity var(--transition-base);
}
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Search Bar ──────────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
}
.search-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-4) 0 44px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-slow);
  outline: none;
}
.search-input::placeholder { color: var(--color-text-muted); }
.search-input:focus {
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(15,40,69,0.1);
  background: var(--color-bg-card);
}
[data-theme="dark"] .search-input:focus {
  box-shadow: 0 0 0 3px rgba(74,128,184,0.2);
}
.search-icon {
  position: absolute;
  left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}
.search-input:focus ~ .search-icon,
.search-wrap:focus-within .search-icon { color: var(--color-accent-primary); }

/* Autocomplete dropdown */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}
.search-suggestions.visible { display: block; }
.suggestion-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
  color: var(--color-text-primary);
}
.suggestion-item:hover, .suggestion-item.selected {
  background: var(--color-bg-secondary);
}
.suggestion-item__cover {
  width: 36px; height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-bg-secondary);
}
.suggestion-item__info { flex: 1; min-width: 0; }
.suggestion-item__title {
  font-weight: 500;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestion-item__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}
.suggestion-section-label {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border-light);
}

/* ─── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--color-accent-primary);
  padding-block: clamp(var(--space-16), 10vw, var(--space-24));
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 70% 50%, rgba(194,138,0,0.15) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 10% 80%, rgba(0,128,128,0.12) 0%, transparent 60%);
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
}
.hero-content { max-width: 560px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(194,138,0,0.2);
  border: 1px solid rgba(194,138,0,0.3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gold-300);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-5);
}
.hero-title {
  font-size: clamp(var(--text-3xl), 5vw, 3.5rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: var(--space-5);
  letter-spacing: -0.02em;
}
.hero-title em {
  font-style: italic;
  color: var(--gold-300);
}
.hero-subtitle {
  font-size: clamp(var(--text-base), 2.5vw, var(--text-lg));
  color: rgba(255,255,255,0.75);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-8);
  font-weight: 300;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}
.hero-stats {
  display: flex;
  gap: var(--space-8);
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.hero-stat { }
.hero-stat__num {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gold-300);
  line-height: 1;
}
.hero-stat__label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.5);
  margin-top: var(--space-1);
  font-weight: 500;
}

/* Hero book stack visual */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
}
.hero-books {
  position: relative;
  width: 280px;
  height: 340px;
}
.hero-book {
  position: absolute;
  width: 160px;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}
.hero-book:nth-child(1) { top: 0; left: 60px; z-index: 3; transform: rotate(-2deg); }
.hero-book:nth-child(2) { top: 30px; left: 20px; z-index: 2; transform: rotate(-8deg); }
.hero-book:nth-child(3) { top: 20px; left: 100px; z-index: 1; transform: rotate(5deg); }
.hero-book img { width: 100%; height: 100%; object-fit: cover; }
.hero-book-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.8);
  text-align: center;
  padding: var(--space-4);
}

/* ─── Section Headers ──────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 3vw, var(--text-3xl));
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: var(--leading-snug);
}
.section-title__accent {
  color: var(--color-accent-gold);
}
.section-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
  font-weight: 400;
}
.section-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: gap var(--transition-spring), color var(--transition-fast);
}
[data-theme="dark"] .section-link { color: var(--color-accent-primary); }
.section-link:hover { color: var(--color-accent-gold); gap: var(--space-2); }
.section-link svg { width: 16px; height: 16px; }

/* ─── Book Cards ──────────────────────────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-5);
}
.books-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.book-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-spring), box-shadow var(--transition-base), border-color var(--transition-fast);
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-h);
  border-color: var(--color-border);
  color: inherit;
}
.book-card__cover-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--color-bg-secondary);
}
.book-card__cover {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.book-card:hover .book-card__cover { transform: scale(1.04); }
.book-card__badges {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.6;
}
.badge--new       { background: var(--color-accent-gold); color: #000; }
.badge--trending  { background: #e05a00; color: #fff; }
.badge--featured  { background: var(--color-accent-primary); color: #fff; }
.badge--recommended { background: var(--color-accent-teal); color: #fff; }

.book-card__quick-read {
  position: absolute;
  bottom: var(--space-2); right: var(--space-2);
  width: 36px; height: 36px;
  background: var(--color-bg-card);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition-fast), transform var(--transition-spring);
  color: var(--color-accent-primary);
}
.book-card:hover .book-card__quick-read {
  opacity: 1;
  transform: scale(1);
}

.book-card__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  flex: 1;
}
.book-card__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card__author {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 400;
}
.book-card__category {
  display: inline-block;
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent-primary);
}
[data-theme="dark"] .book-card__category { color: var(--color-accent-primary); }

/* ─── Category Chips ─────────────────────────────────────────────────────────── */
.category-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: var(--space-1);
  -webkit-overflow-scrolling: touch;
}
.category-chips::-webkit-scrollbar { display: none; }

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.category-chip:hover, .category-chip.active {
  background: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.category-chip__icon { font-size: 1em; line-height: 1; }

/* ─── Banner Slider ───────────────────────────────────────────────────────────── */
.banner-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--color-accent-primary);
}
.banner-slide {
  display: none;
  padding: clamp(var(--space-10), 6vw, var(--space-16)) clamp(var(--space-8), 6vw, var(--space-16));
  min-height: 240px;
  position: relative;
  overflow: hidden;
}
.banner-slide.active { display: flex; align-items: center; }
.banner-slide__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.15;
}
.banner-slide__content {
  position: relative;
  z-index: 1;
  max-width: 600px;
}
.banner-slide__title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 4vw, var(--text-3xl));
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-3);
  line-height: var(--leading-snug);
}
.banner-slide__subtitle {
  color: rgba(255,255,255,0.75);
  font-size: var(--text-base);
  margin-bottom: var(--space-6);
  font-weight: 300;
}
.banner-dots {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-2);
}
.banner-dot {
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.4);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), width var(--transition-base);
  padding: 0;
}
.banner-dot.active { background: var(--color-accent-gold); width: 20px; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.375rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--color-accent-primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--color-accent-primary);
  color: #ffffff;
  border-color: var(--color-accent-primary);
}
.btn--primary:hover {
  background: var(--color-accent-primary-h);
  border-color: var(--color-accent-primary-h);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15,40,69,0.3);
}

.btn--gold {
  background: var(--color-accent-gold);
  color: #ffffff;
  border-color: var(--color-accent-gold);
}
.btn--gold:hover {
  background: var(--color-accent-gold-h);
  border-color: var(--color-accent-gold-h);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(194,138,0,0.3);
}

.btn--outline {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border);
}
.btn--outline:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-text-secondary);
  color: var(--color-text-primary);
}

.btn--ghost {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  border-color: rgba(255,255,255,0.25);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.2);
  color: #ffffff;
}

.btn--lg { padding: 0.875rem 2rem; font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn--sm { padding: 0.4rem 1rem; font-size: var(--text-xs); }
.btn--icon { width: 40px; height: 40px; padding: 0; }
.btn--icon-sm { width: 32px; height: 32px; padding: 0; }

.btn svg { width: 18px; height: 18px; }

/* ─── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy-900);
  color: rgba(255,255,255,0.7);
  padding-block: var(--space-16) var(--space-8);
  margin-top: var(--space-24);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}
.footer-brand__logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-4);
  text-decoration: none;
}
.footer-brand__logo .mark {
  width: 32px; height: 32px;
  background: var(--color-accent-gold);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--navy-900);
  font-size: var(--text-base);
  font-weight: 700;
}
.footer-brand__tagline {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: rgba(255,255,255,0.5);
  max-width: 280px;
  margin-bottom: var(--space-6);
}
.footer-social {
  display: flex;
  gap: var(--space-3);
}
.footer-social a {
  width: 36px; height: 36px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}
.footer-social a:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
  color: #ffffff;
}

.footer-col__title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  margin-bottom: var(--space-5);
}
.footer-col ul { list-style: none; }
.footer-col li + li { margin-top: var(--space-3); }
.footer-col a {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.footer-col a:hover { color: #ffffff; }

.footer-bottom {
  padding-top: var(--space-8);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.footer-bottom__copy {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.3);
}
.footer-bottom__links {
  display: flex;
  gap: var(--space-5);
}
.footer-bottom__links a {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.35);
  transition: color var(--transition-fast);
}
.footer-bottom__links a:hover { color: rgba(255,255,255,0.7); }

/* ─── Consent Banner ──────────────────────────────────────────────────────────── */
.consent-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--navy-900);
  color: rgba(255,255,255,0.85);
  padding: var(--space-5) var(--gutter);
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}
.consent-banner.visible { transform: translateY(0); }
.consent-banner__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}
.consent-banner__text {
  flex: 1;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.consent-banner__text a { color: var(--gold-300); }
.consent-banner__actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ─── Notification Panel ─────────────────────────────────────────────────────── */
.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  display: none;
  overflow: hidden;
}
.notification-panel.open { display: block; }
.notification-panel__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notification-panel__title {
  font-weight: 600;
  font-size: var(--text-sm);
}
.notification-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}
.notification-item:hover { background: var(--color-bg-secondary); }
.notification-item:last-child { border-bottom: none; }
.notification-item__icon {
  font-size: 1.4em;
  line-height: 1;
  flex-shrink: 0;
}
.notification-item__body { flex: 1; min-width: 0; }
.notification-item__title {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: var(--leading-snug);
}
.notification-item__time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ─── Ad Slots ────────────────────────────────────────────────────────────────── */
.ad-slot {
  min-height: 90px;
  background: var(--color-bg-secondary);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-align: center;
  overflow: hidden;
}
.ad-slot--anchor {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  border-radius: 0;
  border-left: none; border-right: none; border-bottom: none;
  z-index: 90;
  background: var(--color-bg-card);
}
.ad-slot:empty::before { content: 'Ad'; letter-spacing: 0.1em; }

/* ─── Loading skeletons ───────────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--color-bg-secondary) 25%,
    var(--color-border) 50%,
    var(--color-bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ─── Utility classes ─────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-2       { gap: var(--space-2); }
.gap-4       { gap: var(--space-4); }
.mt-4        { margin-top: var(--space-4); }
.mt-8        { margin-top: var(--space-8); }
.mb-4        { margin-bottom: var(--space-4); }
.mb-8        { margin-bottom: var(--space-8); }
.hidden      { display: none !important; }

/* ─── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
  .hero-inner  { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
}

@media (max-width: 768px) {
  :root { --header-height: 60px; }

  .header-nav { display: none; }
  .header-search { display: none; }
  .mobile-menu-btn { display: flex; }

  .header-nav.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0; right: 0;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4) var(--gutter);
    gap: var(--space-1);
    box-shadow: var(--shadow-lg);
    z-index: 99;
  }
  .header-nav.mobile-open .header-search {
    display: block;
    max-width: 100%;
    margin-bottom: var(--space-2);
  }

  .books-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }

  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .hero-stats { gap: var(--space-6); }

  .section-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .books-grid { grid-template-columns: repeat(2, 1fr); }
  .category-chips { gap: var(--space-2); }
  .hero { padding-block: var(--space-12); }
}

/* ─── Print ───────────────────────────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .ad-slot, .consent-banner { display: none; }
  body { background: white; color: black; }
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg-secondary); }
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg-secondary);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ─── Animations ──────────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.animate-fade-in  { animation: fadeIn  var(--transition-base) both; }
.animate-fade-up  { animation: fadeUp  var(--transition-slow) both; }
.animate-scale-in { animation: scaleIn var(--transition-base) both; }

/* Staggered children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(n+7) { animation-delay: 360ms; }

/* ─── Focus styles ──────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}

/* ================================================================
   Phase 3 additions
   ================================================================ */

/* ─── Social share buttons ───────────────────────────────────────────────────── */
.social-share-btns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.share-btn {
  font-size: var(--text-xs) !important;
  padding: .3rem .75rem !important;
  text-decoration: none;
}
.share-btn:hover { text-decoration: none; }

/* ─── Consent-gated ad elements ──────────────────────────────────────────────── */
/* Initially hidden; JS removes display:none after consent */
[data-consent] {
  display: none;
}

/* ─── Pagination (public) ─────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
  justify-content: center;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 .5rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-fast);
}
.pagination a:hover { background: var(--color-bg-secondary); color: var(--color-text-primary); }
.pagination span.current {
  background: var(--color-accent-primary);
  color: #fff;
  border-color: var(--color-accent-primary);
}

/* ─── Bookmark toast ─────────────────────────────────────────────────────────── */
.bm-toast {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-accent-primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  animation: fadeUp .2s both;
}

/* ─── Blog prose ──────────────────────────────────────────────────────────────── */
.blog-prose { color: var(--color-text-secondary); }
.blog-prose h2 {
  font-family: var(--font-display);
  font-size: 1.4rem; font-weight: 700;
  margin: 2.5em 0 .75em;
  color: var(--color-text-primary);
}
.blog-prose h3 {
  font-family: var(--font-display);
  font-size: 1.125rem; font-weight: 600;
  margin: 2em 0 .5em;
}
.blog-prose p   { margin-bottom: 1.375em; }
.blog-prose a   { color: var(--color-accent-primary); text-decoration: underline; }
.blog-prose blockquote {
  border-left: 3px solid var(--color-accent-gold);
  padding: .75rem 1.25rem;
  margin: 1.5em 0;
  background: var(--color-bg-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
}
.blog-prose ul, .blog-prose ol { padding-left: 1.5em; margin-bottom: 1.5em; }
.blog-prose li  { margin-bottom: .5em; }
.blog-prose img { border-radius: var(--radius-lg); margin: 1.5em 0; max-width: 100%; display: block; }

/* ─── Category hero responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .book-detail-grid {
    grid-template-columns: 1fr !important;
  }
  .book-detail-grid > *:first-child {
    display: grid !important;
    grid-template-columns: 130px 1fr;
    gap: 1rem;
    position: static !important;
    align-items: start;
  }
}
