/* =========================================================
   Chemistry@BGS — A Level topic-page template
   ========================================================= */

html {
  scroll-behavior: smooth;
}

.alevel-topic-page {
  --topic-accent: #73518a;
  --topic-accent-dark: #5c3d71;
  --topic-accent-soft: #f6f0f8;
  --topic-accent-line: #dfcfe6;

  --site-red: #c7222a;
  --site-red-dark: #a91d24;

  background:
    linear-gradient(
      180deg,
      #f8f9fb 0,
      #ffffff 360px
    );
}




.alevel-topic-shell {
  width: min(1320px, calc(100% - 56px));
  margin: 0 auto;
  padding: 30px 0 80px;
}


/* ---------- Breadcrumb ---------- */

.topic-breadcrumb {
  margin-bottom: 18px;
}

.topic-breadcrumb a,
.topic-breadcrumb a:visited {
  color: #6d7580;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.topic-breadcrumb a:hover {
  color: var(--topic-accent-dark);
}


/* ---------- Hero ---------- */

.topic-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;

  padding: 34px 38px;

  background:
    linear-gradient(
      90deg,
      var(--topic-accent-soft) 0,
      #ffffff 58%
    );

  border: 1px solid var(--topic-accent-line);
  border-top: 5px solid var(--topic-accent);
  border-radius: 20px;

  box-shadow:
    0 9px 28px rgba(38, 44, 52, 0.055);
}

.topic-hero__main {
  min-width: 0;
}

.topic-hero__eyebrow {
  margin: 0 0 7px;

  color: var(--topic-accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.topic-hero h2 {
  margin: 0;

  color: #292c31;
  font-size: clamp(3rem, 6vw, 5.25rem);
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.topic-hero__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;

  margin-top: 17px;
}

.topic-hero__meta span {
  display: inline-flex;

  padding: 6px 10px;

  color: var(--topic-accent-dark);
  background: #ffffff;

  border: 1px solid var(--topic-accent-line);
  border-radius: 999px;

  font-size: 0.78rem;
  font-weight: 800;
}


/* ---------- Test Me ---------- */

.topic-test-button,
.topic-test-button:visited {
  display: flex;
  align-items: center;
  gap: 12px;

  flex: 0 0 auto;

  min-height: 60px;
  padding: 11px 18px;

  color: #ffffff;
  background: var(--site-red);

  border: 1px solid var(--site-red);
  border-radius: 14px;

  text-decoration: none;
  font-weight: 850;
  font-size: 1rem;

  box-shadow:
    0 5px 14px rgba(199, 34, 42, 0.14);

  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

.topic-test-button:hover {
  color: #ffffff;
  background: var(--site-red-dark);
  transform: translateY(-1px);
}

.topic-test-button__icon {
  display: grid;
  place-items: center;

  width: 36px;
  height: 36px;

  background: #ffffff;

  border-radius: 9px;

  font-size: 1.05rem;
}


/* ---------- Topic tools ---------- */

.topic-tools {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;

  margin: 22px 0 28px;
}

.topic-tool,
.topic-tool:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  min-width: 0;
  min-height: 58px;

  padding: 10px 14px;

  color: #353a40;
  background: #ffffff;

  border: 1px solid #dde2e7;
  border-radius: 14px;

  box-shadow:
    0 3px 12px rgba(35, 41, 48, 0.04);

  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 800;

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.topic-tool:hover {
  transform: translateY(-2px);
  border-color: #cfd5dc;

  box-shadow:
    0 7px 18px rgba(35, 41, 48, 0.08);
}

.topic-tool__icon {
  display: grid;
  place-items: center;

  width: 32px;
  height: 32px;

  color: var(--topic-accent-dark);
  background: var(--topic-accent-soft);

  border-radius: 8px;

  font-size: 0.95rem;
}


/* ---------- Shared content sections ---------- */

.topic-content-section {
  scroll-margin-top: 24px;

  padding: 30px;

  background: #ffffff;

  border: 1px solid #dfe4e9;
  border-radius: 20px;

  box-shadow:
    0 9px 28px rgba(38, 44, 52, 0.05);
}

.topic-content-section + .topic-content-section {
  margin-top: 24px;
}

.section-heading-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 30px;
}

.section-eyebrow {
  margin: 0 0 6px;

  color: var(--topic-accent-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.section-heading-row h3,
.content-section-heading h3 {
  margin: 0;

  color: #30343a;
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  line-height: 1.08;
}

.section-intro {
  max-width: none;
  margin: 10px 0 0;

  color: #69727d;
  font-size: 0.98rem;
  line-height: 1.55;
}


/* ---------- Progress ---------- */

.spec-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;

  flex: 0 0 auto;
}

.spec-progress__number {
  color: var(--topic-accent-dark);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.spec-progress__divider {
  margin: 0 3px;
  color: #a4a9b0;
}

.spec-progress__label {
  margin-top: 5px;

  color: #7a828c;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.spec-progress-bar {
  overflow: hidden;

  width: 100%;
  height: 7px;

  margin: 22px 0;

  background: #edf0f2;

  border-radius: 999px;
}

.spec-progress-bar__fill {
  width: 0;
  height: 100%;

  background: var(--topic-accent);

  border-radius: inherit;

  transition: width 0.25s ease;
}


/* ---------- Checklist toggle ---------- */

.spec-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  margin: 0 0 22px;

  padding: 10px 16px;

  color: var(--site-red);
  background: #ffffff;

  border: 2px solid var(--site-red);
  border-radius: 999px;

  font: inherit;
  font-size: 0.92rem;
  font-weight: 850;

  cursor: pointer;

  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.spec-toggle:hover {
  color: #ffffff;
  background: var(--site-red);
  transform: translateY(-1px);
}

.spec-toggle__arrow {
  font-size: 0.78em;
}


/* ---------- Checklist rows ---------- */


.spec-list {
  display: grid;
  gap: 10px;
}

.spec-list--collapsed {
  display: none;
}

.spec-item {
  position: relative;

  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: start;

  padding: 17px 18px;

  background: #fbfbfc;

  border: 1px solid #e2e5e9;
  border-radius: 13px;

  cursor: pointer;

  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}

.spec-item:hover {
  background: #f8f7fa;
  border-color: var(--topic-accent-line);
}

.spec-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.spec-item__check {
  display: grid;
  place-items: center;

  width: 30px;
  height: 30px;

  color: transparent;
  background: #ffffff;

  border: 2px solid #cbd1d8;
  border-radius: 8px;

  font-size: 0.95rem;
  font-weight: 900;

  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.spec-item input:focus-visible + .spec-item__check {
  outline: 3px solid rgba(115, 81, 138, 0.22);
  outline-offset: 3px;
}

.spec-item input:checked + .spec-item__check {
  color: #ffffff;
  background: var(--topic-accent);
  border-color: var(--topic-accent);
}

.spec-item:has(input:checked) {
  background: var(--topic-accent-soft);
  border-color: var(--topic-accent-line);
}

.spec-item__body {
  min-width: 0;
}

.spec-item__code {
  display: block;

  margin-bottom: 5px;

  color: var(--topic-accent-dark);
  font-size: 0.76rem;
  font-weight: 900;
}

.spec-item__text {
  display: block;

  color: #343941;
  font-size: 0.98rem;
  line-height: 1.52;
}


/* ---------- Specification footer ---------- */

.specification-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  margin-top: 22px;
  padding-top: 18px;

  border-top: 1px solid #e5e8eb;
}

.specification-footer p {
  margin: 0;

  color: #7a828c;
  font-size: 0.82rem;
  line-height: 1.45;
}

.specification-footer a,
.specification-footer a:visited {
  flex: 0 0 auto;

  color: var(--topic-accent-dark);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 850;
}

.specification-footer a:hover {
  text-decoration: underline;
}


/* ---------- Empty / future content sections ---------- */

.content-section-heading {
  margin-bottom: 20px;
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 18px;

  min-height: 118px;

  padding: 22px 24px;

  background: #f8f9fa;

  border: 1px dashed #ccd3da;
  border-radius: 14px;
}

.empty-state__icon {
  display: grid;
  place-items: center;

  flex: 0 0 auto;

  width: 48px;
  height: 48px;

  background: var(--topic-accent-soft);
  border-radius: 12px;

  font-size: 1.25rem;
}

.empty-state h4 {
  margin: 0 0 5px;

  color: #383d44;
  font-size: 1rem;
}

.empty-state p {
  margin: 0;

  color: #747d88;
  font-size: 0.92rem;
  line-height: 1.5;
}


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

@media (max-width: 800px) {
  .alevel-topic-shell {
    width: min(100% - 24px, 720px);
  }

  .topic-hero {
  align-items: center;
  flex-direction: row;

  padding: 28px 26px;
}

.topic-test-button {
  width: auto;
  margin-left: auto;
  justify-content: center;
}

  .topic-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading-row {
    flex-direction: column;
    gap: 14px;
  }

  .spec-progress {
    align-items: flex-start;
  }

  .specification-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .alevel-topic-shell {
    width: calc(100% - 18px);
    padding-top: 22px;
  }

  .topic-hero,
  .topic-content-section {
    padding: 20px;
    border-radius: 15px;
  }

  .topic-tools {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .topic-tool {
    justify-content: flex-start;
  }

  .spec-item {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 11px;

    padding: 15px 14px;
  }

  .spec-item__check {
    width: 28px;
    height: 28px;
  }

  .empty-state {
    align-items: flex-start;
  }
}

/* Keep Test Me vertically centred in the whole topic header */
@media (min-width: 521px) {
  .topic-hero {
    position: relative;
  }

  .topic-test-button {
    position: absolute;
    top: 50%;
    right: 38px;

    width: auto !important;
    margin: 0 !important;

    transform: translateY(-50%);
  }

  .topic-test-button:hover {
    transform: translateY(-50%);
  }
}

.alevel-topic-page.inorganic-topic {
  --topic-accent: #276f86;
  --topic-accent-dark: #19586c;
  --topic-accent-soft: #edf6f8;
  --topic-accent-line: #c8e0e6;
}

/* ---------- A Level hero fix: stop Test Me overlapping long titles ---------- */

@media (min-width: 861px) {
  .topic-hero {
    position: relative;
    padding-right: 320px; /* reserve space for the Test Me button */
  }

  .topic-test-button {
    position: absolute;
    top: 50%;
    right: 38px;
    transform: translateY(-50%);
    z-index: 2;
  }

  .topic-test-button:hover {
    transform: translateY(calc(-50% - 1px));
  }
}

@media (max-width: 860px) {
  .topic-hero {
    padding-right: 38px;
  }

  .topic-test-button {
    position: static;
    transform: none;
    margin-top: 20px;
  }

  .topic-test-button:hover {
    transform: translateY(-1px);
  }
}

/* =========================================================
   A Level external resource cards
   ========================================================= */

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

.resource-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;

  background: #ffffff;
  border: 1px solid #dfe4e9;
  border-top: 4px solid var(--topic-accent);
  border-radius: 14px;
}

.resource-card__type {
  align-self: flex-start;

  margin-bottom: 12px;
  padding: 4px 8px;

  color: var(--topic-accent-dark);
  background: var(--topic-accent-soft);

  border-radius: 6px;

  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.resource-card h4 {
  margin: 0;

  color: #30343a;
  font-size: 1.05rem;
}

.resource-card p {
  margin: 6px 0 18px;

  color: #747d88;
  font-size: 0.88rem;
  line-height: 1.4;
}

.resource-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  margin-top: auto;
}

.resource-card__links a,
.resource-card__links a:visited {
  display: inline-flex;
  align-items: center;

  padding: 7px 10px;

  color: var(--topic-accent-dark);
  background: var(--topic-accent-soft);

  border: 1px solid var(--topic-accent-line);
  border-radius: 8px;

  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 800;

  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

.resource-card__links a:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

@media (max-width: 850px) {
  .resource-grid {
    grid-template-columns: 1fr;
  }
}

/* Resource-card refinements */

.resource-card,
.resource-card:hover {
  transform: none;
  box-shadow: none;
}

/* READ / PRACTISE / WATCH are labels, not buttons */
.resource-card__type {
  margin-bottom: 10px;
  padding: 0;

  color: #7a828c;
  background: transparent;

  border-radius: 0;

  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.11em;
}

/* ===== A LEVEL EXAM PRACTICE CARDS ===== */

.exam-paper-type {
  margin-bottom: 14px;
  color: #747b86;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exam-paper-links {
  margin-top: 20px;
}

.exam-paper-links a {
  display: inline-block;
  padding: 10px 15px;
  border: 1px solid #c7e0e9;
  border-radius: 10px;
  background: #eef8fb;
  color: #0b5870;
  font-weight: 700;
  text-decoration: none;
}

.exam-paper-links a:hover {
  background: #e3f3f7;
}

/* =========================================================
   A Level Quiz Me — use the A Level topic accent palette
   ========================================================= */

.alevel-topic-page #quiz .quiz-stats div {
  border-color: var(--topic-accent-line);
  box-shadow: 0 6px 18px rgba(38, 44, 52, 0.045);
}

.alevel-topic-page #quiz .quiz-stats strong {
  color: var(--topic-accent-dark);
}

.alevel-topic-page #quiz button:not(.new-quiz-button) {
  background: var(--topic-accent);
  color: #ffffff;
}

.alevel-topic-page #quiz button:not(.new-quiz-button):hover {
  background: var(--topic-accent-dark);
}

.alevel-topic-page #quiz .question-card {
  border: 1px solid #e2e5e9;
  border-left: 5px solid var(--topic-accent);
  box-shadow: 0 7px 20px rgba(38, 44, 52, 0.045);
}

.alevel-topic-page #quiz .answer {
  background: var(--topic-accent-soft);
  border-left: 4px solid var(--topic-accent);
}

.alevel-topic-page #quiz .new-quiz-button {
  background: #ffffff;
  color: var(--topic-accent-dark);
  border: 2px solid var(--topic-accent);
}

.alevel-topic-page #quiz .new-quiz-button:hover {
  background: var(--topic-accent);
  color: #ffffff;
}