/* =========================================================
   Chemistry@BGS — A Level Test Me topic selector
   Compact layout + Year 12/Year 13 grouping + strand colours
   Teal = Inorganic | Violet = Organic
   ========================================================= */

#topicChoices.topic-choice-grid {
  display: block;
}

/* Clear visual division between Year 12 and Year 13 without
   adding a large amount of vertical space. */
.topic-year-group + .topic-year-group {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.topic-year-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 11px;
}

.topic-year-heading h4 {
  margin: 0;
  color: var(--charcoal);
  font-size: 1.02rem;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.topic-year-heading::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: #ececef;
}

.topic-year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* Slightly smaller than the original 17px / 17px cards.
   Still large enough to remain an easy click/tap target. */
#topicChoices .topic-choice {
  align-items: center;
  gap: 10px;
  min-height: 58px;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 15px;
}

#topicChoices .topic-choice strong {
  font-size: 0.96rem;
  line-height: 1.22;
}

#topicChoices .topic-choice input {
  width: 18px;
  height: 18px;
  margin-top: 0;
}

/* ---------- Inorganic: teal ---------- */

#topicChoices .topic-choice--inorganic {
  background: #f5fbfa;
  border-color: #c7e2df;
}

#topicChoices .topic-choice--inorganic:hover {
  background: #eef8f7;
  border-color: #79b9b3;
  box-shadow: 0 7px 18px rgba(43, 122, 119, 0.08);
}

#topicChoices .topic-choice--inorganic input {
  accent-color: #2f7f7b;
}

#topicChoices .topic-choice--inorganic:has(input:checked) {
  background: #eaf6f4;
  border-color: #4f9f99;
  box-shadow: inset 0 0 0 1px rgba(47, 127, 123, 0.10);
}

/* ---------- Organic: violet ---------- */
/* Uses the established A Level violet family from the topic pages. */

#topicChoices .topic-choice--organic {
  background: #faf7fb;
  border-color: #dfcfe6;
}

#topicChoices .topic-choice--organic:hover {
  background: #f6f0f8;
  border-color: #b99bc8;
  box-shadow: 0 7px 18px rgba(115, 81, 138, 0.08);
}

#topicChoices .topic-choice--organic input {
  accent-color: #73518a;
}

#topicChoices .topic-choice--organic:has(input:checked) {
  background: #f3ebf6;
  border-color: #9e79b2;
  box-shadow: inset 0 0 0 1px rgba(115, 81, 138, 0.10);
}

/* Fallback only: if a future topic does not yet have a year/strand
   classification, it remains neutral rather than being mis-coloured. */
.topic-year-group--other .topic-year-grid {
  margin-top: 4px;
}

/* ---------- Responsive ---------- */

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

@media (max-width: 520px) {
  .topic-year-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #topicChoices .topic-choice {
    min-height: 54px;
    padding: 11px 13px;
  }
}


/* =========================================================
   Quick topic combinations — prototype
   Four toggle buttons can be combined:
   Y12 / Y13 × Organic / Inorganic
   ========================================================= */

.topic-tools {
  align-items: center;
}

.quick-topic-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 4px;
}

.quick-topic-label {
  margin: 0 2px 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.quick-topic-divider {
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: #e0e0e0;
}

.quick-topic-button {
  appearance: none;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: #454545;
  border-radius: 999px;
  min-height: 32px;
  padding: 5px 10px;
  font: inherit;
  font-size: 0.80rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.quick-topic-button:hover {
  transform: translateY(-1px);
  border-color: #bdbdbd;
  background: #fafafa;
}

.quick-topic-button:focus-visible {
  outline: 3px solid rgba(215, 25, 32, 0.16);
  outline-offset: 2px;
}

/* Year toggles remain neutral/gold so they do not compete with
   the chemistry strand colours used on the topic cards. */
.quick-topic-button--year[aria-pressed="true"] {
  background: #fff7df;
  color: #66510a;
  border-color: #d9bd62;
  box-shadow: inset 0 0 0 1px rgba(217, 189, 98, 0.14);
}

.quick-topic-button--inorganic[aria-pressed="true"] {
  background: #eaf6f4;
  color: #236b67;
  border-color: #4f9f99;
  box-shadow: inset 0 0 0 1px rgba(47, 127, 123, 0.10);
}

.quick-topic-button--organic[aria-pressed="true"] {
  background: #f3ebf6;
  color: #634374;
  border-color: #9e79b2;
  box-shadow: inset 0 0 0 1px rgba(115, 81, 138, 0.10);
}

@media (max-width: 760px) {
  .quick-topic-controls {
    width: 100%;
    margin-left: 0;
    margin-top: 2px;
  }
}

@media (max-width: 520px) {
  .quick-topic-label {
    width: 100%;
    margin-left: 0;
  }

  .quick-topic-divider {
    display: none;
  }
}
