/* units.css */

.content-box {
  background: var(--scandi-1);
  border: 3px solid var(--scandi-6);
  border-radius: 1rem;
  padding: 1.5rem;
  position: relative;
  overflow: visible;
  width: 100%;
  margin: 1.5rem 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  /* ensures padding doesn't add extra width */
}

a {
  color: purple;
  /* font-weight: bold; */
}

.content-box a {
  font-weight: bold;
}

.content-box h2 {
  color: var(--scandi-7);
  margin-bottom: 1rem;
}

.content-box ul,
.content-box ol {
  margin-bottom: 1rem;
  padding-left: 1.2rem;
}

.content-box ul li {
  list-style-type: disc;
}

.content-box ol li {
  list-style-type: decimal;
}

.content-box dl {
  border-left: 4px solid #0077cc;
  padding-left: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.content-box dt {
  font-weight: 600;
  color: #004a99;
  margin-top: 1rem;
  font-size: 1.05rem;
  position: relative;
}

.content-box dt::before {
  content: "🔹";
  position: absolute;
  left: -1.5rem;
  color: #0077cc;
}

.content-box dd {
  margin-left: 0;
  padding-left: 0.5rem;
  color: #333;
  margin-bottom: 0.5rem;
  border-bottom: 1px dashed #ccc;
  padding-bottom: 0.5rem;
}

.reading {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  background-color: var(--scandi-5);
  border-radius: 1rem;
  padding: 1.5rem;
  color: #003333;
  gap: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 50rem;
  margin-left: 0;
  margin-right: auto;
}

/* Responsive layout: switch to horizontal on md (≥768px) */
@media (min-width: 768px) {
  .reading {
    flex-direction: row;
    /* flex-md-row */
  }
}

.reading-text {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--scandi-7);
  text-align: left;
  width: 100%;
  flex: 1 1 auto;}

.reading-images {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

/* If there is more than one image -> grid */
.reading-images:has(.reading-image:nth-child(2)) {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Mobile: collapse to 1 per row */
@media (max-width: 600px) {
  .reading-images:has(.reading-image:nth-child(2)) {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}

.reading-image {
  width: auto;
  border-radius: 1rem;
  /* if you want rounded corners on container */
  overflow: hidden;
  /* clip corners if needed */
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  /* ← don't shrink the image */
  max-width: 12rem;
  /* ← consistent width */
  text-align: center;
}

.reading-image img {
  max-height: 10rem;
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
  display: block;
}

.quiz-box {
  background: var(--scandi-1);
  border: 3px solid var(--scandi-6);
  border-radius: 1rem;
  position: relative;
  padding: 1.5rem;
  overflow: visible;
  width: 100%;
  margin: 1.5rem 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.quiz-header {
  display: flex;
  align-items: flex-start;
  position: relative;
}

.quiz-box .score-display {
  position: sticky;
  top: 1rem;
  margin-left: auto;
  z-index: 1050;
  background-color: var(--scandi-6) !important;
  transition: all 0s ease;
}

.quiz-box .score-display.floating {
  position: fixed;
  top: 80px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
}

/* Adjust for mobile */
@media (max-width: 768px) {
  .score-display.floating {
    top: 10px;
    /* Less space on mobile */
  }
}

.quiz-box .quiz-text {
  padding: 1.5rem;
}

.form-control-inline {
  display: inline-block;
  width: auto;
  min-width: 80px;
  margin: 0 0.25rem;
  padding: 0.25rem 0.5rem;
}

.btn-reset {
  background-color: var(--scandi-7);
  color: var(--scandi-1);
}

.btn-reset:hover {
  background-color: var(--scandi-6);
  color: var(--scandi-1);
}

/* Multiple select */
/* Two-column layout when >3 choices */
.choices-wrapper.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.5rem;
  /* row gap, column gap */
  max-width: 500px;
  /* keeps right column from stretching too far */
  /* no margin: auto, so it stays left-aligned */
}

/* Collapse to single column on small screens */
@media (max-width: 768px) {
  .choices-wrapper.two-columns {
    grid-template-columns: 1fr;
    max-width: 100%;
    /* full width on small screens */
  }
}

.quiz-flex {
  display: grid;
  gap: 1rem;
  justify-content: start;

  /* Automatically wrap items while respecting max 3 per row */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  max-width: calc(3 * 200px + 2 * 1rem);
  /* max 3 items with gaps */
}

/* Optional: limit image size inside each choice box */
.choice-box {
  width: 100%;
  max-width: 200px;
}

/* Collapse further on very narrow screens */
@media (max-width: 500px) {
  .quiz-flex {
    grid-template-columns: 1fr;
    /* single column */
    max-width: 100%;
  }
}


/* Generic choice box */
.choice-box {
  width: 100%;
  max-width: 200px;
  /* normal width */
}

/* Images */
.quiz-img {
  width: 100%;
  height: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;

  max-width: 200px;
  /* optional limit */
  display: block;
  margin-bottom: 10px;
}

/* Responsive: narrow screens */
@media (max-width: 500px) {
  .quiz-flex {
    grid-template-columns: 1fr;
    /* one per row */
  }

  .choice-box {
    max-width: 150px;
    /* shrink images a bit */
  }

  .quiz-img {
    height: 150px;
    /* shrink height proportionally */
  }
}

.highlight {
  background-color: #f1dc7f;
  /* yellow highlight */
}

.example {
  margin-left: 2em;
  /* indent about one tab */
}

.example code {
  margin: 0 0.3em;
}

.red {
  color: red;
}
