:root {
  --md-primary-fg-color: #173a63;
  --md-accent-fg-color: #d97706;
  --book-ink: #172d46;
  --book-muted: #526a82;
  --book-line: rgba(23, 58, 99, 0.14);
  --book-surface: #f7f9fb;
  --book-paper: #fffdf9;
  --book-warm: #bd6008;
  --book-trust: #2f7d67;
}

.md-typeset {
  color: var(--book-ink);
  font-size: 0.86rem;
  line-height: 1.92;
}

.md-typeset h1 {
  margin: 0 0 1.35rem;
  color: var(--book-ink);
  font-weight: 760;
  letter-spacing: -0.032em;
  line-height: 1.22;
}

.md-typeset h2 {
  margin-top: 2.8em;
  margin-bottom: 0.9em;
  padding-bottom: 0.32em;
  border-bottom: 1px solid var(--book-line);
  color: var(--book-ink);
  font-weight: 720;
  letter-spacing: -0.015em;
}

.md-typeset h3 {
  margin-top: 2em;
  color: var(--book-ink);
  font-weight: 680;
}

.md-typeset p,
.md-typeset li {
  text-wrap: pretty;
}

.md-typeset > p {
  margin: 1.08em 0;
}

.md-typeset a {
  text-underline-offset: 0.16em;
}

.md-typeset blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 1.1rem;
  border-left: 0.18rem solid var(--md-accent-fg-color);
  color: var(--book-muted);
  background: rgba(213, 139, 0, 0.045);
}

.md-typeset table:not([class]) {
  display: table;
  width: 100%;
  margin: 1.55rem 0 2rem;
  overflow: hidden;
  border: 1px solid rgba(23, 58, 99, 0.16);
  border-radius: 0.45rem;
  box-shadow: 0 0.3rem 1rem rgba(23, 58, 99, 0.055);
  font-size: 0.77rem;
}

.md-typeset table:not([class]) th {
  padding: 0.72rem 0.85rem;
  border-bottom: 0;
  background: #173a63;
  color: #fff;
  font-weight: 700;
  line-height: 1.45;
}

.md-typeset table:not([class]) td {
  padding: 0.68rem 0.85rem;
  border-top: 1px solid rgba(23, 58, 99, 0.09);
  vertical-align: top;
  line-height: 1.6;
}

.md-typeset table:not([class]) tbody tr:nth-child(even) {
  background: rgba(23, 58, 99, 0.032);
}

.md-typeset table:not([class]) tbody tr:hover {
  background: rgba(217, 119, 6, 0.065);
}

.md-typeset img {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.8rem auto 0.95rem;
  border: 1px solid rgba(23, 58, 99, 0.11);
  border-radius: 0.45rem;
  background: var(--book-paper);
  box-shadow: 0 0.5rem 1.5rem rgba(23, 58, 99, 0.07);
}

.md-typeset .md-button {
  margin-right: 0.45rem;
  margin-bottom: 0.5rem;
  border-radius: 0.35rem;
  font-weight: 650;
}

.md-nav__link--active {
  font-weight: 650;
}

.md-content__inner {
  max-width: 52rem;
  margin-right: auto;
  margin-left: auto;
}

html[lang="en"] .md-typeset {
  font-size: 0.88rem;
  line-height: 1.78;
}

html[lang="en"] .md-typeset > p {
  margin: 1em 0;
}

html[lang="ja"] .md-typeset {
  line-break: strict;
  overflow-wrap: anywhere;
  word-break: normal;
}

html[lang="ja"] .md-typeset h1,
html[lang="ja"] .md-typeset h2 {
  letter-spacing: 0;
}

html[lang="en"] .book-kicker,
html[lang="ja"] .book-kicker {
  letter-spacing: 0.07em;
}

/* Book landing page */
.book-home {
  padding-bottom: 1.5rem;
}

.book-hero {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
  align-items: center;
  margin: 0 0 3.4rem;
  padding: 2.7rem 2.6rem 2.5rem;
  overflow: hidden;
  border: 1px solid var(--book-line);
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #fffdfa 0%, #f4f7f9 100%);
  box-shadow: 0 1rem 2.8rem rgba(23, 58, 99, 0.08);
}

.book-hero__content {
  position: relative;
  z-index: 1;
}

.book-hero__visual {
  min-height: 15rem;
  border: 1px solid rgba(23, 58, 99, 0.12);
  border-radius: 0.6rem;
  background-image: url("../images/book/hero-whiteboard.png");
  background-position: center;
  background-size: cover;
  box-shadow: 0 0.75rem 2rem rgba(23, 58, 99, 0.09);
}

.book-kicker {
  margin: 0 0 0.8rem;
  color: var(--book-warm);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.book-hero h1 {
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: clamp(2.05rem, 4.5vw, 3.05rem);
  line-height: 1.16;
}

.book-subtitle {
  margin: 0.55rem 0 1.4rem;
  color: #334c7d;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.book-lead {
  max-width: 44rem;
  margin: 0 0 1.65rem;
  color: #3f4e68;
  font-size: 0.9rem;
  line-height: 1.85;
}

.book-actions {
  position: relative;
  z-index: 1;
}

.book-meta {
  margin: 0.75rem 0 0;
  color: #6d7890;
  font-size: 0.68rem;
  letter-spacing: 0.035em;
}

.book-grid {
  display: grid;
  gap: 0.85rem;
  margin: 1.2rem 0 2.2rem;
}

.book-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.book-grid--parts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.book-card,
.part-card {
  padding: 1.25rem 1.2rem;
  border: 1px solid var(--book-line);
  border-radius: 0.65rem;
  background: var(--book-surface);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.book-card:hover,
.part-card:hover {
  transform: translateY(-2px);
  border-color: rgba(23, 58, 99, 0.28);
  box-shadow: 0 0.6rem 1.5rem rgba(23, 58, 99, 0.08);
}

.book-card__index {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--book-warm);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0.08em;
}

.book-card h3,
.part-card h3 {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
}

.book-card p,
.part-card p {
  margin: 0;
  color: var(--book-muted);
  font-size: 0.75rem;
  line-height: 1.7;
}

.part-card {
  display: flex;
  min-height: 11.2rem;
  flex-direction: column;
  background: #fff;
}

.part-card .part-card__label {
  margin-bottom: 0.55rem;
  color: var(--book-warm);
  font-size: 0.64rem;
  font-weight: 720;
}

.part-card a {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.72rem;
  font-weight: 680;
}

.book-outcomes {
  margin: 1.1rem 0 2rem;
  padding: 1rem 1.3rem;
  border-left: 0.2rem solid var(--md-primary-fg-color);
  background: rgba(23, 58, 99, 0.045);
}

.book-outcomes ul {
  margin: 0.2rem 0;
}

.book-outcomes li {
  margin: 0.38rem 0;
}

.book-closing {
  margin-top: 2.5rem;
  padding: 1.45rem 1.5rem 1.1rem;
  border-top: 1px solid var(--book-line);
  text-align: center;
}

.book-closing p {
  margin: 0 auto 1rem;
  color: var(--book-muted);
}

/* Table of contents */
.book-spine {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  justify-content: space-between;
  margin: 1.4rem 0 2.4rem;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--book-line);
  border-radius: 0.5rem;
  background: var(--book-paper);
  color: var(--book-muted);
  white-space: nowrap;
}

.book-spine span {
  color: var(--book-ink);
  font-size: 0.72rem;
  font-weight: 680;
}

.book-spine b {
  color: var(--book-warm);
  font-weight: 600;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 2.4rem;
}

.chapter-grid--four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chapter-card {
  display: flex;
  min-height: 13.5rem;
  padding: 1.2rem;
  flex-direction: column;
  border: 1px solid var(--book-line);
  border-radius: 0.55rem;
  background: var(--book-paper);
  color: inherit !important;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.chapter-card:hover {
  transform: translateY(-2px);
  border-color: rgba(23, 58, 99, 0.3);
  box-shadow: 0 0.55rem 1.35rem rgba(23, 58, 99, 0.075);
}

.chapter-card__number {
  margin-bottom: 0.55rem;
  color: var(--book-warm);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0.08em;
}

.chapter-card h3 {
  margin: 0 0 0.55rem;
  color: var(--book-ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.chapter-card p {
  margin: 0;
  color: var(--book-muted);
  font-size: 0.74rem;
  line-height: 1.72;
}

.chapter-card small {
  display: block;
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--book-line);
  color: var(--book-trust);
  font-size: 0.65rem;
  line-height: 1.55;
}

[data-md-color-scheme="slate"] {
  --book-ink: #eef2f8;
  --book-muted: #aeb8c9;
  --book-line: rgba(181, 197, 225, 0.16);
  --book-surface: #202a3b;
  --book-paper: #1b2536;
  --book-warm: #f0ad3d;
  --book-trust: #76c7ad;
}

[data-md-color-scheme="slate"] .book-hero {
  background: linear-gradient(135deg, #202b40 0%, #172033 100%);
}

[data-md-color-scheme="slate"] .book-hero__visual {
  opacity: 0.86;
  filter: brightness(0.86) saturate(0.82);
}

[data-md-color-scheme="slate"] .book-subtitle,
[data-md-color-scheme="slate"] .book-lead {
  color: #c7d2e5;
}

[data-md-color-scheme="slate"] .book-meta {
  color: #98a6bb;
}

[data-md-color-scheme="slate"] .part-card {
  background: #1b2536;
}

[data-md-color-scheme="slate"] .md-typeset .md-button:not(.md-button--primary) {
  border-color: #8096e8;
  color: #b9c8ff;
}

[data-md-color-scheme="slate"] .md-typeset .md-button:not(.md-button--primary):hover {
  border-color: #aabaff;
  color: #eef2ff;
}

[data-md-color-scheme="slate"] .md-typeset .md-button--primary {
  color: #fff;
}

[data-md-color-scheme="slate"] .md-typeset blockquote {
  background: rgba(240, 173, 61, 0.07);
}

@media screen and (max-width: 76.25em) {
  .book-hero {
    padding: 2.5rem 2rem;
  }

  .book-hero__visual {
    min-height: 14rem;
  }

  .book-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 44.984375em) {
  .md-typeset {
    font-size: 0.82rem;
    line-height: 1.86;
  }

  .md-content__inner {
    box-sizing: border-box;
    padding-right: 0.8rem;
    padding-left: 0.8rem;
  }

  .book-hero {
    margin-bottom: 2.4rem;
    padding: 2.2rem 1.35rem 1.8rem;
    border-radius: 0.7rem;
  }

  .book-hero h1 {
    font-size: 2rem;
  }

  .book-subtitle {
    font-size: 0.92rem;
  }

  .book-lead {
    font-size: 0.82rem;
  }

  .book-hero__visual {
    min-height: 10.5rem;
    background-position: center;
  }

  .book-grid--four,
  .book-grid--parts,
  .chapter-grid,
  .chapter-grid--four {
    grid-template-columns: 1fr;
  }

  .part-card {
    min-height: auto;
  }

  .book-actions .md-button,
  .book-closing .md-button {
    width: 100%;
    margin-right: 0;
    text-align: center;
  }

  .md-typeset table:not([class]) {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }

  .chapter-card {
    min-height: auto;
  }
}
