/* Librofono — server-rendered catalog (SEO pages).
   Light-only, matched to the landing site's cool token system: Inter for UI, Fraunces for
   headlines, flat indigo accent, coral/teal/violet brand trio for per-book identity hues. */

:root {
  --page: #f9fafb;
  --card: #ffffff;
  --ink: #111827;
  --ink-soft: #4b5563;
  --ink-faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-ink: #4338ca;

  --coral: #f47a53;
  --coral-dark: #e2492a;
  --teal: #19b3a6;
  --teal-dark: #0c8177;
  --violet: #7d6bf0;
  --violet-dark: #5a44d6;

  --word: #1c2333;

  --radius: 0.7rem;
  --radius-md: 0.9rem;
  --radius-lg: 1.25rem;

  --shadow-soft: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-hover: 0 18px 36px -20px rgba(79, 70, 229, 0.35);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --maxw: 1120px;
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

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

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
}

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 10px 0;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.96rem;
  text-decoration: none;
  padding: 0.72rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, color 0.15s ease;
}
.btn--primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}
.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -14px rgba(79, 70, 229, 0.6);
}
.btn--ghost {
  color: var(--ink);
  background: var(--card);
  border-color: var(--line-strong);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(249, 250, 251, 0.85);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.7rem;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-link {
  padding: 0.5rem 0.8rem;
  border-radius: 0.55rem;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.header__cta {
  padding: 0.55rem 1.1rem;
  margin-left: 0.35rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}
.brand__mark {
  display: inline-flex;
  border-radius: 10px;
}
.brand__mark svg {
  display: block;
}
.brand__word {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--word);
}

/* ---------- Sections ---------- */
.page-section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
.section-head {
  max-width: 42rem;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}
.figure-num {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.75rem;
}
.section-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
}
.section-title em {
  font-style: italic;
  color: var(--accent-ink);
}
.section-sub {
  color: var(--ink-soft);
  font-size: 1.1rem;
  margin: 1rem 0 0;
}

/* ---------- Book grid + cards ---------- */
.book-grid {
  display: grid;
  gap: 1.4rem 1.25rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 560px) {
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 780px) {
  .book-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 1000px) {
  .book-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
.book-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  /* Fallback tint when no hue class is in scope; the .hue-* rules override per book. */
  --tint: var(--accent);
}
.book-card:hover .book-cover {
  transform: translateY(-3px);
  /* Hue-tinted lift (matches the app) instead of a fixed accent shadow. */
  box-shadow: 0 18px 36px -20px color-mix(in srgb, var(--tint) 55%, transparent);
}
.book-cover__img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
.book-cover__fallback {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.85rem;
  color: #fff;
}
.book-cover__kicker {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}
.book-cover__falltitle {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.15;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card__title {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.book-card__author {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.1rem;
}

/* Per-book/-author identity hue → the missing-cover/photo gradient (matches the SPA's
   hueForSlug). The hue class sits on the .gradient-hue element itself (compound selector) so a
   book keeps its own colour even when nested inside a page section carrying a different hue. */
.gradient-hue {
  background: linear-gradient(150deg, var(--accent), var(--accent-hover));
}
.gradient-hue.hue-coral {
  background: linear-gradient(150deg, var(--coral), var(--coral-dark));
}
.gradient-hue.hue-teal {
  background: linear-gradient(150deg, var(--teal), var(--teal-dark));
}
.gradient-hue.hue-violet {
  background: linear-gradient(150deg, var(--violet), var(--violet-dark));
}

/* Per-book tint carried by the hue class (used for hue-aware cover shadows). Standalone so it
   also applies where .hue-* sits without .gradient-hue (e.g. .book-card, .detail__cover). */
.hue-coral {
  --tint: var(--coral-dark);
}
.hue-teal {
  --tint: var(--teal-dark);
}
.hue-violet {
  --tint: var(--violet-dark);
}

/* ---------- Pager / notes / crumbs ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
}
.pager__status {
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.empty-note {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--ink-soft);
}
.crumbs {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}
.crumbs a {
  color: var(--ink-soft);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--ink);
}

/* ---------- Book detail ---------- */
.detail__head {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
}
@media (min-width: 680px) {
  .detail__head {
    grid-template-columns: 260px 1fr;
    align-items: start;
  }
}
.detail__cover {
  max-width: 260px;
  /* Hue-tinted so the cover shadow matches the book's own colour, not a cool slate/accent. */
  box-shadow: 0 24px 48px -28px color-mix(in srgb, var(--tint) 45%, transparent);
}
.detail__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}
.detail__byline {
  margin: 0.6rem 0 0;
  font-size: 1.15rem;
  color: var(--ink-soft);
}
.detail__byline a {
  color: var(--accent-ink);
  text-decoration: none;
}
.detail__byline a:hover {
  text-decoration: underline;
}
.detail__byline .role {
  color: var(--ink-faint);
  font-size: 0.9rem;
}
.detail__lang {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-faint);
}
.detail__desc {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  max-width: 42rem;
}
.detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.detail__h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}
.detail__sample,
.detail__narrations {
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
.sample {
  max-width: 44rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.35rem, 4vw, 2.25rem);
  box-shadow: var(--shadow-soft);
}
.sample__heading {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 1.5rem 0 0.75rem;
}
.sample__heading:first-child {
  margin-top: 0;
}
.sample__p {
  margin: 0 0 1rem;
  color: var(--ink);
}

/* ---------- Narrations ---------- */
.narrations {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  max-width: 44rem;
}
.narration {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-soft);
}
.narration__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.narration__meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.narration__label {
  font-weight: 600;
  color: var(--ink);
}
.narration__len {
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.narration__open {
  font-size: 0.85rem;
  color: var(--accent-ink);
  text-decoration: none;
  white-space: nowrap;
}
.narration__open:hover {
  text-decoration: underline;
}
.narration__audio {
  width: 100%;
  margin-top: 0.85rem;
}

/* ---------- Authors ---------- */
.author-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .author-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 880px) {
  .author-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.author-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.author-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
}
.author-card__photo img,
.author-card__initial {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.author-card__initial,
.author-head__initial {
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
}
.author-card__name {
  display: block;
  font-weight: 600;
  color: var(--ink);
}
.author-card__count {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-faint);
  margin-top: 0.1rem;
}

.author-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
@media (min-width: 620px) {
  .author-head {
    grid-template-columns: 140px 1fr;
    align-items: start;
  }
}
.author-head__photo img,
.author-head__initial {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-lg);
  object-fit: cover;
}
.author-head__initial {
  font-size: 3rem;
  border-radius: var(--radius-lg);
}
.author-head__years {
  margin: 0.35rem 0 0;
  color: var(--ink-faint);
  font-size: 0.95rem;
}
.author-head__bio {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  max-width: 44rem;
}
.author-head__wiki {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  text-decoration: none;
}
.author-head__wiki:hover {
  text-decoration: underline;
}

/* ---------- 404 ---------- */
.notfound {
  text-align: center;
  padding-block: clamp(2rem, 8vw, 5rem);
}
.notfound .detail__actions {
  justify-content: center;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--card);
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}
.footer__inner {
  display: grid;
  gap: 1.75rem;
  padding-block: clamp(2.5rem, 6vw, 4rem);
}
.footer__tag {
  font-size: 1rem;
  color: var(--ink-faint);
  margin: 0.75rem 0 0;
}
.footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.footer__nav a {
  font-weight: 500;
  font-size: 0.94rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.footer__nav a:hover {
  border-bottom-color: var(--accent);
  color: var(--accent-ink);
}
.footer__copy {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0;
}
@media (min-width: 900px) {
  .footer__inner {
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }
}

@media (max-width: 720px) {
  .nav-link {
    display: none;
  }
  .header-nav .header__cta {
    display: inline-flex;
  }
}
