/* Font Selector Styles */
.font-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  font-family: 'Source Sans Pro', sans-serif;
}

.font-selector-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 180px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.font-selector-button:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #bbb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.font-selector-button:focus {
  outline: none;
  border-color: #007acc;
  box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.1);
}

.font-selector-text {
  font-weight: 500;
  margin-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.font-selector-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.font-selector-button[aria-expanded="true"] .font-selector-arrow {
  transform: rotate(180deg);
}

.font-selector-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-top: 4px;
  min-width: 250px;
  max-height: 350px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.font-selector-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.font-selector-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 14px;
  color: #333;
}

.font-selector-option:last-child {
  border-bottom: none;
}

.font-selector-option:hover {
  background: rgba(0, 122, 204, 0.05);
}

.font-selector-option:focus {
  outline: none;
  background: rgba(0, 122, 204, 0.1);
}

.font-preview-text {
  font-size: 18px;
  margin-top: 4px;
  color: #666;
  font-weight: normal;
  line-height: 1.2;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .font-selector-button {
    background: rgba(40, 40, 40, 0.95);
    border-color: #555;
    color: #e0e0e0;
  }

  .font-selector-button:hover {
    background: rgba(50, 50, 50, 1);
    border-color: #666;
  }

  .font-selector-button:focus {
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
  }

  .font-selector-dropdown {
    background: rgba(40, 40, 40, 0.98);
    border-color: #555;
  }

  .font-selector-option {
    color: #e0e0e0;
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .font-selector-option:hover {
    background: rgba(74, 158, 255, 0.15);
  }

  .font-selector-option:focus {
    background: rgba(74, 158, 255, 0.2);
  }

  .font-preview-text {
    color: #bbb;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .font-selector {
    top: 10px;
    right: 10px;
  }

  .font-selector-button {
    min-width: 150px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .font-selector-dropdown {
    min-width: 200px;
    max-height: 280px;
  }

  .font-selector-option {
    padding: 10px 12px;
    font-size: 13px;
  }

  .font-preview-text {
    font-size: 16px;
  }
}

/* Smooth font transitions */
body, .masthead, .main-content, #footer {
  transition: font-family 0.3s ease;
}

/* Ensure dropdown appears above all content */
.font-selector-dropdown {
  z-index: 9999;
}