/* directory.css — Centered modal overlay for the group directory */

/* ── Overlay (fixed, full-viewport) ── */
.directory-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.directory-panel.open {
  display: flex;
}

.directory-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 7, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.directory-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1800px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  /* Match the hero/actions pills: page-bg with a 10% white overlay.
     Layered as a flat gradient over page-bg so it renders identically
     to the pills regardless of the dark backdrop sitting behind. */
  background:
    linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)),
    var(--page-bg);
  border: 1px solid #4a4744;
  border-radius: 8px;
  padding: 1.75rem 1.75rem 1.25rem;
  box-shadow: var(--shadow-heavy);
}


/* ── Modal header (date + total count) ── */
.dir-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.02em;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dir-meta-sep {
  opacity: 0.5;
  margin: 0 0.5em;
}

.dir-meta .track-count-filtered {
  color: #e8736e;
  font-weight: 500;
}


/* ── Alphabetical Grid ── */
.link-grid-alpha {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 0.5rem;
  margin-bottom: 1rem;
  column-count: 5;
  column-gap: 1rem;
}

/* ── Letter Groups ── */
.dir-letter-group {
  break-inside: avoid;
  margin-bottom: 0.4rem;
}

.dir-letter-header {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
  color: #7ec8ff;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem 0.1rem 0;
  margin-left: calc(0.35rem + 5px + 0.4rem);
  border-bottom: 1px solid rgba(126, 200, 255, 0.3);
  margin-bottom: 0.1rem;
  transition: color 0.2s;
}

.dir-letter-header:hover {
  color: #fff;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
}

.link-item::before {
  content: '';
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s;
}

.link-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.link-item.selected {
  color: #e8736e;
}

.link-item.selected::before {
  background: #e8736e;
}



/* ── Action bar (bottom of modal) ── */
.dir-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 1rem;
  padding-right: 2rem;
  padding-left: 2rem;
  padding-top: 0.75rem;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dir-action-btns {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.dir-shortcuts {
  margin-left: auto;
  color: var(--text);
  white-space: nowrap;
}

.dir-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.25rem;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
  transition: color 0.2s;
}

.dir-close-btn:hover {
  color: var(--text);
}


.dir-action-btns button {
  padding: 0.4rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 400;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.dir-action-btns button:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}


/* Apply is the primary action — give it stronger fill, outline, and a
   bit more horizontal padding so it reads as a button rather than a
   label. has-selection state (red) takes over once there's pending. */
#dirApplyBtn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  padding: 0.4rem 1.5rem;
  letter-spacing: 0.03em;
}

#dirApplyBtn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
}

/* has-selection uses the darker --accent-hover by default so it doesn't
   scream against the muted-white modal text; brightens to --accent on
   hover so there's still a "this is clickable now" affordance. */
#dirApplyBtn.has-selection {
  background: var(--accent-hover);
  color: #fff;
  border-color: var(--accent-hover);
}

#dirApplyBtn.has-selection:hover {
  background: var(--accent);
  border-color: var(--accent);
}

#dirClearBtn {
  border-style: dashed;
}


.dir-action-btns button:focus-visible,
.dir-close-btn:focus-visible,
.link-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}


/* ── Responsive ── */
@media (max-width: 1200px) {
  .link-grid-alpha {
    column-count: 4;
  }
}

@media (max-width: 900px) {
  .link-grid-alpha {
    column-count: 2;
  }

  .dir-shortcuts {
    display: none;
  }
}

@media (max-width: 600px) {
  .directory-panel {
    padding: 1.5rem 0.5rem;
  }
  .directory-modal {
    max-height: calc(100vh - 3rem);
    padding: 1rem 1rem 0.75rem;
  }
}

@media (max-width: 400px) {
  .link-grid-alpha {
    column-count: 1;
  }
}

/* 1080p desktops — reduce text slightly */
@media (max-height: 1100px) and (min-width: 1200px) {
  .link-item {
    font-size: 0.95rem;
  }
}
