/* ==========================================================================
   Bogatlas — nordisk, redaktionel visuel stil
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --paper: #f6f3ee;
  --surface: #ffffff;
  --ink: #1c2126;
  --ink-soft: #5b6570;
  --line: #e3ddd1;
  --line-strong: #cfc7b6;
  --rust: #b1512e;
  --rust-deep: #8f3f22;
  --pine: #2f5d50;
  --sand: #e4d9c7;

  --cover-1a: #2f5d50; --cover-1b: #1c3934;
  --cover-2a: #b1512e; --cover-2b: #7a2f18;
  --cover-3a: #3a4a63; --cover-3b: #1b2436;
  --cover-4a: #8a6a3b; --cover-4b: #4f3a1c;
  --cover-5a: #6b4457; --cover-5b: #3a2230;
  --cover-6a: #3f6b6f; --cover-6b: #223f42;

  --radius: 3px;
  --shadow-sm: 0 1px 2px rgba(28, 33, 38, 0.06);
  --shadow-md: 0 8px 24px rgba(28, 33, 38, 0.10);
  --header-h: 4.25rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: 1440px; margin: 0 auto; padding: 0 1.75rem; }

/* ---------------------------------- header ------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center;
  background: rgba(246, 243, 238, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex; align-items: center; gap: 2rem;
  width: 100%;
}

.brand { display: flex; align-items: baseline; gap: 0.6rem; flex-shrink: 0; }
.brand-mark {
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--rust), var(--pine));
  flex-shrink: 0;
}
.brand h1 { font-size: 1.25rem; }
.brand span { font-size: 0.7rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.1em; }

.search-wrap { flex: 1; max-width: 640px; position: relative; }
.search-form {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.5rem 0.4rem 0.5rem 1.1rem;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.search-form:focus-within { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(177,81,46,0.12); }
.search-form input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 0.92rem; color: var(--ink); font-family: inherit;
}
.search-form input::placeholder { color: #93949a; }
.search-form button {
  border: none; background: var(--ink); color: var(--paper);
  border-radius: 999px; padding: 0.5rem 1.1rem; font-size: 0.85rem; font-weight: 600;
  transition: background .15s ease;
}
.search-form button:hover { background: var(--rust); }

.search-meta {
  display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
  font-size: 0.8rem; color: var(--ink-soft);
}
.reset-btn {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.78rem; color: var(--ink);
  display: none; align-items: center; gap: 0.35rem;
}
.reset-btn.is-visible { display: inline-flex; }
.reset-btn:hover { border-color: var(--rust); color: var(--rust); }

/* ---------------------------------- hero -------------------------------- */

.hero {
  padding: 3rem 0 1.75rem;
  border-bottom: 1px solid var(--line);
}
.hero-grid { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; flex-wrap: wrap; }
.hero h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); max-width: 34rem; }
.hero p { color: var(--ink-soft); max-width: 32rem; margin-top: 0.75rem; }
.hero-stats { display: flex; gap: 1.75rem; }
.hero-stat strong { display: block; font-family: 'Fraunces', serif; font-size: 1.7rem; }
.hero-stat span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 999px; padding: 0.35rem 0.85rem; font-size: 0.78rem; color: var(--ink-soft);
}
.chip:hover { border-color: var(--rust); color: var(--rust); }

/* ---------------------------------- layout ------------------------------ */

.explorer {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.map-pane { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); }
#map { width: 100%; height: 100%; background: #eae6dd; }
#map .leaflet-tile-pane { filter: saturate(0.55) brightness(1.06) contrast(0.96) sepia(0.06); }

.list-pane {
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  border-left: 1px solid var(--line);
  padding: 1.5rem 1.75rem 4rem;
}

.list-pane-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1rem;
}
.list-pane-head h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); font-family: 'Inter'; font-weight: 600; }
.list-count { font-size: 0.8rem; color: var(--ink-soft); }

.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--ink-soft);
}
.empty-state strong { display: block; color: var(--ink); font-family: 'Fraunces', serif; font-size: 1.15rem; margin-bottom: 0.4rem; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }

/* ---------------------------------- book card ---------------------------- */

.book-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
  scroll-margin-top: 1rem;
}
.book-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.book-card.is-highlighted { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(177,81,46,0.18); }

.book-cover {
  aspect-ratio: 3 / 2;
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1rem 1.1rem;
  color: #f4f1ea;
  overflow: hidden;
}
.book-cover::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45), transparent 60%);
}
.book-cover .kicker, .book-cover h4, .book-cover .cover-author { position: relative; z-index: 1; }
.book-cover .kicker { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.85; }
.book-cover h4 { font-size: 1.15rem; margin: 0.3rem 0 0.15rem; }
.book-cover .cover-author { font-size: 0.78rem; opacity: 0.9; }
.book-cover svg.pattern { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.16; }

.book-cover.cover-1 { background: linear-gradient(160deg, var(--cover-1a), var(--cover-1b)); }
.book-cover.cover-2 { background: linear-gradient(160deg, var(--cover-2a), var(--cover-2b)); }
.book-cover.cover-3 { background: linear-gradient(160deg, var(--cover-3a), var(--cover-3b)); }
.book-cover.cover-4 { background: linear-gradient(160deg, var(--cover-4a), var(--cover-4b)); }
.book-cover.cover-5 { background: linear-gradient(160deg, var(--cover-5a), var(--cover-5b)); }
.book-cover.cover-6 { background: linear-gradient(160deg, var(--cover-6a), var(--cover-6b)); }

.book-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.book-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ink-soft); }
.book-synopsis { font-size: 0.86rem; color: var(--ink); opacity: 0.88; }

.location-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.1rem; }
.location-pill {
  font-size: 0.72rem; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: var(--sand); color: var(--rust-deep); border: 1px solid transparent;
}

.book-actions { margin-top: auto; padding-top: 0.4rem; }
.show-on-map {
  width: 100%; border: 1px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: var(--radius); padding: 0.5rem; font-size: 0.8rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: background .15s ease, color .15s ease;
}
.show-on-map:hover { background: var(--ink); color: var(--paper); }

/* ---------------------------------- leaflet tweaks ----------------------- */

.leaflet-popup-content-wrapper { border-radius: var(--radius); box-shadow: var(--shadow-md); }
.leaflet-popup-content { margin: 0.85rem 1rem; font-family: 'Inter'; }
.popup-kicker { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }
.popup-title { font-family: 'Fraunces', serif; font-size: 1rem; margin: 0.15rem 0; }
.popup-author { font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 0.5rem; }
.popup-link { font-size: 0.78rem; font-weight: 600; color: var(--rust); text-decoration: none; }

.bogatlas-pin { display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25)); }
.marker-cluster-custom {
  background: var(--ink); color: var(--paper); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; font-family: 'Inter';
  box-shadow: 0 0 0 4px rgba(28,33,38,0.12);
}

/* ---------------------------------- footer ------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.site-footer a { color: var(--rust); text-decoration: none; }

/* ---------------------------------- responsive --------------------------- */

@media (max-width: 980px) {
  .explorer { grid-template-columns: 1fr; }
  .map-pane { position: relative; top: 0; height: 62vh; }
  .list-pane { height: auto; border-left: none; border-top: 1px solid var(--line); }
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 0; }
  .site-header { height: auto; }
  :root { --header-h: 0px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
}

@media (max-width: 560px) {
  .hero-stats { display: none; }
}
