:root {
  --bg: #f9f1e8;
  --bg-deep: #f2e7d9;
  --panel: rgba(255, 251, 245, 0.8);
  --ink: #1b1a1a;
  --muted: #4d4b49;
  --line: rgba(27, 26, 26, 0.12);
  --warm: #e98654;
  --clay: #d86e61;
  --sage: #d8e7d4;
  --lavender: #dfe0ff;
  --shadow: rgba(20, 16, 12, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Geist', 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217, 110, 97, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(142, 163, 224, 0.18), transparent 30%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--ink);
}

img {
  max-width: 100%;
  display: block;
}

button,
a {
  font: inherit;
}

.page {
  position: relative;
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.4rem 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar {
  position: absolute;
  top: 2rem;
  right: 1.25rem;
}

.shuffle-button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.36);
  backdrop-filter: blur(12px);
  color: var(--ink);
  border-radius: 999px;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.04);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.shuffle-button:hover,
.shuffle-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(27, 26, 26, 0.28);
  background: rgba(255, 255, 255, 0.55);
}

.shuffle-button:focus-visible,
.book-link:focus-visible,
.full-link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.note-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 1.5rem) 0;
}

.note-text {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 80;
  font-size: clamp(2.2rem, 4vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
  color: var(--ink);
  text-wrap: balance;
  transition: opacity 200ms ease, transform 200ms ease;
  transform: translateY(0);
}

.note-shell.is-transitioning .note-text {
  opacity: 0.3;
  transform: translateY(8px);
}

.meta {
  margin-top: 1.6rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.book-link,
.full-link {
  color: var(--ink);
  text-decoration: none;
}

.book-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: clamp(0.9rem, 1.8vw, 1.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  border-bottom: 1px solid rgba(27, 26, 26, 0.18);
  padding-bottom: 0.12rem;
}

.author-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.byline {
  opacity: 0.75;
}

.full-link {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.full-link:hover,
.book-link:hover {
  opacity: 0.8;
}

.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;
}

@media (max-width: 640px) {
  .page {
    padding-top: 4rem;
  }

  .topbar {
    top: 1rem;
    right: 0.9rem;
  }

  .shuffle-button {
    width: 46px;
    height: 46px;
  }

  .note-text {
    font-size: clamp(2.1rem, 12vw, 4rem);
  }
}

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