/* ==========================================================
   Biblioteka e Vogël — Warm Library (Modern + Cozy)
   ========================================================== */

/* Light (default) */
:root {
  --bg: #f7f0e6;        /* parchment */
  --bg2: #fff8ef;       /* warm highlight */
  --surface: rgba(255, 255, 255, 0.72);
  --surface2: rgba(255, 255, 255, 0.86);

  --text: #2b2118;      /* coffee */
  --muted: rgba(43, 33, 24, 0.72);
  --line: rgba(43, 33, 24, 0.14);

  --accent: #b07a3b;    /* amber */
  --accent2: #7f5539;   /* walnut */
  --accentSoft: rgba(176, 122, 59, 0.18);

  --ok: #2f855a;
  --warn: #b45309;

  --shadow: 0 18px 50px rgba(24, 16, 10, 0.14);
  --shadow2: 0 10px 28px rgba(24, 16, 10, 0.10);

  --radius: 18px;
  --radius2: 14px;
  --max: 1140px;

  --serif: "Playfair Display", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Dark (sepia / library-night) */
html[data-theme="dark"] {
  --bg: #1a1310;
  --bg2: #221914;
  --surface: rgba(255, 248, 235, 0.06);
  --surface2: rgba(255, 248, 235, 0.09);

  --text: rgba(255, 248, 235, 0.92);
  --muted: rgba(255, 248, 235, 0.70);
  --line: rgba(255, 248, 235, 0.14);

  --accent: #d2a154;
  --accent2: #c08a4a;
  --accentSoft: rgba(210, 161, 84, 0.16);

  --shadow: 0 22px 65px rgba(0, 0, 0, 0.55);
  --shadow2: 0 12px 34px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.6;

  /* Warm, not noisy: soft light + paper vibe */
  background:
    radial-gradient(1000px 520px at 12% 12%, rgba(176, 122, 59, 0.18), transparent 60%),
    radial-gradient(900px 520px at 88% 8%, rgba(127, 85, 57, 0.14), transparent 62%),
    radial-gradient(900px 620px at 50% 98%, rgba(176, 122, 59, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

/* Subtle paper grain (no "busy" pattern) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(43, 33, 24, 0.06) 1px, transparent 0);
  background-size: 3px 3px;
  opacity: 0.08;
  mix-blend-mode: multiply;
}
html[data-theme="dark"] body::before {
  background-image: radial-gradient(rgba(255, 248, 235, 0.05) 1px, transparent 0);
  opacity: 0.10;
  mix-blend-mode: overlay;
}

::selection {
  background: var(--accentSoft);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  padding: 0.14em 0.38em;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.container {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: -999px;
  background: var(--surface2);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 12px;
  z-index: 999;
}
.skip-link:focus { left: 16px; top: 16px; }

.sr-only {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* ==========================================================
   Header / Nav
   ========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  /* Fallback-friendly translucent parchment */
  background: rgba(255, 248, 239, 0.78);
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] .site-header {
  background: rgba(26, 19, 16, 0.70);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(18px 18px at 30% 25%, rgba(255,255,255,0.70), transparent 60%),
    linear-gradient(135deg, rgba(176, 122, 59, 0.95), rgba(127, 85, 57, 0.92));
  color: white;
  box-shadow: var(--shadow2);
  border: 1px solid rgba(255,255,255,0.18);
}
html[data-theme="dark"] .logo {
  border-color: rgba(255, 248, 235, 0.14);
}

.brand-title {
  font-weight: 860;
  letter-spacing: -0.2px;
}
.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(24,16,10,0.06);
}
html[data-theme="dark"] .nav {
  box-shadow: 0 10px 26px rgba(0,0,0,0.28);
}

.nav-link {
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}
.nav-link:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--surface2);
}
.nav-link.is-active {
  color: var(--text);
  background: linear-gradient(135deg, var(--accentSoft), rgba(255,255,255,0.22));
  border: 1px solid var(--line);
}
html[data-theme="dark"] .nav-link.is-active {
  background: linear-gradient(135deg, var(--accentSoft), rgba(255, 248, 235, 0.06));
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(24,16,10,0.10);
}
.theme-toggle:hover { background: var(--surface2); }
.theme-toggle:focus-visible {
  outline: 0;
  box-shadow:
    0 0 0 4px rgba(176, 122, 59, 0.28),
    0 12px 30px rgba(24,16,10,0.14);
}
html[data-theme="dark"] .theme-toggle:focus-visible {
  box-shadow:
    0 0 0 4px rgba(210, 161, 84, 0.22),
    0 12px 30px rgba(0,0,0,0.44);
}
.theme-emoji { font-size: 16px; }
.theme-label { font-size: 13px; color: var(--muted); }

/* ==========================================================
   Buttons / UI
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-weight: 850;
  text-decoration: none !important;
  user-select: none;
  white-space: nowrap;
  transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  border-color: rgba(255,255,255,0.20);
  color: #fff;
  background:
    radial-gradient(22px 22px at 25% 20%, rgba(255,255,255,0.30), transparent 60%),
    linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: var(--shadow2);
}
.btn-primary:hover { filter: brightness(1.04); }

.btn-ghost {
  background: var(--surface);
}
.btn-ghost:hover { background: var(--surface2); }

/* Buttons on book cards */
.btn-open {
  background:
    radial-gradient(18px 18px at 25% 30%, rgba(255,255,255,0.26), transparent 60%),
    linear-gradient(135deg, var(--ok), var(--accent));
  color: white;
  border: 1px solid rgba(255,255,255,0.18);
}
.btn-download {
  background: transparent;
}
.btn-open:hover { transform: translateY(-1px); }
.btn-download:hover { background: var(--surface); }

.btn-disabled, .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
}

.link {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-weight: 850;
}

/* ==========================================================
   Layout blocks
   ========================================================== */
.hero {
  padding: 56px 0 28px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px;
  align-items: center;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(32px, 3vw, 46px);
  letter-spacing: -0.8px;
  line-height: 1.06;
}
.hero-copy p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
  max-width: 66ch;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 18px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.section {
  padding: 46px 0 76px;
}
.section.alt {
  padding: 24px 0 58px;
}

.section-head {
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  letter-spacing: -0.4px;
}
.section-head p {
  margin: 0;
  color: var(--muted);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.feature {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 14px 34px rgba(24,16,10,0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feature:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 58px rgba(24,16,10,0.12);
}
.feature-icon { font-size: 22px; }
.feature h3 {
  margin: 10px 0 8px;
  letter-spacing: -0.2px;
}
.feature p {
  margin: 0;
  color: var(--muted);
}

.page-head {
  padding: 36px 0 18px;
}
.page-head h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(28px, 2.6vw, 38px);
  letter-spacing: -0.6px;
}
.muted { color: var(--muted); }

/* ==========================================================
   Cards / Panels
   ========================================================== */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Hero card: book-spine preview (warm, clean) */
.card.glass {
  background:
    radial-gradient(520px 260px at 22% 0%, rgba(176, 122, 59, 0.16), transparent 60%),
    radial-gradient(520px 260px at 85% 10%, rgba(127, 85, 57, 0.12), transparent 60%),
    linear-gradient(180deg, var(--surface2), var(--surface));
}

.card-top { padding: 16px; display: grid; gap: 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.30);
  font-weight: 850;
  font-size: 13px;
  color: var(--muted);
}
html[data-theme="dark"] .chip { background: rgba(255,248,235,0.06); }

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.32);
}
html[data-theme="dark"] .stat { background: rgba(255,248,235,0.06); }

.stat-k {
  font-size: 20px;
  font-weight: 920;
  letter-spacing: -0.3px;
}
.stat-l {
  font-size: 12px;
  color: var(--muted);
}

.card-mid { padding: 0 16px 16px; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.preview-tile {
  height: 86px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.20));
  position: relative;
  overflow: hidden;
}
html[data-theme="dark"] .preview-tile {
  background: linear-gradient(180deg, rgba(255,248,235,0.10), rgba(255,248,235,0.04));
}
.preview-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      transparent 0 22%,
      rgba(176, 122, 59, 0.22) 22% 24%,
      transparent 24% 58%,
      rgba(127, 85, 57, 0.16) 58% 60%,
      transparent 60% 100%);
  opacity: 0.55;
}
html[data-theme="dark"] .preview-tile::after {
  background:
    linear-gradient(90deg,
      transparent 0 22%,
      rgba(210, 161, 84, 0.22) 22% 24%,
      transparent 24% 58%,
      rgba(192, 138, 74, 0.18) 58% 60%,
      transparent 60% 100%);
}

.card-bottom {
  padding: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.note {
  color: var(--muted);
  font-size: 14px;
}

.panel {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 14px 34px rgba(24,16,10,0.08);
}
.panel h2 { margin: 0 0 8px; font-family: var(--serif); }
.panel p { margin: 0 0 12px; color: var(--muted); }

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.list li { margin: 6px 0; }

/* ==========================================================
   Callout
   ========================================================== */
.callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(520px 220px at 18% 20%, rgba(176, 122, 59, 0.16), transparent 65%),
    radial-gradient(520px 220px at 88% 0%, rgba(127, 85, 57, 0.12), transparent 62%),
    var(--surface);
  box-shadow: 0 18px 48px rgba(24,16,10,0.10);
}
.callout h2 { margin: 0 0 6px; font-family: var(--serif); letter-spacing: -0.3px; }
.callout p { margin: 0; color: var(--muted); max-width: 70ch; }

/* ==========================================================
   Timeline
   ========================================================== */
.timeline {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.timeline-item h3 {
  margin: 0 0 6px;
  letter-spacing: -0.2px;
}
.timeline-item p { margin: 0; color: var(--muted); }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 28px rgba(176,122,59,0.18);
}

/* ==========================================================
   Librat page — Toolbar
   ========================================================== */
.toolbar {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.search { position: relative; }
.search input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-weight: 700;
}
.search input::placeholder { color: rgba(43, 33, 24, 0.50); }
html[data-theme="dark"] .search input::placeholder { color: rgba(255, 248, 235, 0.45); }
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 6px rgba(176, 122, 59, 0.22);
}
html[data-theme="dark"] .search input:focus {
  box-shadow: 0 0 0 6px rgba(210, 161, 84, 0.18);
}
.search-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}
.pill:hover { background: var(--surface2); color: var(--text); }
.pill:active { transform: translateY(1px); }
.pill.is-active {
  color: #fff;
  border-color: rgba(255,255,255,0.18);
  background:
    radial-gradient(18px 18px at 25% 30%, rgba(255,255,255,0.26), transparent 60%),
    linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ==========================================================
   Books grid
   ========================================================== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.book {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(24,16,10,0.08);
  display: flex;
  flex-direction: column;
  min-height: 360px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.book:hover {
  transform: translateY(-6px);
  box-shadow: 0 26px 70px rgba(24,16,10,0.14);
}

.book-cover {
  height: 140px;
  display: flex;
  align-items: center;
  padding: 18px 20px;
  gap: 14px;
  background:
    radial-gradient(500px 200px at 15% 10%, rgba(176, 122, 59, 0.18), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,0.48), rgba(255,255,255,0.18));
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] .book-cover {
  background:
    radial-gradient(520px 220px at 15% 10%, rgba(210, 161, 84, 0.18), transparent 62%),
    linear-gradient(180deg, rgba(255,248,235,0.08), rgba(255,248,235,0.03));
}

.book-cover .cover-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(18px 18px at 30% 25%, rgba(255,255,255,0.32), transparent 60%),
    linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 12px 26px rgba(176,122,59,0.18);
  color: white;
}
.book-cover .cover-icon svg { width: 26px; height: 26px; fill: currentColor; }

.book-head { display:flex; flex-direction: column; gap: 6px; }
.book-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 900;
  letter-spacing: -0.2px;
  line-height: 1.12;
  color: var(--text);
}
.book-author {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
}

.book-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
}

.book-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-height: 4.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

.book-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  align-items: center;
}

/* Empty state */
.empty {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  background: transparent;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  max-width: var(--max);
  margin: 0 auto;
  padding: 6px 20px;
}

.footer-left { display: flex; flex-direction: column; gap: 6px; }
.footer-brand { font-weight: 900; font-size: 18px; }
.footer-right { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.footer-link {
  color: var(--muted);
  font-weight: 750;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
}
.footer-link:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  text-decoration: none;
}

@media (max-width: 560px) {
  .footer-inner { padding: 6px 12px; }
  .footer-left { align-items: center; text-align: center; }
  .footer-right { justify-content: center; }
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .header-inner { grid-template-columns: 1fr; }
  .nav { justify-content: center; }
  .theme-toggle { justify-self: start; }
  .toolbar { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container { width: min(var(--max), calc(100% - 28px)); }
  .callout { flex-direction: column; align-items: flex-start; }
}
