/* Le letture di Lisa — stile */

@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/fraunces-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/fraunces-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/fraunces-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #fff8fb;
  --glow-1: rgba(250, 205, 220, .38);
  --glow-2: rgba(253, 224, 233, .45);
  --panel: #ffffff;
  --panel-strong: #fff1f6;
  --line: #f8e2ea;
  --fg: #4a3541;
  --muted: #9b7d8a;
  --rose: #eea1ba;
  --rose-deep: #e07ea0;
  --rose-soft: #fadbe5;
  --rose-wash: #fef0f4;
  --ink: #cf7096;
  --ink-strong: #b0557b;
  --grid: #faeaf0;
  --axis: #f3d0dc;
  --tip-bg: #ffffff;
  --shadow: 0 1px 2px rgba(200, 110, 145, .05), 0 8px 24px -14px rgba(200, 110, 145, .22);
  --bad: #c0392b;
  --cover-ink: #6f2c48;
  --cover-line: rgba(111, 44, 72, .28);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --gap: 16px;
  --dur: 600ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1217;
    --glow-1: rgba(212, 87, 127, .22);
    --glow-2: rgba(160, 60, 100, .18);
    --panel: #281920;
    --panel-strong: #34202a;
    --line: #47293a;
    --fg: #f7e9ef;
    --muted: #c5a2b2;
    --rose: #ec7fa1;
    --rose-deep: #f8a9c1;
    --rose-soft: #5b3445;
    --rose-wash: #3a2330;
    --ink: #f4a3bd;
    --ink-strong: #f7b6ca;
    --cover-ink: #5a2139;
    --cover-line: rgba(90, 33, 57, .3);
    --grid: #3a2430;
    --axis: #5b3445;
    --tip-bg: #321f28;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .7);
    --bad: #ff8a7a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(60rem 26rem at 6% -8%, var(--glow-1), transparent 70%),
    radial-gradient(42rem 24rem at 100% 0%, var(--glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1200px;
  margin-inline: auto;
  padding: clamp(20px, 4vw, 56px) clamp(16px, 4vw, 48px) 40px;
}

/* Header */
.head { margin-bottom: clamp(24px, 4vw, 40px); }
.head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-strong);
}
.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.04;
  letter-spacing: -.01em;
  color: var(--ink);
}
.title em { font-style: italic; }
.lede {
  margin: 12px 0 0;
  max-width: 46rem;
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  color: var(--muted);
}
.lede b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

.anno { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.anno[hidden] { display: none; }
.anno span { font-size: 13px; }
.anno select {
  appearance: none;
  font: inherit;
  color: var(--fg);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23d4577f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 32px 6px 14px;
  cursor: pointer;
}
.anno select:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* Section heads */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.h2.h2-big {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  line-height: 1.15;
  color: var(--ink);
}

/* Layout */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}
.col { display: grid; gap: clamp(20px, 2.4vw, 28px); min-width: 0; }

.h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-strong);
}
.note {
  margin: 4px 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2vw, 24px);
  box-shadow: var(--shadow);
  min-width: 0;
}

/* Ranking */
.rank-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.toggle[hidden] { display: none; }
.toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.toggle button[aria-pressed="true"] { background: var(--rose-soft); color: var(--ink-strong); }
.toggle button:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.book {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.book.first { background: linear-gradient(160deg, var(--panel-strong), var(--panel) 70%); }
.rank-n {
  font-family: var(--serif);
  font-size: 2.1rem;
  line-height: 1;
  color: var(--rose-deep);
  min-width: 1.3ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cover {
  width: 78px;
  aspect-ratio: 2 / 3;
  border-radius: 3px 7px 7px 3px;
  box-shadow: inset 5px 0 0 rgba(111, 44, 72, .08), 0 8px 16px -10px rgba(200, 110, 145, .55);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 8px 8px 12px;
  color: var(--cover-ink);
  overflow: hidden;
}
img.cover { padding: 0; object-fit: cover; background: var(--rose-wash); }
.first .cover { width: 96px; }
.cv-t {
  font-family: var(--serif);
  font-size: 11.5px;
  line-height: 1.2;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.first .cv-t { font-size: 13.5px; }
.cv-a {
  font-size: 8.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .92;
  border-top: 1px solid var(--cover-line);
  padding-top: 4px;
  flex-shrink: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-t { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.2rem; line-height: 1.25; }
.first .bk-t { font-size: 1.38rem; }
.bk-a { margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.bk-m {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bk-d { margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--fg); }
.stars { position: relative; display: inline-block; letter-spacing: 1px; color: var(--rose-soft); line-height: 1; font-size: 14px; }
.stars-on { position: absolute; inset: 0 auto 0 0; overflow: hidden; white-space: nowrap; color: var(--rose); }
.chip { padding: 2px 9px; border-radius: 999px; background: var(--rose-wash); color: var(--ink-strong); }

.empty {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .book { gap: 12px; padding: 14px; }
  .rank-n { font-size: 1.7rem; }
  .cover { width: 62px; padding: 8px 6px 6px 10px; }
  .first .cover { width: 76px; }
  .cv-t { font-size: 10px; -webkit-line-clamp: 3; }
  .first .cv-t { font-size: 11.5px; -webkit-line-clamp: 4; }
  .cv-a { font-size: 7.5px; }
}

/* Tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
  gap: 14px;
  margin-top: 14px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.tl { margin: 0; font-size: 13px; color: var(--muted); }
.tv {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.unit { font-family: var(--sans); font-size: 15px; color: var(--muted); margin-left: 4px; }
.ts { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tiles-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.tile-wide { background: linear-gradient(120deg, var(--panel-strong), var(--panel) 75%); }
.unit.unit-pre { margin: 0 6px 0 0; }
.tile-side { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.tile-side span { white-space: nowrap; }
.tile-side b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-note { white-space: normal; }
.tile-note[hidden] { display: none; }
.stars[hidden] { display: none; }
.stars-big { font-size: 19px; letter-spacing: 2px; margin-top: 6px; }

/* Chart */
.chart { position: relative; min-height: 250px; }
.chart svg { display: block; overflow: visible; }
.chart text { font-family: var(--sans); font-variant-numeric: tabular-nums; }
.bar { fill: var(--rose); transition: fill .15s; }
.bar.on { fill: var(--rose-deep); }
.tip {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--tip-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px 10px;
  font-size: 12.5px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}
.tip[hidden] { display: none; }
.tip-d { color: var(--muted); }
.tip b { font-weight: 600; }

/* Authors and languages */
.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: clamp(20px, 2.4vw, 28px);
  align-items: stretch;
}
.empty-line { margin: 0; font-size: 13.5px; color: var(--muted); }
.empty-line[hidden] { display: none; }
.empty code { color: var(--ink-strong); }
.genres { display: grid; gap: 12px; }
.gr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 13.5px;
}
.gr .gn { grid-row: 1; grid-column: 1; }
.gr .gc { grid-row: 1; grid-column: 2; }
.gr .gb { grid-row: 2; grid-column: 1 / -1; }
.gn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb { height: 8px; border-radius: 999px; background: var(--rose-wash); overflow: hidden; }
.gb i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--rose-soft), var(--rose)); }
.gc { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.5ch; white-space: nowrap; }

/* Footer */
.foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* Error */
.error {
  max-width: 34rem;
  margin: 18vh auto 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--fg);
}
.error[hidden] { display: none; }
.error h2 { margin: 0 0 8px; font-family: var(--serif); font-weight: 400; color: var(--ink); }
.error p { margin: 0; color: var(--muted); font-size: 14px; }
.error code { color: var(--fg); }

@media (prefers-reduced-motion: no-preference) {
  @keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .anim .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow var(--dur) var(--ease) both; }
  .anim .book, .anim .tile { animation: rise var(--dur) var(--ease) both; }
  .anim .gb i { transform-origin: 0 50%; animation: fill var(--dur) var(--ease) both; }
}

/* All books */
.all { margin-top: clamp(24px, 3vw, 36px); }
.all-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.all-title { flex: 1 1 20rem; min-width: 0; }
.all-count { font-weight: 400; color: var(--muted); font-size: .95rem; margin-left: 4px; font-variant-numeric: tabular-nums; }
.all-tools { display: flex; gap: 8px; flex: 0 1 26rem; min-width: 0; flex-wrap: wrap; }
.search {
  flex: 1 1 12rem; min-width: 0;
  font: inherit; font-size: 14px; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px;
}
.search::placeholder { color: var(--muted); }
.search:focus-visible { outline: 2px solid var(--rose); outline-offset: 1px; }
.btn {
  appearance: none; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--ink-strong); background: var(--rose-wash); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; white-space: nowrap;
}
.btn:hover { background: var(--rose-soft); }
.btn:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
.table-box { max-height: 32rem; overflow: auto; border-top: 1px solid var(--line); margin-top: 4px; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-weight: 600; padding: 0; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.table td:not(:first-child) { color: var(--muted); white-space: nowrap; }
.table .num { text-align: right; }
.table td.stima { font-style: italic; opacity: .75; }
.table tbody tr:hover td { background: var(--rose-wash); }
.sort { appearance: none; border: 0; background: none; font: inherit; color: var(--ink-strong); padding: 9px 10px; width: 100%; text-align: inherit; cursor: pointer; white-space: nowrap; }
.sort:focus-visible { outline: 2px solid var(--rose); outline-offset: -2px; }
.table th[aria-sort="ascending"] .sort::after { content: " ↑"; }
.table th[aria-sort="descending"] .sort::after { content: " ↓"; }
.nessuno { padding-top: 14px; }
@media (max-width: 560px) { .narrow-hide { display: none; } }

/* Loading */
.loading {
  margin: 30vh auto 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--ink);
}
.loading[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes pulse { 50% { opacity: .45; } }
  .loading { animation: pulse 1.4s ease-in-out infinite; }
}

/* To read and wishlist */
.lists { margin-top: clamp(24px, 3vw, 36px); }
.lists .h2 { margin-bottom: 10px; }
.mini-list { list-style: none; margin: 0; padding: 0; max-height: 26rem; overflow: auto; border-top: 1px solid var(--line); }
.mini-list[hidden] { display: none; }
.mini { display: grid; gap: 2px; padding: 10px 2px; border-bottom: 1px solid var(--grid); }
.mini-t { font-family: var(--serif); font-size: 1.02rem; color: var(--fg); text-decoration: none; }
a.mini-t { color: var(--ink-strong); text-decoration: underline; text-decoration-color: var(--rose-soft); text-underline-offset: 3px; }
a.mini-t:hover { text-decoration-color: var(--rose); }
a.mini-t::after { content: " ↗"; font-family: var(--sans); font-size: .8em; }
.mini-a { font-size: 13px; color: var(--muted); }
.all-head .h2 { margin-bottom: 4px; }

/* Card titles without subtitles */
.card > .h2 { margin-bottom: 14px; }
.all-head { align-items: center; margin-bottom: 12px; }

/* Period buttons */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 500; padding: 5px 14px; border-radius: 999px; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background-color .2s, color .2s;
}
.seg button[aria-pressed="true"] { background: var(--rose-soft); color: var(--ink-strong); }
.seg button:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
.rank-head { margin-bottom: 14px; }
.page { padding-bottom: clamp(32px, 5vw, 64px); }

/* Logo next to the title */
.title { display: flex; align-items: center; gap: .22em; }
.logo { width: .86em; height: .86em; flex: none; transform: translateY(.03em); }
.logo-page { fill: var(--rose-wash); stroke: var(--rose); stroke-width: 2; stroke-linejoin: round; }
.logo-line { fill: none; stroke: var(--rose); stroke-width: 1.6; stroke-linecap: round; opacity: .75; }
.logo-ribbon { fill: var(--rose-deep); }

/* Empty ranking places */
.book-vuoto { background: transparent; box-shadow: none; border-style: dashed; min-height: 0; align-items: center; }
.book-vuoto .rank-n { color: var(--rose-soft); }
.cover-vuota { background: transparent; border: 1.5px dashed var(--rose-soft); box-shadow: none; width: 52px; padding: 0; }
.first .cover-vuota { width: 64px; }
.book-vuoto.first { background: transparent; }

/* Rating in the table */
.table td.voto-cella { color: var(--ink-strong); }
.book-vuoto { border: 1.5px dashed var(--rose-soft); }
.book-vuoto .rank-n { color: var(--rose); opacity: .55; }
.cover-vuota { border-color: var(--rose); opacity: .45; }
