/* Libretto landing — app mockup mirrors the native macOS UI. */

:root {
  --ink: #1d1d1f;
  --soft: #8a8a8e;
  --faint: #b0b0b5;
  --rule: #e8e8ea;
  --page: #fff;          /* page background */
  --paper: #fff;         /* app window background */
  --paper-0: rgba(255, 255, 255, 0);
  --bar: #f7f7f8;
  --hover: rgba(0, 0, 0, .04);
  --press: rgba(0, 0, 0, .08);
  --sent-dim: rgba(29, 29, 31, .30);
  --sent-near: rgba(29, 29, 31, .45);
  --track-bg: #e5e5ea;
  --track-fg: #8e8e93;
  --thumb: #fff;
  --thumb-edge: rgba(0, 0, 0, .12);
  --btn-bg: #ececee;
  --btn-bg-hover: #e2e2e6;
  --btn-bg-press: #d8d8dc;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f0f0f2;
    --soft: #a4a4ab;
    --faint: #6f6f76;
    --rule: #333338;
    --page: #161618;
    --paper: #1e1e20;
    --paper-0: rgba(30, 30, 32, 0);
    --bar: #232326;
    --hover: rgba(255, 255, 255, .06);
    --press: rgba(255, 255, 255, .10);
    --sent-dim: rgba(240, 240, 242, .28);
    --sent-near: rgba(240, 240, 242, .45);
    --track-bg: #3a3a3f;
    --track-fg: #98989f;
    --thumb: #cfcfd4;
    --thumb-edge: rgba(0, 0, 0, .4);
    --btn-bg: #333336;
    --btn-bg-hover: #3d3d41;
    --btn-bg-press: #47474c;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--page);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- marketing chrome ---------- */
.hero {
  text-align: center;
  padding: 72px 24px 0;
}
.mark {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 44px;
  letter-spacing: .01em;
  margin-top: 28px;
}
.tagline {
  font-family: var(--serif);
  font-style: italic;
  color: var(--soft);
  font-size: 20px;
  margin-top: 8px;
}
.soon {
  display: inline-block;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 7px 18px;
}

/* ---------- app window ---------- */
.window {
  max-width: 860px;
  height: 560px;
  margin: 48px auto 0;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 12px;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, .04),
    0 22px 60px rgba(0, 0, 0, .14);
  overflow: hidden;
  text-align: left;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (prefers-color-scheme: dark) {
  .window {
    border-color: rgba(255, 255, 255, .1);
    box-shadow:
      0 0 0 0.5px rgba(0, 0, 0, .3),
      0 22px 60px rgba(0, 0, 0, .5);
  }
}
.chrome {
  position: absolute;
  top: 14px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}
.tl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}
.tl.red    { background: #ff5f57; }
.tl.yellow { background: #febc2e; }
.tl.green  { background: #28c840; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.screen.hidden { display: none; }

/* ---------- Library ---------- */
.library-scroll {
  flex: 1;
  overflow: auto;
  padding: 0 48px 28px;
}
.library-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  padding: 64px 12px 22px;
  color: var(--ink);
}
.library-list {
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.library-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background .12s;
}
.library-row:hover { background: var(--hover); }
.library-row .cover {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bar);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.library-row .meta { flex: 1; min-width: 0; }
.library-row .name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-row .author {
  font-size: 12px;
  color: var(--soft);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-row .sub {
  font-size: 12px;
  color: var(--soft);
  margin-top: 3px;
}
.ring {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 2;
}
.ring .bg { stroke: var(--track-bg); }
.ring .fg {
  stroke: var(--track-fg);
  stroke-linecap: round;
  transition: stroke-dashoffset .3s;
}

/* ---------- Reader header ---------- */
.app-header {
  position: relative;
  display: flex;
  align-items: center;
  padding: 42px 20px 10px; /* room for traffic lights */
  min-height: 36px;
  flex-shrink: 0;
}
.app-header .back {
  font-size: 13px;
  color: var(--soft);
  gap: 4px;
  z-index: 1;
  cursor: pointer;
}
.app-header .back:hover { color: var(--ink); }
.book-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 500;
  color: var(--soft);
  max-width: 46%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1;
}
.ghost {
  appearance: none;
  background: none;
  border: none;
  color: var(--soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font: inherit;
  padding: 0;
}
.icon-btn {
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color .12s, background .12s, transform .08s;
}
.icon-btn:hover { color: var(--ink); background: var(--hover); }
.icon-btn:active { transform: scale(0.92); background: var(--press); }
/* ---------- stages ---------- */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.stage.hidden { display: none; }

/* Stream of Consciousness */
.flow {
  position: absolute;
  left: 50%;
  top: 0;
  width: min(32em, 100%);
  padding: 0 48px;
  transform: translateX(-50%);
  transition: transform .7s cubic-bezier(.3, 0, .2, 1);
  will-change: transform;
}
.flow.manual, .flow.snap { transition: none; }
.flow .pad { pointer-events: none; }
.flow .para {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.52;
  margin-bottom: 1.05em;
  text-align: left;
}
/* Headings: bold, 1.15×, extra space above, left-aligned — like the app */
.flow .para.heading {
  font-weight: 700;
  font-size: 22px;
  margin-top: 1.1em;
  margin-bottom: .55em;
}
.flow .para.heading:first-of-type { margin-top: 0; }

.sent {
  color: var(--sent-dim);
  transition: color .25s ease-in-out; /* app's highlight crossfade */
  cursor: pointer;
}
.sent.near { color: var(--sent-near); }
.sent.now  { color: var(--ink); }
.sent:hover { color: var(--ink); }

.fade {
  position: absolute;
  left: 0; right: 0;
  height: 56px;
  pointer-events: none;
  z-index: 2;
}
.fade.top { top: 0; background: linear-gradient(var(--paper), var(--paper-0)); }
.fade.bottom { bottom: 0; height: 40px; background: linear-gradient(var(--paper-0), var(--paper)); }

/* Now Playing pill — appears when the reader wanders off the narration */
.pill {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) translateY(4px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--soft);
  background: var(--paper);
  border: 0.5px solid var(--rule);
  border-radius: 999px;
  padding: 7px 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 3;
}
.pill.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.pill:hover { color: var(--ink); }

/* Pages */
.stage.pages:not(.hidden) {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  grid-template-rows: 1fr auto;
  align-items: stretch;
  padding: 8px 4px 0;
}
@keyframes pagefade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.spread.flip { animation: pagefade .18s ease-in-out; }
.spread {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  min-height: 0;
  overflow: hidden;
  padding: 12px 8px 0;
}
/* Real book typography like the app's TextKit columns: justified + hyphenated */
.col .para {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.48;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  margin-bottom: .15em;
}
.col .para.heading {
  font-weight: 700;
  text-align: left;
  -webkit-hyphens: none;
  hyphens: none;
  margin: .6em 0 .5em;
}
.page-turn {
  grid-row: 1;
  align-self: center;
  appearance: none;
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  width: 36px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.page-turn:hover { color: var(--soft); }
.page-turn:disabled { opacity: 0; pointer-events: none; }
.page-turn.left  { grid-column: 1; }
.page-turn.right { grid-column: 3; }
.page-num {
  grid-column: 1 / -1;
  grid-row: 2;
  text-align: center;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  padding: 8px 0 6px;
}

/* ---------- transport ---------- */
.transport {
  flex-shrink: 0;
  border-top: 1px solid var(--rule);
  background: var(--bar);
  padding: 10px 18px 12px;
}
.scrub-row { padding: 0 2px; }
/* The scrubber is drawn by the shell's pseudo-elements from --p; the native
   range input sits invisibly on top and only handles pointer/keyboard input.
   Native slider parts have browser-controlled paint order and pixel-snapped
   centering (Firefox painted the track over the thumb; zoom drifted the thumb
   off the track), so nothing visual is left to them. */
.scrub-shell {
  position: relative;
  height: 15px;
}
.scrub-shell::before { /* track: filled to --p, then rest */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--track-fg) 0%, var(--track-fg) var(--p, 0%), var(--track-bg) var(--p, 0%), var(--track-bg) 100%);
}
.scrub-shell::after { /* thumb, centered on the progress fraction */
  content: "";
  position: absolute;
  left: var(--p, 0%);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--thumb);
  border: 0.5px solid var(--thumb-edge);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.scrub {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1; /* input above the painted track and thumb */
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
}
.scrub-shell:has(.scrub:focus-visible)::after {
  outline: 2px solid var(--track-fg);
  outline-offset: 2px;
}
.times {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  margin-top: 2px;
  padding: 0 1px;
}
.controls {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 8px;
  min-height: 36px;
}
.chapter {
  font-size: 12px;
  color: var(--soft);
  gap: 5px;
  max-width: 22%;
  cursor: pointer;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 6px;
  transition: color .12s, background .12s;
}
.chapter:hover { color: var(--ink); background: var(--hover); }
.chapter:active { background: var(--press); }
.chapter span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Chapters popover */
.ch-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  min-width: 150px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .16);
  padding: 5px;
  z-index: 30;
}
.ch-item {
  display: block;
  width: 100%;
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  color: var(--ink);
  padding: 6px 10px 6px 26px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.ch-item:hover { background: var(--hover); }
.ch-item.current { font-weight: 600; }
.ch-item.current::before {
  content: "✓";
  position: absolute;
  left: 9px;
  font-weight: 400;
  color: var(--soft);
}
.transport-btns {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--soft);
}
.tbtn {
  appearance: none;
  background: none;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--soft);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: color .12s, background .12s, transform .08s, font-weight .12s;
}
.tbtn:hover { color: var(--ink); background: var(--hover); }
.tbtn:active { transform: scale(0.9); background: var(--press); }
.tbtn.play {
  color: var(--ink);
  width: 40px;
  height: 40px;
  padding: 0;
}
.tbtn.play:hover { background: var(--hover); }
.tbtn.sm {
  color: var(--soft);
  padding: 5px;
}
/* Active toggles: heavier ink, like the app's semibold "on" state */
.tbtn.on {
  color: var(--ink);
  font-weight: 600;
}
.tbtn.on svg { transform: none; }
.right-cluster {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--soft);
}
.vol-track {
  appearance: none;
  border: none;
  background: none;
  width: 56px;
  height: 18px;
  padding: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.vol-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--track-bg);
}
.vol-track i {
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: -1.5px;
  height: 3px;
  width: var(--vol, 62%);
  background: var(--track-fg);
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
}
.vol-track::after {
  content: "";
  position: absolute;
  left: var(--vol, 62%);
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--thumb);
  border: 0.5px solid var(--thumb-edge);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  pointer-events: none;
  transition: left .08s;
}
.vol-track:hover::after { box-shadow: 0 1px 4px rgba(0, 0, 0, .22); }
.vol-track.dragging::after { transition: none; }
.vol-track.muted i { width: 0; }
.vol-track.muted::after { left: 0; }
.speed {
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--soft);
  min-width: 2em;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .12s, background .12s;
}
.speed:hover { color: var(--ink); background: var(--hover); }
.speed:active { background: var(--press); }

/* Brief toast for noop affordances */
.toast {
  position: absolute;
  left: 50%;
  bottom: 124px; /* clear of the transport bar */
  transform: translateX(-50%) translateY(6px);
  background: rgba(30, 30, 32, .88);
  color: #fff;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s, transform .18s;
  z-index: 20;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- mode tabs ---------- */
.modes {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 22px auto 0;
  padding-bottom: 56px;
  flex-wrap: wrap;
}
.mode-tab {
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: 13px;
  color: var(--soft);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.mode-tab:hover { color: var(--ink); border-color: var(--faint); }
.mode-tab.active {
  color: var(--ink);
  border-color: var(--ink);
}
/* ---------- marketing sections ---------- */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  max-width: 720px;
  margin: 0 auto;
}
section {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 24px;
}
.sec-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 27px;
  margin-bottom: 28px;
}
.lede {
  color: var(--soft);
  max-width: 560px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.7;
}
.center { text-align: center; }
.tease .sec-title { margin-bottom: 18px; }
.tease .lede { text-align: center; margin-bottom: 0; }
@media (prefers-color-scheme: light) {
  .lede { color: #555; }
}
.fine {
  color: var(--faint);
  font-size: 13.5px;
  margin-top: 40px;
}

/* Features */
.features-wrap { max-width: 880px; }
.features {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 36px 40px;
}
.feature { grid-column: span 2; }
/* Five cards: row of three, then two centered in the gaps below */
.feature:nth-child(4) { grid-column: 2 / span 2; }
.feature:nth-child(5) { grid-column: 4 / span 2; }
.feature h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.feature p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--soft);
}

/* How it works */
.how {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
}
.step-num {
  font-family: var(--serif);
  font-size: 30px;
  color: var(--faint);
  display: block;
  margin-bottom: 10px;
}
.how p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--soft);
}
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .92em;
}

/* FAQ */
.faq-wrap { max-width: 620px; }
.faq {
  display: grid;
  gap: 28px;
}
.faq dt {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.faq dd {
  font-size: 14px;
  line-height: 1.6;
  color: var(--soft);
  margin: 0;
}

/* Closing CTA — coming soon lives here, after the pitch */
.cta {
  max-width: 560px;
  padding: 88px 24px 72px;
}
.cta .soon { margin-bottom: 28px; }
.cta .sec-title { margin-bottom: 14px; }
.cta .lede { font-size: 16px; }

footer {
  border-top: 1px solid var(--rule);
  text-align: center;
  padding: 40px 24px 56px;
  color: var(--faint);
  font-size: 13px;
}
footer .word {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--soft);
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .hero h1 { font-size: 36px; }
  .window { height: 520px; max-width: 100%; }
  .library-scroll { padding: 0 20px 28px; }
  .flow { padding: 0 24px; }
  .flow .para { font-size: 17px; }
  .spread { grid-template-columns: 1fr; gap: 0; }
  .col + .col { display: none; }
  .right-cluster .vol-track,
  .right-cluster .tbtn.sm:nth-child(n+3) { display: none; }
  .chapter { max-width: 18%; }
  .features { grid-template-columns: 1fr; gap: 28px; }
  .feature,
  .feature:nth-child(4),
  .feature:nth-child(5) { grid-column: auto; }
  .how { grid-template-columns: 1fr; gap: 28px; }
  section { padding: 56px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .flow { transition: none; }
  .sent { transition: none; }
  .pill { transition: opacity .01s; }
  .toast { transition: opacity .01s; }
  .spread.flip { animation: none; }
}
