/* ============================================================
   VELUNE — Global Stylesheet
   Fonts: Cormorant Garamond (headings) · DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;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');

:root {
  --bg:         #faf8f4;
  --bg-alt:     #f2ede5;
  --text:       #111118;
  --text-muted: #6b6472;
  --border:     #e4ddd3;
  --surface:    #ffffff;
  --radius:     0.75rem;
  --radius-lg:  1.25rem;
  --shadow:     0 1px 4px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.07);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  --premium:    #c9a84c;
  --danger:     #dc2626;
  --success:    #16a34a;
  --font-head:  'Cormorant Garamond', Georgia, serif;
  --font-body:  'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
input, textarea { outline: none; }

/* Page Loader */
#page-loader {
  position: fixed; inset: 0; background: var(--bg); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
#page-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo {
  font-family: var(--font-head); font-size: 2rem; font-weight: 600;
  letter-spacing: 0.04em; animation: pulse 1.4s ease infinite;
}

/* Toast */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 8000;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.1rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease; max-width: 320px;
}
.toast-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.toast-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Container */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; }
.section    { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }

/* Typography */
.display {
  font-family: var(--font-head);
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 300; line-height: 1.1; letter-spacing: -0.02em;
}
.headline {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 400; line-height: 1.2;
}
.label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.label.muted { color: var(--text-muted); }
.muted { color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.45rem; padding: 0.6rem 1.25rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all 0.18s ease;
  white-space: nowrap; text-decoration: none; font-family: var(--font-body); line-height: 1;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary  { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #2d2d3a; border-color: #2d2d3a; }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--text); background: rgba(0,0,0,0.03); }
.btn-ghost    { background: transparent; color: var(--text); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-premium  { background: var(--premium); color: #fff; border-color: var(--premium); font-weight: 600; }
.btn-premium:hover { background: #b8963e; border-color: #b8963e; }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-lg  { padding: 0.8rem 1.75rem; font-size: 1rem; border-radius: 0.6rem; }
.btn-sm  { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; aspect-ratio: 1; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { box-shadow: var(--shadow); border-color: #d4cfc8; }
.card-body { padding: 1.5rem; }

/* Hero */
.hero {
  position: relative; overflow: hidden;
  min-height: 100vh; display: flex; align-items: center; background: var(--bg);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.85rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.78rem; font-weight: 500; color: var(--text-muted);
  margin-bottom: 1.75rem; background: var(--surface);
}
.hero-headline { color: var(--text); margin-bottom: 1.25rem; }
.hero-headline em { font-style: italic; color: var(--text-muted); }
.hero-sub { font-size: 1.05rem; color: var(--text-muted); line-height: 1.7; max-width: 520px; margin-bottom: 2rem; }
.hero-cta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.hero-visual {
  position: absolute; right: -2rem; top: 0; bottom: 0; width: 42%;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem;
  padding: 3rem 1rem; align-items: center; opacity: 0.6;
}

/* Stats */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; text-align: center;
}
.stat-value {
  font-family: var(--font-head); font-size: 2.5rem; font-weight: 600;
  line-height: 1; letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.8rem; color: var(--text-muted); margin-top: 0.4rem;
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
}

/* Section header */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem;
}
.section-title { font-family: var(--font-head); font-size: 1.6rem; font-weight: 500; }

/* Shelf */
.shelf {
  display: flex; gap: 1rem; overflow-x: auto;
  padding-bottom: 1rem; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }

/* Book Card */
.book-card {
  flex: 0 0 160px; position: relative; border-radius: var(--radius);
  overflow: hidden; scroll-snap-align: start; display: block;
  aspect-ratio: 2/3; background: var(--bg-alt);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.book-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-lg); }
.cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; padding: 1rem;
  font-family: var(--font-head); font-size: 0.9rem; font-weight: 500;
  text-align: center; line-height: 1.4;
  background: linear-gradient(145deg, #2d3748, #1a202c); color: rgba(255,255,255,0.85);
}
.badge {
  position: absolute; top: 0.5rem; left: 0.5rem; padding: 0.18rem 0.5rem;
  border-radius: 0.3rem; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; z-index: 2;
}
.badge-premium { background: var(--premium); color: #fff; }
.badge-new     { background: #2563eb; color: #fff; }
.badge-free    { background: rgba(0,0,0,0.45); color: rgba(255,255,255,0.9); backdrop-filter: blur(4px); }
.overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 55%, rgba(0,0,0,0.2) 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0.85rem; opacity: 0; transition: opacity 0.2s ease; z-index: 1;
}
.book-card:hover .overlay { opacity: 1; }

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

/* Pricing */
.pricing-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.25rem;
}
.pricing-card.featured {
  background: var(--text); color: #fff; border-color: var(--text);
  box-shadow: var(--shadow-lg); transform: scale(1.03);
}
.pricing-price {
  font-family: var(--font-head); font-size: 3rem; font-weight: 600;
  line-height: 1; letter-spacing: -0.03em;
}
.pricing-period { font-size: 0.875rem; color: var(--text-muted); }
.pricing-card.featured .pricing-period { color: rgba(255,255,255,0.5); }

/* Navbar */
.navbar {
  position: sticky; top: 0; z-index: 500;
  background: rgba(250,248,244,0.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); height: 64px;
}
.navbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 1.5rem;
  height: 100%; display: flex; align-items: center; gap: 1.5rem;
}
.nav-logo {
  font-family: var(--font-head); font-size: 1.5rem; font-weight: 600;
  letter-spacing: 0.01em; color: var(--text); flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 0.25rem; flex: 1; }
.nav-links a {
  padding: 0.4rem 0.75rem; border-radius: 0.4rem; font-size: 0.875rem;
  color: var(--text-muted); transition: color 0.15s, background 0.15s; font-weight: 450;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-alt); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

/* Search */
.search-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 0 0.75rem; width: 100%;
  position: relative; transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px rgba(17,17,24,0.08); }
.search-bar .icon { color: var(--text-muted); flex-shrink: 0; display: flex; }
.search-bar input {
  flex: 1; border: none; background: transparent; padding: 0.6rem 0;
  font-size: 0.875rem; color: var(--text); outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-suggestions {
  position: absolute; top: calc(100% + 0.35rem); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 300; overflow: hidden;
}
.search-suggestions.hidden { display: none; }
.suggestion-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem;
  font-size: 0.875rem; color: var(--text); transition: background 0.12s;
}
.suggestion-item:hover { background: var(--bg-alt); }
.suggestion-item svg { flex-shrink: 0; color: var(--text-muted); }

/* Sidebar */
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 1.5rem 1rem;
  display: flex; flex-direction: column;
  position: sticky; top: 64px; height: calc(100vh - 64px);
  overflow-y: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-logo {
  font-family: var(--font-head); font-size: 1.35rem; font-weight: 600;
  padding: 0.25rem 0.5rem; margin-bottom: 1.5rem;
}
.sidebar-section {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted); padding: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.75rem; border-radius: 0.5rem; font-size: 0.875rem;
  color: var(--text-muted); transition: background 0.15s, color 0.15s;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; text-decoration: none; font-family: var(--font-body);
}
.sidebar-link:hover, .sidebar-link.active { background: var(--bg-alt); color: var(--text); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.form-hint  { font-size: 0.78rem; color: var(--text-muted); }
.form-input {
  width: 100%; padding: 0.65rem 0.875rem; border: 1px solid var(--border);
  border-radius: 0.5rem; font-size: 0.9rem; color: var(--text);
  background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font-body);
}
.form-input:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(17,17,24,0.08); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; appearance: none; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 600;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 2rem; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); animation: modalIn 0.2s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-family: var(--font-head); font-size: 1.4rem; font-weight: 500; }

/* Progress */
.progress-bar { height: 4px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--text); transition: width 0.5s ease; }

/* Divider */
.divider-text {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.8rem; color: var(--text-muted); text-align: center;
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.8rem; border: 1px solid var(--border);
  border-radius: 999px; font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s; background: transparent;
  color: var(--text-muted); font-family: var(--font-body);
}
.chip:hover, .chip-active { border-color: var(--text); background: var(--text); color: #fff; }

/* Toggle */
.toggle { position: relative; width: 2.4rem; height: 1.4rem; flex-shrink: 0; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 999px; transition: background 0.2s; cursor: pointer;
}
.toggle input:checked ~ .toggle-track { background: var(--text); }
.toggle-thumb {
  position: absolute; width: 1rem; height: 1rem; left: 0.2rem; top: 0.2rem;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
  pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(1rem); }

/* Table */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.table-wrapper table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table-wrapper thead th {
  padding: 0.75rem 1rem; background: var(--bg-alt); text-align: left;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-wrapper tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-wrapper tbody tr:last-child td { border-bottom: none; }
.table-wrapper tbody tr:hover td { background: var(--bg); }

/* Spinner */
.spinner {
  display: inline-block; width: 1.25rem; height: 1.25rem;
  border: 2px solid var(--border); border-top-color: var(--text);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* Scroll Reveal */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* Hidden */
.hidden { display: none !important; }

/* Responsive */
.hide-mobile  { }
.hide-desktop { display: none !important; }

@media (max-width: 768px) {
  .hide-mobile  { display: none !important; }
  .hide-desktop { display: flex !important; }
  .hero-visual  { display: none; }
  .hero { min-height: auto; padding-top: 2rem; }
  .section    { padding: 3rem 0; }
  .section-sm { padding: 2rem 0; }
  .sidebar { display: none; }
  .pricing-card.featured { transform: none; }
  .container { padding: 0 1rem; }
}

/* Animations */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes slideIn { from { transform: translateX(1rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes modalIn { from { transform: scale(0.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }