:root {
  --paper: #f2ede3;
  --paper-deep: #e6ded0;
  --ink: #191816;
  --muted: #6e685f;
  --line: rgba(25, 24, 22, .18);
  --red: #a22b30;
  --red-dark: #771b20;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.35), transparent 32rem),
    var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
::selection { color: #fff; background: var(--red); }

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  transform: translateY(-150%); background: var(--ink); color: white;
  padding: 10px 14px;
}
.skip-link:focus { transform: none; }

.site-header {
  height: 76px; padding: 0 clamp(22px, 4vw, 68px);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: absolute; inset: 0 0 auto; z-index: 10;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600; letter-spacing: .16em;
  text-decoration: none;
}
.wordmark span {
  font-family: var(--serif); font-size: 10px; font-style: italic;
  letter-spacing: .03em; color: var(--red); transform: rotate(-90deg);
}
.site-header nav { display: flex; align-items: center; gap: clamp(18px, 2.6vw, 42px); }
.site-header nav a, .nav-link {
  border: 0; padding: 8px 0; background: transparent; text-decoration: none;
  font-size: 13px; cursor: pointer; position: relative;
}
.site-header nav a::after, .nav-link::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 2px;
  height: 1px; background: var(--red); transition: right .25s ease;
}
.site-header nav a:hover::after, .nav-link:hover::after { right: 0; }
#savedCount {
  display: inline-grid; place-items: center; width: 20px; height: 20px;
  margin-left: 4px; color: white; background: var(--red); border-radius: 50%;
  font-size: 10px;
}

.opening {
  min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(320px, .78fr);
  padding: 150px clamp(24px, 7vw, 120px) 80px; position: relative; overflow: hidden;
}
.opening::before {
  content: ""; position: absolute; width: 1px; height: 62%; top: 18%; left: 55%;
  background: var(--line); transform: rotate(13deg); transform-origin: center;
}
.opening-copy { align-self: center; max-width: 760px; position: relative; z-index: 1; }
.eyebrow {
  margin: 0 0 20px; color: var(--red); font-size: 11px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
}
h1, h2, h3, blockquote { font-family: var(--serif); font-weight: 300; }
h1 {
  margin: 0; font-size: clamp(70px, 10vw, 150px); line-height: .78;
  letter-spacing: -.065em;
}
h1 em { color: var(--red); font-weight: 300; }
.dek {
  max-width: 570px; margin: 48px 0 0 12%; color: var(--muted);
  font-family: var(--serif); font-size: clamp(20px, 2vw, 28px); line-height: 1.42;
}
.opening-actions { display: flex; align-items: center; gap: 30px; margin: 36px 0 0 12%; }
.primary-button {
  min-height: 50px; border: 1px solid var(--red); padding: 14px 21px;
  color: white; background: var(--red); cursor: pointer; transition: background .2s, transform .2s;
}
.primary-button:hover { background: var(--red-dark); transform: translateY(-2px); }
.text-link { text-underline-offset: 5px; font-size: 13px; }
.opening-quote {
  align-self: center; margin: 60px 0 0 clamp(0px, 4vw, 70px); max-width: 420px;
  position: relative; z-index: 1;
}
.quote-mark {
  display: block; height: 70px; color: var(--red); font-family: var(--serif);
  font-size: 120px; line-height: 1;
}
.opening-quote blockquote { margin: 10px 0 24px; font-size: clamp(32px, 4vw, 55px); line-height: 1.02; letter-spacing: -.025em; }
.opening-quote figcaption { color: var(--muted); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.scroll-note {
  position: absolute; right: clamp(24px, 4vw, 68px); bottom: 32px;
  display: flex; align-items: center; gap: 12px; color: var(--muted);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
}
.scroll-note span { width: 44px; height: 1px; background: var(--red); }

.invitation {
  min-height: 190px; display: flex; align-items: center; justify-content: center; gap: clamp(20px, 7vw, 100px);
  padding: 35px 24px; color: #f8f3eb; background: var(--ink);
}
.invitation p { font-family: var(--serif); font-size: clamp(24px, 3vw, 38px); }
.invitation button { border: 0; padding: 20px 26px; color: inherit; background: transparent; cursor: pointer; font-size: 14px; }
.random-orbit { display: inline-block; margin-right: 14px; color: #cf5559; transition: transform .6s ease; }
.invitation button:hover .random-orbit { transform: rotate(180deg) scale(1.3); }

.themes-section, .browse-section { padding: clamp(80px, 10vw, 150px) clamp(24px, 7vw, 120px); }
.section-heading { display: grid; grid-template-columns: 1fr minmax(270px, 430px); align-items: end; gap: 50px; }
.section-heading h2, .browse-intro h2, .closing h2, .about-copy h2 {
  margin: 0; font-size: clamp(52px, 7vw, 105px); line-height: .95; letter-spacing: -.05em;
}
.section-heading > p { margin: 0 0 9px; color: var(--muted); font-family: var(--serif); font-size: 21px; line-height: 1.5; }
.theme-list { margin-top: 70px; border-top: 1px solid var(--line); }
.theme-button {
  width: 100%; min-height: 88px; display: grid; grid-template-columns: 58px 1fr auto;
  align-items: center; gap: 18px; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; cursor: pointer; text-align: left; transition: padding .25s, color .25s;
}
.theme-button:hover, .theme-button.active { padding-left: 18px; color: var(--red); }
.theme-index { color: var(--muted); font-size: 10px; }
.theme-name { font-family: var(--serif); font-size: clamp(31px, 4vw, 50px); font-weight: 300; }
.theme-count { color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.theme-arrow { display: none; }

.browse-section { background: #fbf8f2; }
.browse-intro { max-width: 730px; }
.browse-intro > p:last-child { color: var(--muted); line-height: 1.6; }
.search-wrap { max-width: 900px; margin: 70px 0 60px; }
.search-wrap label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; }
.search-field { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 13px; border-bottom: 1px solid var(--ink); }
.search-field svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.search-field input { width: 100%; border: 0; outline: 0; padding: 18px 0; background: transparent; font-family: var(--serif); font-size: clamp(25px, 4vw, 43px); }
.search-field input::placeholder { color: #aaa296; }
kbd { border: 1px solid var(--line); padding: 4px 8px; color: var(--muted); font-size: 11px; }
.browse-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: clamp(35px, 6vw, 100px); }
.filters > p { margin: 0 0 18px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; }
#bookList { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.book-button {
  min-height: 38px; border: 0; padding: 8px 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 13px; text-align: left;
}
.book-button:hover, .book-button.active { color: var(--red); }
.book-button.active::before { content: "— "; }
.results-bar { min-height: 40px; display: flex; justify-content: space-between; align-items: start; color: var(--muted); font-size: 12px; }
.results-bar p { margin: 0; }
.results-bar button { border: 0; padding: 0 0 4px; border-bottom: 1px solid; background: transparent; cursor: pointer; }
.passage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.passage-card {
  min-height: 310px; display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(28px, 3vw, 48px); border: 0; background: #fbf8f2; cursor: pointer; text-align: left;
  position: relative; transition: background .25s;
}
.passage-card:nth-child(4n+2), .passage-card:nth-child(4n+3) { background: #f5f0e8; }
.passage-card:hover { background: var(--paper-deep); }
.passage-card::before { content: "“"; color: var(--red); font-family: var(--serif); font-size: 45px; line-height: .6; }
.passage-card blockquote {
  margin: 24px 0 38px; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical;
  overflow: hidden; font-size: clamp(23px, 2.15vw, 34px); line-height: 1.17; letter-spacing: -.02em;
}
.card-meta { display: flex; justify-content: space-between; align-items: end; gap: 18px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.card-theme { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-save {
  position: absolute; right: 20px; top: 18px; width: 40px; height: 40px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; opacity: 0;
}
.passage-card:hover .card-save, .card-save.saved, .card-save:focus-visible { opacity: 1; }
.card-save.saved { color: var(--red); }
.load-more { display: block; margin: 50px auto 0; border: 0; border-bottom: 1px solid; padding: 10px 0; background: transparent; cursor: pointer; }
.empty-state { padding: 80px 20px; text-align: center; }
.empty-mark { margin: 0; color: var(--red); font-family: var(--serif); font-size: 70px; }
.empty-state h3 { margin: 0; font-size: 35px; }
.empty-state p:last-child { color: var(--muted); }

.closing { padding: clamp(90px, 12vw, 180px) 24px; text-align: center; color: #f7f0e6; background: var(--red-dark); }
.closing .eyebrow { color: #e69b9e; }
.closing h2 { max-width: 1000px; margin-inline: auto; }
.closing > p:not(.eyebrow) { max-width: 510px; margin: 30px auto; color: #e7cfd0; font-family: var(--serif); font-size: 21px; line-height: 1.5; }
.primary-button.inverse { border-color: #f7f0e6; color: var(--red-dark); background: #f7f0e6; }
footer { min-height: 180px; display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 40px; padding: 45px clamp(24px, 5vw, 78px); color: #aaa39a; background: var(--ink); font-size: 11px; line-height: 1.6; }
footer .wordmark { color: #f7f0e6; }
footer .nav-link { color: #ddd4c8; justify-self: end; }

:is(button, a, input):focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
dialog { border: 0; padding: 0; max-width: none; }
dialog::backdrop { background: rgba(15, 13, 11, .7); backdrop-filter: blur(3px); }
.passage-dialog { width: min(860px, calc(100% - 32px)); color: var(--ink); background: var(--paper); }
.dialog-close { position: absolute; top: 14px; right: 18px; z-index: 2; border: 0; background: transparent; cursor: pointer; font-family: var(--serif); font-size: 34px; }
.dialog-body { padding: clamp(50px, 8vw, 100px); }
.dialog-body blockquote { margin: 0 0 30px; font-size: clamp(34px, 5vw, 62px); line-height: 1.05; letter-spacing: -.035em; }
.dialog-reference { color: var(--red); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.dialog-actions { display: flex; gap: 12px; margin-top: 50px; padding-top: 20px; border-top: 1px solid var(--line); }
.dialog-actions button { border: 0; border-bottom: 1px solid; padding: 8px 0; margin-right: 24px; background: transparent; cursor: pointer; font-size: 12px; }
.about-dialog { width: min(720px, 100%); margin-right: 0; min-height: 100%; background: var(--paper); }
.about-copy { padding: clamp(60px, 9vw, 110px); }
.about-copy h2 { font-size: clamp(48px, 6vw, 77px); }
.about-copy > p { color: var(--muted); font-family: var(--serif); font-size: 20px; line-height: 1.55; }
.about-copy dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 42px 0; border-block: 1px solid var(--line); }
.about-copy dl div { padding: 20px 12px 20px 0; }
.about-copy dt { color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.about-copy dd { margin: 4px 0 0; font-family: var(--serif); font-size: 30px; }

.journey {
  position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 28px clamp(22px, 5vw, 70px); color: #f3ece3; background: var(--ink);
  transform: translateY(105%); visibility: hidden; transition: transform .55s cubic-bezier(.75,0,.15,1), visibility .55s;
}
.journey.open { transform: none; visibility: visible; }
.journey-top, .journey-controls { display: flex; align-items: center; justify-content: space-between; }
.journey-top button, .journey-controls button { border: 0; color: inherit; background: transparent; cursor: pointer; }
.journey-top button { font-size: 12px; }
.journey-top button span { margin-left: 8px; font-family: var(--serif); font-size: 25px; }
.journey-content { width: min(1060px, 100%); max-height: 100%; margin: auto; overflow-y: auto; padding: 24px 8px 24px 0; scrollbar-color: #5b5550 transparent; scrollbar-width: thin; }
.journey-number { color: #a29a90; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.journey-content blockquote { margin: 22px 0 32px; font-size: clamp(38px, 6.3vw, 92px); line-height: .97; letter-spacing: -.045em; }
.journey-content > p:last-child { color: #c25458; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.journey-controls { border-top: 1px solid rgba(255,255,255,.17); padding-top: 18px; color: #999187; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.journey-controls button { min-width: 50px; min-height: 50px; color: #f3ece3; font-size: 24px; }

@media (max-width: 850px) {
  .site-header { height: 66px; }
  .site-header nav a { display: none; }
  .site-header nav { gap: 16px; }
  .opening { grid-template-columns: 1fr; min-height: auto; padding-top: 130px; }
  .opening::before { left: auto; right: 15%; height: 44%; top: 41%; }
  h1 { font-size: clamp(66px, 20vw, 112px); }
  .dek, .opening-actions { margin-left: 0; }
  .opening-quote { margin: 100px 8vw 70px 15vw; }
  .section-heading { grid-template-columns: 1fr; }
  .browse-layout { grid-template-columns: 1fr; }
  .filters { overflow: hidden; }
  #bookList { flex-direction: row; overflow-x: auto; gap: 18px; padding-bottom: 9px; scrollbar-width: thin; }
  .book-button { white-space: nowrap; }
  .book-button.active::before { content: ""; }
  footer { grid-template-columns: 1fr; }
  footer .nav-link { justify-self: start; }
}

@media (max-width: 600px) {
  .site-header { padding-inline: 18px; }
  .site-header nav .nav-link:last-child { display: none; }
  .opening { padding: 115px 20px 60px; }
  h1 { line-height: .84; }
  .dek { margin-top: 35px; font-size: 20px; }
  .opening-actions { align-items: flex-start; flex-direction: column; gap: 18px; }
  .opening-quote { margin: 85px 20px 25px 14vw; }
  .scroll-note { display: none; }
  .invitation { flex-direction: column; gap: 0; text-align: center; }
  .themes-section, .browse-section { padding-inline: 20px; }
  .theme-button { grid-template-columns: 34px 1fr auto; min-height: 72px; }
  .theme-count { font-size: 9px; }
  .search-wrap { margin: 55px 0 42px; }
  .search-field input { font-size: 24px; }
  kbd { display: none; }
  .passage-grid { grid-template-columns: 1fr; }
  .passage-card { min-height: 280px; }
  .passage-card:nth-child(odd) { background: #fbf8f2; }
  .passage-card:nth-child(even) { background: #f5f0e8; }
  .card-save { opacity: 1; }
  .dialog-body { padding: 60px 25px 35px; }
  .dialog-body blockquote { font-size: 34px; }
  .about-copy { padding: 70px 25px 40px; }
  .about-copy dl { grid-template-columns: 1fr; }
  .about-copy dl div + div { border-top: 1px solid var(--line); }
  .journey { padding: 23px 20px; }
  .journey-content blockquote { font-size: clamp(36px, 11vw, 58px); line-height: 1.02; }
  .journey-controls span { display: none; }
}

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