@font-face {
  font-family: "NibProBook";
  src: url("/fonts/nibpro-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "NibProBook";
  src: url("/fonts/nibpro-semibold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

.handbook-page:has(.sketchbook-app) {
  min-height: 100%;
  overflow: hidden;
}

.handbook-page:has(.sketchbook-app) .handbook-shell {
  display: none !important;
}

.sketchbook-app {
  --table: #ffffff;
  --table-deep: #f6efe9;
  --ink: #393438;
  --ink-soft: rgba(57, 52, 56, 0.58);
  --ink-faint: rgba(57, 52, 56, 0.12);
  --pink: #ec90a4;
  --teal: #138a7a;
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  color: var(--ink);
  background: var(--table);
  font-family: NibProBook, "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.sketchbook-app[data-book-theme="dark"] {
  --table: #1b1c1d;
  --table-deep: #101112;
  --ink: #f1ede6;
  --ink-soft: rgba(241, 237, 230, 0.58);
  --ink-faint: rgba(241, 237, 230, 0.17);
  background:
    radial-gradient(
      circle at 50% 44%,
      rgba(54, 55, 56, 0.8),
      transparent 37rem
    ),
    radial-gradient(
      circle at 8% 88%,
      rgba(200, 79, 128, 0.13),
      transparent 27rem
    ),
    var(--table);
}

#sketchbook-book {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: default;
  touch-action: none;
}

#sketchbook-book:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: -8px;
}

.sketchbook-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 22px 18px;
  pointer-events: none;
}

.sketchbook-brand,
.sketchbook-header-actions {
  pointer-events: auto;
}

.sketchbook-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.sketchbook-brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: #23132d;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.08em;
}

.sketchbook-brand-mark span {
  color: #eaa5d1;
}

.sketchbook-brand strong,
.sketchbook-brand small {
  display: block;
}

.sketchbook-brand strong {
  font-size: 17px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.sketchbook-brand small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.sketchbook-header-actions {
  display: flex;
  gap: 8px;
}

.sketchbook-plain-button,
.sketchbook-control,
.sketchbook-close {
  appearance: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sketchbook-plain-button {
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.02em;
  transition:
    background-color 100ms ease-out,
    color 100ms ease-out,
    transform 100ms ease-out;
}

.sketchbook-plain-button:hover {
  background: color-mix(in srgb, var(--pink) 12%, transparent);
  color: var(--ink);
}

.sketchbook-plain-button:active,
.sketchbook-control:active,
.sketchbook-close:active {
  transform: scale(0.96);
}

.sketchbook-plain-button:focus-visible,
.sketchbook-control:focus-visible,
.sketchbook-close:focus-visible,
.sketchbook-chapter:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 3px;
}

.sketchbook-dock {
  position: fixed;
  inset: auto 0 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 16px max(8px, env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0.76;
  transition: opacity 180ms ease-out;
}

.sketchbook-dock:hover,
.sketchbook-dock:focus-within {
  opacity: 1;
}

.sketchbook-dock > * {
  pointer-events: auto;
}

.sketchbook-caption {
  min-height: 1.3em;
  max-width: min(620px, calc(100vw - 36px));
  margin: 0;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
  text-align: center;
}

.sketchbook-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sketchbook-control {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 19px;
  line-height: 1;
  transition:
    background-color 100ms ease-out,
    color 100ms ease-out,
    transform 100ms ease-out;
}

.sketchbook-control:hover:not(:disabled) {
  border-color: var(--ink-faint);
  background: color-mix(in srgb, var(--pink) 12%, transparent);
  color: var(--ink);
}

.sketchbook-control:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

.sketchbook-counter {
  min-width: 64px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-align: center;
}

.sketchbook-credit {
  display: none;
}

.sketchbook-snap {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 4;
  margin: 0;
  padding: 4px 4px 14px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(60, 45, 30, 0.16);
  transform: rotate(4deg);
  transform-origin: bottom right;
  transition:
    transform 300ms ease-out,
    opacity 200ms ease-out;
}

.sketchbook-snap,
.sketchbook-snap[hidden] {
  display: none;
}

.sketchbook-snap[hidden] {
  display: block;
  opacity: 0;
  pointer-events: none;
}

.sketchbook-snap img {
  display: block;
  width: 76px;
  height: 96px;
  border-radius: 2px;
  background: #eee;
  object-fit: cover;
}

.sketchbook-snap:hover {
  transform: rotate(0deg) scale(2.2);
}

.sketchbook-contents {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  width: min(360px, calc(100vw - 28px));
  padding: max(24px, env(safe-area-inset-top)) 24px
    max(24px, env(safe-area-inset-bottom));
  overflow: auto;
  background: color-mix(in srgb, var(--table) 94%, #fff 6%);
  box-shadow: -20px 0 50px rgba(30, 20, 24, 0.14);
  transform: translateX(0);
}

.sketchbook-contents[hidden] {
  display: block;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(102%);
}

.sketchbook-contents,
.sketchbook-contents[hidden] {
  transition:
    transform 250ms ease-out,
    visibility 250ms ease-out;
}

.sketchbook-contents-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.sketchbook-overline {
  color: var(--pink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.sketchbook-contents h2 {
  margin: 4px 0 0;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.06em;
}

.sketchbook-close {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--ink-faint);
  border-radius: 50%;
  background: transparent;
  font-size: 26px;
  line-height: 1;
}

.sketchbook-chapter {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 11px 8px;
  border: 0;
  border-bottom: 1px solid var(--ink-faint);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sketchbook-chapter-number {
  padding-top: 2px;
  color: var(--pink);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.sketchbook-chapter strong,
.sketchbook-chapter small {
  display: block;
}

.sketchbook-chapter strong {
  font-size: 15px;
  font-weight: 600;
}

.sketchbook-chapter small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
}

.sketchbook-chapter.is-active {
  background: color-mix(in srgb, var(--pink) 9%, transparent);
}

.sketchbook-contents-note {
  margin: 24px 8px 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.sketchbook-backdrop {
  position: fixed;
  inset: 0;
  z-index: 7;
  border: 0;
  background: rgba(20, 14, 18, 0.22);
}

.sketchbook-backdrop[hidden] {
  display: none;
}

.sketchbook-reader-text {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .sketchbook-header {
    align-items: center;
    justify-content: center;
    padding: max(14px, env(safe-area-inset-top)) 14px 14px;
  }

  .sketchbook-brand small,
  .sketchbook-header-actions button:last-child {
    display: none;
  }

  .sketchbook-brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    font-size: 14px;
  }

  .sketchbook-brand strong {
    font-size: 21px;
  }

  .sketchbook-header-actions {
    position: absolute;
    right: 12px;
  }

  .sketchbook-plain-button {
    min-height: 40px;
    padding: 8px 10px;
  }

  .sketchbook-caption {
    font-size: 16px;
  }

  .sketchbook-snap {
    right: 12px;
    bottom: 112px;
  }

  .sketchbook-snap img {
    width: 54px;
    height: 68px;
  }

  .sketchbook-credit {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sketchbook-plain-button,
  .sketchbook-control,
  .sketchbook-close,
  .sketchbook-snap,
  .sketchbook-contents,
  .sketchbook-contents[hidden] {
    transition: none;
  }
}
