:root {
  color-scheme: light;
  --ink: #363737;
  --muted: #757575;
  --paper: #ffffff;
  --panel: #ffffff;
  --wash: #f7f7f4;
  --line: #e6e6e6;
  --accent: #8ae1a2;
  --accent-strong: #2f8a4b;
  --accent-dark: #1e5e35;
  --accent-soft: #ecfaef;
  --orange: #ff6719;
  --warn: #8b5a00;
  --shadow: 0 12px 28px rgba(54, 55, 55, 0.08);
  --chrome-width: 1120px;
  font-family: Spectral, Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: rgba(255, 255, 255, 0.98);
}

.site-header__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  max-width: var(--chrome-width);
  margin: 0 auto;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.site-header__icon-link {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  text-decoration: none;
}

.site-header__icon {
  display: block;
  width: 40px;
  height: 40px;
}

.site-header__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hero__logo {
  display: block;
  width: min(269px, calc(100vw - 136px));
  height: auto;
  max-height: 38px;
}

.top-nav {
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.65;
}

.top-nav__items {
  min-height: 45px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.top-nav__items::-webkit-scrollbar {
  display: none;
}

.top-nav__item {
  flex: 0 0 auto;
}

.top-nav__item a {
  display: block;
  padding: 13px 14px;
  color: #6b6b6b;
  font-size: 0.95em;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav__label-short {
  display: none;
}

.top-nav__item a:hover,
.top-nav__item a:focus-visible {
  color: #005eb8;
  outline: none;
}

.top-nav__item--selected a,
.top-nav a[aria-current="page"] {
  color: #111;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  font-weight: 500;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.35rem, 6.7vw, 5.45rem);
}

.opening h1 {
  max-width: none;
  font-size: 36px;
  font-weight: 600;
  line-height: 1.08;
}

.button,
button {
  min-height: 42px;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #14351f;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.78);
}

.section {
  padding: clamp(36px, 7vw, 78px) clamp(18px, 5vw, 68px);
}

.section.opening {
  padding-top: clamp(28px, 5vw, 54px);
}

.section.narrow {
  padding-top: 34px;
  padding-bottom: 34px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto 26px;
}

.section-header p {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

.section h2 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
}

.controls {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  padding: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--wash);
}

.catalog-results {
  max-width: 1180px;
  margin: 24px auto 0;
}

.catalog-results .letter-bar {
  margin: 0 0 22px;
}

.catalog-results .grid,
.catalog-results .empty-state {
  margin-right: 0;
  margin-left: 0;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input[type="search"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: white;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-group button,
.letter-bar button {
  min-height: 34px;
  padding: 0 11px;
  background: white;
  color: var(--muted);
  font-size: 0.82rem;
}

.filter-group button[aria-pressed="true"],
.letter-bar button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.result-count {
  align-self: center;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  white-space: nowrap;
}

.grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}

.book-card {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cover {
  position: relative;
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(138, 225, 162, 0.26), rgba(255, 255, 255, 0.86)),
    var(--wash);
  color: var(--ink);
}

.cover[href] {
  text-decoration: none;
}

.cover[href]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -4px;
}

.cover img {
  position: relative;
  z-index: 2;
  width: 118px;
  height: 172px;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 14px 24px rgba(54, 55, 55, 0.2);
  background: white;
}

.cover.placeholder-image img {
  border: 1px solid rgba(54, 55, 55, 0.16);
  border-radius: 4px;
}

.cover.source-crop img {
  object-fit: cover;
  object-position: left center;
}

.cover span {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.cover strong {
  display: block;
  max-width: 16ch;
  margin-top: 8px;
  font-size: 1.05rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.book-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.book-card h3 {
  font-size: 1.24rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: -5px 0 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  line-height: 1.35;
}

.authors,
.why {
  margin: 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

.authors {
  color: #39423e;
}

.retailers {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.retailers a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}

.retailers a.amazon {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.shelves {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.shelf-link {
  display: block;
  min-height: 124px;
  padding: 18px;
  border-top: 3px solid var(--accent);
  background: #fff;
  text-decoration: none;
}

.shelf-link strong {
  display: block;
  margin-bottom: 9px;
  font-size: 1.18rem;
  line-height: 1.15;
}

.shelf-link span {
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

.letter-bar {
  max-width: 1180px;
  margin: 0 auto 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.empty-state {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
}

.site-footer {
  padding: 0 clamp(18px, 5vw, 68px) 34px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
}

.site-footer .inner {
  max-width: 1180px;
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  justify-content: center;
  padding: 22px 0 13px;
}

.footer-brand img {
  display: block;
  width: 190px;
  height: auto;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.footer-nav a:hover,
.footer-nav a[aria-current="page"] {
  color: #111;
}

.footer-notes {
  max-width: 900px;
  margin: 18px auto 0;
}

.footer-notes p {
  margin: 0 0 10px;
}

.affiliate-note {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(54, 55, 55, 0.12);
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .section-header,
  .search-row {
    display: grid;
  }

  .footer-nav {
    gap: 13px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .controls {
    padding: 16px;
  }

  .result-count {
    white-space: normal;
  }
}

@media (min-width: 761px) {
  .opening h1 {
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .site-header__bar {
    min-height: 52px;
  }

  .site-header__icon-link {
    width: 34px;
    height: 34px;
  }

  .site-header__icon {
    width: 34px;
    height: 34px;
  }

  .top-nav__items {
    justify-content: flex-start;
    min-height: 42px;
    padding: 0 12px;
  }

  .top-nav__item a {
    padding: 12px 10px;
    font-size: 0.85em;
  }

  .top-nav__label-full {
    display: none;
  }

  .top-nav__label-short {
    display: inline;
  }
}
