/* =========================================================
   TỨ PHỦ — Sacred figure profile
   ========================================================= */

.profile-hero {
  padding-top: calc(var(--header-h) + 1.25rem);
  padding-bottom: 1.75rem;
}

.profile-media {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(196, 154, 89, 0.45);
  box-shadow:
    inset 0 0 0 4px rgba(25, 15, 18, 0.35),
    inset 0 0 0 5px rgba(196, 154, 89, 0.22);
  background: var(--surface-elevated);
}

.profile-media img,
.profile-media .profile-media-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.profile-media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(196, 154, 89, 0.14), transparent 60%),
    linear-gradient(160deg, #3a2427, #2a1a1c 55%, #41282c);
  color: var(--gold);
  text-align: center;
  padding: 1.5rem;
}

.profile-summary-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--border-dark);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-dark);
}

.profile-summary-grid dt,
.profile-summary-grid dd {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(98, 68, 60, 0.45);
}

.profile-summary-grid dt {
  background: rgba(53, 35, 38, 0.65);
  color: var(--text-muted);
  font-weight: 500;
}

.profile-summary-grid dd {
  color: var(--text-light);
  margin: 0;
}

.profile-summary-grid > div:last-child dt,
.profile-summary-grid > div:last-child dd {
  border-bottom: 0;
}

@media (min-width: 640px) {
  .profile-summary-grid > div {
    display: grid;
    grid-template-columns: 220px 1fr;
  }
}

.profile-section-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  border-bottom: 1px solid rgba(98, 68, 60, 0.55);
  background: rgba(25, 15, 18, 0.94);
  backdrop-filter: blur(10px);
}

.profile-section-nav__scroller {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 0.5rem 0;
}

.profile-nav-link {
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.profile-nav-link:hover,
.profile-nav-link:focus-visible {
  color: var(--gold-light);
  border-color: rgba(196, 154, 89, 0.35);
}

.profile-nav-link.is-active {
  color: var(--text-light);
  border-color: var(--gold);
  background: rgba(116, 43, 50, 0.28);
}

.profile-layout {
  display: grid;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .profile-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 2.5rem;
  }
}

.profile-article {
  max-width: 780px;
}

.profile-article.reading-lg {
  font-size: 1.0625rem;
}

.profile-article.reading-xl {
  font-size: 1.125rem;
}

.profile-article.reading-sm {
  font-size: 0.9375rem;
}

.profile-section {
  scroll-margin-top: calc(var(--header-h) + 3.25rem);
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(98, 68, 60, 0.35);
}

.profile-section:last-of-type {
  border-bottom: 0;
}

.profile-prose p {
  margin-top: 0.85rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.profile-prose h3 {
  margin-top: 1.35rem;
  font-family: "Noto Serif", Georgia, serif;
  font-size: 1.15rem;
  color: var(--text-light);
}

.profile-callout {
  margin-top: 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(196, 154, 89, 0.3);
  background: rgba(53, 35, 38, 0.55);
  padding: 1rem 1.1rem;
}

.profile-callout__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 1024px) {
  .profile-sidebar-sticky {
    position: sticky;
    top: calc(var(--header-h) + 3.5rem);
  }
}

.profile-side-card {
  border-radius: 10px;
  border: 1px solid var(--border-dark);
  background: var(--surface-dark);
  padding: 1rem;
}

.profile-toc a {
  display: block;
  padding: 0.35rem 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  padding-left: 0.65rem;
}

.profile-toc a.is-active,
.profile-toc a:hover {
  color: var(--gold-light);
  border-left-color: var(--gold);
}

.profile-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-dark);
  background: var(--surface-elevated);
  padding: 0.45rem 0.7rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.profile-tool-btn:hover,
.profile-tool-btn:focus-visible {
  border-color: var(--gold);
  color: var(--gold-light);
}

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

.profile-related-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 480px) {
  .profile-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.profile-related-card {
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border-dark);
  background: var(--surface-dark);
  transition: border-color 0.15s ease;
}

.profile-related-card:hover {
  border-color: rgba(196, 154, 89, 0.55);
}

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

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

.profile-lightbox__panel {
  position: relative;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border-dark);
  background: var(--surface-elevated);
  padding: 0.75rem;
}

.profile-lightbox__panel img {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
}

.profile-toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  z-index: 95;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  visibility: hidden;
  border-radius: 999px;
  border: 1px solid var(--border-dark);
  background: var(--surface-elevated);
  color: var(--text-light);
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

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

.names-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.names-table th,
.names-table td {
  border: 1px solid var(--border-dark);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.names-table th {
  background: rgba(53, 35, 38, 0.7);
  color: var(--gold-light);
  font-weight: 500;
}

.names-table td {
  color: var(--text-muted);
}

@media (max-width: 639px) {
  .names-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.collapse-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.collapse-panel.is-open {
  max-height: 640px;
}

@media (prefers-reduced-motion: reduce) {
  .collapse-panel {
    transition: none;
  }
}
