
:root {
  --accent: #0f766e;
  --accent-soft: #14b8a6;
  --ink: #1a1f24;
  --muted: #5b6770;
  --bg: #ffffff;
  --font-primary: "Inter", sans-serif;
  --font-secondary: "Space Grotesk", sans-serif;
  --font-thin-body: "Roboto", sans-serif;
  --font-book-title: "IBM Plex Mono", monospace;
  --font-display: var(--font-secondary);
  --font-body: var(--font-primary);
}
* { box-sizing: border-box; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: #fff;
  margin-top: 64px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.transparent-navbar {
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(26,31,36,0.08);
}
.nav-logo { height: 32px; margin-right: 12px; }
.navbar-brand, .nav-link { color: var(--ink) !important; }
.dropdown-menu { max-height: 70vh; overflow: auto; }
/* Home — full width, white */
.home {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 4rem;
}
.home-tile {
  background: #fff;
  border-radius: 0;
  box-shadow: 0 6px 18px rgba(26, 31, 36, 0.07);
  border: 1px solid rgba(26, 31, 36, 0.08);
  transition:
    box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease;
  position: relative;
  z-index: 1;
}
.home-tile:hover {
  z-index: 3;
  box-shadow: 0 16px 36px rgba(26, 31, 36, 0.16);
  border-color: rgba(26, 31, 36, 0.12);
}
.home-hero,
.home-about,
.home-author-main,
.home-author-aside {
  padding: clamp(1.75rem, 4vw, 2.75rem) clamp(1.25rem, 4vw, 2.5rem);
}
.home-hero,
.home-about {
  width: calc(100% - 2 * clamp(1.25rem, 4vw, 3rem));
  margin: 1.25rem clamp(1.25rem, 4vw, 3rem) 0;
}
.home-author,
.home-chapters {
  width: 100%;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem) 0;
}
.home-hero .brand {
  font-family: var(--font-book-title);
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin: 0 0 0.65rem;
}
.home-hero h1 {
  font-family: var(--font-secondary);
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 0.85rem;
}
.home-hero .lead {
  font-family: var(--font-thin-body);
  font-weight: 300;
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 44rem;
  margin-bottom: 0;
}

.home-about h2,
.home-author h2,
.home-chapters-head h2 {
  font-family: var(--font-secondary);
  font-weight: 500;
  letter-spacing: -0.02em;
}
.home-about .eyebrow,
.home-author .eyebrow {
  color: #6b7f93;
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.home-about h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  margin: 0 0 0.85rem;
}
.home-about p {
  font-family: var(--font-thin-body);
  font-weight: 300;
  color: #44515d;
  font-size: 1.05rem;
  max-width: 52rem;
  margin-bottom: 0.85rem;
}
.home-about p:last-child { margin-bottom: 0; }

.home-author-main h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin: 0 0 0.25rem;
}
.home-author-main .role {
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1rem;
}
.home-author-main p {
  font-family: var(--font-thin-body);
  font-weight: 300;
  color: #44515d;
  margin-bottom: 0.9rem;
  max-width: 52rem;
}
.home-author-main p:last-child { margin-bottom: 0; }
.home-author-grid {
  display: grid;
  grid-template-columns: 1.7fr 0.9fr;
  gap: 1.25rem;
  align-items: stretch;
}
.home-author-aside h3 {
  font-family: var(--font-book-title);
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 0.85rem;
}
.home-author-aside ul {
  margin: 0 0 1.1rem;
  padding-left: 1.1rem;
  color: #4a5d70;
}
.home-author-aside li { margin-bottom: 0.4rem; }
.home-author-aside .text-link {
  color: #4a5d70 !important;
  background: #e4ebf1 !important;
  box-shadow: inset 0 0 0 1px rgba(90, 110, 130, 0.12) !important;
  border-radius: 0 !important;
}

.home-chapters {
  padding-top: 1.75rem;
}
.home-chapters-head {
  margin-bottom: 1rem;
}
.home-chapters-head h2 {
  font-size: 1.45rem;
  margin: 0 0 0.3rem;
}
.home-chapters-head p {
  font-family: var(--font-thin-body);
  font-weight: 300;
  color: var(--muted);
  margin: 0;
}
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  width: 100%;
}
.chapter-tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.4rem;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 0.85rem 0.9rem;
  background: #fff;
  border-radius: 0;
  color: var(--ink);
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(26, 31, 36, 0.06);
  border: 1px solid rgba(26, 31, 36, 0.08);
  margin: -1px 0 0 -1px;
  transition:
    box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    z-index 0s;
  position: relative;
  z-index: 1;
}
.chapter-tile:hover {
  z-index: 3;
  background: #fff;
  border-color: rgba(26, 31, 36, 0.14);
  box-shadow: 0 14px 32px rgba(26, 31, 36, 0.16);
  color: var(--ink);
}
.chapter-tile .num {
  font-family: var(--font-book-title);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #6b7f93;
}
.chapter-tile .title {
  font-family: var(--font-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

@media (max-width: 1100px) {
  .chapter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .home-author-grid { grid-template-columns: 1fr; }
  .chapter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(26,31,36,0.1);
}
.page-header .eyebrow {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  margin: 0;
}
.content h2, .content h3, .content h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin-top: 1.75rem;
}
.content a[href^="http"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  color: #4a5d70;
  background: #e4ebf1;
  padding: 0.1rem 0.5rem 0.12rem 0.45rem;
  margin: 0 0.06rem;
  border-radius: 0;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: inset 0 0 0 1px rgba(90, 110, 130, 0.12);
  transition:
    background 0.3s ease,
    color 0.3s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease;
}
.content a[href^="http"]::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.25em;
  flex: 0 0 auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7f93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.75;
  transform: translateX(0) scale(0.92);
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.25s ease,
    background-image 0.3s ease;
}
.content a[href^="http"]:hover,
.content a[href^="http"]:focus-visible {
  color: #2f4256;
  background: #d2dce6;
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(70, 95, 120, 0.18),
    0 4px 12px rgba(60, 80, 100, 0.12);
  outline: none;
}
.content a[href^="http"]:hover::after,
.content a[href^="http"]:focus-visible::after {
  opacity: 1;
  transform: translateX(2px) translateY(-1px) scale(1.08) rotate(8deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f4256' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
}
.content a[href^="http"]:active {
  transform: translateY(0);
  box-shadow: inset 0 0 0 1px rgba(70, 95, 120, 0.16);
}
.content img { max-width: 100%; height: auto; }
.content hr { border: 0; border-top: 1px solid rgba(26,31,36,0.08); margin: 1.25rem 0; }

/* Full-width responsive YouTube / embeds */
.content .kg-embed-card,
.content .video-embed {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.25rem 0;
  overflow: hidden;
  background: #0b1220;
}
.content .kg-embed-card iframe,
.content .video-embed iframe,
.content iframe[src*="youtube.com"],
.content iframe[src*="youtu.be"],
.content iframe[src*="youtube-nocookie.com"] {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
  max-width: none;
}
.content iframe:not([src*="youtube"]):not([src*="youtu.be"]) {
  max-width: 100%;
}
.author {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

.content h2,
.content h3 {
  scroll-margin-top: 90px;
}

/* Chapter TOC (from s.tepedu.com, teal accent) */
:root {
  --chapter-toc-mobile-bottom: 1.25rem;
  --toc-glow: rgba(20, 184, 166, 0.55);
}

.chapter-toc-toggle {
  position: fixed;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10003;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #15171a;
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.25),
    0 0 0 0 rgba(20, 184, 166, 0);
  transition:
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.28s ease 0.1s;
  animation: toc-pulse 3.2s ease-in-out infinite;
}
.chapter-toc-toggle::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 1.5px solid rgba(20, 184, 166, 0);
  opacity: 0;
  transform: scale(0.88);
  transition:
    opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.chapter-toc-toggle:active:not(.is-open) {
  transform: translateY(-50%) scale(0.94);
  transition-duration: 0.14s;
}
.chapter-toc-toggle:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow:
    0 0 0 4px rgba(20, 184, 166, 0.18),
    0 10px 36px rgba(0, 0, 0, 0.42),
    0 0 56px rgba(20, 184, 166, 0.22);
  animation: none;
}
.chapter-toc-toggle:hover::after {
  opacity: 1;
  transform: scale(1);
  border-color: rgba(20, 184, 166, 0.55);
}
.chapter-toc-toggle.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  animation: none;
  transform: translateY(-50%) scale(1);
  transition: opacity 0.12s ease, visibility 0s linear 0.12s;
}
@keyframes toc-pulse {
  0%, 100% {
    box-shadow:
      0 4px 20px rgba(0, 0, 0, 0.25),
      0 0 0 0 rgba(20, 184, 166, 0);
  }
  50% {
    box-shadow:
      0 4px 24px rgba(0, 0, 0, 0.3),
      0 0 0 6px rgba(20, 184, 166, 0.12);
  }
}
.chapter-toc-toggle-icon {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 1.25rem;
  position: relative;
  z-index: 1;
}
.chapter-toc-line {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition:
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.chapter-toc-line:nth-child(1) { width: 100%; }
.chapter-toc-line:nth-child(2) { width: 75%; align-self: flex-end; }
.chapter-toc-line:nth-child(3) { width: 50%; align-self: flex-end; }
.chapter-toc-toggle:hover .chapter-toc-line:nth-child(1) {
  width: 88%;
  transform: translateX(-1px);
}
.chapter-toc-toggle:hover .chapter-toc-line:nth-child(2) {
  width: 100%;
  transform: translateX(2px);
  transition-delay: 45ms;
}
.chapter-toc-toggle:hover .chapter-toc-line:nth-child(3) {
  width: 72%;
  transform: translateX(1px);
  transition-delay: 90ms;
}

.chapter-toc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 10, 0.52);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.62s cubic-bezier(0.12, 1, 0.28, 1),
    visibility 0s linear 0.62s,
    backdrop-filter 0.72s cubic-bezier(0.12, 1, 0.28, 1);
}
.chapter-toc-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.62s cubic-bezier(0.12, 1, 0.28, 1),
    visibility 0s linear 0s,
    backdrop-filter 0.72s cubic-bezier(0.12, 1, 0.28, 1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.chapter-toc-panel {
  position: fixed;
  top: 80px;
  right: 0;
  bottom: 72px;
  width: min(320px, 90vw);
  z-index: 10002;
  background: linear-gradient(165deg, #1a1d22 0%, #15171a 55%, #121418 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  clip-path: circle(0px at var(--toc-origin-x, calc(100% - 2.625rem)) var(--toc-origin-y, 50%));
  transition: clip-path 0.62s cubic-bezier(0.12, 1, 0.28, 1);
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}
.chapter-toc-panel.is-open {
  clip-path: circle(150vmax at var(--toc-origin-x, calc(100% - 2.625rem)) var(--toc-origin-y, 50%));
  pointer-events: auto;
  visibility: visible;
}
.chapter-toc-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease 0.12s;
}
.chapter-toc-panel-body.is-ready {
  pointer-events: auto;
  opacity: 1;
}
.chapter-toc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.chapter-toc-panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}
.chapter-toc-close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.2s ease, background 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.chapter-toc-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transform: rotate(90deg);
}
.chapter-toc-nav {
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable both-edges;
  padding: 0.75rem 0;
}
.chapter-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chapter-toc-link {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  line-height: 1.4;
  padding: 0.45rem 1.25rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition:
    background 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    padding-left 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.chapter-toc-level-3 .chapter-toc-link {
  padding-left: 2rem;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}
.chapter-toc-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding-left: 1.65rem;
  transform: translateX(3px);
}
.chapter-toc-level-3 .chapter-toc-link:hover { padding-left: 2.4rem; }
.chapter-toc-item.is-active .chapter-toc-link {
  border-left-color: #8fa3b5;
  background: rgba(143, 163, 181, 0.16);
  color: #fff;
}

@media (max-width: 768px) {
  .chapter-toc-toggle {
    top: auto;
    bottom: var(--chapter-toc-mobile-bottom);
    right: 1rem;
    transform: none;
  }
  .chapter-toc-toggle:hover { transform: scale(1.1); }
  .chapter-toc-toggle:active:not(.is-open) { transform: scale(0.94); }
  .chapter-toc-toggle.is-hidden { transform: none; }
  .chapter-toc-panel {
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 0;
    clip-path: circle(0px at var(--toc-origin-x, 50%) var(--toc-origin-y, var(--chapter-toc-mobile-bottom)));
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.4);
  }
  .chapter-toc-panel.is-open {
    clip-path: circle(150vmax at var(--toc-origin-x, 50%) var(--toc-origin-y, var(--chapter-toc-mobile-bottom)));
  }
}
