/* Remigiusz Mróz – mapa książek. Plain CSS, no build step. */

:root {
  --bg: #f4f0e8;
  --surface: #fffdf8;
  --surface-2: #efe9df;
  --text: #1f1c18;
  --muted: #6d665b;
  --line: #ddd5c8;
  --accent: #8b2e2e;
  --accent-text: #ffffff;
  --read: #2f7d4f;
  --reading: #b8700a;
  --want: #4a52b5;
  --skip: #9b948a;
  --none: #d6cfc2;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.08), 0 6px 18px rgba(40, 30, 10, 0.06);
  --radius: 10px;
  --tile-w: 112px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f;
    --surface: #211e19;
    --surface-2: #2a261f;
    --text: #efe8dc;
    --muted: #a69e90;
    --line: #35302a;
    --accent: #e07a5f;
    --accent-text: #1a120e;
    --read: #4fb57c;
    --reading: #e3a23d;
    --want: #8f95f2;
    --skip: #6e685f;
    --none: #3b362f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

a { color: var(--accent); }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.wrap {
  width: min(1100px, 100% - 32px);
  margin: 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 8px 12px;
  border-radius: 6px;
}
.skip-link:focus { left: 8px; z-index: 10; }

/* Header */

.site-header {
  padding: 28px 0 18px;
  background: linear-gradient(180deg, var(--surface-2), var(--bg));
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--muted);
}

.site-header h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.1; }

.intro {
  margin: 10px 0 0;
  max-width: 70ch;
  color: var(--muted);
}

.intro a { white-space: nowrap; }

.stats {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 14px;
  color: var(--muted);
}

.stats b { color: var(--text); font-weight: 600; }

/* Toolbar */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 0;
}

.search { flex: 1 1 220px; }

.search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--none);
  display: inline-block;
}
.dot.read { background: var(--read); }
.dot.reading { background: var(--reading); }
.dot.want { background: var(--want); }
.dot.skip { background: var(--skip); }

/* Next up */

.next-up {
  margin: 20px 0 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.next-up h2 { font-size: 18px; margin-bottom: 6px; }

.next-up ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.next-up li button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 4px 0;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.next-up li button:hover .title { text-decoration: underline; }

.next-up .series-name { color: var(--muted); font-size: 14px; min-width: 150px; }
.next-up .title { font-weight: 600; }
.next-up .tag { font-size: 12px; color: var(--reading); }

/* Series sections */

.series {
  margin: 26px 0 0;
}

.series-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: start;
}

.series-head h2 { font-size: 24px; }

.series-head .pseudonym {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 8px;
}

.series-head .tagline {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  max-width: 80ch;
}

.series-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.series-meta .next { color: var(--text); }
.series-meta .next b { font-weight: 600; }

.series-meta .link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
}

.segments {
  grid-column: 1 / -1;
  display: flex;
  gap: 3px;
  margin-top: 4px;
  max-width: 520px;
}

.seg {
  flex: 1 1 0;
  height: 6px;
  border-radius: 2px;
  background: var(--none);
}
.seg.read { background: var(--read); }
.seg.reading { background: var(--reading); }
.seg.want { background: var(--want); }
.seg.skip { background: var(--skip); }

.lane {
  list-style: none;
  margin: 10px 0 0;
  padding: 6px 2px 16px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.tile {
  flex: 0 0 var(--tile-w);
  scroll-snap-align: start;
}

.tile[hidden] { display: none; }

.tile button {
  position: relative;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--none);
  border-radius: 8px;
  padding: 7px 7px 8px;
  box-shadow: var(--shadow);
  transition: transform 120ms ease;
}

.tile button:hover, .tile button:focus-visible { transform: translateY(-2px); outline-offset: 2px; }

.tile[data-status="read"] button { border-top-color: var(--read); }
.tile[data-status="reading"] button { border-top-color: var(--reading); }
.tile[data-status="want"] button { border-top-color: var(--want); }
.tile[data-status="skip"] button { border-top-color: var(--skip); }
.tile[data-status="skip"] .cover, .tile[data-status="read"] .cover { filter: saturate(0.6); }
.tile[data-status="skip"] button { opacity: 0.75; }

.cover {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-2);
}

.cover.placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.25;
  color: var(--muted);
}

.num {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.mark {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--none);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.mark.read { background: var(--read); }
.mark.reading { background: var(--reading); }
.mark.want { background: var(--want); }
.mark.skip { background: var(--skip); }

.tile .title {
  display: block;
  margin-top: 7px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.tile .year {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.series.other .lane { opacity: 0.9; }

.empty { color: var(--muted); margin: 40px 0; text-align: center; }

/* Footer */

.site-footer {
  margin-top: 48px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 14px;
  color: var(--muted);
}

.site-footer .wrap {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.site-footer h2 { font-size: 18px; color: var(--text); margin-bottom: 6px; }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.buttons button, .status-buttons button, .nav-buttons button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 12px;
}

.buttons button.danger { color: var(--accent); }

.sources ul { padding-left: 18px; margin: 0; }

/* Dialogs */

.dialog {
  width: min(720px, 100% - 24px);
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.dialog::backdrop { background: rgba(10, 8, 5, 0.55); }

.dialog-inner { padding: 20px 22px 24px; }

.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dialog-top .crumbs { font-size: 13px; color: var(--muted); margin: 0 0 4px; }

.close {
  border: 0;
  background: var(--surface-2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
}

.book-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  margin-top: 14px;
}

@media (max-width: 560px) {
  .book-grid { grid-template-columns: 1fr; }
  .book-grid .cover { max-width: 160px; }
}

.dialog h2 { font-size: 26px; line-height: 1.15; }

.meta { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 4px;
}

.status-buttons button { display: inline-flex; align-items: center; gap: 6px; }

.status-buttons button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.status-buttons button[aria-pressed="true"] .dot { outline: 2px solid var(--bg); }

.desc { margin: 14px 0 0; }

.desc-more { margin-top: 8px; }

.muted { color: var(--muted); }

.dialog h3 { font-size: 16px; margin-top: 16px; }

.count { font-size: 13px; color: var(--muted); white-space: nowrap; padding-top: 8px; }

.source { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.note { margin: 10px 0 0; font-style: italic; color: var(--muted); }

details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); }
details p { margin: 8px 0 0; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.tags li {
  font-size: 12px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--muted);
}

.editions { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }

.links { margin-top: 12px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; }

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.nav-buttons button[disabled] { opacity: 0.4; cursor: default; }

.adaptations, .related { padding-left: 18px; margin: 6px 0 0; }

@media (max-width: 480px) {
  :root { --tile-w: 100px; }
  .series-head h2 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile button { transition: none; }
}
