/* Epigraph's landing page. The tokens are the app's (Shelf/Design/Theme.swift): a white page, a
   serif for headings, mono for the shelf's labels, and one solid block painted in a book's colours. */

:root {
  /* Walls and voices */
  --bg: #FFFFFF;
  --surface: #F2F0EA;
  --line: #DCD8CE;
  --ink: #17140F;
  --muted: #6C665C;
  --soft: #47423A;
  --accent: #BD5800;
  --cream: #F3E7CA;
  --page-ink: #2A2420;

  /* Space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --gutter: 16px;

  /* Type */
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-text: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-eyebrow: 11px;
  --t-sm: 13px;
  --t-body: 15px;
  --t-md: 16px;
  --t-lede: clamp(17px, 1.3vw + 11px, 20px);
  --t-h3: 22px;
  --t-h2: clamp(30px, 3.4vw + 12px, 48px);
  --t-h1: clamp(38px, 4.2vw + 14px, 64px);

  /* Shape */
  --r-cover: 3px;
  --r-art-sm: 8px;
  --r-button: 14px;
  --r-row: 16px;
  --r-phone: 44px;
  --phone-bezel: 8px;

  /* The shelf's cover flow */
  --cw: 196px;
  --step: 124px;

  --ease-rise: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-tint: cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: light;
}

@media (max-width: 640px) {
  :root { --cw: 136px; --step: 90px; --r-phone: 32px; --phone-bezel: 6px; }
}

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

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible, a:focus-visible {
  outline: 2px solid currentColor; outline-offset: 3px; border-radius: var(--r-button);
}
img { display: block; }
figure { margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Mono eyebrows, as on the app's walls */
.eyebrow {
  font-family: var(--font-mono); font-size: var(--t-eyebrow); font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8;
}

/* ------------------------------------------------------------------ Header */

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s5) var(--gutter);
  max-width: 1200px; margin: 0 auto;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -0.01em;
}
.brand svg { width: 18px; height: 20px; }
.brand .note { fill: url(#rose); }

/* -------------------------------------------------------------------- Hero */

.hero { padding: var(--s7) var(--gutter) 0; }
.hero-copy {
  max-width: 1200px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding-top: var(--s4);
}
.hero h1 { font-size: var(--t-h1); line-height: 1.04; max-width: 13ch; }
.hero .lede { font-size: var(--t-lede); line-height: 1.45; color: var(--soft); max-width: 42ch; margin-top: var(--s5); }
.hero .join { margin-top: var(--s6); }

/* Three phones at the foot of the hero, the player in front, cut off where the shelf begins so
   only their top halves show. */
.hero-phones {
  --centre-w: 300px;
  --side-w: 250px;
  --side-drop: 88px;
  --overlap: 72px;
  --peek: 360px;
  position: relative;
  height: var(--peek);
  /* Runs edge to edge, so the side phones are cut by the screen, not the gutter. */
  margin: var(--s7) calc(-1 * var(--gutter)) 0;
  display: flex; justify-content: center; align-items: flex-start;
  overflow: hidden;
}
.hero-phones .phone { flex: 0 0 auto; }
.phone-centre { width: var(--centre-w); z-index: 2; }
.phone-left, .phone-right { width: var(--side-w); margin-top: var(--side-drop); }
.phone-left { margin-right: calc(-1 * var(--overlap)); }
.phone-right { margin-left: calc(-1 * var(--overlap)); }

@media (max-width: 640px) {
  .hero-phones { --centre-w: 190px; --side-w: 156px; --side-drop: 56px; --overlap: 48px; --peek: 230px; margin-top: var(--s6); }
}

/* The app on a phone: a dark bezel around a screenshot, corners concentric with the screen's. */
.phone {
  position: relative;
  aspect-ratio: 402 / 874;
  padding: var(--phone-bezel);
  border-radius: var(--r-phone);
  background: #0F0E0D;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2), 0 28px 56px rgba(0, 0, 0, 0.22);
  animation: phone-rise 0.7s var(--ease-rise) both;
}
.phone-left { animation-delay: 0.08s; }
.phone-right { animation-delay: 0.16s; }
.phone img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: calc(var(--r-phone) - var(--phone-bezel));
  background: var(--surface);
}
@keyframes phone-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* Join the waitlist: an email and one button, the same wherever it appears. */
.join { width: 100%; max-width: 460px; }
.join-row { display: flex; gap: var(--s2); }
.join input[type="email"] {
  flex: 1 1 auto; min-width: 0;
  height: 52px; padding: 0 var(--s4);
  font: inherit; font-size: var(--t-md);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-button);
}
.join input[type="email"]::placeholder { color: var(--muted); }
.join button[type="submit"] {
  flex: 0 0 auto;
  height: 52px; padding: 0 var(--s5);
  font-weight: 600; font-size: var(--t-md);
  color: #fff;
  background: var(--ink);
  border-radius: var(--r-button);
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}
.join button[type="submit"]:active { transform: scale(0.985); opacity: 0.85; }
.join button[type="submit"][disabled] { opacity: 0.6; cursor: progress; }
.join .trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.join-note { min-height: 1.5em; margin-top: var(--s3); font-size: var(--t-sm); color: var(--muted); }
.join-note.is-error { color: var(--ink); }
.join.is-done .join-row { display: none; }
.join.is-done .join-note { font-family: var(--font-display); font-size: var(--t-h3); color: var(--ink); min-height: 52px; display: flex; align-items: center; justify-content: center; margin: 0; }
.fine { font-size: var(--t-sm); color: var(--muted); margin-top: var(--s4); }

@media (max-width: 480px) {
  .join-row { flex-direction: column; }
  .join button[type="submit"] { width: 100%; }
}

/* ------------------------------------------------------------------- Shelf */

/* One solid block in the colours of the book in the middle of the shelf: the app's wall for that
   book, under a fine film grain. It changes when the book does, never with the scroll. */
.shelf {
  --wall-base: #321D00;
  --wall-light: #664201;
  --wall-ink: #F3E7CA;
  --wall-ink-72: color-mix(in srgb, var(--wall-ink) 72%, transparent);
  --wall-ink-16: color-mix(in srgb, var(--wall-ink) 16%, transparent);
  --wall-ink-22: color-mix(in srgb, var(--wall-ink) 22%, transparent);
  position: relative;
  padding: var(--s8) 0 var(--s7);
  background: var(--wall-base);
  color: var(--wall-ink);
  transition: background-color 0.8s var(--ease-tint), color 0.8s var(--ease-tint);
}
.shelf::before {
  content: ""; position: absolute; inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
.shelf > * { position: relative; }
.shelf :focus-visible { outline-color: var(--wall-ink); }

.shelf-head { text-align: center; padding: 0 var(--gutter); }
.shelf-head h2 { font-size: var(--t-h2); line-height: 1.08; }
.shelf-head p { margin: var(--s3) auto 0; font-size: var(--t-lede); color: var(--wall-ink-72); max-width: 30ch; }

/* A cover flow on scroll snapping. Each item is a slot; the card inside turns and recedes. */
.flow {
  --ch: calc(var(--cw) / 0.68);
  display: flex; align-items: center;
  height: calc(var(--ch) + 72px);
  margin-top: var(--s6);
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  perspective: 1400px;
  perspective-origin: 50% 40%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  cursor: grab;
}
.flow::-webkit-scrollbar { display: none; }
.flow.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.flow::before, .flow::after { content: ""; flex: 0 0 calc(50% - var(--step) / 2); }
.flow-item {
  position: relative;
  flex: 0 0 var(--step); height: var(--ch);
  scroll-snap-align: center;
  display: flex; justify-content: center;
  transform-style: preserve-3d;
}
.flow-item .card {
  position: absolute; top: 0; width: var(--cw); height: var(--ch);
  transform-style: preserve-3d;
  will-change: transform;
  border-radius: var(--r-cover);
  transition: box-shadow 0.3s ease-out;
}
.flow-item .cover { width: 100%; }
.flow-item.is-centre .card { box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45); }

.flow-caption { text-align: center; padding: var(--s4) var(--gutter) 0; min-height: 68px; }
.flow-caption h3 { font-size: var(--t-h3); line-height: 1.2; }
.flow-caption .eyebrow { display: block; margin-top: var(--s1); }
.flow-caption .vibe { font-family: var(--font-display); font-style: italic; font-size: var(--t-md); color: var(--wall-ink-72); margin-top: var(--s2); max-width: 44ch; margin-inline: auto; }

/* The five songs, rising in one after another as the app's list does. */
.songs {
  list-style: none; margin: var(--s5) auto 0; padding: 0 var(--gutter);
  max-width: 560px; min-height: 340px;
}
.songs li { opacity: 0; transform: translateY(16px); transition: opacity 0.45s var(--ease-rise), transform 0.45s var(--ease-rise); transition-delay: calc(0.12s + 0.035s * var(--i)); }
.songs.is-shown li { opacity: 1; transform: none; }
.songs.is-leaving li { opacity: 0; transition: opacity 0.15s ease-out; transition-delay: 0s; }
.song {
  width: 100%; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2); border-radius: var(--r-row);
  text-align: left; min-height: 62px;
  transition: background-color 0.2s ease-out;
}
.song:hover { background: color-mix(in srgb, var(--wall-ink) 8%, transparent); }
.song.is-current { background: var(--wall-ink-16); }
.song .thumb { width: 46px; height: 46px; flex: 0 0 46px; border-radius: var(--r-art-sm); overflow: hidden; background: linear-gradient(135deg, var(--art-a, #6c6a7a), var(--art-b, #35333f)); }
.song .thumb img { width: 100%; height: 100%; object-fit: cover; }
.song .text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.song .name { font-size: var(--t-body); font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .name span { font-weight: 400; color: var(--wall-ink-72); }
.song .why { font-size: 12.5px; line-height: 1.35; color: var(--wall-ink-72); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.song .state { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; }
.song .state svg { width: 22px; height: 22px; fill: var(--wall-ink); opacity: 0.7; }
.song.is-current .state svg { opacity: 1; }

/* Three bars, moving while the song plays. */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.bars i { width: 3px; height: 40%; background: var(--wall-ink); border-radius: 1px; animation: bar 0.9s ease-in-out infinite alternate; animation-play-state: paused; }
.bars i:nth-child(2) { animation-delay: -0.3s; height: 90%; }
.bars i:nth-child(3) { animation-delay: -0.6s; height: 60%; }
.song.is-playing .bars i { animation-play-state: running; }
@keyframes bar { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }

.shelf .credit { text-align: center; font-size: 12px; color: var(--wall-ink-72); margin-top: var(--s5); padding: 0 var(--gutter); }
.shelf .empty { text-align: center; color: var(--wall-ink-72); padding: var(--s6) var(--gutter); }

/* ------------------------------------------------------------- Join again */

.again {
  max-width: 1200px; margin: 0 auto;
  padding: var(--s9) var(--gutter) var(--s7);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.again h2 { font-size: var(--t-h2); line-height: 1.08; }
.again .join { margin-top: var(--s5); }

footer {
  max-width: 1200px; margin: 0 auto;
  padding: var(--s5) var(--gutter) var(--s7);
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); justify-content: center;
  font-size: var(--t-sm); color: var(--muted);
}
footer a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* ------------------------------------------------------------- Book covers */

/* Real art when there is any, over a cover drawn from the book's colours. Every cover gets the
   binding crease, as in the app. */
.cover {
  position: relative; width: var(--w, 96px); aspect-ratio: 0.68;
  border-radius: var(--r-cover); overflow: hidden;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 6px 8px rgba(0, 0, 0, 0.14), inset 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  container-type: inline-size;
}
.cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.25s ease-out; }
.cover.has-art > img { opacity: 1; }
.cover .crease {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg,
    rgba(0, 0, 0, 0.24) 0%, rgba(0, 0, 0, 0.08) 2.6%, rgba(255, 255, 255, 0.22) 3.6%,
    rgba(255, 255, 255, 0) 6.5%, rgba(0, 0, 0, 0.06) 9%, transparent 14%);
}
.drawn {
  position: absolute; inset: 0;
  background: var(--c-cover, #2B2D42); color: var(--c-ink, #F3E7CA);
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center;
  padding: 11cqw 9cqw 13cqw 10cqw;
  overflow: hidden;
}
.drawn .who, .drawn .what { font-size: 5.7cqw; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.drawn .title { font-family: var(--font-display); font-weight: 700; font-size: 13.5cqw; line-height: 1.02; letter-spacing: -0.01em; text-wrap: balance; }
.drawn.orb::before { content: ""; position: absolute; width: 68cqw; height: 68cqw; border-radius: 50%; background: var(--c-accent); right: -24cqw; top: -24cqw; }
.drawn.band::before { content: ""; position: absolute; left: 0; right: 0; height: 11cqw; bottom: 26cqw; background: var(--c-accent); }
.drawn.frame::before { content: ""; position: absolute; inset: 6.5cqw 6.5cqw 6.5cqw 9cqw; border: 1px solid color-mix(in srgb, var(--c-ink) 42%, transparent); }
.drawn > * { position: relative; }

/* ---------------------------------------------------------- Reduce motion */

@media (prefers-reduced-motion: reduce) {
  .shelf { transition: none; }
  .phone { animation: none; }
  .songs li { transition-delay: 0s; transform: none; }
  .bars i { animation: none; }
  .flow { scroll-behavior: auto; }
}

/* ------------------------------------------------------------ Legal pages */

/* Privacy and terms: one column of reading, in the page's own voice. */
.legal { max-width: 640px; margin: 0 auto; padding: var(--s6) var(--gutter) var(--s8); font-size: 17px; line-height: 1.6; }
.legal .eyebrow { display: block; color: var(--muted); }
.legal h1 { font-size: var(--t-h2); line-height: 1.1; margin-top: var(--s3); }
.legal .lede { font-size: var(--t-lede); line-height: 1.5; color: var(--soft); margin-top: var(--s4); }
.legal h2 { font-size: 26px; line-height: 1.2; margin-top: var(--s7); }
.legal h3 { font-family: var(--font-text); font-size: var(--t-md); font-weight: 600; letter-spacing: 0; margin-top: var(--s5); }
.legal h2 + h3 { margin-top: var(--s4); }
.legal p { margin-top: var(--s3); color: var(--soft); }
.legal p a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
.legal p a:hover { text-decoration-color: var(--ink); }
