:root {
  --paper: #f4efe6;
  --paper-deep: #e9e0d1;
  --ink: #1d2522;
  --muted: #676c66;
  --line: rgba(29, 37, 34, 0.16);
  --green: #294a3c;
  --green-deep: #17342a;
  --gold: #b58b4a;
  --white: #fffdf8;
  --serif: "Iowan Old Style", "Palatino Linotype", Baskerville, Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

body.dialog-open { overflow: hidden; }

a { color: inherit; }

button, input { font: inherit; }

button { color: inherit; }

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

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

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid #bc742f;
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 239, 230, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font: 600 13px/1 var(--serif);
  letter-spacing: 0.08em;
}

.brand-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 42px);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.header-actions > a {
  text-decoration: none;
  position: relative;
}

.header-actions > a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -4px;
  height: 1px;
  background: currentColor;
  transition: right 180ms ease;
}

.header-actions > a:hover::after { right: 0; }

.language-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  border-left: 1px solid var(--line);
  padding-left: clamp(14px, 2.5vw, 32px);
}

.ui-lang {
  appearance: none;
  border: 0;
  padding: 7px 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.ui-lang.active { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

.hero {
  min-height: calc(100svh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  align-items: center;
  gap: clamp(40px, 7vw, 110px);
  position: relative;
  overflow: hidden;
  padding: clamp(70px, 10vw, 150px) clamp(22px, 7.5vw, 120px);
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  width: 440px;
  height: 440px;
  top: -280px;
  right: -120px;
  border: 1px solid rgba(181, 139, 74, 0.45);
  border-radius: 50%;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font: 600 clamp(58px, 7.2vw, 112px)/0.92 var(--serif);
  letter-spacing: -0.045em;
}

.hero h1 em { color: var(--green); font-weight: 500; }

.hero-intro {
  max-width: 650px;
  margin: 28px 0;
  color: var(--muted);
  font-size: clamp(15.5px, 1.15vw, 17px);
  line-height: 1.55;
}

.hero-intro p { margin: 0 0 14px; }
.hero-intro p:last-child { margin-bottom: 0; }
.hero-intro strong { color: var(--ink); font-weight: 600; }

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 30px;
  min-height: 54px;
  padding: 0 23px;
  background: var(--green);
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 180ms ease, background 180ms ease;
}

.primary-button:hover { transform: translateY(-2px); background: var(--green-deep); }

.primary-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.hero-boxset {
  position: relative;
  height: min(52vw, 600px);
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.hero-boxset-image {
  display: block;
  width: auto;
  max-width: min(100%, 560px);
  max-height: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(20, 54, 43, .2);
  box-shadow: 0 28px 52px rgba(25, 30, 27, .24);
  transition: transform 450ms cubic-bezier(.2,.8,.2,1), box-shadow 450ms cubic-bezier(.2,.8,.2,1);
}

.hero-boxset:hover .hero-boxset-image {
  transform: translateY(-5px);
  box-shadow: 0 34px 60px rgba(25, 30, 27, .28);
}

.boxset-note {
  align-self: flex-end;
  margin-top: 14px;
  font-size: 9px;
  letter-spacing: .18em;
}

.hero-index {
  position: absolute;
  right: clamp(22px, 5vw, 76px);
  bottom: 24px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.library-section {
  padding: clamp(82px, 10vw, 150px) clamp(22px, 7.5vw, 120px);
}

.section-heading {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 470px);
  gap: 40px;
  align-items: end;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2,
.author-copy h2 {
  margin: 0;
  font: 600 clamp(40px, 5vw, 72px)/1.03 var(--serif);
  letter-spacing: -0.035em;
}

.catalog-intro { margin: 0 0 8px; color: var(--muted); font-size: 16px; }

.catalog-tools {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 34px 0 20px;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 560px;
}

.search-wrap svg {
  position: absolute;
  left: 0;
  top: 50%;
  width: 20px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
}

.search-wrap input {
  width: 100%;
  height: 50px;
  padding: 0 12px 0 32px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}

.search-wrap input::placeholder { color: #85877f; }

.edition-filter {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  padding: 4px;
}

.edition-button {
  min-width: 54px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.edition-button.active { background: var(--ink); color: var(--white); }

.topic-filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 8px 2px 18px;
  scrollbar-width: thin;
}

.topic-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  transition: all 160ms ease;
}

.topic-button:hover { border-color: var(--ink); color: var(--ink); }
.topic-button.active { background: var(--green); border-color: var(--green); color: white; }

.catalog-status {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.catalog-status p { margin: 0; }

#clear-filters {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 2px 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(34px, 4.5vw, 76px) clamp(20px, 3vw, 44px);
  margin-top: 24px;
}

.book-card {
  min-width: 0;
  animation: cardIn 430ms both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.cover-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 460px;
  padding: 38px;
  background: rgba(255,255,255,.36);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}

.cover-wrap::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 1px;
  height: 150%;
  background: rgba(29,37,34,.07);
  transform: translate(-50%,-50%) rotate(35deg);
}

.book-cover {
  position: relative;
  width: min(76%, 238px);
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 22px 20px;
  color: #fff9ec;
  box-shadow: -12px 18px 28px rgba(28,31,28,.22), inset 3px 0 rgba(255,255,255,.18);
  transition: transform 350ms cubic-bezier(.2,.8,.2,1), box-shadow 350ms ease;
  isolation: isolate;
  overflow: hidden;
}

.book-cover-image {
  display: block;
  padding: 0;
  object-fit: cover;
  background: none;
}

.book-card:hover .book-cover,
.book-card:focus-within .book-cover {
  transform: translateY(-8px) rotate(-1deg);
  box-shadow: -16px 26px 38px rgba(28,31,28,.28), inset 3px 0 rgba(255,255,255,.18);
}

.book-cover::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 190px;
  height: 190px;
  right: -76px;
  top: 32%;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(255,255,255,.04), 0 0 0 48px rgba(255,255,255,.035);
}

.book-cover::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  top: 52%;
  height: 1px;
  background: rgba(255,255,255,.3);
  transform: rotate(-22deg) scaleX(1.5);
}

.cover-ai { background: linear-gradient(145deg, #193a35, #426954); }
.cover-work { background: linear-gradient(145deg, #24364a, #60788a); }
.cover-education { background: linear-gradient(145deg, #9b552f, #d09659); }
.cover-consciousness { background: linear-gradient(145deg, #3c3a5b, #77719a); }
.cover-desire { background: linear-gradient(145deg, #703745, #ba6d73); }
.cover-science { background: linear-gradient(145deg, #183f4c, #598b88); }
.cover-fiction { background: linear-gradient(145deg, #403328, #886b4f); }
.cover-spirituality { background: linear-gradient(145deg, #6d4d23, #c09955); }
.cover-poetry { background: linear-gradient(145deg, #763e3b, #b57668); }

.cover-kicker,
.cover-author {
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cover-title {
  display: block;
  margin-top: 26px;
  font: 600 clamp(18px, 1.8vw, 25px)/1.13 var(--serif);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.cover-subtitle {
  display: block;
  margin-top: 14px;
  font-size: 8px;
  line-height: 1.45;
  opacity: .9;
}

.book-meta {
  padding-top: 22px;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.topic-label,
.edition-label {
  color: var(--gold);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.edition-label {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
}

.book-meta h3 {
  margin: 0;
  font: 600 clamp(23px, 2.2vw, 31px)/1.15 var(--serif);
  letter-spacing: -0.02em;
}

.book-meta > p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: 4.8em;
  margin: 13px 0 19px;
  color: var(--muted);
  font-size: 14px;
}

.card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.details-button,
.amazon-link {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 2px 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.amazon-link { color: var(--green); }

.amazon-unavailable,
.availability-note {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.availability-note { margin: 12px 0 0; }

.empty-state {
  padding: 80px 20px;
  text-align: center;
  border: 1px solid var(--line);
}

.empty-state span { color: var(--gold); font: 500 54px var(--serif); }
.empty-state h3 { margin: 10px 0; font: 600 30px var(--serif); }
.empty-state p { color: var(--muted); }

.author-section {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.15fr) minmax(240px, .75fr);
  gap: clamp(36px, 7vw, 110px);
  align-items: center;
  padding: clamp(88px, 11vw, 170px) clamp(22px, 7.5vw, 120px);
  background: var(--green-deep);
  color: #f8f2e8;
}

.author-portrait {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1024 / 1535;
  margin: 0;
  justify-self: center;
  border: 1px solid rgba(255,255,255,.14);
  overflow: hidden;
  background: #102d27;
  box-shadow: 0 24px 52px rgba(0,0,0,.24);
}

.author-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-copy .eyebrow { color: #d5b177; }

.author-lead {
  margin: 28px 0 18px;
  color: #f4ddba;
  font: italic 500 clamp(22px, 2vw, 30px)/1.45 var(--serif);
}

.author-copy > p:not(.eyebrow):not(.author-lead) { color: rgba(248,242,232,.72); }

.text-link {
  display: inline-flex;
  gap: 20px;
  margin-top: 22px;
  color: #f8f2e8;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.4);
  font-size: 13px;
  font-weight: 600;
}

.author-quote {
  margin: 0;
  padding: 26px 0;
  border-top: 1px solid rgba(255,255,255,.18);
  border-bottom: 1px solid rgba(255,255,255,.18);
  color: rgba(248,242,232,.76);
  font: italic 500 19px/1.6 var(--serif);
}

footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: 112px;
  padding: 24px clamp(22px, 5vw, 76px);
  background: #10261f;
  color: rgba(248,242,232,.7);
  font-size: 11px;
  letter-spacing: .08em;
}

.footer-brand { color: #f8f2e8; font: 600 18px var(--serif); letter-spacing: 0; }
footer p { text-align: center; }
footer a { justify-self: end; text-decoration: none; }

.book-dialog {
  width: min(960px, calc(100vw - 34px));
  max-height: min(760px, calc(100svh - 34px));
  margin: auto;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(10,18,15,.5);
}

.book-dialog::backdrop { background: rgba(13,28,23,.76); backdrop-filter: blur(6px); }

.dialog-close {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
}

.dialog-close svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(280px, .75fr) minmax(360px, 1.25fr);
  min-height: 620px;
}

.dialog-cover-pane {
  display: grid;
  place-items: center;
  padding: 60px 40px;
  background: var(--paper-deep);
}

.dialog-cover-pane .book-cover { width: min(78%, 270px); }

.dialog-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 70px clamp(34px, 6vw, 78px) 56px;
}

.dialog-copy .eyebrow { margin-bottom: 16px; }
.dialog-copy h2 { margin: 0; font: 600 clamp(36px, 4vw, 56px)/1.03 var(--serif); letter-spacing: -.035em; }
.dialog-subtitle { margin: 17px 0 28px; color: var(--gold); font: italic 500 18px/1.4 var(--serif); }
.dialog-description { color: var(--muted); }
.dialog-meta { display: flex; gap: 12px; margin: 26px 0; }
.dialog-meta span { border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.dialog-copy .primary-button { align-self: flex-start; margin-top: 10px; }

.reveal { animation: reveal 700ms both; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr 420px; padding-left: 42px; padding-right: 42px; }
  .hero h1 { font-size: clamp(54px, 7vw, 78px); }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .author-section { grid-template-columns: .8fr 1.2fr; }
  .author-quote { grid-column: 2; }
}

@media (max-width: 760px) {
  .site-header { min-height: 64px; padding: 0 18px; }
  .brand-name { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .header-actions { gap: 14px; font-size: 11px; }
  .header-actions > a:first-child { display: none; }
  .language-switch { padding-left: 10px; }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 50px;
    padding: 74px 22px 62px;
  }
  .hero h1 { font-size: clamp(50px, 15vw, 72px); }
  .hero-intro { margin: 28px 0; font-size: 16px; }
  .hero-boxset { height: auto; min-height: 0; max-width: 460px; width: 100%; margin: 0 auto; }
  .hero-boxset-image { width: 100%; max-width: 460px; max-height: none; }

  .library-section { padding: 78px 18px; }
  .section-heading { grid-template-columns: 1fr; gap: 22px; padding-bottom: 30px; }
  .section-heading h2 { font-size: 44px; }
  .catalog-tools { align-items: stretch; flex-direction: column; }
  .search-wrap { max-width: none; }
  .edition-filter { align-self: flex-start; }
  .book-grid { grid-template-columns: 1fr; gap: 56px; }
  .cover-wrap { min-height: 430px; }
  .book-cover { width: min(68%, 250px); }

  .author-section { grid-template-columns: 1fr; padding: 78px 22px; }
  .author-portrait { width: min(100%, 340px); }
  .author-quote { grid-column: auto; }

  footer { grid-template-columns: 1fr auto; }
  footer p { display: none; }

  .dialog-layout { grid-template-columns: 1fr; }
  .dialog-cover-pane { min-height: 410px; padding: 50px 30px; }
  .dialog-cover-pane .book-cover { width: min(60%, 225px); }
  .dialog-copy { padding: 42px 26px 48px; }
  .dialog-copy h2 { font-size: 38px; }
}

@media (max-width: 390px) {
  .header-actions > a { display: none; }
  .hero h1 { font-size: 48px; }
  .hero-boxset { height: auto; }
  .cover-wrap { min-height: 390px; padding: 26px; }
  .book-cover { width: min(76%, 230px); }
}

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

/* Contextual introduction to Science & Consciousness. */
.science-feature {
  padding: clamp(54px, 7vw, 100px) clamp(22px, 7.5vw, 120px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
}
.science-feature h2 {
  margin: 0;
  font: 600 clamp(34px, 4.5vw, 60px)/1.1 var(--serif);
  letter-spacing: -.035em;
}
.science-feature > p:not(.eyebrow) {
  max-width: 800px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}
.science-feature a {
  color: var(--green);
  text-underline-offset: .2em;
}
#ontological-resonance { scroll-margin-top: 100px; }
