.uctd-root {
  --uctd-w: 480px;
  --uctd-z: 9999;
  --uctd-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Force body scroll lock when drawer is open */
body.uctd-scroll-lock,
html.uctd-scroll-lock {
  overflow: hidden !important;
  position: relative;
}

body.uctd-scroll-lock {
  padding-right: var(--uctd-scrollbar-width, 0);
}

.uctd-drawer {
  display: none;
}

.uctd-drawer.is-open {
  display: block;
}

.uctd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--uctd-transition), visibility var(--uctd-transition);
  z-index: calc(var(--uctd-z) - 1);
  backdrop-filter: blur(2px);
}

.uctd-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(var(--uctd-w), 90vw);
  max-width: var(--uctd-w);
  height: 100%;
  background: #fff;
  transform: translateX(100%);
  transition: transform var(--uctd-transition);
  z-index: var(--uctd-z);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Prevent panel itself from scrolling */
}

.uctd-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.uctd-close:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

.uctd-close svg {
  color: #333;
}

.uctd-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 60px 24px 32px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* Prevent scroll chaining to page */
  position: relative;
  min-height: 0;
  /* Important for flex child scrolling */
}

.uctd-body::-webkit-scrollbar {
  width: 6px;
}

.uctd-body::-webkit-scrollbar-track {
  background: transparent;
}

.uctd-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.uctd-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.uctd-content-wrapper {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.uctd-media {
  margin-bottom: 24px;
}

.uctd-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.uctd-name {
  margin: 0 0 8px;
  color: #333;
  line-height: 1.3;
  font-weight: 700;
}

/* Size variants based on tag */
h1.uctd-name {
  font-size: 32px;
}

h2.uctd-name {
  font-size: 28px;
}

h3.uctd-name {
  font-size: 24px;
  font-weight: 600;
}

h4.uctd-name {
  font-size: 20px;
  font-weight: 600;
}

h5.uctd-name {
  font-size: 18px;
  font-weight: 600;
}

h6.uctd-name {
  font-size: 16px;
  font-weight: 600;
}

p.uctd-name,
div.uctd-name {
  font-size: 28px;
}

.uctd-role {
  font-size: 16px;
  font-weight: 500;
  color: #666;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.uctd-details {
  color: #333;
  line-height: 1.6;
}

.uctd-bio {
  margin-bottom: 24px;
}

.uctd-bio p {
  margin: 0 0 12px;
}

.uctd-bio p:last-child {
  margin-bottom: 0;
}

.uctd-contact {
  margin: 24px 0;
  padding: 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border-left: 3px solid #007bff;
}

.uctd-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.uctd-contact-item:last-child {
  margin-bottom: 0;
}

.uctd-contact-item svg {
  flex-shrink: 0;
  color: #007bff;
}

.uctd-contact-item a {
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease;
}

.uctd-contact-item a:hover {
  color: #007bff;
  text-decoration: underline;
}

.uctd-social {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.uctd-social-link {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  color: #333;
  text-decoration: none;
  transition: all 0.2s ease;
}

.uctd-social-link:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.uctd-drawer.is-open .uctd-overlay {
  opacity: 1;
  visibility: visible;
}

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

/* Mobile bottom-sheet */
@media (max-width: 768px) {
  .uctd-panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: min(85vh, 800px);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    transform: translateY(110%);
  }

  .uctd-drawer.is-open .uctd-panel {
    transform: translateY(0);
  }

  .uctd-close {
    top: 12px;
    right: 12px;
  }

  .uctd-body {
    padding: 56px 20px 24px;
  }

  .uctd-name {
    font-size: 24px;
  }

  .uctd-role {
    font-size: 14px;
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .uctd-panel {
    width: min(420px, 90vw);
  }
}