/* ==========================================================================
   Doctors & Departments — Design tokens
   ========================================================================== */
:root {
  --dd-ink:        #0a0f52;   /* headings, primary text */
  --dd-ink-soft:   #4a4f7a;   /* secondary text on light bg */
  --dd-sky:        #0d8ce0;   /* accent — actions, focus */
  --dd-sky-soft:   #eaf5fd;   /* accent background tint */
  --dd-sage:       #1f8a70;   /* "in service" signal, used sparingly */
  --dd-amber:      #c88719;   /* rare highlight */
  --dd-paper:      #f5f8fc;   /* page background */
  --dd-card:       #ffffff;   /* card surface */
  --dd-line:       #e2e8f0;   /* hairline borders */
  --dd-line-soft:  #eef2f7;

  --dd-font-display: 'Literata', Georgia, serif;
  --dd-font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --dd-radius: 14px;
  --dd-radius-sm: 8px;
  --dd-shadow: 0 8px 24px rgba(10, 15, 82, 0.08);
  --dd-shadow-hover: 0 14px 34px rgba(10, 15, 82, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.dd-hero {
  background: linear-gradient(160deg, var(--dd-ink) 0%, #131a6b 55%, #1a2380 100%);
  padding: 64px 20px 56px;
  position: relative;
  overflow: hidden;
}

.dd-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 20%, rgba(13, 140, 224, 0.25), transparent 55%),
    radial-gradient(circle at 10% 90%, rgba(31, 138, 112, 0.18), transparent 50%);
  pointer-events: none;
}

.dd-hero-inner {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.dd-eyebrow {
  font-family: var(--dd-font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9fd4f5;
  margin: 0 0 10px;
}

.dd-title {
  font-family: var(--dd-font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  line-height: 1.12;
  color: #fff;
  margin: 0 0 12px;
}

.dd-subtitle {
  font-family: var(--dd-font-body);
  font-size: 1.02rem;
  color: #c9d6f0;
  margin: 0 0 28px;
  line-height: 1.55;
}

/* Signature moment: pulse line draws itself once on load */
.dd-pulse {
  display: block;
  width: 100%;
  max-width: 420px;
  height: 34px;
  margin: 0 auto 28px;
  color: #4fb8ef;
  opacity: 0.9;
}

.dd-pulse-path {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: dd-draw 1.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

@keyframes dd-draw {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dd-pulse-path {
    stroke-dashoffset: 0;
    animation: none;
  }
}

/* Search */
.dd-search-wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}

.dd-search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #7a8bc4;
  pointer-events: none;
  z-index: 2;
}

.dd-search-input {
  width: 100%;
  font-family: var(--dd-font-body);
  font-size: 1rem;
  padding: 15px 48px 15px 54px !important;
  border-radius: 50px;
  border: none;
  outline: none;
  background: #fff;
  color: var(--dd-ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: box-shadow 0.2s ease;
}

.dd-search-input::placeholder {
  color: #9aa3c2;
}

.dd-search-input:focus-visible {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 0 0 3px #4fb8ef;
}

.dd-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--dd-sky-soft);
  color: var(--dd-sky);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.dd-search-clear:hover {
  background: #d9edfb;
}

.dd-result-count {
  font-family: var(--dd-font-body);
  font-size: 0.85rem;
  color: #a9b6de;
  margin: 14px 0 0;
  min-height: 1.2em;
}

/* ==========================================================================
   Directory
   ========================================================================== */
.dd-directory {
  background: var(--dd-paper);
  padding: 44px 20px 70px;
}

.dd-directory-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.dd-dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Reveal-on-scroll (mirrors the site's existing .fade-in pattern) */
.dd-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.dd-reveal.dd-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .dd-reveal { opacity: 1; transform: none; }
}

/* Department card — index-tab folder motif */
.dd-dept-card {
  background: var(--dd-card);
  border: 1px solid var(--dd-line);
  border-radius: var(--dd-radius);
  box-shadow: var(--dd-shadow);
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.dd-dept-card:hover {
  box-shadow: var(--dd-shadow-hover);
  transform: translateY(-3px);
}

.dd-dept-card.dd-no-match {
  display: none;
}

.dd-dept-header {
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.dd-dept-header:focus-visible {
  outline: 3px solid var(--dd-sky);
  outline-offset: -3px;
}

.dd-dept-tab {
  flex-shrink: 0;
  width: 8px;
  background: var(--dd-sky);
}

/* Cycle the tab color across a quiet, deliberate palette — the folder-index cue */
.dd-dept-card:nth-of-type(6n+2) .dd-dept-tab { background: var(--dd-sage); }
.dd-dept-card:nth-of-type(6n+3) .dd-dept-tab { background: var(--dd-amber); }
.dd-dept-card:nth-of-type(6n+4) .dd-dept-tab { background: #6a5fc4; }
.dd-dept-card:nth-of-type(6n+5) .dd-dept-tab { background: #c8548a; }
.dd-dept-card:nth-of-type(6n+6) .dd-dept-tab { background: #3a8fbf; }

.dd-dept-heading {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 16px;
  min-width: 0;
}

.dd-dept-name {
  font-family: var(--dd-font-display);
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--dd-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-dept-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--dd-font-body);
  font-size: 0.78rem;
  color: var(--dd-ink-soft);
}

.dd-dept-category {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--dd-sky);
}

.dd-dept-category::after {
  content: "\2022";
  margin-left: 8px;
  color: var(--dd-line);
}

.dd-chevron {
  flex-shrink: 0;
  align-self: center;
  width: 20px;
  height: 20px;
  margin-right: 16px;
  color: var(--dd-ink-soft);
  transition: transform 0.25s ease;
}

.dd-dept-header[aria-expanded="true"] .dd-chevron {
  transform: rotate(180deg);
  color: var(--dd-sky);
}

/* Panel — height animated via JS (max-height + inline style), fade via CSS */
.dd-dept-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.dd-dept-panel-inner {
  padding: 4px 16px 18px;
  border-top: 1px solid var(--dd-line-soft);
}

.dd-doctor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.dd-doctor-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--dd-paper);
  border-radius: var(--dd-radius-sm);
  opacity: 0;
  transform: translateY(8px);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.dd-doctor-card:hover,
.dd-doctor-card:focus-visible {
  background: #fff;
  border-color: var(--dd-line);
  box-shadow: 0 6px 16px rgba(10, 15, 82, 0.1);
  transform: translateY(-1px);
}

.dd-doctor-card:focus-visible {
  outline: 3px solid var(--dd-sky);
  outline-offset: 2px;
}

.dd-doctor-card:active {
  transform: translateY(0);
}

.dd-doctor-arrow {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: #b7c0dd;
  transition: transform 0.2s ease, color 0.2s ease;
}

.dd-doctor-card:hover .dd-doctor-arrow,
.dd-doctor-card:focus-visible .dd-doctor-arrow {
  transform: translateX(3px);
  color: var(--dd-sky);
}

.dd-dept-header[aria-expanded="true"] ~ .dd-dept-panel .dd-doctor-card {
  /* fallback visibility if JS/anime fails to run */
  opacity: 1;
  transform: none;
}

.dd-doctor-card.dd-no-match {
  display: none;
}

.dd-doctor-avatar {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--dd-sky-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--dd-line);
}

.dd-doctor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dd-doctor-initials {
  font-family: var(--dd-font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--dd-sky);
}

.dd-doctor-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dd-doctor-name {
  font-family: var(--dd-font-body);
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--dd-ink);
}

.dd-doctor-spec {
  font-family: var(--dd-font-body);
  font-size: 0.8rem;
  color: var(--dd-sky);
  font-weight: 600;
}

.dd-doctor-designation {
  font-family: var(--dd-font-body);
  font-size: 0.76rem;
  color: var(--dd-ink-soft);
}

.dd-empty {
  font-family: var(--dd-font-body);
  font-size: 0.85rem;
  color: var(--dd-ink-soft);
  font-style: italic;
  margin: 14px 0 4px;
}

.dd-no-results {
  text-align: center;
  font-family: var(--dd-font-body);
  color: var(--dd-ink-soft);
  padding: 40px 20px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
  .dd-hero { padding: 48px 16px 44px; }
  .dd-search-input { padding: 13px 44px 13px 50px !important; font-size: 0.95rem; }
  .dd-dept-grid { grid-template-columns: 1fr; }
  .dd-dept-name { white-space: normal; }
}

/* ==========================================================================
   Doctor profile modal
   ========================================================================== */
.dd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 82, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.dd-modal-overlay.dd-modal-open {
  opacity: 1;
}

.dd-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--dd-card);
  border-radius: var(--dd-radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 32px 28px 28px;
  transform: translateY(18px) scale(0.97);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.dd-modal-overlay.dd-modal-open .dd-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .dd-modal-overlay,
  .dd-modal { transition: none; }
}

.dd-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--dd-paper);
  color: var(--dd-ink-soft);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.dd-modal-close:hover {
  background: var(--dd-sky-soft);
  color: var(--dd-sky);
}

.dd-modal-close:focus-visible {
  outline: 3px solid var(--dd-sky);
  outline-offset: 2px;
}

.dd-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-right: 30px;
}

.dd-modal-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--dd-sky-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--dd-line);
}

.dd-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dd-modal-initials {
  font-family: var(--dd-font-display);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--dd-sky);
}

.dd-modal-name {
  font-family: var(--dd-font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--dd-ink);
  margin: 0 0 4px;
}

.dd-modal-dept {
  font-family: var(--dd-font-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--dd-sky);
  margin: 0;
}

.dd-modal-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
}

.dd-modal-fact {
  background: var(--dd-paper);
  border-radius: var(--dd-radius-sm);
  padding: 8px 14px;
}

.dd-modal-fact dt {
  font-family: var(--dd-font-body);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dd-ink-soft);
  margin: 0 0 2px;
}

.dd-modal-fact dd {
  font-family: var(--dd-font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dd-ink);
  margin: 0;
}

.dd-modal-bio h3 {
  font-family: var(--dd-font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--dd-ink);
  margin: 0 0 8px;
}

.dd-modal-bio p {
  font-family: var(--dd-font-body);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--dd-ink-soft);
  margin: 0;
  white-space: pre-line;
}

.dd-modal-bio-empty {
  font-family: var(--dd-font-body);
  font-size: 0.88rem;
  font-style: italic;
  color: var(--dd-ink-soft);
  margin: 0;
}

body.dd-modal-locked {
  overflow: hidden;
}