/* ===================================================================
   TYPOGRAPHY & FONTS
   =================================================================== */

#quarto-document-content .title {
  display: none;
}

.navbar, .nav-footer {
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  font-style: normal;
}

h1 {
  font-size: 7rem;
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  font-style: normal;
}

h5 {
  font-weight: 600;
}

@media screen and (max-width: 640px) {
  h1 {
    font-size: 5rem;
  }
}

/* ===================================================================
   ACCESSIBILITY IMPROVEMENTS
   =================================================================== */

/* Improve focus visibility for keyboard navigation */
*:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

/* Improve screen reader text utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
  .fellowship-card {
    border-width: 2px;
  }
  
  .urgency-badge {
    border: 1px solid currentColor;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .fellowship-card,
  .learn-more-btn,
  .download-btn,
  .advanced-filters-section,
  .slider-container {
    transition: none;
  }
  
  .fellowship-card:hover {
    transform: none;
  }
}

/* ===================================================================
   FILTER SECTION
   =================================================================== */

.filter-box {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 20px 24px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
}

.filter-header {
  display: grid;
  grid-template-columns: 1fr 0.25fr;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}

.career-stage-wrapper {
  display: flex;
  justify-content: flex-end;
}

.crosstalk-options-group {
  display: flex;
  gap: 16px;
}

/* Mobile: center the PhD/Postdoc checkboxes */
@media (max-width: 768px) {
  .career-stage-wrapper {
    justify-content: center;
  }
}

.filter-title {
  font-family: "Montserrat", sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-icon {
  font-size: 1.2rem;
  /* Improve icon accessibility */
  aria-hidden: true;
}

.filters-grid-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-row-triple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  column-gap: 40px;
  padding-right: 20px;
}

.filter-row-double {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  column-gap: 40px;
  padding-right: 20px;
}

.filter-row-quad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 16px;
  column-gap: 20px;
  padding-right: 20px;
}

.filter-row-postdoc {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 4px;
}

/* Mobile: stack requirement filters on separate lines, group toggles together */
@media (max-width: 768px) {
  .filter-row-postdoc {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .filter-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
  }
}

.filter-group.compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 0px;
}

.filter-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #1f2937; /* Improved contrast from #374151 to #1f2937 */
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-group.deadline-range {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.req-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1f2937; /* Improved contrast from #374151 to #1f2937 */
  margin: 0;
}

.advanced-filters-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

.filter-toggles {
  display: flex;
  gap: 16px;
}

.toggle-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #4b5563; /* Improved contrast from #6b7280 to #4b5563 */
  margin: 0;
}

.toggle-checkbox input[type="checkbox"] {
  margin: 0;
  /* Improve checkbox accessibility */
  width: 16px;
  height: 16px;
}

.toggle-checkbox input[type="checkbox"]:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.experience-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.slider-container {
  transition: opacity 0.3s ease;
}

/* Override crosstalk spacing */
.filter-box .form-group {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.filter-box .crosstalk-input-select,
.filter-box .crosstalk-input {
  margin-top: 0 !important;
  padding-top: 0 !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.filter-box .form-control {
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  /* Improve minimum touch target size */
  min-height: 44px;
}

.filter-box .form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

select {
  background-color: #fff;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
  /* Improve minimum touch target size */
  min-height: 44px;
}

/* Improve slider accessibility */
.irs-from,
.irs-to,
.irs-single {
  background-color: #1f2937 !important; /* Improved contrast */
  color: #ffffff !important;
  font-weight: 500 !important;
}

.irs-from:after,
.irs-to:after,
.irs-single:after {
  border-top-color: #1f2937 !important;
}

/* ===================================================================
   FELLOWSHIP CARDS
   =================================================================== */

.fellowship-table .rt-table {
  background: #E7EFFF;
}

.fellowship-table .rt-tbody {
  display: block;
  width: 100%;
  background-color: #E7EFFF;
}

.rt-pagination {
  background-color: #E7EFFF;
}

.rt-page-size-select {
  width: 60px;
}

.fellowship-table .rt-tbody .rt-tr {
  background: transparent;
}

.fellowship-table .rt-tbody .rt-td {
  border: none;
  padding: 8px 0;
}

.fellowship-table .rt-tr-group {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 0;
  margin-bottom: 0;
  cursor: default;
  transition: none;
}

.fellowship-table .rt-tr-group:hover {
  transform: none;
  box-shadow: none;
}

.fellowship-table .rt-th {
  display: none;
}

.rt-tr-group .rt-td:first-child {
  border-top: none !important;
}

.fellowship-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 20px;
  margin: 6px 0;
  border-left: 4px solid #3b82f6;
  position: relative;
  transition: box-shadow 0.2s ease;
}

.fellowship-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.fellowship-card.urgency-critical {
  border-left-color: #dc2626; /* Improved contrast from #ef4444 to #dc2626 */
  background: linear-gradient(to right, #fef2f2 0%, white 20%);
}

.fellowship-card.urgency-warning {
  border-left-color: #d97706; /* Improved contrast from #f59e0b to #d97706 */
  background: linear-gradient(to right, #fffbeb 0%, white 20%);
}

.fellowship-card.urgency-normal {
  border-left-color: #2563eb; /* Improved contrast from #3b82f6 to #2563eb */
  background: linear-gradient(to right, #eff6ff 0%, white 20%);
}

.fellowship-card.urgency-passed {
  border-left-color: #4b5563; /* Improved contrast from #6b7280 to #4b5563 */
  background: linear-gradient(to right, #f9fafb 0%, white 20%);
  opacity: 0.8; /* Slightly improved from 0.7 to 0.8 for better readability */
}

.fellowship-card .card-header {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background-color: transparent;
  border-color: transparent !important;
}

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

.card-header-right {
  display: flex;
  flex-direction: row;
  gap: 30px;
  margin-left: 16px;
  flex-shrink: 0;
  align-items: flex-end;
  font-size: 16px;
  color: #1f2937; /* Improved contrast from #374151 to #1f2937 */
  font-weight: 500;
}

.header-detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.header-detail-item .detail-icon {
  font-size: 16px;
  margin-right: 2px;
  /* Improve icon accessibility */
  aria-hidden: true;
}

.fellowship-title {
  font-size: 20px;
  font-weight: bold;
  color: #111827;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.fellowship-funder {
  font-size: 16px;
  font-weight: 500;
  color: #1f2937; /* Improved contrast from #374151 to #1f2937 */
  margin: 0;
}

.detail-text {
  font-size: 16px;
  color: #1f2937; /* Improved contrast from #374151 to #1f2937 */
  font-weight: 500;
}

.deadline-date {
  font-size: 16px;
  align-items: center;
  color: #1f2937; /* Improved contrast from #374151 to #1f2937 */
  font-weight: 500;
}

.urgency-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  align-items: center;
  /* Add minimum touch target size */
  min-height: 24px;
  display: inline-flex;
}

.urgency-badge.urgency-critical {
  background: #fef2f2;
  color: #b91c1c; /* Improved contrast from #dc2626 to #b91c1c */
  border: 1px solid #fecaca; /* Add border for better definition */
}

.urgency-badge.urgency-warning {
  background: #fffbeb;
  color: #b45309; /* Improved contrast from #d97706 to #b45309 */
  border: 1px solid #fed7aa; /* Add border for better definition */
}

.urgency-badge.urgency-normal {
  background: #eff6ff;
  color: #1d4ed8; /* Improved contrast from #2563eb to #1d4ed8 */
  border: 1px solid #dbeafe; /* Add border for better definition */
}

.urgency-badge.urgency-passed {
  background: #f3f4f6;
  color: #374151; /* Improved contrast from #6b7280 to #374151 */
  border: 1px solid #d1d5db; /* Add border for better definition */
}

.special-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.special-note {
  display: inline-flex;
  align-items: center;
  background: #f9fafb; /* Slightly darker background */
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #374151; /* Improved contrast from #6b7280 to #374151 */
  border: 1px solid #d1d5db; /* Darker border */
  white-space: nowrap;
  /* Add minimum touch target size */
  min-height: 24px;
}

.special-note .detail-icon {
  margin-right: 4px;
  font-size: 14px;
  /* Improve icon accessibility */
  aria-hidden: true;
}

.card-actions {
  padding-top: 6px;
  border-top: 1px solid #e5e7eb; /* Darker border for better definition */
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.card-actions-right {
  display: flex;
  flex-direction: row;
  margin-left: 16px;
  flex-shrink: 0;
  align-items: center;
}

.learn-more-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: #2563eb; /* Improved contrast from #3b82f6 to #2563eb */
  color: white !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  /* Improve minimum touch target size */
  min-height: 44px;
  border: 2px solid transparent;
}

.learn-more-btn:hover {
  background: #1d4ed8; /* Improved contrast from #2563eb to #1d4ed8 */
  color: white !important;
  text-decoration: none;
}

.learn-more-btn:focus {
  outline: none;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #2563eb;
}

.external-icon {
  margin-left: 8px;
  font-size: 14px;
  /* Improve icon accessibility */
  aria-hidden: true;
}

.card-last-updated {
  font-size: 12px;
  color: #6b7280; /* Keep this lighter as it's secondary information */
  margin: 0;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: #2563eb; /* Improved contrast from #3b82f6 to #2563eb */
  color: white !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  /* Improve minimum touch target size */
  min-height: 44px;
}

.download-btn:hover {
  background: #1d4ed8; /* Improved contrast from #2563eb to #1d4ed8 */
  color: white !important;
  text-decoration: none;
}

.download-btn:focus {
  outline: none;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #2563eb;
}

.filter-label-download {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  color: white !important;
}

/* ===================================================================
   MOBILE RESPONSIVENESS
   =================================================================== */

@media (max-width: 768px) {
  .fellowship-card .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .card-header-right {
    margin-left: 0;
    margin-top: 8px;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .header-detail-item {
    font-size: 13px;
  }
  
  .fellowship-card {
    padding: 16px;
    margin: 4px 0;
  }
  
  .fellowship-title {
    font-size: 18px;
  }
  
  .fellowship-funder {
    font-size: 14px;
  }
  
  .filter-header {
    grid-template-columns: 1fr;
    gap: 16px;
    text-align: left;
  }
  
  .filter-row-triple {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .filter-row-double {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-left: 20px;
  }
  
  .filter-row-quad {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-left: 20px;
  }
  
  .experience-sliders {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .filter-box {
    padding: 16px 20px;
  }
  
  /* Improve mobile touch targets */
  .toggle-checkbox {
    padding: 8px;
    margin: -8px;
  }
  
  .special-note {
    min-height: 32px; /* Larger touch target on mobile */
  }
}

@media (max-width: 480px) {
  .card-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .card-actions-right {
    margin-left: 0;
    margin-top: 8px;
    align-items: center;
  }
  
  .filter-toggles {
    flex-direction: column;
    gap: 8px;
  }
}

/* ===================================================================
   ADDITIONAL ACCESSIBILITY IMPROVEMENTS
   =================================================================== */

/* Improve table accessibility */
.rt-table {
  /* Ensure proper table role is maintained */
  role: table;
}

.rt-thead {
  /* Ensure proper table header role */
  role: rowgroup;
}

.rt-tbody {
  /* Ensure proper table body role */
  role: rowgroup;
}

.rt-tr {
  /* Ensure proper table row role */
  role: row;
}

.rt-td {
  /* Ensure proper table cell role */
  role: cell;
}

/* Improve form accessibility */
input, select, textarea {
  font-family: inherit;
}

/* Ensure all interactive elements have sufficient color contrast */
button, input, select, textarea, a {
  color: inherit;
}

/* Improve landmark identification */
.filter-box {
  /* This could be enhanced with proper ARIA landmarks in the HTML */
  role: region;
  aria-label: "Fellowship Filters";
}

/* Ensure decorative icons are hidden from screen readers */
.detail-icon,
.filter-icon,
.external-icon {
  aria-hidden: true;
}

/* Print styles for accessibility */
@media print {
  .fellowship-card {
    break-inside: avoid;
    border: 1px solid #000;
    box-shadow: none;
  }
  
  .learn-more-btn,
  .download-btn {
    color: #000 !important;
    background: transparent !important;
    border: 1px solid #000 !important;
  }
  
  /* Show URLs for links in print */
  .learn-more-btn::after {
    content: " (" attr(href) ")";
    font-size: 12px;
  }
}


.filters {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 20px 24px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
}

.filter-input {
  margin-top: 0.1rem;
  flex: 1;
  min-width: 250px;
}

.filter-input select,
.filter-input input[type="search"] {
  padding: 0 0.375rem;
  height: 1.5rem;
  border-radius: 6px;
}

.filter-input input[type="search"] {
  /* Revert Bootstrap 5's Reboot styles, which change native search input styling */
  -webkit-appearance: searchfield;
  outline-offset: revert;
  border-color: revert;
}
