:root {
  --lecture-content-width: 900px;
  --lecture-accent: #1f5f83;
  --lecture-accent-strong: #174763;
  --lecture-accent-soft: rgba(31, 95, 131, 0.1);
  --lecture-border: rgba(64, 82, 96, 0.2);
  --lecture-shadow: 0 14px 36px rgba(26, 45, 58, 0.1);
}

body {
  font-size: 1.04rem;
  text-rendering: optimizeLegibility;
}

main.content {
  max-width: var(--lecture-content-width);
}

p,
li {
  line-height: 1.72;
}

a {
  text-underline-offset: 0.16em;
}

.quarto-title h1,
.lecture-hero h1 {
  font-weight: 750;
  letter-spacing: -0.025em;
}

.lecture-home .quarto-title-block {
  display: none;
}

.lecture-home main.content {
  max-width: 1180px;
}

.lecture-hero {
  position: relative;
  overflow: hidden;
  margin: 1.25rem auto 3.5rem;
  padding: clamp(2.25rem, 6vw, 5rem);
  border: 1px solid var(--lecture-border);
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at 88% 18%, var(--lecture-accent-soft), transparent 28rem),
    linear-gradient(145deg, rgba(31, 95, 131, 0.08), rgba(255, 255, 255, 0));
}

.lecture-hero::after {
  position: absolute;
  right: -5rem;
  bottom: -7rem;
  width: 18rem;
  height: 18rem;
  border: 1.5rem solid var(--lecture-accent-soft);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.lecture-hero > * {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.lecture-hero p {
  max-width: 680px;
  margin: 1.1rem 0 1.8rem;
  font-size: clamp(1.08rem, 2vw, 1.28rem);
}

.lecture-kicker {
  margin-bottom: 0.75rem;
  color: var(--lecture-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.lecture-hero .btn-primary {
  padding: 0.68rem 1.1rem;
  border-color: var(--lecture-accent);
  background: var(--lecture-accent);
  font-weight: 700;
}

.lecture-hero .btn-primary:hover,
.lecture-hero .btn-primary:focus-visible {
  border-color: var(--lecture-accent-strong);
  background: var(--lecture-accent-strong);
}

.lecture-listing-heading {
  margin-bottom: 1.35rem;
}

.lecture-listing-heading h2 {
  margin-bottom: 0.3rem;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.quarto-grid-item.card {
  height: 100%;
  border: 1px solid var(--lecture-border);
  border-radius: 0.8rem;
  box-shadow: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.quarto-grid-item.card:hover,
.quarto-grid-item.card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(31, 95, 131, 0.5);
  box-shadow: var(--lecture-shadow);
}

.listing-title {
  font-weight: 720;
  line-height: 1.3;
}

.listing-description {
  line-height: 1.6;
}

.chapter-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: -0.35rem 0 2.2rem;
  padding: 0.72rem 0.9rem;
  border-left: 3px solid var(--lecture-accent);
  background: var(--lecture-accent-soft);
  font-size: 0.92rem;
}

.chapter-source-links a {
  font-weight: 650;
}

.math.display,
.MathJax_Display,
table {
  overflow-x: auto;
}

.math.display {
  padding-block: 0.2rem;
}

.callout,
pre,
div[class~="Definition"],
div[class~="Theorem"],
div[class~="Proposition"],
div[class~="Corollary"],
div[class~="Lemma"],
div[class~="Example"],
div[class~="Remark"],
div[class~="Property"],
div[class~="mainbox"],
div[class~="Khungdinhli"],
div[class~="proof"],
div[class~="bt"] {
  border-radius: 0.55rem;
}

div[class~="Definition"]::before,
div[class~="Theorem"]::before,
div[class~="Proposition"]::before,
div[class~="Corollary"]::before,
div[class~="Lemma"]::before,
div[class~="Example"]::before,
div[class~="Remark"]::before,
div[class~="Property"]::before,
div[class~="proof"]::before,
div[class~="bt"]::before,
div[class~="Vidu"]::before {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--lecture-accent-strong);
  font-weight: 750;
  letter-spacing: 0.01em;
}

div[class~="Definition"]::before {
  content: "Định nghĩa";
}

div[class~="Theorem"]::before {
  content: "Định lí";
}

div[class~="Proposition"]::before {
  content: "Mệnh đề";
}

div[class~="Corollary"]::before {
  content: "Hệ quả";
}

div[class~="Lemma"]::before {
  content: "Bổ đề";
}

div[class~="Example"]::before,
div[class~="Vidu"]::before {
  content: "Ví dụ";
}

div[class~="Remark"]::before {
  content: "Nhận xét";
}

div[class~="Property"]::before {
  content: "Tính chất";
}

div[class~="proof"]::before {
  content: "Chứng minh";
}

div[class~="bt"]::before {
  content: "Bài tập";
}

div[class~="Definition"],
div[class~="Theorem"],
div[class~="Proposition"],
div[class~="Corollary"],
div[class~="Lemma"],
div[class~="Example"],
div[class~="Remark"],
div[class~="Property"],
div[class~="mainbox"],
div[class~="Khungdinhli"],
div[class~="proof"],
div[class~="bt"] {
  margin: 1.35rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--lecture-border);
  border-left: 4px solid var(--lecture-accent);
  background: var(--lecture-accent-soft);
}

div[class~="proof"] {
  border-left-color: #6b7280;
  background: rgba(107, 114, 128, 0.08);
}

div[class~="Example"],
div[class~="bt"] {
  border-left-color: #9a6b22;
  background: rgba(154, 107, 34, 0.08);
}

pre {
  border: 1px solid var(--lecture-border);
}

table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
}

img {
  max-width: 100%;
  height: auto;
}

.tikz-image-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-evenly;
  gap: 1rem;
  margin: 1rem 0;
}

.tikz-image-row > p {
  display: contents;
}

.tikz-image-row img {
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
  max-width: min(100%, 18rem);
}

@media (prefers-reduced-motion: reduce) {
  .quarto-grid-item.card {
    transition: none;
  }
}

@media (max-width: 767.98px) {
  body {
    font-size: 1rem;
  }

  .lecture-hero {
    margin-top: 0.4rem;
    padding: 2rem 1.3rem;
    border-radius: 0.8rem;
  }

  .lecture-hero::after {
    display: none;
  }

  .chapter-source-links {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --lecture-accent: #76b9dc;
    --lecture-accent-strong: #9bcce5;
    --lecture-accent-soft: rgba(118, 185, 220, 0.12);
    --lecture-border: rgba(210, 222, 231, 0.22);
    --lecture-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  }
}

body.quarto-dark {
  --lecture-accent: #76b9dc;
  --lecture-accent-strong: #9bcce5;
  --lecture-accent-soft: rgba(118, 185, 220, 0.12);
  --lecture-border: rgba(210, 222, 231, 0.22);
  --lecture-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}
