/* Shared identity and compact reading corrections. */
:root {
  --header-h: 56px;
}

.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 7px;
  transform: none;
}

.splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}

.splash.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.splash.is-visible.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .32s ease, visibility .32s;
}

.splash-mark {
  display: block;
  width: 168px;
  height: 168px;
  margin: 0 auto;
  object-fit: cover;
  border-radius: 24px;
  animation: breathe 1.8s ease-in-out infinite;
}

.app-frame {
  padding-bottom: 0;
}

.developer-footer,
.reader-body .developer-footer {
  position: relative;
  inset: auto;
  z-index: 1;
  width: 100%;
  height: 20px;
  min-height: 20px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.reader-body .app-frame {
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.site-header {
  padding-inline: clamp(20px, 3vw, 40px);
}

.library-hero {
  padding: 32px max(24px, calc((100vw - 1180px) / 2)) 28px;
}

.library-hero h1 {
  max-width: 740px;
  margin: 8px 0 10px;
  font-size: clamp(40px, 4vw, 48px);
  line-height: 1.06;
}

.library-hero > p:last-child {
  max-width: 650px;
  font-size: 17px;
  line-height: 1.45;
}

.library-section,
.book-page {
  padding: 24px 0 32px;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-top: 5px;
  font-size: 28px;
}

.book-grid {
  grid-template-columns: minmax(0, 720px);
  gap: 16px;
}

.book-card {
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 20px;
  padding: 16px;
  border-radius: 14px;
}

.book-card-copy {
  padding: 4px 0 0;
}

.book-card h3 {
  font-size: 26px;
}

.book-card-copy > p:not(.book-kind) {
  margin: 6px 0 12px;
  font-size: 14px;
}

.book-card-meta {
  margin: 8px 0 12px;
}

.back-link {
  margin-bottom: 16px;
  font-size: 13px;
}

.book-intro {
  grid-template-columns: 240px minmax(0, 620px);
  grid-template-areas:
    "cover copy"
    "cover summary"
    "cover actions"
    "cover privacy";
  align-items: start;
  gap: 12px 28px;
}

.book-intro .cover-large {
  grid-area: cover;
  width: 240px;
  max-height: 360px;
}

.book-intro-copy {
  grid-area: copy;
}

.book-intro-copy h1 {
  margin: 5px 0 7px;
  font-size: 44px;
  line-height: 1.06;
}

.book-intro .subtitle {
  margin: 0 0 8px;
  font-size: 18px;
}

.book-author {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.book-summary {
  grid-area: summary;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 240, .58);
}

.book-summary h2 {
  margin: 4px 0 7px;
  font: 700 24px/1.1 Georgia, serif;
}

.book-summary > p:last-child {
  margin: 0;
  color: var(--muted);
  font: 400 15px/1.5 Georgia, serif;
}

.book-intro > .book-actions {
  grid-area: actions;
  margin-top: 0;
}

.book-intro > .privacy-note {
  grid-area: privacy;
  margin: 0;
}

.reader-shell {
  height: auto;
  min-height: 0;
  grid-template-rows: 56px 3px minmax(0, 1fr);
}

.reader-header {
  min-height: 56px;
}

.reader-page {
  padding-top: 32px;
  padding-bottom: 48px;
}

.reader-page h1 {
  margin: 10px auto 14px;
  font-size: 40px;
  line-height: 1.1;
}

.bookmark-button {
  min-height: 44px;
  margin-bottom: 18px;
}

.chapter-navigation {
  margin-top: 32px;
  gap: 16px;
}

.book-card-author {
  margin-top: -12px !important;
  font: 700 12px/1.3 Inter, sans-serif !important;
  color: var(--ink) !important;
}

.share-icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.share-icon-button:hover,
.share-icon-button:focus-visible { background: rgba(255, 255, 255, .55); }
.share-icon-button svg,
.reader-share-icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.share-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.share-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(48, 34, 22, .34);
  backdrop-filter: blur(2px);
}

.share-sheet {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: min(430px, calc(100% - 24px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: 0 24px 70px rgba(52, 31, 16, .25);
  transform: translate(-50%, calc(100% + 50px));
  transition: transform .22s ease;
}

.share-layer.is-open .share-sheet { transform: translate(-50%, 0); }
.share-sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.share-sheet-header small { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.share-sheet-header h2 { margin: 3px 0 0; font: 700 24px/1 Georgia, serif; }
.share-sheet-header > button { width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 25px; cursor: pointer; }
.share-actions { display: grid; gap: 8px; }
.share-actions > button { min-height: 58px; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.share-actions > button > span:first-child { color: var(--accent); font-size: 23px; text-align: center; }
.share-actions strong,.share-actions small { display: block; }
.share-actions strong { font-size: 13px; }
.share-actions small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.share-direct { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.share-direct a { min-height: 38px; display: grid; place-items: center; border-radius: 9px; background: var(--paper); color: var(--ink); text-decoration: none; font-size: 11px; font-weight: 800; }
.share-status { min-height: 16px; margin: 10px 0 0; color: var(--accent-dark); text-align: center; font-size: 11px; }

@media (max-width: 720px) {
  :root { --header-h: 48px; }
  .site-header { height: 48px; padding-inline: 10px; }
  .brand { gap: 7px; font-size: 20px; }
  .brand-mark { width: 28px; height: 28px; border-radius: 6px; }
  .site-nav .admin-link { display: none; }
  .site-nav { align-items: center; }
  .site-nav a { padding: 8px; font-size: 12px; }
  .share-icon-button { width: 44px; height: 44px; }
  .share-sheet { bottom: calc(24px + env(safe-area-inset-bottom)); padding: 16px; border-radius: 16px; }
  .library-hero { padding: 20px 12px 16px; }
  .library-hero h1 { margin: 6px 0 8px; font-size: 30px; line-height: 1.06; }
  .library-hero > p:last-child { font-size: 15px; line-height: 1.4; }
  .library-section,
  .book-page { width: calc(100% - 24px); padding: 16px 0 24px; }
  .section-heading { margin-bottom: 12px; }
  .section-heading h2 { font-size: 22px; }
  .book-grid { grid-template-columns: 1fr; gap: 12px; }
  .book-card { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 10px; border-radius: 14px; }
  .book-card h3 { font-size: 20px; }
  .book-card-copy > p:not(.book-kind) { margin: 5px 0 8px; }
  .book-card-author { margin-top: -5px !important; }
  .book-card-meta { margin: 6px 0 9px; }
  .back-link { margin-bottom: 12px; font-size: 12px; }
  .book-intro {
    grid-template-columns: 108px minmax(0, 1fr);
    grid-template-areas:
      "cover copy"
      "summary summary"
      "actions actions"
      "privacy privacy";
    gap: 12px;
  }
  .book-intro .cover-large { width: 108px; max-height: 162px; }
  .book-intro-copy h1 { margin: 4px 0 5px; font-size: 24px; line-height: 1.05; }
  .book-intro .subtitle { margin-bottom: 7px; font-size: 14px; }
  .book-author { margin: 0; font-size: 12px; }
  .book-intro > .book-actions { margin-top: 0; }
  .book-summary { padding: 12px 14px; }
  .book-summary h2 { margin: 3px 0 6px; font-size: 21px; }
  .book-summary > p:last-child { font-size: 14px; line-height: 1.45; }
  .reader-page {
    padding-top: 20px;
    padding-bottom: 36px;
  }

  .reader-page h1 {
    font-size: 24px;
    line-height: 1.1;
    margin: 7px auto 9px;
  }

  .bookmark-button {
    margin-bottom: 12px;
    min-height: 44px;
    font-size: 13px;
  }

  .reader-copy {
    line-height: 1.62;
  }

  .reader-copy p:first-child:first-letter {
    font-size: 3em;
    line-height: .84;
    margin: .1em .09em 0 0;
  }

  .splash-mark {
    width: 144px;
    height: 144px;
    border-radius: 20px;
  }

  .reader-shell {
    grid-template-rows: calc(48px + env(safe-area-inset-top)) 3px minmax(0, 1fr);
  }

  .reader-header {
    min-height: calc(48px + env(safe-area-inset-top));
  }

  .reader-icon-button,
  .reader-actions .reader-icon-button {
    width: 44px;
    height: 44px;
  }

  .chapter-navigation {
    margin-top: 28px;
  }
}

@media (max-width: 390px) {
  .reader-page h1 { font-size: 24px; }
  .book-intro-copy h1 { font-size: 24px; }
}
