:root {
  --bg: #ffffff;
  --fg: #1f2530;
  --muted: #5b6472;
  --accent: #1b6fa8;
  --accent-dark: #124b73;
  --border: #e2e6ea;
  --header-bg: #f7f9fb;
  --code-bg: #f2f4f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
}

.page-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-content h1 {
  font-size: 1.9rem;
  margin-bottom: 1.2rem;
  color: var(--accent-dark);
}

.page-content h2 {
  font-size: 1.3rem;
  margin-top: 2rem;
  color: var(--accent-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

.page-content p {
  margin: 0.9rem 0;
}

.page-content ul, .page-content ol {
  padding-left: 1.4rem;
}

.page-content li {
  margin: 0.4rem 0;
}

figure.lesson-image {
  margin: 1.4rem 0;
  text-align: center;
}

figure.lesson-image img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

figure.lesson-image figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.practice-lettered-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1rem 0;
}
.practice-lettered-row > .practice-letter {
  font-weight: 600;
  flex: 0 0 auto;
  padding-top: 0.2rem;
}
.practice-lettered-row > figure.lesson-image {
  margin: 0;
  text-align: left;
  flex: 0 1 auto;
}

section.downloads {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

section.downloads ul {
  list-style: none;
  padding-left: 0;
}

section.downloads li a {
  color: var(--accent);
  text-decoration: none;
}

section.downloads li a:hover {
  text-decoration: underline;
}

/* Homepage: "Contact me" form, emails Dr. Wallace via Web3Forms (no backend).
   Lives in the bottom-right of the footer, next to the site credit line. */
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
  text-align: left;
  max-width: 960px;
  margin: 0 auto;
}
.site-footer__credit { flex: 1 1 220px; }
.contact-section {
  flex: 0 1 340px;
  max-width: 340px;
}
@media (max-width: 640px) {
  .site-footer__inner { flex-direction: column; align-items: stretch; }
  .contact-section { max-width: none; }
}
.contact-section__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
  color: var(--fg);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}
.contact-section__title::-webkit-details-marker { display: none; }
.contact-section__title::after {
  content: "\25B8";
  color: var(--accent);
  font-size: 1rem;
  transition: transform 0.15s ease;
}
.contact-section[open] .contact-section__title::after {
  transform: rotate(90deg);
}
.contact-form__honeypot { display: none; }
.contact-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
.contact-form__field {
  margin-bottom: 1.2rem;
}
.contact-form__field label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}
.contact-form__field input,
.contact-form__field textarea {
  width: 100%;
  padding: 0.5rem 0;
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
}
.contact-form__field input:focus,
.contact-form__field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.contact-form__field textarea { resize: vertical; }
.contact-form__submit {
  border: 0;
  cursor: pointer;
  font: inherit;
}
@media (max-width: 480px) {
  .contact-form__row { grid-template-columns: 1fr; }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0.2rem 0;
}

/* All-lessons index page */
.chapter-group {
  margin-bottom: 2rem;
}

.chapter-group h2 {
  color: var(--accent-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

.chapter-group ul {
  columns: 2;
  -webkit-columns: 2;
  list-style: none;
  padding-left: 0;
}

.chapter-group li {
  break-inside: avoid;
  margin: 0.3rem 0;
}

.chapter-group a {
  color: var(--accent);
  text-decoration: none;
}

.chapter-group a:hover {
  text-decoration: underline;
}

/* Topics page: single column, with real indentation for nested sub-items */
.topics-page .chapter-group ul {
  columns: 1;
  -webkit-columns: 1;
}
.topics-page .chapter-group ul ul {
  margin: 0.3rem 0 0.3rem 0.4rem;
  padding-left: 1.2rem;
  list-style: disc;
}
.topics-page .chapter-group li > ul li {
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .chapter-group ul { columns: 1; }
}
/* ============================================================================
   WallaceWay Organic Chemistry — brand header + hero + lesson subnav
   ----------------------------------------------------------------------------
   Append this block to /site/styles.css.

   BEFORE appending, DELETE these three now-dead rules from styles.css:
     1. `.site-header { ... }`        (lines 22-34)  — fully replaced below
     2. `.site-header .brand { ... }` (lines 36-41)  — the `.brand` class is gone
     3. `.site-nav { ... }` + `.site-nav a { ... }` + `.site-nav a:hover { ... }`
                                      (lines 43-58)  — fully replaced below
     4. inside `@media (max-width: 640px)` (line 177):
        `.site-header { flex-direction: column; align-items: flex-start; }`
        — this FIGHTS the responsive rules at the bottom of this file.

   Add to every page's <head>, above the stylesheet link:
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Anton&family=Poppins:wght@300;500;600&display=swap">
   Everything degrades to system fonts if that link is omitted.
   ========================================================================== */

:root {
  /* Brand */
  --ww-ink:       #111318;  /* wordmark + nav text                          */
  --ww-blue:      #5271ff;  /* brand blue: GRAPHIC fills + focus ring only   */
  --ww-blue-ink:  #3a56d6;  /* darker blue for small TEXT (contrast)         */
  --ww-blue-soft: #b9c0ff;  /* focus ring on dark surfaces                   */
  --ww-yt:        #ff0000;  /* YouTube red — icon only                       */

  /* Hero gradient stops (near-black -> indigo -> periwinkle) */
  --ww-hero-1: #0b0a14;
  --ww-hero-2: #1d1733;
  --ww-hero-3: #372c5f;
  --ww-hero-4: #4f4894;
  --ww-hero-5: #6569bd;    /* lightest stop — capped so white text stays 4.87:1 */

  /* Sub-nav strip */
  --ww-subnav-bg: #1a1c22;
  --ww-subnav-fg: #e8eaf0;

  /* Form surfaces */
  --ww-field-bg:  #f1f3f7;
  --ww-hairline:  #d7dbe3;

  --ww-font-display: "Anton", "Arial Narrow", Impact, system-ui, sans-serif;
  --ww-font-ui: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                Helvetica, Arial, sans-serif;

  --ww-header-h: 76px;
}

html { scroll-padding-top: calc(var(--ww-header-h) + 8px); }

.ww-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;
}

/* ---------------------------------------------------------------- header -- */

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: nowrap;
  min-height: var(--ww-header-h);
  padding: 0.6rem 1.5rem;
  background: #fff;
  border-bottom: 2px solid var(--ww-ink);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* -- wordmark ------------------------------------------------------------- */

.ww-brand { flex: 0 0 auto; display: block; text-decoration: none; color: inherit; }

.ww-brand__wordmark { display: block; line-height: 1; }

.ww-brand__line1 {
  display: block;
  font-family: var(--ww-font-display);
  font-size: 1.55rem;
  letter-spacing: 0.01em;
  color: var(--ww-ink);
}

/* "WAY" — outlined letters, matching the logo PNG already in /assets */
.ww-brand__way {
  color: #fff;
  -webkit-text-stroke: 1.4px var(--ww-ink);
}

/* Alternate: solid black pill. Add class `ww-brand--pill` on .ww-brand to use. */
.ww-brand--pill .ww-brand__way {
  color: #fff;
  -webkit-text-stroke: 0;
  background: var(--ww-ink);
  border-radius: 6px;
  padding: 0 0.18em;
  margin-left: 0.06em;
}

/* the underline-with-arrowhead */
.ww-brand__rule {
  display: block;
  position: relative;
  width: 100%;
  height: 2px;
  margin: 0.28rem 0 0.26rem;
  background: var(--ww-ink);
}
.ww-brand__rule::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 7px solid var(--ww-ink);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.ww-brand__sub {
  display: block;
  font-family: var(--ww-font-ui);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  color: var(--ww-blue-ink);
}

/* -- search --------------------------------------------------------------- */

.ww-search {
  display: flex;
  align-items: stretch;
  flex: 1 1 320px;
  min-width: 0;
  max-width: 400px;
}

.ww-search__input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--ww-font-ui);
  font-size: 0.92rem;
  padding: 0.5rem 0.8rem;
  color: var(--ww-ink);
  background: var(--ww-field-bg);
  border: 1px solid var(--ww-hairline);
  border-right: 0;
  border-radius: 6px 0 0 6px;
}
.ww-search__input::placeholder { color: var(--muted); opacity: 1; }

.ww-search__btn {
  flex: 0 0 auto;
  width: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0 6px 6px 0;
  background: var(--ww-blue);
  color: #fff;
  cursor: pointer;
}
.ww-search__btn:hover { background: var(--ww-blue-ink); }
.ww-search__btn svg { width: 17px; height: 17px; }

/* -- nav ------------------------------------------------------------------ */

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin-left: auto;
  flex: 0 0 auto;
}

.site-nav a {
  font-family: var(--ww-font-ui);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ww-ink);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover {
  color: var(--ww-blue-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ww-yt {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--ww-yt);
  color: #fff;
}
.ww-yt:hover { filter: brightness(0.9); text-decoration: none; }
.ww-yt svg { width: 15px; height: 15px; }

/* -- focus (light surfaces) ----------------------------------------------- */

.site-header a:focus-visible,
.ww-search__input:focus-visible,
.ww-search__btn:focus-visible {
  outline: 3px solid var(--ww-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ hero -- */

.site-hero {
  padding: 2.25rem 1.5rem 2.5rem;
  text-align: center;
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--ww-hero-1)   0%,
    var(--ww-hero-2)  30%,
    var(--ww-hero-3)  58%,
    var(--ww-hero-4)  80%,
    var(--ww-hero-5) 100%
  );
}

.site-hero__inner { max-width: 860px; margin: 0 auto; }

.site-hero__title {
  margin: 0;
  font-family: var(--ww-font-ui);
  font-weight: 300;
  font-size: clamp(1.6rem, 1.1rem + 2.4vw, 3rem);
  line-height: 1.15;
  letter-spacing: 0.005em;
  color: #fff;
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* taller band when the page actually has a lead image */
.site-hero--with-media { padding: 2.75rem 1.5rem 3.25rem; }
.site-hero--with-media .site-hero__title { margin-bottom: 1.9rem; }

/* self-correcting fallback if the modifier class is ever missed */
@supports selector(:has(*)) {
  .site-hero:has(.site-hero__media) { padding: 2.75rem 1.5rem 3.25rem; }
  .site-hero:has(.site-hero__media) .site-hero__title { margin-bottom: 1.9rem; }
}

.site-hero__media { margin: 0; }

.site-hero__media img {
  display: block;
  max-width: min(100%, 620px);
  height: auto;
  margin: 0 auto;
  padding: 6px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
}

/* Two videos side by side, sharing one caption below (e.g. a lesson + its "crossed" variant) */
.site-hero__media-group {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-hero__media-group .site-hero__media {
  flex: 0 1 340px;
  max-width: 340px;
}
.site-hero__media-group .site-hero__media img { max-width: 100%; width: 100%; }

.site-hero__caption {
  margin-top: 0.85rem;
  font-family: var(--ww-font-ui);
  font-weight: 600;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  color: #fff;
}

/* NOT USED YET. The mirror contains no video URLs, so the hero image is not a
   link and must not look like one. If per-lesson YouTube URLs are ever added,
   wrap the <img> in an <a class="site-hero__media-link"> and this activates. */
.site-hero__media-link { display: block; text-decoration: none; }
.site-hero__media-link:hover img { transform: translateY(-2px); }
.site-hero__media-link img { transition: transform 0.15s ease; }
.site-hero__media-link:focus-visible {
  outline: 3px solid var(--ww-blue-soft);
  outline-offset: 6px;
  border-radius: 10px;
}

/* ------------------------------------------------------- lesson sub-nav -- */

.lesson-nav { background: var(--ww-subnav-bg); }

.lesson-nav ul {
  list-style: none;
  max-width: 860px;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: center;
  gap: clamp(2rem, 12vw, 7rem);
}

.lesson-nav li { margin: 0; }

.lesson-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--ww-font-ui);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ww-subnav-fg);
  text-decoration: none;
}
.lesson-nav__item svg { width: 20px; height: 20px; }

a.lesson-nav__item:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
a.lesson-nav__item:focus-visible {
  outline: 3px solid var(--ww-blue-soft);
  outline-offset: 4px;
  border-radius: 6px;
}

/* Rendered as <span>, never <a>, when there is no target. */
.lesson-nav__item--muted { opacity: 0.5; cursor: default; }

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 900px) {
  .site-header { flex-wrap: wrap; gap: 0.75rem 1rem; }
  .ww-search { order: 3; flex: 1 1 100%; max-width: none; }
  .site-nav  { order: 2; }
}

@media (max-width: 560px) {
  .site-nav {
    width: 100%;
    margin-left: 0;
    gap: 0.9rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }
  .site-hero { padding: 1.75rem 1rem 2rem; }
  .site-hero--with-media { padding: 2rem 1rem 2.5rem; }
  .lesson-nav ul { gap: clamp(1.25rem, 14vw, 3rem); }
}

@media (prefers-reduced-motion: reduce) {
  .site-hero__media-link img { transition: none; }
}

/* Photo attribution lines (e.g. "Photo by X at Morguefile.com") */
.photo-credit {
  margin: -1rem 0 1.4rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Homepage: call-to-action button */
.cta-row { text-align: center; margin: 1.4rem 0; }
.cta-button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
}
.cta-button:hover { background: var(--accent-dark); }

/* Homepage: second "browse topics" prompt after the testimonials, so a
   visitor scrolling past the top still has an obvious next step */
.cta-row--bottom { margin: 2.5rem 0 1rem; }
.cta-button--large {
  padding: 1rem 2rem;
  font-size: 1.15rem;
  border-radius: 8px;
}

/* Homepage: testimonials */
.testimonials {
  margin: 2rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.6rem;
}
.testimonial { margin: 0; padding: 0 1rem; text-align: center; border-left: 1px solid var(--border); }
.testimonial:first-child { border-left: 0; }
.testimonial__quote { font-style: italic; color: var(--fg); margin: 0 0 0.6rem; }
.testimonial__name { font-size: 0.85rem; color: var(--muted); font-style: normal; }

@media (max-width: 640px) {
  .testimonial { border-left: 0; border-top: 1px solid var(--border); padding: 1rem 0 0; }
  .testimonial:first-child { border-top: 0; }
}

/* Homepage: hidden hero (kept only for the accessible <h1>) */
.site-hero--home { padding: 0; background: none; }

/* Homepage: "stressed?" banner */
.stress-banner {
  padding: 1.5rem 1.5rem 1.75rem;
  background: linear-gradient(135deg, #39444b 0%, #4d5761 45%, #66777f 100%);
}
.stress-banner__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.stress-banner__pair {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  align-self: flex-start;
  max-width: 720px;
}
.stress-banner__pair--reverse {
  align-self: flex-end;
  flex-direction: row-reverse;
  text-align: right;
  max-width: 600px;
}
.stress-banner__photo { margin: 0; flex: 0 0 auto; }
.stress-banner__photo img {
  display: block;
  width: 270px;
  height: 270px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
/* No font-family on purpose — the loaded Poppins has no 700 and no italic,
   so the inherited system stack is what gives real bold italic. */
.stress-banner__question,
.stress-banner__answer {
  margin: 0;
  color: #fff;
  font-style: italic;
  font-weight: 700;
  text-wrap: balance;
}
.stress-banner__question {
  text-transform: uppercase;
  font-size: clamp(1.4rem, 1rem + 1.9vw, 2.15rem);
  line-height: 1.2;
  letter-spacing: 0.015em;
}
.stress-banner__answer {
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.65rem);
  line-height: 1.28;
}

/* Homepage: About card — contained at 812px (.page-content's 860px minus its padding) */
.about-section {
  max-width: 812px;
  width: calc(100% - 3rem);
  margin: 1.5rem auto 0;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 1.75rem;
  background: #14151a;
  border-radius: 10px;
}
.about-section__photo { margin: 0; flex: 0 0 auto; }
.about-section__photo img {
  display: block;
  width: 240px;
  height: 340px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
.about-section__box {
  flex: 1 1 auto;
  min-width: 0;
  color: #eef0f3;
}
.about-section__box h2 {
  margin: 0 0 0.9rem;
  font-size: 1.3rem;
  font-weight: 400;
  color: #fff;
  border-bottom: 0;
  text-align: center;
}
.about-section__box p {
  margin: 0 0 0.9rem;
  color: #d7dae0;
  font-size: 0.97rem;
  line-height: 1.62;
}
.about-section__box .about-section__ready { margin: 1.1rem 0 0; text-align: center; }
.about-section__box .cta-row { text-align: center; margin: 1.15rem 0 0; }
.about-section__box .cta-button {
  background: #b9f0d8;
  color: #10241c;
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
}
.about-section__box .cta-button:hover { background: #9fe4c6; }
.about-section__box .cta-button:focus-visible {
  outline: 3px solid var(--ww-blue-soft);
  outline-offset: 3px;   /* load-bearing: seats the ring on the dark card, not the mint */
  border-radius: 6px;
}

@media (max-width: 900px) {
  .stress-banner__pair,
  .stress-banner__pair--reverse { max-width: none; }
}
@media (max-width: 700px) {
  .stress-banner { padding: 1.5rem 1.25rem 1.75rem; }
  .stress-banner__inner { gap: 1.25rem; }
  .stress-banner__pair,
  .stress-banner__pair--reverse {
    align-self: stretch;
    flex-direction: row;
    text-align: left;
    max-width: none;
    gap: 1rem;
  }
  .stress-banner__photo img { width: 132px; height: 132px; }
  .about-section {
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 1.25rem;
  }
  .about-section__photo img { width: 200px; height: 260px; }
}

/* ------------------------------------------------------ practice widgets -- */
/* Reusable interactive elements for "fill in the blank" lesson exercises:
   handwriting-practice boxes, a periodic-table grid with blanks, and a
   symbol-to-name matching list. All answer reveals use a checkbox + CSS
   sibling selector (no JS needed). */

/* Blue panel around a group of numbered problems, so it reads as "work to do"
   at a glance, distinct from the reading material around it. */
.practice-section {
  background: #aebdf7;
  margin: 1.6rem -1.5rem;
  padding: 1.5rem;
}
.practice-section p { margin: 0 0 0.6rem; }
.practice-section .practice-exercise:last-child { margin-bottom: 0; }

.practice-exercise { margin: 1.2rem 0 1.8rem; }

/* Hide a "draw the answer" problem set's solutions until the reader asks
   for them, so the page can't be used as an answer key by accident. */
.practice-reveal { display: none; }
.practice-toggle-input:checked ~ .practice-reveal { display: block; }
.practice-exercise--answers { border-top: 1px dashed var(--border); padding-top: 1rem; }

.practice-toggle-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.practice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  user-select: none;
}
.practice-toggle-track {
  display: inline-block;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border);
  position: relative;
  transition: background 0.15s ease;
  flex: 0 0 auto;
}
.practice-toggle-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: transform 0.15s ease;
}
.practice-toggle-input:checked ~ .practice-toggle .practice-toggle-track {
  background: var(--accent);
}
.practice-toggle-input:checked ~ .practice-toggle .practice-toggle-track::before {
  transform: translateX(16px);
}
.practice-toggle-input:focus-visible ~ .practice-toggle .practice-toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* handwriting-practice boxes (e.g. "write it six times") */
.practice-write {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 620px;
}
.practice-write input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
@media (max-width: 480px) {
  .practice-write { grid-template-columns: repeat(2, 1fr); }
}

/* periodic table grid */
.practice-pt {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  gap: 2px;
  max-width: 760px;
  background: var(--border);
  border: 1px solid var(--border);
  font-size: 0.72rem;
}
.practice-pt__cell {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--fg);
  position: relative;
  padding: 0;
}
.practice-pt__cell--empty { background: transparent; }
.practice-pt__cell input {
  width: 100%;
  height: 100%;
  border: 0;
  text-align: center;
  font: inherit;
  font-weight: 600;
  color: var(--accent-dark);
  background: transparent;
  padding: 0;
}
.practice-pt__cell input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.practice-pt__answer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef7ee;
  color: var(--accent-dark);
  opacity: 0;
  pointer-events: none;
}
.practice-toggle-input:checked ~ .practice-pt .practice-pt__answer { opacity: 1; }
@media (max-width: 640px) {
  .practice-pt { font-size: 0.6rem; }
}

/* symbol-to-name matching list */
.practice-match {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 700px;
}
.practice-match__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  position: relative;
}
.practice-match__symbol { font-weight: 700; min-width: 1.6rem; }
.practice-match__row input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  font: inherit;
  padding: 0.2rem 0;
  background: transparent;
}
.practice-match__answer {
  position: absolute;
  inset: 0.4rem 0.6rem;
  display: flex;
  align-items: center;
  padding-left: 2.1rem;
  background: #eef7ee;
  color: var(--accent-dark);
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
}
.practice-toggle-input:checked ~ .practice-match .practice-match__answer { opacity: 1; }
@media (max-width: 480px) {
  .practice-match { grid-template-columns: 1fr; }
}

/* Image + text shown side by side instead of stacked */
.lyric-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 1.4rem 0;
}
.lyric-row figure.lesson-image { margin: 0; flex: 0 0 auto; }
.lyric-row figure.lesson-image img { max-width: 220px; }
.lyric-row p { margin: 0; flex: 1 1 auto; }
@media (max-width: 560px) {
  .lyric-row { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .lyric-row figure.lesson-image img { max-width: 160px; }
}

/* Short-answer question with an inline blank (e.g. "the atom is (O or C)?") */
.practice-qa { margin: 0.6rem 0; }
.practice-qa__input {
  margin: 0 0.5rem;
  padding: 0.4rem 0.6rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 140px;
}
.practice-qa__answer {
  font-weight: 600;
  color: var(--accent-dark);
  opacity: 0;
}
.practice-toggle-input:checked ~ .practice-qa .practice-qa__answer { opacity: 1; }

/* Red circle appears around the correct choice when "Show answers" is on */
.practice-circle { position: relative; padding: 0 0.2em; }
.practice-circle::after {
  content: "";
  position: absolute;
  inset: -3px -5px;
  border: 2px solid transparent;
  border-radius: 50%;
}
.practice-toggle-input:checked ~ .practice-choices .practice-circle::after,
.practice-toggle-input:checked ~ .practice-choices-list .practice-circle::after {
  border-color: #d64545;
}
.practice-choices-list { margin: 0.6rem 0; padding-left: 1.2rem; }
.practice-choices-list li { margin: 0.3rem 0; }
