/* PMBAH Directory — dark, quiet, type-led. */

:root {
  --bg: #08090b;
  --bg-raise: #0e1014;
  --surface: rgba(255, 255, 255, 0.032);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e9eaee;
  --text-dim: #a2a7b2;
  --text-mute: #6f7480;
  --gold: #d4af6a;
  --gold-soft: rgba(212, 175, 106, 0.14);
  --danger: #e2726e;
  --radius: 14px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

/* `.gate` and friends set an explicit display, which outranks the UA rule for
   [hidden]. Without this they keep occupying layout after being hidden. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient background --------------------------------------------------- */

.aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aura::after {
  /* fine grain so the large flat areas do not band */
  content: "";
  position: absolute;
  inset: -50%;
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 255, 255, 0.3) 0.5px, transparent 0.5px);
  background-size: 4px 4px;
  mix-blend-mode: overlay;
}

.aura-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.9;
  will-change: transform;
}

.aura-blob--one {
  width: 46vmax;
  height: 46vmax;
  top: -20vmax;
  left: -12vmax;
  background: radial-gradient(circle, rgba(212, 175, 106, 0.3), transparent 68%);
  animation: drift-one 34s ease-in-out infinite;
}

.aura-blob--two {
  width: 40vmax;
  height: 40vmax;
  right: -16vmax;
  bottom: -18vmax;
  background: radial-gradient(circle, rgba(86, 132, 168, 0.3), transparent 68%);
  animation: drift-two 41s ease-in-out infinite;
}

@keyframes drift-one {
  50% {
    transform: translate3d(6vmax, 4vmax, 0) scale(1.12);
  }
}

@keyframes drift-two {
  50% {
    transform: translate3d(-5vmax, -4vmax, 0) scale(1.09);
  }
}

/* Password gate -------------------------------------------------------- */

.gate {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: min(400px, 100%);
  padding: 38px 32px 32px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.gate-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 20px;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 106, 0.24);
  border-radius: 16px;
}

.gate-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.gate-sub {
  margin: 0 0 26px;
  color: var(--text-mute);
  font-size: 13.5px;
}

.gate-field {
  display: flex;
  gap: 8px;
}

.gate-field input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  color: var(--text);
  font: inherit;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.gate-field input::placeholder {
  color: var(--text-mute);
}

.gate-field input:focus {
  border-color: rgba(212, 175, 106, 0.55);
  box-shadow: 0 0 0 3px rgba(212, 175, 106, 0.12);
}

.gate-field button {
  display: grid;
  place-items: center;
  min-width: 92px;
  padding: 12px 16px;
  color: #16130c;
  font: inherit;
  font-weight: 600;
  background: linear-gradient(180deg, #e0c184, var(--gold));
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: filter 0.18s ease, opacity 0.18s ease;
}

.gate-field button:hover:not(:disabled) {
  filter: brightness(1.07);
}

.gate-field button:disabled {
  cursor: default;
  opacity: 0.75;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(0, 0, 0, 0.28);
  border-top-color: #16130c;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.gate-error {
  margin: 16px 0 0;
  color: var(--danger);
  font-size: 13px;
}

/* Shell ---------------------------------------------------------------- */

.app {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -20px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(8, 9, 11, 0.94) 62%, rgba(8, 9, 11, 0));
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 0 18px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 106, 0.22);
  border-radius: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.brand-text small {
  color: var(--text-mute);
  font-size: 11px;
}

/* Search --------------------------------------------------------------- */

.search {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--text-mute);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 11px 76px 11px 40px;
  color: var(--text);
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.search input::placeholder {
  color: var(--text-mute);
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search input:focus {
  background: var(--surface-hover);
  border-color: rgba(212, 175, 106, 0.45);
  box-shadow: 0 0 0 3px rgba(212, 175, 106, 0.1);
}

.search-clear {
  position: absolute;
  right: 42px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--text-dim);
  font-size: 19px;
  line-height: 1;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
}

.search-clear:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.search-hint {
  position: absolute;
  right: 12px;
  padding: 2px 7px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 6px;
  pointer-events: none;
}

.lock {
  flex-shrink: 0;
  padding: 9px 14px;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.lock:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* Highlights ----------------------------------------------------------- */

.highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.highlight {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 9px 14px;
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, rgba(212, 175, 106, 0.09), rgba(212, 175, 106, 0.03));
  border: 1px solid rgba(212, 175, 106, 0.2);
  border-radius: 999px;
}

.highlight::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(212, 175, 106, 0.18);
}

/* Department chips ----------------------------------------------------- */

.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.chips::-webkit-scrollbar {
  height: 6px;
}

.chips::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

.chip {
  flex-shrink: 0;
  padding: 7px 13px;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.chip:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.chip[aria-pressed="true"] {
  color: #16130c;
  font-weight: 600;
  background: var(--gold);
  border-color: var(--gold);
}

/* Results -------------------------------------------------------------- */

.results {
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.group-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.group-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.group-title-ar {
  color: var(--text-mute);
  font-size: 14px;
}

.group-count {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11.5px;
}

.subgroup {
  margin-top: 18px;
}

.subgroup-title {
  margin: 0 0 10px;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
  will-change: transform;
}

.card:hover,
.card:focus-visible {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  outline: none;
}

.card:focus-visible {
  box-shadow: 0 0 0 2px rgba(212, 175, 106, 0.5);
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-name-ar {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 400;
}

.card-sep {
  margin: 0 5px;
  color: var(--text-mute);
  opacity: 0.6;
}

.card-role {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.card-where {
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-mute);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.card-ext {
  flex-shrink: 0;
  padding: 6px 10px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 106, 0.2);
  border-radius: 9px;
}

.card-ext--none {
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.card-right {
  flex-shrink: 0;
  text-align: right;
}

/* A mobile or direct line standing in for an extension. */
.card-ext--phone {
  color: #9fd0c4;
  font-size: 12.5px;
  background: rgba(120, 190, 175, 0.1);
  border-color: rgba(120, 190, 175, 0.22);
  white-space: nowrap;
}

.card-direct {
  display: block;
  max-width: 140px;
  margin-top: 4px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-align: right;
  overflow-wrap: anywhere;
}

mark {
  color: var(--gold);
  background: rgba(212, 175, 106, 0.16);
  border-radius: 3px;
}

/* States --------------------------------------------------------------- */

.empty {
  padding: 72px 20px;
  color: var(--text-mute);
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.sentinel {
  height: 1px;
}

.foot {
  margin-top: 40px;
  padding-top: 18px;
  color: var(--text-mute);
  font-size: 12px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.foot-sep {
  margin: 0 8px;
  opacity: 0.5;
}

/* Toast ---------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 26px;
  inset-inline: 0;
  z-index: 60;
  width: fit-content;
  margin-inline: auto;
  padding: 10px 18px;
  color: var(--text);
  font-size: 13px;
  background: var(--bg-raise);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

/* Responsive ----------------------------------------------------------- */

@media (max-width: 780px) {
  .topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 12px;
  }

  .search {
    grid-column: 1 / -1;
    order: 3;
  }

  .search-hint {
    display: none;
  }

  .search input {
    padding-right: 44px;
  }

  .search-clear {
    right: 10px;
  }

  .brand-text small {
    display: none;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
