/* Base styles with accessibility considerations */
:root {
  --primary-color: #1F5C63;         
  --background-color: #ffffff;     
  --accent-color: #000000;        
  --error-color: #e74c3c;           
  --success-color: #27ae60;         
  --focus-outline: 3px solid var(--accent-color);
  --focus-ring-color: rgba(25, 74, 79, 0.698); 
  --progress-bg: #edf2f7;           
  --text-color: #2c3e50;            
  --border-color: #e2e8f0;         
  --hover-bg: rgba(0, 0, 0, 0.05);   
  --transition-speed: 0.3s;         
}

/* Apply box-sizing border-box to all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Checkbox styling */
.checkbox-container {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.checkbox-container input[type='checkbox'] {
  width: auto;
  margin-right: 0.5rem;
}

select {
  width: 100%;
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid var(--primary-color);
}

.checkbox-container label {
  margin-bottom: 0;
}

.intro-section {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

/* Base styles for readability */
body {
  font-family: "proxima-nova", sans-serif;
  line-height: 1.6;
  color: var(--primary-color);
  background-color: var(--background-color);
  margin: 0;
  font-size: 16px;
  min-width: auto;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Skip link with enhanced visibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-color);
  color: #ffffff;
  padding: 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
  outline: var(--focus-outline);
  outline-offset: 3px;
}

/* Enhanced focus styles */
:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Progress bar styles */
.quiz-progress {
  margin: 2rem 0;
}

.progress-bar {
  background-color: var(--progress-bg);
  border-radius: 8px;
  height: 20px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  background-color: var(--primary-color);
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 8px;
}

.progress-text {
  margin-top: 0.5rem;
  text-align: center;
  font-weight: 500;
}

/* Question groups */
.question-group {
  margin-bottom: 2rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #f8fafc;
}

.question-heading {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* Form elements */
fieldset {
  border: 1px solid var(--primary-color);
  margin: 1em 0;
  padding: 1em;
  border-radius: 4px;
}

legend {
  font-weight: bold;
  padding: 0.5em 1em;
  color: var(--primary-color);
  background-color: #f8fafc;
  border: 1px solid var(--primary-color);
  border-radius: 4px;
}

.radio-group {
  margin: 1em 0;
}

/* Enhanced radio button styling */
.radio-option {
  position: relative;
  padding: 0.75em;
  margin: 0.5em 0;
  border-radius: 4px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
}

.radio-option:hover {
  background-color: rgba(44, 62, 80, 0.1);
}

/* Custom radio button styling */
input[type='radio'] {
  margin-right: 0.75em;
  width: 20px;
  height: 20px;
}

input[type='radio']:focus-visible + label {
  outline: var(--focus-outline);
  outline-offset: 2px;
  border-radius: 2px;
}

input[type='radio'] + label {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
  flex: 1;
}

/* Instructions section */
.quiz-instructions {
  background-color: #f8f9fa;
  padding: 1em;
  margin: 1em 0;
  border-left: 4px solid var(--accent-color);
  border-radius: 0 4px 4px 0;
}

/* Submit button */
.form-controls {
  margin-top: 2rem;
  text-align: center;
}

.submit-button {
  margin-top: 20px;
  font-family: 'Proxima Nova', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.5px;
  color: var(--background-color);
  background: linear-gradient(145deg, var(--primary-color), var(--accent-color));
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px 28px;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, transform 0.1s ease, box-shadow 0.3s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.submit-button:hover {
  background: linear-gradient(145deg, var(--accent-color), var(--primary-color));
  border-color: var(--accent-color);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.submit-button:focus {
  outline: none;
}

.submit-button:focus-visible {
  box-shadow: 0 0 0 4px var(--focus-ring-color);
}

.submit-button:active {
  transform: scale(0.98);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.2);
}

/* Results section */
#results {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 8px;
  background-color: #f8fafc;
  border: 1px solid var(--primary-color);
  margin-bottom: 3rem;
}

.quiz-details {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 4px;
}

#quiz-form {
  margin-bottom: 3rem;
}

/* Utility classes */
.visually-hidden {
  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 */
@media (prefers-contrast: more) {
  :root {
    --primary-color: #000000;
    --background-color: #ffffff;
    --accent-color: #0000ff;
    --error-color: #ff0000;
    --success-color: #008000;
    --text-color: #000000;
    --border-color: #000000;
    --hover-bg: #000000;
    --focus-outline: 3px solid #000000;
    --focus-ring-color: #000000;
    --progress-bg: #ffffff;
  }

  body {
    background-color: var(--background-color);
    color: var(--text-color);
  }

  a {
    color: var(--accent-color);
    text-decoration: underline;
  }

  button,
  input,
  select,
  textarea {
    border: 3px solid var(--text-color);
    background-color: var(--background-color);
    color: var(--text-color);
  }

  fieldset {
    border: 2px solid var(--text-color);
  }

  legend {
    border: 2px solid var(--text-color);
    background-color: var(--background-color);
  }

  .radio-option:hover,
  .checkbox-container:hover {
    background-color: var(--hover-bg);
  }

  .progress-bar {
    border: 2px solid var(--text-color);
  }

  .progress-fill {
    background-color: var(--text-color);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .progress-fill {
    transition: none;
  }

  .skip-link {
    transition: none;
  }

  button,
  input,
  select,
  textarea {
    transition: none;
  }
}

/* Add a class for manual high contrast toggle */
.high-contrast-mode {
  --primary-color: #000000 !important;
  --background-color: #ffffff !important;
  --accent-color: #0000ff !important;
  --error-color: #ff0000 !important;
  --success-color: #008000 !important;
  --text-color: #000000 !important;
  --border-color: #000000 !important;
  --hover-bg: #000000 !important;
  --focus-outline: 3px solid #000000 !important;
  --focus-ring-color: #000000 !important;
  --progress-bg: #ffffff !important;
}

/* Basic responsive design */
@media (max-width: 600px) {
  fieldset {
    padding: 0.5em;
  }

  header {
    padding: 1.25rem;
  }

  nav ul {
    gap: 0.75rem;
  }

  .intro-section {
    flex-direction: column;
  }
}

/* User Info Form */
#user-info {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.form-control {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-control label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--primary-color);
}

.form-control input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-control input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.form-control input[aria-invalid='true'] {
  border-color: var(--error-color);
}

.form-control input[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.25);
}

.error {
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.hint {
  color: var(--secondary-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Introduction section and images */
#introduction {
  padding: 2rem;
  margin-bottom: 2rem;
  background-color: #f8fafc;
  border-radius: 12px;
}

#introduction h2 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

#introduction p {
  max-width: 800px;
  margin: 0 auto 2rem;
}

.hero-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  margin: 2rem 0;
}

.decorative-image,
.info-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  background: white;
}


/* Full-width banner */
#banner {
  margin: -20px -20px 2rem;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  overflow: hidden;
}

#banner img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

h1,
h2 {
  margin-bottom: 1rem;
}

nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

nav a {
  color: var(--accent-color);
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

/* About page specific styles */
#about {
  padding: 2rem;
  background-color: #f8fafc;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#about h2 {
  color: #2c3e50;
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 3px solid #3498db;
  padding-bottom: 0.5rem;
  display: inline-block;
}

#about p {
  font-size: 1.2rem;
  line-height: 1.6;
  color: #34495e;
  margin-bottom: 2rem;
  max-width: 800px;
}

#about .hero-images img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

#about .hero-images img:hover {
  transform: scale(1.02);
}

/* Header improvements */
#header {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  background-color: var(--primary-color);
  color: white;
  padding: 2rem 0;
}

#header .header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

#header h1 {
  color: white;
  margin-bottom: 1rem;
}

#header nav ul {
  list-style: none;
  padding: 0;
  margin: 1rem 1rem;
  display: flex;
  gap: 2rem;
}

#header nav a {
  color: white;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: opacity var(--transition-speed);
}

#header nav a:hover {
  background-color: rgba(255, 255, 255, 0.391);
}

/* Media Queries */
@media (max-width: 600px) {
  #header {
    padding: 1.5rem 0;
  }

  #header nav ul {
    gap: 1rem;
  }

  #header .header-content {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (min-width: 768px) {
  .hero-images {
    flex-direction: row;
    justify-content: center;
    gap: 3rem;
  }

  .decorative-image,
  .info-image {
    width: 55%;
  }
}

/* Footer styles */
footer {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  background-color: var(--primary-color);
  color: white;
  padding: 2rem 0;
  margin-top: auto;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  justify-content: center;
  gap: 2rem;
}

.footer-content nav {
  margin-bottom: 1rem;
}

.footer-content h3 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.footer-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-content a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 0;
  display: block;
  transition: opacity var(--transition-speed);
}

.footer-content a:hover {
  opacity: 0.8;
}

.footer-info {
  grid-column: 1 / -1;
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
  footer {
    padding-bottom: 4rem;
  }
  
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .accordion-button,
  .accordion-icon,
  .accordion-icon::before,
  .accordion-icon::after,
  .accordion-content {
    transition: none;
  }
}