/* Aasta Books — one calm visual language for discovery and deep reading.
   Semantic markup and reader controls remain unchanged; this file deliberately
   loads last so the public experience has a single, predictable finish. */

:root {
  --aasta-ink: #18120f;
  --aasta-walnut: #2b1d17;
  --aasta-copper: #a94b3f;
  --aasta-parchment: #f5efe3;
  --aasta-mist: #b9aa9a;
  --aasta-rule: rgba(88, 61, 43, .18);
}

/* Storefront: an editorial library, not a dashboard of cards. */
.library-view {
  color: var(--aasta-ink);
  background: #f4eee4;
  background-image: linear-gradient(130deg, rgba(255,255,255,.52), transparent 38%),
    radial-gradient(circle at 87% 7%, rgba(174, 109, 76, .11), transparent 25%);
}

.library-view .site-nav {
  min-height: 66px;
  padding-inline: clamp(18px, 4vw, 68px);
  color: #f2e9df;
  background: #17120f;
  border-bottom: 1px solid rgba(241, 226, 211, .13);
}

.library-view .wordmark,
.library-view .footer-wordmark {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -.035em;
  text-transform: none;
}

.library-view .wordmark span,
.library-view .footer-wordmark span {
  margin-left: .65em;
  font: 600 10px/1.2 system-ui, sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.library-view .library-hero {
  min-height: min(780px, calc(100dvh - 66px));
  padding: clamp(44px, 8vw, 112px) clamp(22px, 7vw, 128px);
  align-items: center;
  background: #211711;
  background-image: radial-gradient(ellipse at 73% 42%, rgba(174, 100, 67, .28), transparent 31%),
    radial-gradient(ellipse at 22% 94%, rgba(118, 53, 38, .25), transparent 35%);
}

.library-view .editorial-title {
  max-width: 10ch;
  margin-block: 12px 18px;
  color: #f8f1e8;
  font: 500 clamp(46px, 6.2vw, 94px)/.94 Georgia, 'Times New Roman', serif;
  letter-spacing: -.062em;
}

.library-view .editorial-intro,
.library-view .resume-hint { max-width: 49ch; color: #cfc1b1; }
.library-view .eyebrow,
.library-view .section-label { color: #e7b582; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }

.library-view .primary-button {
  border-radius: 2px;
  background: #c26855;
  box-shadow: inset 0 -2px 0 rgba(71, 28, 23, .35);
}

.library-view .secondary-button,
.library-view .nav-action {
  border-radius: 2px;
  border-color: rgba(244, 229, 213, .28);
}

.library-view .editorial-benefits {
  gap: 0;
  min-height: 62px;
  padding-inline: clamp(18px, 7vw, 128px);
  color: #6a5141;
  background: #ebe0d0;
  border-block: 1px solid var(--aasta-rule);
}

.library-view .editorial-benefits span {
  padding: 0 clamp(14px, 3vw, 50px);
  font-size: 12px;
  letter-spacing: .08em;
}

.library-view .editorial-benefits span + span { border-left: 1px solid var(--aasta-rule); }

.library-view :is(.library-section, .books-section, .collection-section) {
  padding-inline: clamp(18px, 7vw, 128px);
}

.library-view :is(.library-section, .books-section, .collection-section) h2 {
  font: 500 clamp(31px, 4vw, 54px)/1 Georgia, 'Times New Roman', serif;
  letter-spacing: -.045em;
}

.library-view :is(.book-card, .library-book, .shelf-book) {
  border-radius: 0;
  box-shadow: none;
}

/* Store `Aasta` as a name, not a wordmark. The old uppercase rules made the
   author line look like a different spelling in every public card. */
.library-view :is(#bookGrid .book-author, .shelf-edition p, .library-book-card .book-author) {
  letter-spacing: .09em;
  text-transform: none;
}

.library-view :is(button, a):focus-visible,
#readerView :is(button, a, input, summary):focus-visible {
  outline: 3px solid #d9a45e;
  outline-offset: 3px;
}

/* The reading room: quiet charcoal around a real, tactile book. */
#readerView {
  --reader-font: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --reader-font-size: clamp(18px, 1.25vw, 21px);
  --reader-line-height: 1.62;
  --reader-v2-measure: 57ch;
  --reader-paragraph-gap: .1em;
  --reader-v2-page-margin: clamp(32px, 4.1vw, 74px);
  background-color: #0b0907;
  background-image: radial-gradient(ellipse at 50% 38%, rgba(128, 66, 37, .16), transparent 44%), var(--premium-wood);
}

#readerView[data-theme='lamp'] {
  --reader-page: #201912;
  --reader-text: #f0dfbd;
  background-image: radial-gradient(ellipse at 50% 42%, rgba(221, 150, 68, var(--lamp-inner)) 0, rgba(137, 69, 30, var(--lamp-outer)) 42%, transparent 70%), var(--premium-wood);
}

#readerView .reader-topbar {
  min-height: calc(58px + var(--safe-top));
  background: rgba(12, 10, 8, .94);
  border-bottom-color: rgba(247, 233, 216, .11);
  box-shadow: 0 5px 22px rgba(0,0,0,.22);
}

#readerView .reader-wordmark { font-size: 18px; }
#readerView #readerBookTitle { color: #c3b6a6; }
#readerView .chapter-pill {
  min-width: 104px;
  color: #f8ebdd;
  border-color: rgba(227, 181, 117, .42);
  border-radius: 2px;
}

#readerView[data-reader-view='spread'].flipbook-spread-mode {
  --flipbook-width: min(1560px, calc(100vw - clamp(42px, 6vw, 130px)));
  --flipbook-height: min(852px, calc(100dvh - 126px));
  --flipbook-pad-x: clamp(38px, 4.4vw, 86px);
  --flipbook-pad-y: clamp(32px, 4.5vh, 68px);
}

#readerView .flipbook-spread {
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .58));
}

#readerView .flipbook-physical-page,
#readerView .flipbook-leaf-face {
  overflow: hidden;
  border-color: rgba(76, 51, 33, .26);
}

#readerView .flipbook-left-page { box-shadow: inset -48px 0 42px -47px rgba(47, 28, 15, .9), inset 4px 0 8px -6px rgba(65, 36, 18, .42); }
#readerView .flipbook-right-page { box-shadow: inset 48px 0 42px -47px rgba(47, 28, 15, .9), inset -4px 0 8px -6px rgba(65, 36, 18, .42); }
#readerView .flipbook-spine { width: 24px; background: linear-gradient(90deg, transparent, rgba(43,26,14,.23) 42%, rgba(255,255,255,.1) 50%, rgba(43,26,14,.23) 58%, transparent); }

#readerView .reader-block-chapter-heading { margin-bottom: clamp(30px, 5vh, 62px); }
#readerView .reader-block-chapter-heading h1 { max-width: 17ch; font-size: clamp(36px, 3.2vw, 54px); }
#readerView .reader-block-paragraph + .reader-block-paragraph { margin-top: .12em; text-indent: 1.2em; }
#readerView .reader-block-chapter-heading + .reader-block-paragraph,
#readerView .reader-scene-break + .reader-block-paragraph { text-indent: 0; }

#readerView .toc-drawer { background: #171513; }
#readerView .toc-item { border-radius: 1px; }
#readerView .toc-item.active { background: rgba(143, 39, 48, .54); box-shadow: inset 3px 0 0 #dc7378; }

/* Completion is a useful decision point, never a paywall or an inaccessible
   black-on-black button cluster. */
#chapterCompletion :is(button, [data-completion-action]),
.chapter-completion :is(button, [data-completion-action]) {
  min-height: 48px;
  color: #fff8ef;
  background: #28201b;
  border: 1px solid rgba(95, 57, 38, .48);
  border-radius: 999px;
}

#chapterCompletion [data-completion-action='continue'],
.chapter-completion [data-completion-action='continue'] { background: #a52c37; }

@media (min-width: 1080px) {
  #readerView[data-reader-view='spread'].flipbook-spread-mode .reader-stage { inset: calc(58px + var(--safe-top)) 0 calc(38px + var(--safe-bottom)); }
  #readerView[data-reader-view='spread'].flipbook-spread-mode .pages-viewport { padding-bottom: 18px; }
}

@media (max-width: 1079px) {
  .library-view .library-hero { min-height: auto; grid-template-columns: 1fr; }
  .library-view .cover-stage { min-height: 460px; }
  #readerView { --reader-font-size: clamp(17px, 4.7vw, 20px); --reader-v2-page-margin: clamp(22px, 7vw, 44px); }
  #readerView .reader-topbar { padding-inline: 12px; }
  #readerView .reader-brand-rule, #readerView #readerBookTitle { display: none; }
}

@media (max-width: 680px) {
  .library-view .site-nav { min-height: 58px; padding-inline: 16px; }
  .library-view .library-nav-links, .library-view .nav-action { display: none; }
  .library-view .wordmark { font-size: 20px; }
  .library-view .library-hero { padding: 44px 20px 26px; }
  .library-view .editorial-title { font-size: clamp(44px, 14vw, 64px); }
  .library-view .editorial-benefits { display: grid; grid-template-columns: 1fr 1fr; padding: 10px 8px; }
  .library-view .editorial-benefits span { padding: 8px 10px; }
  .library-view .editorial-benefits span + span { border-left: 0; }
  #readerView .chapter-pill { min-width: 44px; padding: 0; }
  #readerView .chapter-pill::after { display: none; }
  #readerView .topbar-actions .icon-button, #readerView > .reader-topbar > #exitReaderButton { width: 40px; min-width: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
