/* EHF Fellows directory – layout and reference-style detail */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0.75rem;
  background: #f5f5f8;
}

.connection-banner {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  border-radius: 3px;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffe69c;
}

.hidden {
  display: none;
}

/* Side-by-side: directory (left) + detail (right) so detail is always visible */
#app-wrap {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  min-height: 60vh;
}

/* #app-wrap beats .hidden alone; keep install landing mode from showing the shell. */
#app-wrap.hidden {
  display: none;
}

h1 {
  margin: 0;
}

#directory {
  flex: 0 0 220px;
  max-height: 75vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

#search-container {
  margin-bottom: 0.75rem;
}

.search-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.search-input {
  box-sizing: border-box;
  width: 100%;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  border: 1px solid #bbb;
  border-radius: 2px;
}

.search-input:focus {
  outline: 2px solid #4a2c6a;
  outline-offset: 1px;
}

.search-status {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: #555;
}

.nl-search-container {
  margin-top: 0.75rem;
}

.nl-search-button {
  margin-top: 0.5rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 3px;
  border: 1px solid #4a2c6a;
  background: #4a2c6a;
  color: #fff;
  cursor: pointer;
}

.nl-search-button:hover {
  background: #3b2355;
}

#directory ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Directory links: blue and underlined so they look clickable */
#directory a {
  display: block;
  padding: 0.25em 0;
  color: #0066cc;
  text-decoration: underline;
}

#directory a:hover {
  color: #004499;
}

/* Detail panel: always visible, scrollable */
.detail {
  flex: 1;
  min-width: 0;
  padding: 1rem;
  border: 1px solid #ccc;
  background: #fff;
  overflow-y: auto;
  max-height: 75vh;
}

.detail .placeholder {
  color: #666;
}

/* Two-column detail layout (reference: Internal Directory Profile) */
.detail-grid {
  display: grid;
  grid-template-columns: 48% 1fr;
  grid-template-rows: auto auto;
  gap: 0 1.5rem;
  align-items: start;
}

.detail-column {
  display: block;
  box-sizing: border-box;
}

.detail-left-top {
  grid-column: 1;
  grid-row: 1;
  padding-right: 0.5rem;
}

.detail-right-top {
  grid-column: 2;
  grid-row: 1;
  min-width: 280px;
}

.detail-left-rest {
  grid-column: 1;
  grid-row: 2;
  padding-right: 0.5rem;
}

.detail-right-rest {
  grid-column: 2;
  grid-row: 2;
  min-width: 280px;
}

/* Legacy two-column (kept for any non-grid use) */
.detail-column.detail-left {
  width: 48%;
  padding-right: 1rem;
}

.detail-column.detail-right {
  width: 50%;
  min-width: 280px;
}

@media (max-width: 700px) {
  #app-wrap {
    flex-direction: column;
    gap: 0.75rem;
  }
  #directory {
    max-height: 40vh;
    flex: none;
    width: 100%;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .detail-left-top { grid-column: 1; grid-row: 1; }
  .detail-right-top { grid-column: 1; grid-row: 2; }
  .detail-left-rest { grid-column: 1; grid-row: 3; }
  .detail-right-rest { grid-column: 1; grid-row: 4; }
  .detail-column.detail-left,
  .detail-column.detail-right {
    width: 100%;
    display: block;
  }
}

/* Detail page title (above two columns) */
.detail-page-title {
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid #ccc;
  width: 100%;
}

/* Section headers: purple (primary) vs grey (secondary) like reference */
.detail-section {
  margin: 1rem 0;
}

.detail-section-title {
  margin: 0 0 0.5rem 0;
  padding: 0.35em 0.5em;
  background: #4a2c6a;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.detail-section-title--secondary {
  background: #e8e8e8;
  color: #333;
}

.detail-section-body {
  padding-left: 0;
}

/* Work section: subheaders stacked, no text to the right when empty; single blank line between subheaders */
.work-block {
  margin-top: 1em;
  margin-bottom: 1em;
}

.work-block:first-child {
  margin-top: 0.5em;
}

.work-block:last-child {
  margin-bottom: 0;
}

.work-subheader {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 0.25em 0;
  padding: 0.35em 0.5em;
  background: #f0f0f0;
}

.work-value {
  margin-top: 0.25em;
  font-size: 0.9rem;
}

/* Single blank line below section header when there is no body content */
.detail-section-body--empty {
  min-height: 1em;
}

/* Table-like rows: label (grey) | value (white) */
.detail-section-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5em;
  font-size: 0.9rem;
}

.detail-section-body .field-label {
  background: #f0f0f0;
  padding: 0.35em 0.5em;
  font-weight: 600;
  vertical-align: top;
  width: 40%;
}

.detail-section-body .field-value {
  padding: 0.35em 0.5em;
  background: #fff;
}

/* This Profile Last Updated date: same font/size as How to Connect / Geography data, italic */
.profile-updated-date {
  font-size: 0.9rem;
  font-style: italic;
}

.detail-name {
  margin: 0 0 0.25em 0;
  font-size: 1.5rem;
}

.detail-demographics {
  margin: 0 0 0.75em 0;
  font-size: 0.9rem;
  color: #444;
}

.detail-tagline {
  margin: 0.5rem 0 1rem 0;
  font-size: 0.95rem;
  line-height: 1.4;
  font-style: italic;
}

.profile-image-wrap {
  margin-bottom: 0.75rem;
}

.detail img.profile-image {
  max-width: 200px;
  width: 200px;
  height: 200px;
  object-fit: cover;
  display: block;
}

.detail .field {
  margin: 0.35em 0;
  font-size: 0.9rem;
}

.detail .field-label {
  font-weight: 600;
  margin-right: 0.35em;
}

/* All links in detail: blue and underlined (like reference) */
.detail a {
  color: #0066cc;
  text-decoration: underline;
}

.detail a:hover {
  color: #004499;
}

/* Fellow detail navigation arrows (prev/next) */
.fellow-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #ccc;
}

.fellow-nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  font-size: 2rem;
  line-height: 1;
  padding: 0.25rem 1rem;
  border-radius: 6px;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  text-decoration: none;
  cursor: pointer;
}

.fellow-nav-arrow:hover {
  background: #f0f0f0;
  color: #000;
  text-decoration: none;
}

.fellow-nav-arrow--hidden {
  visibility: hidden;
}

.fellow-nav-hint {
  font-size: 0.8rem;
  color: #888;
  margin-left: 0.5rem;
}

/* Site header with navigation */
.site-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Must beat .site-header { display: flex } when both classes apply (install landing vs app). */
.site-header.hidden {
  display: none;
}

.site-title-link {
  color: inherit;
  text-decoration: none;
}

.site-title-link:hover {
  color: #4a2c6a;
}

.header-search {
  flex: 1;
  min-width: 180px;
  max-width: 350px;
}

.site-nav {
  display: flex;
  gap: 1rem;
}

.site-nav-link {
  color: #4a2c6a;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.2em 0.5em;
  border-radius: 3px;
}

.site-nav-link:hover {
  background: #4a2c6a;
  color: #fff;
}

/* Stats page */
.stats-page {
  max-width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.stats-col {
  min-width: 0;
}

.stats-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.3rem;
}

.stats-total {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.about-body {
  margin-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 700px;
}

.about-body p {
  margin: 0 0 0.75rem 0;
}

.about-repo a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #4a2c6a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.about-repo a:hover {
  text-decoration: underline;
}

.github-icon {
  vertical-align: middle;
}

.stats-chart {
  display: block;
  margin: 0.5rem 0 1rem 0;
  max-width: 100%;
  height: auto;
}

@media (max-width: 700px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-chart {
    min-width: 600px;
  }
  .detail-section-body {
    overflow-x: auto;
  }
}

/* PWA install landing (browser tab only) */
.install-landing {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.install-landing.hidden {
  display: none;
}

.install-landing-inner {
  max-width: 28rem;
  text-align: center;
  background: #fff;
  border-radius: 12px;
  padding: 2rem 1.75rem;
  box-shadow: 0 4px 24px rgba(74, 44, 106, 0.12);
  border: 1px solid #e8e4ef;
}

.install-brand {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  border-radius: 12px;
  background: #4a2c6a;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.install-title {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  color: #2d1f3d;
}

.install-lead {
  margin: 0 0 1rem;
  color: #444;
  line-height: 1.45;
}

.install-status {
  min-height: 1.25rem;
  font-size: 0.9rem;
  color: #4a2c6a;
  margin: 0 0 1rem;
}

.install-pwa-button {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #4a2c6a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.install-pwa-button:hover {
  background: #3d2460;
}

.install-pwa-button:focus {
  outline: 2px solid #4a2c6a;
  outline-offset: 2px;
}

.install-ios-hint {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: #555;
  line-height: 1.4;
}

.install-support {
  margin: 1.5rem 0 0;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

.sw-update-banner {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: #e7f1ff;
  color: #0b3d6b;
  border: 1px solid #b6d4fe;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sw-update-reload {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 4px;
  border: 1px solid #0b3d6b;
  background: #fff;
  color: #0b3d6b;
  cursor: pointer;
}

.about-support {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #4a2c6a;
}
