/* TỨ PHỦ — Glossary encyclopedia entry */

.gd-hero {
  position: relative;
  overflow: hidden;
}

.gd-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 12% 20%, rgba(196, 154, 89, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 40% at 90% 75%, rgba(116, 43, 50, 0.18), transparent 50%);
  pointer-events: none;
}

.gd-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(98, 68, 60, 0.55);
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  color: #d5ba99;
}

.gd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.45rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: rgba(53, 35, 38, 0.9);
  color: #f4e6d1;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.gd-btn:hover,
.gd-btn:focus-visible {
  border-color: #c49a59;
  outline: none;
}

.gd-btn.is-primary {
  border-color: transparent;
  background: #742b32;
}

.gd-btn.is-primary:hover,
.gd-btn.is-primary:focus-visible {
  background: #913c43;
}

.gd-btn.is-active {
  border-color: #c49a59;
  color: #e4c58c;
}

.gd-paper {
  border-radius: 0.85rem;
  border: 1px solid rgba(98, 68, 60, 0.28);
  background: #f5ebdd;
  color: #33241f;
  padding: 1.25rem 1.15rem;
}

.gd-definition {
  border-left: 3px solid #c49a59;
}

.gd-empty {
  border-radius: 0.85rem;
  border: 1px dashed rgba(98, 68, 60, 0.55);
  background: rgba(42, 26, 28, 0.55);
  padding: 1.35rem 1.1rem;
  text-align: center;
}

.gd-meta {
  display: grid;
  gap: 0.75rem 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .gd-meta {
    grid-template-columns: 1fr 1fr;
  }
}

.gd-meta dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(51, 36, 31, 0.65);
}

.gd-meta dd {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  color: #33241f;
}

.gd-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .gd-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
  }
}

.gd-toc {
  display: none;
}

@media (min-width: 1024px) {
  .gd-toc {
    display: block;
    position: sticky;
    top: calc(var(--header-h, 64px) + 1rem);
    border-radius: 0.85rem;
    border: 1px solid rgba(98, 68, 60, 0.55);
    background: rgba(42, 26, 28, 0.9);
    padding: 0.85rem;
    max-height: calc(100vh - var(--header-h, 64px) - 2rem);
    overflow: auto;
  }
}

.gd-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gd-toc-list a {
  display: block;
  border-radius: 0.4rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  color: #d5ba99;
  text-decoration: none;
}

.gd-toc-list a:hover,
.gd-toc-list a:focus-visible,
.gd-toc-list a.is-active {
  background: rgba(116, 43, 50, 0.35);
  color: #f4e6d1;
  outline: none;
}

.gd-article {
  font-size: 1.02rem;
  line-height: 1.75;
}

.gd-article[data-reader-theme="paper"] {
  background: #f5ebdd;
  color: #33241f;
}

.gd-article[data-reader-theme="light"] {
  background: #faf7f2;
  color: #2a211c;
}

.gd-article[data-reader-theme="dark"] {
  background: #241618;
  color: #f4e6d1;
}

.gd-article[data-reader-font="sm"] {
  font-size: 0.95rem;
}

.gd-article[data-reader-font="md"] {
  font-size: 1.02rem;
}

.gd-article[data-reader-font="lg"] {
  font-size: 1.15rem;
}

.gd-article h3 {
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.25rem;
  margin: 1.25rem 0 0.5rem;
}

.gd-article p + p {
  margin-top: 0.85rem;
}

.gd-article blockquote {
  margin: 1rem 0;
  border-left: 3px solid #c49a59;
  padding-left: 0.85rem;
  font-style: italic;
  opacity: 0.92;
}

.gd-card-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .gd-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .gd-card-grid.is-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.gd-card {
  border-radius: 0.85rem;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: rgba(42, 26, 28, 0.88);
  padding: 1rem;
  color: inherit;
  text-align: left;
}

.gd-card:hover,
.gd-card:focus-within {
  border-color: #c49a59;
}

.gd-card a {
  color: inherit;
  text-decoration: none;
}

.gd-script {
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.35rem;
  color: #e4c58c;
  word-break: break-word;
}

.gd-graph {
  border-radius: 0.85rem;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: rgba(42, 26, 28, 0.88);
  padding: 1.25rem 1rem;
  overflow: auto;
}

.gd-graph-svg {
  width: 100%;
  min-height: 220px;
  display: block;
}

.gd-graph-node {
  cursor: pointer;
}

.gd-graph-node rect {
  fill: rgba(53, 35, 38, 0.95);
  stroke: rgba(98, 68, 60, 0.7);
  stroke-width: 1.5;
}

.gd-graph-node.is-current rect {
  fill: rgba(116, 43, 50, 0.55);
  stroke: #c49a59;
}

.gd-graph-node:hover rect,
.gd-graph-node:focus rect {
  stroke: #e4c58c;
}

.gd-graph-node text {
  fill: #f4e6d1;
  font-size: 12px;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
}

.gd-graph-edge {
  stroke: rgba(196, 154, 89, 0.55);
  stroke-width: 1.5;
  fill: none;
}

.gd-graph-list {
  margin-top: 1rem;
}

.gd-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.gd-gallery {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .gd-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.gd-gallery figure {
  margin: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: rgba(42, 26, 28, 0.88);
}

.gd-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gd-gallery figcaption {
  padding: 0.65rem 0.75rem;
  font-size: 0.75rem;
  color: #d5ba99;
}

.gd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(25, 15, 18, 0.92);
  padding: 1rem;
}

.gd-lightbox.is-open {
  display: flex;
}

.gd-lightbox img {
  max-width: min(960px, 100%);
  max-height: 80vh;
  object-fit: contain;
  border-radius: 0.5rem;
}

.gd-lightbox-caption {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  text-align: center;
  font-size: 0.85rem;
  color: #d5ba99;
}

.gd-cite {
  white-space: pre-wrap;
  border-radius: 0.65rem;
  border: 1px solid rgba(98, 68, 60, 0.28);
  background: rgba(255, 255, 255, 0.4);
  padding: 0.85rem;
  font-size: 0.9rem;
}

.gd-accordion details {
  border-radius: 0.65rem;
  border: 1px solid rgba(98, 68, 60, 0.55);
  background: rgba(42, 26, 28, 0.88);
  padding: 0.75rem 0.9rem;
}

.gd-accordion details + details {
  margin-top: 0.5rem;
}

.gd-accordion summary {
  cursor: pointer;
  font-family: "Noto Serif", Georgia, serif;
  color: #f4e6d1;
}

.gd-accordion summary:focus-visible {
  outline: 2px solid #c49a59;
  outline-offset: 2px;
}

.gd-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.gd-toc-drawer {
  position: fixed;
  inset: 0;
  z-index: 72;
  pointer-events: none;
}

.gd-toc-drawer.is-open {
  pointer-events: auto;
}

.gd-toc-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 15, 18, 0.72);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gd-toc-drawer.is-open .gd-toc-drawer-overlay {
  opacity: 1;
}

.gd-toc-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(100%, 300px);
  transform: translateX(-105%);
  background: #2a1a1c;
  border-right: 1px solid rgba(98, 68, 60, 0.55);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.gd-toc-drawer.is-open .gd-toc-drawer-panel {
  transform: translateX(0);
}

.gd-toc-drawer-body {
  overflow: auto;
  flex: 1;
  padding: 0.85rem;
}

.gd-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  z-index: 95;
  transform: translateX(-50%) translateY(120%);
  border-radius: 999px;
  border: 1px solid rgba(196, 154, 89, 0.45);
  background: #2a1a1c;
  color: #f4e6d1;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
}

.gd-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .gd-toc-drawer-overlay,
  .gd-toc-drawer-panel,
  .gd-toast {
    transition: none;
  }
}

@media (max-width: 1023px) {
  .gd-toc-mobile-btn {
    display: inline-flex;
  }
}

@media (min-width: 1024px) {
  .gd-toc-mobile-btn {
    display: none;
  }
}
