:root {
  --tl-paper: #f7f1e6;
  --tl-paper-deep: #eee3d1;
  --tl-surface: #fffdf8;
  --tl-ink: #2d1d17;
  --tl-muted: #6f665e;
  --tl-saffron: #bd6b06;
  --tl-saffron-soft: #f2e3c9;
  --tl-green: #415f37;
  --tl-green-soft: #e7ecdf;
  --tl-bronze: #b78844;
  --tl-line: #ddcfb9;
  --tl-shadow: 0 18px 45px rgba(64, 41, 22, 0.08);
  --tl-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --tl-sans: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
}

[data-md-color-scheme="default"] {
  --md-default-bg-color: var(--tl-surface);
  --md-default-fg-color: var(--tl-ink);
  --md-default-fg-color--light: var(--tl-muted);
  --md-default-fg-color--lighter: #9b9187;
  --md-primary-fg-color: #fffdf8;
  --md-primary-bg-color: var(--tl-ink);
  --md-accent-fg-color: var(--tl-saffron);
  --md-typeset-a-color: var(--tl-green);
  --md-code-bg-color: #f3eadc;
  --md-code-fg-color: #47372e;
}

[data-md-color-scheme="slate"] {
  --tl-paper: #171914;
  --tl-paper-deep: #22251d;
  --tl-surface: #1d201a;
  --tl-ink: #f3eadb;
  --tl-muted: #bdb3a5;
  --tl-saffron: #e0a244;
  --tl-saffron-soft: #3d3020;
  --tl-green: #a9c28f;
  --tl-green-soft: #293226;
  --tl-bronze: #c4934d;
  --tl-line: #403c32;
  --tl-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
  --md-default-bg-color: var(--tl-surface);
  --md-default-fg-color: var(--tl-ink);
  --md-default-fg-color--light: var(--tl-muted);
  --md-default-fg-color--lighter: #817a70;
  --md-primary-fg-color: #171914;
  --md-primary-bg-color: var(--tl-ink);
  --md-accent-fg-color: var(--tl-saffron);
  --md-typeset-a-color: var(--tl-green);
  --md-code-bg-color: #282b23;
  --md-code-fg-color: #e8decf;
}

html {
  background: var(--tl-surface);
}

body,
input {
  font-family: var(--tl-sans);
}

body {
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--tl-paper) 72%, transparent), transparent 36rem),
    var(--tl-surface);
  color: var(--tl-ink);
  overflow-x: hidden;
}

.md-header {
  background: color-mix(in srgb, var(--tl-surface) 96%, transparent);
  border-bottom: 1px solid var(--tl-line);
  box-shadow: none;
  color: var(--tl-ink);
  backdrop-filter: blur(14px);
}

.md-header__inner {
  min-height: 3.8rem;
  max-width: 100%;
  padding-inline: 1.25rem;
}

.md-header__button.md-logo {
  color: var(--tl-saffron);
  margin-right: 0.35rem;
  padding: 0.35rem;
}

.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 2.25rem;
  width: 2.25rem;
}

.md-header__title {
  font-family: var(--tl-serif);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.md-search {
  margin-left: auto;
}

.md-search__form {
  background: color-mix(in srgb, var(--tl-surface) 90%, var(--tl-paper));
  border: 1px solid var(--tl-line);
  border-radius: 0.55rem;
  box-shadow: none;
  height: 2.45rem;
}

.md-search__input {
  font-size: 0.76rem;
}

.md-search__input::placeholder {
  color: var(--tl-muted);
}

.md-tabs {
  background: var(--tl-surface);
  border-bottom: 1px solid var(--tl-line);
  color: var(--tl-ink);
}

.md-container,
.md-main {
  background: transparent;
}

.md-main__inner {
  margin-top: 0;
  max-width: 100%;
}

.md-sidebar {
  background: color-mix(in srgb, var(--tl-surface) 96%, var(--tl-paper));
}

.md-sidebar--primary {
  border-right: 1px solid var(--tl-line);
}

.md-sidebar--secondary {
  border-left: 1px solid var(--tl-line);
}

.md-sidebar__scrollwrap {
  padding-top: 1rem;
}

.md-nav {
  font-size: 0.72rem;
}

.md-nav__title {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--tl-muted);
  font-family: var(--tl-serif);
  font-size: 0.83rem;
}

.md-nav__item--section > .md-nav__link {
  align-items: center;
  border-left: 3px solid transparent;
  color: var(--tl-ink);
  display: flex;
  font-weight: 600;
  gap: 0.62rem;
  margin: 0.16rem 0;
  min-height: 2.7rem;
  padding: 0.55rem 0.7rem;
}

.md-nav__item--section > .md-nav__link:hover,
.md-nav__item--section > .md-nav__link:focus-visible {
  background: color-mix(in srgb, var(--tl-saffron-soft) 64%, transparent);
  border-left-color: var(--tl-saffron);
  color: var(--tl-saffron);
}

.md-nav__link--active,
.md-nav__link[aria-current="page"] {
  color: var(--tl-saffron) !important;
}

.nav-motif {
  background: currentColor;
  display: inline-block;
  flex: 0 0 1.3rem;
  height: 1.3rem;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  width: 1.3rem;
}

.nav-motif--path {
  -webkit-mask-image: url("../icons/path.svg");
  mask-image: url("../icons/path.svg");
}

.nav-motif--book {
  -webkit-mask-image: url("../icons/book.svg");
  mask-image: url("../icons/book.svg");
}

.nav-motif--meditation {
  -webkit-mask-image: url("../icons/meditation.svg");
  mask-image: url("../icons/meditation.svg");
}

.nav-motif--target {
  -webkit-mask-image: url("../icons/target.svg");
  mask-image: url("../icons/target.svg");
}

.nav-motif--manuscript {
  -webkit-mask-image: url("../icons/manuscript.svg");
  mask-image: url("../icons/manuscript.svg");
}

.md-content {
  background: var(--tl-surface);
}

.md-content__inner {
  margin: 0 auto;
  max-width: 58rem;
  padding: 0 1.7rem 3.5rem;
}

.md-content__inner::before {
  display: none;
}

.reading-progress {
  align-items: center;
  color: var(--tl-muted);
  display: grid;
  font-size: 0.65rem;
  gap: 0.75rem;
  grid-template-columns: auto minmax(5rem, 1fr) auto;
  min-height: 3rem;
  position: relative;
}

.reading-progress__track {
  background: var(--tl-paper-deep);
  border-radius: 999px;
  height: 3px;
  overflow: hidden;
}

.reading-progress__fill {
  background: var(--tl-saffron);
  border-radius: inherit;
  height: 100%;
  transform-origin: left center;
  transition: transform 100ms linear;
}

.reading-progress__value {
  color: var(--tl-green);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 2.2rem;
  text-align: right;
}

.md-typeset {
  color: var(--tl-ink);
  font-size: 0.79rem;
  line-height: 1.75;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  color: var(--tl-ink);
  font-family: var(--tl-serif);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.md-typeset h1 {
  font-size: clamp(2.25rem, 5vw, 4.4rem);
  line-height: 0.98;
  margin: 0;
}

.md-typeset h2 {
  border-bottom: 1px solid var(--tl-line);
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
  margin-top: 2.5rem;
  padding-bottom: 0.55rem;
}

.md-typeset h2::after {
  background: var(--tl-saffron);
  content: "";
  display: block;
  height: 2px;
  margin-top: 0.55rem;
  width: 3.5rem;
}

.md-typeset h3 {
  color: var(--tl-green);
  font-size: 1.15rem;
}

.md-typeset a {
  text-decoration-color: color-mix(in srgb, var(--tl-green) 45%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.md-typeset a:hover {
  color: var(--tl-saffron);
}

.library-hero {
  background: var(--tl-paper);
  border: 1px solid var(--tl-line);
  box-shadow: var(--tl-shadow);
  display: grid;
  grid-template-columns: minmax(16rem, 0.8fr) minmax(20rem, 1.2fr);
  margin: 0 -0.7rem 2rem;
  min-height: 23rem;
  overflow: hidden;
  position: relative;
}

.library-hero::before {
  border: 1px solid color-mix(in srgb, var(--tl-bronze) 22%, transparent);
  content: "";
  inset: 0.65rem;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.library-hero__copy {
  align-self: center;
  padding: 3.4rem 0.5rem 3.1rem 3.1rem;
  position: relative;
  z-index: 3;
}

.library-hero h1 {
  font-size: clamp(2.5rem, 4vw, 4rem);
}

.library-hero__title-word {
  white-space: nowrap;
}

.library-hero__intro {
  color: var(--tl-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 1.25rem 0 1.35rem;
  max-width: 28rem;
}

.library-hero__figure {
  align-self: stretch;
  margin: 0;
  min-height: 100%;
  overflow: hidden;
}

.library-hero__figure img {
  display: block;
  height: 100%;
  object-fit: cover;
  object-position: 64% center;
  width: 100%;
}

.teaching-links {
  display: grid;
  gap: 0.38rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 31rem;
}

.teaching-link {
  align-items: center;
  color: var(--tl-green) !important;
  display: flex;
  font-family: var(--tl-serif);
  font-size: 0.82rem;
  gap: 0.42rem;
  line-height: 1.25;
  min-height: 1.75rem;
  text-decoration: underline !important;
  text-decoration-color: color-mix(in srgb, var(--tl-green) 45%, transparent) !important;
}

.teaching-link::before,
.pathway-icon {
  background: currentColor;
  content: "";
  display: inline-block;
  flex: 0 0 1.05rem;
  height: 1.05rem;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  width: 1.05rem;
}

.teaching-link--lotus::before,
.pathway-icon--lotus {
  -webkit-mask-image: url("../icons/lotus.svg");
  mask-image: url("../icons/lotus.svg");
}

.teaching-link--wheel::before,
.pathway-icon--wheel {
  -webkit-mask-image: url("../brand/dhamma-wheel.svg");
  mask-image: url("../brand/dhamma-wheel.svg");
}

.teaching-link--leaf::before,
.pathway-icon--leaf {
  -webkit-mask-image: url("../icons/bodhi-leaf.svg");
  mask-image: url("../icons/bodhi-leaf.svg");
}

.teaching-link--links::before,
.pathway-icon--links {
  border: 1.6px solid currentColor;
  border-radius: 999px;
  height: 0.65rem;
  -webkit-mask-image: none;
  mask-image: none;
  transform: rotate(-35deg);
  width: 1.05rem;
}

.teaching-link--mind::before {
  border: 1.6px solid currentColor;
  border-radius: 50% 50% 45% 45%;
  height: 0.95rem;
  -webkit-mask-image: none;
  mask-image: none;
  width: 0.82rem;
}

.study-pathway {
  counter-reset: pathway;
  list-style: none !important;
  margin: 1.5rem 0 !important;
  padding: 0 !important;
}

.study-pathway li {
  counter-increment: pathway;
  margin: 0 !important;
}

.study-pathway a {
  align-items: center;
  border-bottom: 1px solid var(--tl-line);
  color: var(--tl-ink) !important;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 2rem 1.35rem minmax(0, 1fr) auto;
  min-height: 4rem;
  padding: 0.55rem 0.45rem;
  text-decoration: none !important;
  transition: background-color 160ms ease, padding 160ms ease;
}

.study-pathway a::before {
  align-items: center;
  background: var(--tl-green);
  border-radius: 50%;
  color: white;
  content: counter(pathway);
  display: flex;
  font-size: 0.67rem;
  font-weight: 700;
  height: 1.55rem;
  justify-content: center;
  width: 1.55rem;
}

.study-pathway a:hover,
.study-pathway a:focus-visible {
  background: color-mix(in srgb, var(--tl-green-soft) 75%, transparent);
  padding-inline: 0.75rem;
}

.study-pathway strong {
  color: var(--tl-green);
  display: block;
  font-family: var(--tl-serif);
  font-size: 0.9rem;
  line-height: 1.3;
}

.study-pathway small {
  color: var(--tl-muted);
  display: block;
  font-size: 0.66rem;
  line-height: 1.45;
  margin-top: 0.08rem;
}

.pathway-icon {
  color: var(--tl-green);
  height: 1.35rem;
  width: 1.35rem;
}

.pathway-arrow {
  color: var(--tl-bronze);
  font-family: var(--tl-serif);
  font-size: 1.2rem;
  transition: transform 160ms ease;
}

.study-pathway a:hover .pathway-arrow {
  transform: translateX(0.2rem);
}

.source-note {
  align-items: center;
  background: var(--tl-paper);
  border-left: 3px solid var(--tl-saffron);
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  margin: 2rem 0;
  padding: 1rem 1.15rem;
}

.source-note img {
  filter: sepia(1) saturate(0.85) hue-rotate(55deg);
  width: 1.55rem;
}

.source-note p {
  color: var(--tl-muted);
  font-family: var(--tl-serif);
  font-size: 0.8rem;
  line-height: 1.55;
  margin: 0;
}

.md-typeset table:not([class]) {
  background: transparent;
  border: 1px solid var(--tl-line);
  border-radius: 0;
  box-shadow: none;
  display: table;
}

.md-typeset table:not([class]) th {
  background: var(--tl-paper);
  color: var(--tl-ink);
  font-family: var(--tl-serif);
}

.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  border-color: var(--tl-line);
}

.md-typeset code {
  border-radius: 0.2rem;
}

.md-typeset pre {
  border-left: 3px solid var(--tl-saffron);
}

.md-footer {
  background: #251914;
}

@media screen and (max-width: 76.234375em) {
  body:has(#__drawer:checked) {
    overflow: hidden;
  }

  .md-sidebar--primary {
    border-right: 0;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: contain;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list {
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list::-webkit-scrollbar {
    width: 0.3rem;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--tl-bronze) 55%, transparent);
    border-radius: 999px;
  }

  .library-hero {
    grid-template-columns: minmax(15rem, 0.9fr) minmax(18rem, 1.1fr);
  }

  .library-hero__copy {
    padding-left: 2.25rem;
  }
}

@media screen and (max-width: 60em) {
  .library-hero {
    grid-template-columns: 1fr;
  }

  .library-hero__copy {
    padding: 2.8rem 2.3rem 1.6rem;
  }

  .library-hero__figure {
    max-height: 18rem;
    min-height: 15rem;
  }

  .library-hero__figure img {
    object-position: 70% center;
  }
}

@media screen and (max-width: 44.984375em) {
  .md-header__inner {
    min-height: 3.25rem;
    padding-inline: 0.35rem;
  }

  .md-header__button.md-logo img,
  .md-header__button.md-logo svg {
    height: 1.8rem;
    width: 1.8rem;
  }

  .md-header__title {
    font-size: 0.85rem;
  }

  .md-content__inner {
    padding-inline: 0.85rem;
  }

  .reading-progress {
    font-size: 0.58rem;
    min-height: 2.65rem;
  }

  .library-hero {
    border-left: 0;
    border-right: 0;
    box-shadow: none;
    margin: 0 -0.85rem 1.8rem;
  }

  .library-hero::before {
    display: none;
  }

  .library-hero__copy {
    padding: 2.1rem 1.4rem 1.25rem;
  }

  .md-typeset h1 {
    font-size: clamp(2.75rem, 15vw, 4.2rem);
    line-height: 0.94;
  }

  .library-hero h1 {
    font-size: clamp(2.75rem, 15vw, 4.2rem);
  }

  .library-hero__intro {
    font-size: 0.86rem;
    margin-top: 1.05rem;
  }

  .library-hero__figure {
    margin: 0 1.1rem 1.2rem;
    min-height: 12.5rem;
  }

  .library-hero__figure img {
    border-radius: 0.65rem;
    object-position: 66% center;
  }

  .teaching-links {
    grid-template-columns: 1fr;
  }

  .teaching-link {
    border-bottom: 1px solid var(--tl-line);
    font-size: 0.91rem;
    min-height: 2.55rem;
  }

  .study-pathway a {
    gap: 0.55rem;
    grid-template-columns: 1.75rem 1.15rem minmax(0, 1fr) auto;
  }

  .study-pathway small {
    font-size: 0.62rem;
  }

  .md-typeset h2 {
    font-size: 1.45rem;
  }
}

@media screen and (max-width: 20rem) {
  .md-sidebar--primary,
  .md-sidebar--primary .md-nav {
    max-width: 100vw;
    width: 100vw;
  }

  .md-sidebar--primary .md-nav__title {
    font-size: 0.65rem;
    white-space: normal;
  }

  .md-sidebar--primary .md-nav__item--section > .md-nav__link {
    font-size: 0.62rem;
    gap: 0.3rem;
    line-height: 1.25;
    padding: 0.42rem 0.25rem;
    white-space: normal;
  }

  .md-sidebar--primary .md-nav__item--section > .md-nav__link .md-ellipsis {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .md-sidebar--primary .nav-motif {
    flex-basis: 0.95rem;
    height: 0.95rem;
    width: 0.95rem;
  }

  .md-header__inner {
    justify-content: space-between;
    padding-inline: 0.2rem;
  }

  .md-header__title {
    display: none;
  }

  .md-header__button {
    margin: 0;
    padding: 0.45rem;
  }

  .md-header__button.md-logo {
    display: none;
  }

  .md-content__inner {
    padding-inline: 0.35rem;
  }

  .reading-progress {
    gap: 0.35rem;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .reading-progress > span:first-child {
    display: none;
  }

  .library-hero {
    margin-inline: -0.35rem;
  }

  .library-hero__copy {
    padding: 1.5rem 0.6rem 1rem;
  }

  .md-typeset h1 {
    font-size: 1.4rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .library-hero h1 {
    font-size: 1.4rem;
  }

  .md-typeset > h1 {
    font-size: 1.05rem;
  }

  .md-typeset pre {
    margin-inline: 0;
    max-width: 100%;
  }

  .md-typeset pre > code {
    max-width: 100%;
  }

  .library-hero__intro {
    font-size: 0.72rem;
    overflow-wrap: anywhere;
  }

  .library-hero__figure {
    margin: 0 0.55rem 0.8rem;
    min-height: 8rem;
  }

  .teaching-link {
    font-size: 0.75rem;
    overflow-wrap: anywhere;
  }

  .md-typeset h2 {
    font-size: 1.15rem;
    overflow-wrap: anywhere;
  }

  .study-pathway a {
    gap: 0.35rem;
    grid-template-columns: 1.45rem minmax(0, 1fr) auto;
    padding-inline: 0.15rem;
  }

  .study-pathway .pathway-icon {
    display: none;
  }

  .study-pathway strong {
    font-size: 0.78rem;
    overflow-wrap: anywhere;
  }

  .study-pathway small {
    font-size: 0.58rem;
    overflow-wrap: anywhere;
  }

  .source-note {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.md-footer-meta__inner {
  align-items: center;
}

.md-copyright {
  max-width: 52rem;
}

.footer-disclaimer {
  display: block;
  font-size: 0.67rem;
  line-height: 1.55;
  opacity: 0.82;
}

.footer-credit {
  color: var(--tl-gold);
  display: block;
  font-family: var(--tl-font-display);
  font-size: 0.78rem;
  letter-spacing: 0.035em;
  margin-top: 0.55rem;
}
