/* Deep Dive 5 — Math Practice Problems UI.
 * All selectors are scoped to .practice / .pp-* so this file cannot
 * affect any other page. Reuses the site's design tokens from styles.css
 * (with safe fallbacks). */

.practice {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 var(--pad-page, 24px) clamp(40px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 3vw, 26px);
}

.practice-problem {
  background: var(--surface, #ffffff);
  border-radius: var(--radius-lg, 28px);
  box-shadow:none;
  padding: clamp(22px, 4vw, 34px);
}

.pp-title {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-dark, #4338ca);
  margin-bottom: 10px;
}
.pp-statement {
  font-size: clamp(18px, 2.4vw, 21px);
  font-weight: 700;
  color: var(--text-strong, #1a1135);
  line-height: 1.5;
  margin-bottom: 18px;
}

/* Your answer */
.pp-your-answer { margin-bottom: 18px; }
.pp-your-answer label {
  display: block;
  font-weight: 700;
  color: var(--text, #2d2348);
  margin-bottom: 8px;
  font-size: 15px;
}
.pp-your-answer input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 13px 16px;
  border: 2px solid #6B7C93;   /* visible on white (3:1+), darkens on focus */
  border-radius:4px;
  background: #fff;
  color: var(--text-strong, #1a1135);
}
.pp-your-answer input:focus-visible {
  outline: none;
  border-color: var(--accent-dark, #1B3A5C);
  box-shadow: 0 0 0 2px rgba(3,105,161,.18);
}

/* Controls: three help buttons, visually distinct + a reset */
.pp-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
  padding: 12px 20px;
  border: none;
  border-radius:4px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.pp-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow:none; }
.pp-btn:focus-visible { outline: 3px solid var(--accent, #6366f1); outline-offset: 2px; }
.pp-btn:disabled { opacity: 0.45; cursor: default; }
.pp-btn-hint   { background: #f59e0b; } /* amber  */
.pp-btn-step   { background: #6366f1; } /* indigo */
.pp-btn-answer { background: #10b981; } /* green  */
.pp-btn-reset  {
  background: #fff;
  color: var(--text-dim, #6b6385);
  border: 2px solid var(--bg-soft, #e7e0f5);
  font-weight: 700;
}
.pp-btn-reset:hover:not(:disabled) { color: var(--text-strong, #1a1135); }

/* Hint box (also used for the "last step" note) */
.pp-hint-box {
  display: none;
  margin-top: 14px;
  background: #fff7ed;
  border-left: 4px solid #f59e0b;
  border-radius:4px;
  padding: 13px 16px;
  font-size: 16px;
  line-height: 1.5;
  color: #7c2d12;
}
.pp-hint-box.show { display: block; }

/* Worked steps — stacked, numbered, stay visible */
.pp-steps {
  display: none;
  margin-top: 14px;
  padding: 0;
  list-style: none;
  counter-reset: ppstep;
}
.pp-steps.show { display: block; }
.pp-steps li {
  position: relative;
  background: var(--bg-soft, #f6f2fd);
  border-radius:4px;
  padding: 14px 16px 14px 52px;
  margin-bottom: 10px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-strong, #1a1135);
}
.pp-steps li:last-child { margin-bottom: 0; }
.pp-steps li::before {
  counter-increment: ppstep;
  content: counter(ppstep);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--accent, #6366f1);
  color: #fff;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  border-radius: 50%;
}

/* Answer box */
.pp-answer-box {
  display: none;
  margin-top: 16px;
  border-radius:4px;
  padding: 16px 18px;
  background: #ecfdf5;
  border: 2px solid #a7f3d0;
}
.pp-answer-box.show { display: block; }
.pp-answer-box .row { font-size: 17px; line-height: 1.5; margin-bottom: 6px; }
.pp-answer-box .row:last-child { margin-bottom: 0; }
.pp-answer-box .lbl { font-weight: 700; }
.pp-answer-box .yours .val { color: var(--text, #2d2348); }
.pp-answer-box .correct { color: #065f46; }
.pp-answer-box .correct .val { font-weight: 700; }

/* Stacked (vertical) fractions with a bar */
.pp-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
  margin: 0 3px;
}
.pp-frac .pp-num { padding: 0 5px 1px; font-size: 0.86em; }
.pp-frac .pp-den { padding: 1px 5px 0; font-size: 0.86em; border-top: 2px solid currentColor; }

/* The number we multiply by — highlighted so it reads as the SAME both times.
   Bold + colored (meaning is never carried by color alone: it is literally the
   same value in both steps, and it is bold). */
.pp-mult { color: #be185d; font-weight: 800; }
.pp-step1 { color: #C14B30; font-weight: 800; }

/* Optional per-problem data table */
.pp-table-wrap { overflow-x: auto; margin: 2px 0 20px; }
.pp-table {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: 17px;
}
.pp-table th, .pp-table td {
  border: 1px solid var(--bg-soft, #e7e0f5);
  padding: 10px 20px;
  text-align: center;
}
.pp-table thead th {
  background: var(--accent, #6366f1);
  color: #fff;
  border-color: var(--accent-dark, #1B3A5C);
  box-shadow: 0 0 0 2px rgba(3,105,161,.18);
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
}
.pp-table tbody td { color: var(--text-strong, #1a1135); font-weight: 600; }
.pp-table tbody tr:nth-child(even) td { background: var(--bg-soft, #f6f2fd); }

/* Visually-hidden text alternative for screen readers (e.g. "15 over 2") */
.pp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Study-guide download button */
.pp-download-wrap { text-align: center; padding: 0 var(--pad-page, 24px) clamp(20px, 3vw, 32px); }
.pp-download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  background: var(--accent, #6366f1);
  padding: 14px 26px;
  border-radius:4px;
  box-shadow:none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pp-download:hover, .pp-download:focus-visible {
  transform: translateY(-2px);
  box-shadow:none;
  outline: none;
}
.pp-download svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .pp-btn, .pp-download { transition: none; }
}

/* several labeled answer boxes (answerBoxes) */
.pp-your-answer.multi .pp-ya-title { font-weight: 700; margin-bottom: 8px; }
.pp-ya-row { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 8px; }
.pp-ya-row label { font-weight: 600; margin: 0; }
@media (max-width: 520px) { .pp-ya-row { grid-template-columns: 1fr; gap: 4px; } }
