/* Fromm's Orientations Test
   Accessible modernization of C. George Boeree's original test
*/

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #111111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

main {
  width: min(1200px, 94%);
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

/* Skip link */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Header */

.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  margin-bottom: 0.5rem;
}

h2 {
  margin-top: 0;
}

p {
  margin: 0 0 0.75rem;
}

/* Question grid */

.questions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 1rem;
  border: 2px solid #767676;
  border-radius: 0.35rem;
}

legend {
  padding: 0 0.35rem;
  font-weight: 700;
  font-size: 1.05rem;
}

/* Rating controls */

.rating {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.rating label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 2.25rem;
  padding: 0.35rem;
  cursor: pointer;
  border-radius: 0.25rem;
}

.rating label:hover {
  outline: 2px solid #767676;
}

.rating input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  cursor: pointer;
}

.rating input[type="radio"]:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

/* Buttons */

.form-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
}

button {
  min-height: 44px;
  padding: 0.7rem 1.25rem;
  border: 2px solid #333333;
  border-radius: 0.3rem;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #eeeeee;
}

button:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

/* Results */

.results {
  max-width: 700px;
  margin: 2rem auto;
  padding: 1.5rem;
  border: 3px solid #333333;
  border-radius: 0.4rem;
}

.results:focus {
  outline: 3px solid currentColor;
  outline-offset: 4px;
}

.results dl {
  margin: 1.5rem 0;
}

.results dl div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #767676;
}

.results dt {
  font-weight: 700;
}

.results dd {
  margin: 0;
  font-weight: 700;
}

.results-note {
  margin-top: 1rem;
}

/* Links */

a {
  color: #0645ad;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

/* Footer */

hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid #767676;
}

footer {
  text-align: center;
}

/* Tablet */

@media (max-width: 900px) {
  .questions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phone */

@media (max-width: 550px) {
  main {
    width: min(96%, 100%);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .questions {
    grid-template-columns: 1fr;
  }

  .rating {
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .rating label {
    flex: 1;
  }
}
/* Detailed results */

.highest-result {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 2px solid #555555;
  border-radius: 0.35rem;
}

.highest-result p {
  margin: 0;
}

.result-item {
  margin: 1.5rem 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid #767676;
}

.result-item h3 {
  margin: 0 0 0.4rem;
}

.result-item p {
  margin: 0;
}

.results-note {
  margin-top: 1.5rem;
  padding-top: 1rem;
}

/* Respect reduced-motion preference */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}