:root {
  color-scheme: light;
  --page: #eef2ee;
  --surface: #fff;
  --ink: #14201b;
  --muted: #55665f;
  --line: #d3dcd6;
  --accent: #0e6b58;
  --accent-ink: #fff;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--ui);
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0c1311;
  --surface: #141e1a;
  --ink: #e6eee9;
  --muted: #93a59d;
  --line: #26352f;
  --accent: #4cc4a2;
  --accent-ink: #05130e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --page: #0c1311;
    --surface: #141e1a;
    --ink: #e6eee9;
    --muted: #93a59d;
    --line: #26352f;
    --accent: #4cc4a2;
    --accent-ink: #05130e;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--accent);
}

a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 8px;
  padding: 9px 13px;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--surface);
}

.skip-link:focus {
  transform: translateY(0);
}

.book-header {
  border-bottom: 1px solid #26352f;
  background: #0c1311;
}

.book-header-inner {
  display: flex;
  width: min(760px, calc(100% - 32px));
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-inline: auto;
}

.book-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
}

.book-header .search-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #26352f;
  border-radius: 12px;
  background: #141e1a;
  color: #e6eee9;
}

.book-header .search-toggle:hover {
  border-color: #4cc4a2;
  color: #4cc4a2;
}

.book-header .search-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.book-header .install-button {
  border: 1px solid #4cc4a2;
  border-radius: 999px;
  padding: 8px 12px;
  background: #4cc4a2;
  color: #05130e;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
}

.book-header .install-button[hidden] {
  display: none;
}

.book-header .install-button:hover {
  background: #68d2b6;
}

.school-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e6eee9;
  text-decoration: none;
}

.school-brand .brand-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: contain;
}

.school-brand .brand-name {
  max-width: 160px;
  font: 800 15px/1.15 var(--display);
  letter-spacing: -.02em;
}

.brand-wave {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  height: 18px;
}

.brand-wave i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: #4cc4a2;
}

.brand-wave i:nth-child(1),
.brand-wave i:nth-child(5) {
  height: 7px;
}

.brand-wave i:nth-child(2) {
  height: 16px;
}

.brand-wave i:nth-child(3) {
  height: 11px;
}

.brand-wave i:nth-child(4) {
  height: 18px;
}

.school-link {
  color: #93a59d;
  font-size: .88rem;
  font-weight: 650;
  text-align: right;
  text-decoration: none;
}

.book-page {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 20px;
  color: var(--muted);
  font-size: .82rem;
}

.breadcrumbs a {
  text-decoration: none;
}

.book-detail {
  display: grid;
  grid-template-columns: minmax(260px, .75fr) 1.25fr;
  align-items: start;
  gap: clamp(32px, 7vw, 88px);
  padding-block: 18px 56px;
}

.cover-stage {
  display: grid;
  min-height: 440px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(20 32 27 / 9%);
}

.main-cover {
  width: min(100%, 300px);
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: 5px;
  box-shadow: 0 9px 24px rgb(0 0 0 / 20%);
}

.book-description {
  padding-top: 20px;
}

.author-label {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.book-description h1 {
  margin: 0 0 8px;
  font: 700 clamp(2.1rem, 5vw, 3.25rem)/1.12 var(--display);
  letter-spacing: -.035em;
}

.book-description .page-tagline {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: .98rem;
  font-weight: 650;
  line-height: 1.55;
}

.book-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 1.05rem;
}

.book-description h2,
.related-heading h2 {
  margin: 26px 0 9px;
  font: 700 1.35rem/1.3 var(--display);
}

.book-summary {
  max-width: 680px;
  margin: 0 0 18px;
  font-size: 1.04rem;
  line-height: 1.75;
}

.book-badge {
  display: inline-block;
  margin: 0 0 4px;
  border-radius: 99px;
  padding: 5px 11px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-size: .82rem;
  font-weight: 750;
}

.series-note,
.app-note {
  color: var(--muted);
  font-size: .9rem;
}

.read-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  margin-block: 7px 4px;
  border-radius: 9px;
  padding: 11px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
  text-decoration: none;
}

.read-button:hover {
  filter: brightness(.94);
}

.app-note {
  max-width: 480px;
  margin: 8px 0 15px;
}

.back-link {
  font-size: .9rem;
}

.related-section {
  border-top: 1px solid var(--line);
  padding-block: 32px 64px;
}

.book-return {
  padding-block: 0 54px;
  text-align: center;
}

.related-heading .author-label {
  margin-bottom: 4px;
}

.related-heading h2 {
  margin: 0 0 20px;
  font-size: 1.8rem;
}

.related-scroll-hint {
  display: none;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.related-grid:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.related-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.related-cover {
  display: grid;
  height: 180px;
  place-items: center;
  padding: 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.related-cover img {
  width: auto;
  max-width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
}

.related-info {
  padding: 12px;
}

.related-info h3 {
  margin: 0 0 7px;
  font: 700 .98rem/1.35 var(--display);
}

.related-info h3 a {
  color: var(--ink);
  text-decoration: none;
}

.related-info h3 a:hover,
.related-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.related-info p {
  display: -webkit-box;
  min-height: 4.65em;
  overflow: hidden;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.related-link {
  font-size: .8rem;
  font-weight: 700;
}

.book-footer {
  border-top: 1px solid var(--line);
  padding: 22px 20px 30px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.book-footer p {
  margin: 0 0 4px;
}

@media (max-width: 760px) {
  .book-detail {
    grid-template-columns: minmax(0, .8fr) 1.2fr;
    gap: 22px;
  }

  .cover-stage {
    min-height: 330px;
    padding: 16px;
  }

  .related-scroll-hint {
    display: block;
    margin: -10px 0 10px;
    color: var(--muted);
    font-size: .78rem;
  }

  .related-grid {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 2px 2px 12px;
    overscroll-behavior-inline: contain;
    scroll-padding-inline: 2px;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .related-card {
    flex: 0 0 clamp(175px, 35%, 210px);
    scroll-snap-align: start;
  }
}

@media (max-width: 520px) {
  .book-header-inner,
  .book-page {
    width: calc(100% - 30px);
  }

  .book-header-inner {
    min-height: 64px;
    flex-wrap: wrap;
    gap: 8px;
    padding-block: 10px;
  }

  .book-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .school-brand .brand-logo {
    width: 36px;
    height: 36px;
  }

  .school-brand .brand-name {
    max-width: 110px;
    font-size: 13px;
  }

  .school-link {
    max-width: 145px;
    font-size: .74rem;
    line-height: 1.35;
  }

  .breadcrumbs {
    padding-block: 14px;
    font-size: .74rem;
  }

  .book-detail {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 4px;
  }

  .cover-stage {
    min-height: 0;
    padding: 20px;
  }

  .main-cover {
    width: min(72%, 250px);
  }

  .book-description {
    padding-top: 0;
  }

  .book-description h1 {
    font-size: 2rem;
  }

  .related-grid {
    gap: 10px;
  }

  .related-cover {
    height: 145px;
  }

  .related-info {
    padding: 9px;
  }

  .related-info h3 {
    font-size: .88rem;
  }

  .related-info p {
    font-size: .73rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
