:root {
  font-family: "SF Pro Text", "SF Pro Display", "San Francisco", -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  letter-spacing: -0.01em;
  color-scheme: light dark;
  --background: #fbfbfd;
  --surface: rgba(255, 255, 255, 0.92);
  --text-color: #1d1d1f;
  --muted-text: #6e6e73;
  --border-color: rgba(210, 210, 215, 0.4);
  --primary: #0071e3;
  --primary-hover: #0a84ff;
  --hero-gradient-start: #f5f5f7;
  --hero-gradient-end: #ffffff;
  --shadow-soft: 0 30px 60px rgba(31, 41, 55, 0.14);
  --shadow-card: 0 18px 40px rgba(31, 41, 55, 0.12);
}

html {
  font-size: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 90%;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #000000;
    --surface: rgba(28, 28, 30, 0.9);
    --text-color: #f5f5f7;
    --muted-text: rgba(245, 245, 247, 0.7);
    --border-color: rgba(84, 84, 88, 0.55);
    --primary: #2997ff;
    --primary-hover: #5dadef;
    --hero-gradient-start: #1f1f21;
    --hero-gradient-end: #000000;
    --shadow-soft: 0 30px 60px rgba(0, 0, 0, 0.45);
    --shadow-card: 0 20px 48px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="light"] {
  --background: #fbfbfd;
  --surface: rgba(255, 255, 255, 0.92);
  --text-color: #1d1d1f;
  --muted-text: #6e6e73;
  --border-color: rgba(210, 210, 215, 0.4);
  --primary: #0071e3;
  --primary-hover: #0a84ff;
  --hero-gradient-start: #f5f5f7;
  --hero-gradient-end: #ffffff;
  --shadow-soft: 0 30px 60px rgba(31, 41, 55, 0.14);
  --shadow-card: 0 18px 40px rgba(31, 41, 55, 0.12);
}

:root[data-theme="dark"] {
  --background: #000000;
  --surface: rgba(28, 28, 30, 0.9);
  --text-color: #f5f5f7;
  --muted-text: rgba(245, 245, 247, 0.7);
  --border-color: rgba(84, 84, 88, 0.55);
  --primary: #2997ff;
  --primary-hover: #5dadef;
  --hero-gradient-start: #1f1f21;
  --hero-gradient-end: #000000;
  --shadow-soft: 0 30px 60px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 20px 48px rgba(0, 0, 0, 0.5);
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
}

body.page--scroll-lock {
  overflow: hidden;
  overscroll-behavior: contain;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--background);
}

.landing-hero {
  background: linear-gradient(
    180deg,
    var(--hero-gradient-start) 0%,
    var(--hero-gradient-end) 100%
  );
  border-bottom: 1px solid rgba(210, 210, 215, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(4rem, 10vh, 7rem) 0 4rem;
  transition: min-height 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.landing:not(.landing--active) .landing-hero {
  border-bottom-color: transparent;
  padding-bottom: clamp(1.25rem, 4vh, 2.5rem);
}

.landing--active .landing-hero {
  min-height: auto;
  align-items: flex-start;
  padding: clamp(0.1rem, 1.5vh, 0.5rem) 0 0.5rem;
}

.landing-hero__inner {
  max-width: 52.5rem;
  margin: 0 auto;
  padding: clamp(4rem, 6vw, 6.5rem) 1.75rem 3rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  transform: translateY(var(--hero-offset, 0px));
  transition: padding 0.75s cubic-bezier(0.4, 0, 0.2, 1),
    text-align 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    align-items 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.landing--active .landing-hero__inner {
  padding: clamp(0.25rem, 2vw, 0.85rem) 1.5rem 0.5rem;
  text-align: left;
  align-items: flex-start;
  gap: 0.5rem;
  transform: none;
}

.hero-kicker {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-text);
}

.hero-title {
  margin: 0;
  font-size: clamp(2.7rem, 6vw, 3.8rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-color);
  max-height: 6rem;
  overflow: hidden;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.landing--active .hero-title {
  opacity: 0;
  transform: translateY(-1rem);
  max-height: 0;
}

.hero-subtitle {
  margin: 0;
  max-width: 35rem;
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--muted-text);
}

.search-form {
  width: 100%;
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  transition: margin-top 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.landing--active .search-form {
  margin-top: 0;
  justify-content: flex-start;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(36.25rem, 100%);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  border: 1px solid transparent;
  box-shadow: 0 20px 48px rgba(31, 41, 55, 0.12);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.search-field:focus-within {
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 24px 54px rgba(15, 76, 129, 0.18);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: transparent;
  font-size: 1.08rem;
  color: var(--text-color);
}

.search-field input::placeholder {
  color: rgba(110, 110, 115, 0.7);
}

.search-field input:focus {
  outline: none;
}

.search-field button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.75rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease,
    background 0.2s ease;
}

.search-field button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 113, 227, 0.2);
}

.search-field button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.18);
}

.search-field button:disabled {
  opacity: 0.65;
  cursor: wait;
  box-shadow: none;
}

.results {
  flex: 0;
  max-width: 56.25rem;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.75rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2rem);
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
}

.landing:not(.landing--active) .results {
  display: none;
}

.landing--active .results {
  flex: 1;
  padding: 0.75rem 1.75rem 3.25rem;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  max-height: 9999px;
  overflow: visible;
  pointer-events: auto;
}

.landing--animating .results {
  padding: 0 1.75rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2rem);
  max-height: 0;
  pointer-events: none;
}

.results__status {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 1.05rem;
  color: var(--muted-text);
}

.results__status[data-state="error"] {
  color: #d70015;
}

.results__status[data-state="notice"] {
  color: var(--primary);
}

.results__list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2.5rem auto 0;
  padding: 0;
}

.pagination__button {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-color);
  border-radius: 9999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.pagination__button:hover:not(:disabled):not(.is-active) {
  border-color: rgba(0, 113, 227, 0.5);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 113, 227, 0.18);
}

.pagination__button:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

.pagination__button.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  cursor: default;
  box-shadow: 0 12px 24px rgba(0, 113, 227, 0.22);
  transform: none;
}

.pagination__button.is-active:hover {
  transform: none;
}

.pagination__button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.pagination__button--prev,
.pagination__button--next {
  min-width: 3.2rem;
}

.pagination__ellipsis {
  color: var(--muted-text);
  padding: 0.25rem 0.5rem;
  font-size: 0.95rem;
}

.book-card {
  background: var(--surface);
  border-radius: 1.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.25s ease,
    border-color 0.25s ease;
  position: relative;
}

.book-card.is-expanded {
  transform: translateY(-0.125rem);
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: var(--shadow-soft);
}

.book-card__research {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  padding: 0.4rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-0.2rem);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease,
    border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  z-index: 2;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.12);
}

.book-card:hover .book-card__research,
.book-card:focus-within .book-card__research,
.book-card__research:hover,
.book-card__research:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.book-card__research:hover,
.book-card__research:focus-visible {
  border-color: rgba(0, 113, 227, 0.35);
  color: var(--primary-hover);
  box-shadow: 0 18px 36px rgba(31, 41, 55, 0.22);
}

.book-card__research:focus-visible {
  outline: 0.1875rem solid rgba(0, 113, 227, 0.45);
  outline-offset: 0.15rem;
}

.book-card__research:active {
  transform: translateY(0.1rem);
}

@media (hover: none) {
  .book-card__research {
    opacity: 1;
    transform: none;
  }
}

.book-card__toggle {
  display: flex;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 1.75rem 2rem;
  text-align: left;
  gap: 2rem;
  cursor: pointer;
}

.book-card__toggle:focus-visible {
  outline: 0.1875rem solid rgba(0, 113, 227, 0.45);
  outline-offset: 0.25rem;
}

.book-card__cover {
  width: 8.25rem;
  height: 11.75rem;
  flex-shrink: 0;
  border-radius: 1.125rem;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.book-card__cover--placeholder {
  background: linear-gradient(140deg, rgba(0, 113, 227, 0.16), rgba(0, 113, 227, 0.04));
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.book-card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.book-card__title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.book-card__meta {
  margin: 0;
  font-size: 0.98rem;
  color: var(--muted-text);
}

.book-card__description {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-color);
}

.book-card__description--full {
  display: none;
}

.book-card.is-expanded [data-role="summary"] {
  display: none;
}

.book-card.is-expanded .book-card__description--full {
  display: block;
}

.book-card__toggle::after {
  content: "";
  width: 0.875rem;
  height: 0.875rem;
  border-right: 0.125rem solid var(--muted-text);
  border-bottom: 0.125rem solid var(--muted-text);
  transform: rotate(45deg);
  margin-left: auto;
  align-self: center;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.book-card.is-expanded .book-card__toggle::after {
  transform: rotate(-135deg);
  border-color: var(--primary);
}

body.is-research-overlay-open {
  overflow: hidden;
}

.research-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.research-overlay[hidden] {
  display: none;
}

.research-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.research-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(48rem, 100%);
  max-height: min(85vh, 44rem);
  background: var(--surface);
  border-radius: 1.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-soft);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow: hidden;
}

.research-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.research-overlay__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.research-overlay__close {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-text);
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease,
    background-color 0.2s ease, box-shadow 0.2s ease;
}

.research-overlay__close:hover,
.research-overlay__close:focus-visible {
  color: var(--primary);
  border-color: rgba(0, 113, 227, 0.35);
  background: rgba(0, 113, 227, 0.08);
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.18);
}

.research-overlay__close:focus-visible {
  outline: 0.1875rem solid rgba(0, 113, 227, 0.35);
  outline-offset: 0.1rem;
}

.research-overlay__body {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.research-overlay__body::-webkit-scrollbar {
  width: 0.5rem;
}

.research-overlay__body::-webkit-scrollbar-track {
  background: transparent;
}

.research-overlay__body::-webkit-scrollbar-thumb {
  background: rgba(110, 110, 115, 0.4);
  border-radius: 999px;
}

.research-overlay__loading,
.research-overlay__error {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  padding: 2rem 0;
  color: var(--muted-text);
}

.research-overlay__loading[hidden],
.research-overlay__content[hidden],
.research-overlay__error[hidden] {
  display: none;
}

.research-overlay__spinner {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 0.35rem solid rgba(0, 113, 227, 0.2);
  border-top-color: var(--primary);
  animation: research-spin 0.8s linear infinite;
}

@keyframes research-spin {
  to {
    transform: rotate(360deg);
  }
}

.research-overlay__status-text {
  margin: 0;
  font-size: 1rem;
  color: inherit;
}

.research-overlay__content {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.research-overlay__meta-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted-text);
  font-weight: 600;
}

.research-overlay__section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.research-overlay__section-heading {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.research-overlay__section p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
}

.research-overlay__sources {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.research-overlay__source-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.research-overlay__source-item a {
  color: var(--primary);
  font-weight: 600;
  word-break: break-word;
}

.research-overlay__error-message {
  margin: 0;
  font-size: 1rem;
  color: var(--muted-text);
}

.research-overlay__retry {
  padding: 0.55rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.research-overlay__retry:hover,
.research-overlay__retry:focus-visible {
  background: var(--primary-hover);
  box-shadow: 0 12px 24px rgba(31, 41, 55, 0.22);
}

.research-overlay__retry:focus-visible {
  outline: 0.1875rem solid rgba(255, 255, 255, 0.3);
  outline-offset: 0.1rem;
}

.research-overlay__empty {
  margin: 0;
  font-size: 1rem;
  color: var(--muted-text);
  text-align: center;
}
@media (max-width: 860px) {
  .book-card__toggle {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .book-card__cover {
    width: 7rem;
    height: 10.25rem;
  }

  .research-overlay {
    padding: clamp(1rem, 6vw, 1.8rem);
  }

  .research-overlay__panel {
    width: 100%;
    max-height: min(90vh, 46rem);
    border-radius: 1.5rem;
  }

  .research-overlay__body {
    padding-right: 0;
  }

}

@media (max-width: 540px) {
  .landing-hero__inner {
    padding: 3.5rem 1.25rem 2.75rem;
  }

  .search-field {
    gap: 0.5rem;
  }

  .search-field button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .book-card__toggle::after {
    display: none;
  }

  .book-card.is-expanded {
    transform: none;
  }

  .book-card__research {
    top: 0.85rem;
    right: 0.85rem;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
  }

  .research-overlay__panel {
    border-radius: 1.25rem;
    padding: 1.4rem;
    max-height: 90vh;
  }

  .research-overlay__title {
    font-size: 1.2rem;
  }

  .research-overlay__body {
    gap: 1.25rem;
  }

  .research-overlay__section-heading {
    font-size: 1.05rem;
  }
}