/* =========================================================================
   A work page — one book, in its own paper and ink.
   The page sets --paper/--ink/--ink-soft/--spruce from the book's palette
   (inline, both themes) and --face/--wt on <body>; everything in site.css
   follows. Also dresses the Great Books Reading List page.
   ========================================================================= */
.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding-block: var(--space-sm); }
.bar__back, .bar__brand { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-soft); }
.bar__back { gap: .5rem; font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; }
.bar__back:hover, .bar__brand:hover { color: var(--ink); }
.bar__brand { gap: .45rem; font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); }
.bar__brand svg { width: 13px; height: 17px; fill: var(--spruce); }
.bar__brand span { font-family: var(--font-text); font-size: .62em; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-soft); }

.page { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px 72px; align-items: start; padding-block: 5vh var(--space-3xl); }
.label { font-size: var(--t-label); letter-spacing: .2em; text-transform: uppercase; font-weight: 400; color: var(--ink-soft); }

.titlepage__eyebrow { font-size: var(--t-label); letter-spacing: .2em; text-transform: uppercase; color: var(--spruce); margin-bottom: 22px; }
.titlepage h1 { font-family: var(--face); font-weight: var(--wt, 400); font-size: clamp(2.75rem, 7vw, 5.75rem); line-height: 1; margin-bottom: 14px; overflow-wrap: anywhere; }
.titlepage--long h1 { font-size: clamp(2.5rem, 5.6vw, 4.5rem); }
.titlepage__english { font-family: var(--font-display); font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-style: italic; margin-bottom: 6px; }
.titlepage__by { color: var(--ink-soft); margin-bottom: 30px; }
.titlepage__rule { width: 56px; height: 1px; background: var(--spruce); margin-bottom: 26px; }
.titlepage__concept { font-size: var(--t-md); line-height: 1.5; max-width: 26em; }

/* the editions: every format this work exists in, and only what is real */
.eds .label { margin-bottom: 6px; }
.ed { border-top: 1px solid var(--hairline-bold); padding: 20px 0 22px; }
.ed:last-of-type { border-bottom: 1px solid var(--hairline-bold); }
.ed__state { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--spruce); margin-bottom: 6px; }
.ed h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.15; margin-bottom: 4px; }
.ed__body { margin-bottom: 14px; color: var(--ink-soft); font-size: .97rem; line-height: 1.55; max-width: 34em; }
.ed .signup { padding-top: 0; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 11px 18px;
  background: var(--ink); color: var(--paper); border-radius: 2px; font-size: .95rem;
  transition: background-color .2s ease-in-out;
}
.btn small { font-size: .78rem; opacity: .72; font-variant-numeric: tabular-nums; }
.btn:hover { background: var(--spruce); }
.eds__assoc { margin-top: 14px; font-size: var(--t-small); color: var(--ink-soft); }

/* the opening: tap a line and its translation unfolds, as in the app */
.opening { grid-column: 1 / -1; max-width: 780px; }
.opening__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: 6px; }
.listen {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px;
  font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--spruce);
}
.listen svg { width: 12px; height: 12px; fill: currentColor; }
.listen:hover { color: var(--ink); }
.line { display: block; width: 100%; text-align: left; border-top: 1px solid var(--hairline); padding: 16px 0; }
.line:active { opacity: 1; transform: none; }
.line__source { display: block; font-family: var(--face); font-weight: var(--wt, 400); font-size: clamp(1.25rem, 2.5vw, 1.7rem); line-height: 1.4; transition: color .2s ease-in-out; }
.line.is-playing .line__source { color: var(--spruce); }
.line__english { display: block; overflow: hidden; max-height: 0; opacity: 0; font-style: italic; color: var(--ink-soft); font-size: 1.05rem; transition: max-height .35s ease, opacity .35s ease, margin .35s ease; }
.line[aria-expanded="true"] .line__english { max-height: 12em; opacity: 1; margin-top: 8px; }
.opening__hint { font-size: var(--t-small); color: var(--ink-soft); margin-top: 10px; }

.about p { margin-top: var(--space-xs); max-width: 34em; line-height: 1.62; }
.facets { display: grid; gap: var(--space-md); margin-top: var(--space-sm); }
.facets h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; line-height: 1.25; margin-bottom: 4px; }
.facets p { color: var(--ink-soft); font-size: .97rem; line-height: 1.55; }
.particulars { grid-column: 1 / -1; border-top: 1px solid var(--hairline-bold); padding-top: var(--space-md); }
.particulars dl { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: var(--space-xs) var(--space-md); margin-top: var(--space-sm); max-width: 52rem; }
.particulars dt { font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); padding-top: .3em; }
.particulars dd { font-size: .97rem; line-height: 1.55; }
.particulars a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.particulars a:hover { color: var(--spruce); }

/* the Reading List page: a quick estimate of the reading a life holds */
.calc { border: 1px solid var(--hairline-bold); padding: 26px 26px 22px; }
.calc label { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-soft); margin-bottom: 4px; }
.calc label b { color: var(--ink); font-weight: 400; font-variant-numeric: tabular-nums; }
.calc input[type="range"] { width: 100%; accent-color: var(--spruce); margin-bottom: 18px; }
.calc__n { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: clamp(4rem, 10vw, 6.5rem); line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 8px 0 6px; }
.calc__says { font-size: 1.05rem; }
.calc__fine { margin-top: 12px; font-size: var(--t-small); color: var(--ink-soft); }
.titlepage .btns { margin-top: 26px; }
.titlepage__fine { margin-top: 18px; color: var(--ink-soft); font-size: var(--t-small); max-width: 34em; }

@media (max-width: 820px) {
  .page { grid-template-columns: 1fr; gap: 40px; padding-block: 12px var(--space-2xl); }
  .particulars dl { grid-template-columns: 1fr; gap: var(--space-3xs); }
  .particulars dd { margin-bottom: var(--space-xs); }
}

/* ---- The turn: arriving from the shelf, the cover opens onto the page.
   A script in <head> adds .turning when the reader came by way of a spine;
   the keyframes finish hidden, so the page never depends on script to clear. */
.turn { display: none; }
.turning .turn {
  display: block; position: fixed; inset: 0; z-index: 60; perspective: 1900px; overflow: hidden;
  background: var(--paper); pointer-events: none; animation: turn-clear .86s linear forwards;
}
.turn__stage {
  --H: min(76vh, 600px, calc((100vw - 40px) / .66));
  position: absolute; left: calc(50% - var(--H) * .33); top: calc(50% - var(--H) / 2);
  width: calc(var(--H) * .66); height: var(--H); font-size: calc(var(--H) / 30);
  transform-style: preserve-3d;
}
.turn__leaf {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 10%;
  background: var(--paper); color: var(--ink); font-family: var(--face); font-weight: var(--wt, 400); font-size: 1.5em;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .45);
}
.turn__lid { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; }
.turning .turn__lid { animation: turn-open .78s cubic-bezier(.45, .05, .3, 1) forwards; }
.turn__inside { position: absolute; inset: 0; background: color-mix(in srgb, var(--cloth) 82%, var(--foil)); transform: rotateY(180deg); backface-visibility: hidden; }
@keyframes turn-open { to { transform: rotateY(-172deg); } }
@keyframes turn-clear { 0%, 50% { opacity: 1; } 99% { opacity: 0; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .turning .turn { display: none; } }
