/* css/style.css */
:root {
  --color-bg: #ffffff;
  --color-text: #1a1a2e;
  --color-muted: #5a6472;
  --color-border: #e2e5e9;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-success: #15803d;
  --color-danger: #dc2626;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 1rem;
}

.site-header h1 { font-size: 1.1rem; margin: 0; }

#nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }

#nav a { color: var(--color-muted); text-decoration: none; font-weight: 500; }

#nav a.active, #nav a:hover { color: var(--color-primary); }

#app-content { max-width: 960px; margin: 0 auto; padding: 2rem; min-height: 60vh; }

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

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 1rem;
}

button:hover { background: var(--color-primary-dark); }

button.secondary { background: #fff; color: var(--color-text); }

button.secondary:hover { background: #f3f4f6; }

button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Keyboard focus indicator matching the styled hover feedback; applies to
   nav links, in-content links, buttons, and form controls alike. */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.domain-list { list-style: none; padding: 0; }

.domain-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--color-border); }

.study-section { margin-bottom: 2rem; }

.study-topic { margin-left: 1rem; padding-left: 1rem; border-left: 3px solid var(--color-border); margin-bottom: 1rem; }

.study-topic h4 { margin-bottom: 0.25rem; }

fieldset { border: 0; padding: 0; margin: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.quiz-question { display: block; font-weight: 600; margin-bottom: 0.75rem; }

.quiz-option { display: block; margin: 0.5rem 0; }

.quiz-progress { color: var(--color-muted); }

.feedback-correct { color: var(--color-success); }

.feedback-incorrect { color: var(--color-danger); }

.quiz-score { font-size: 1.25rem; font-weight: 600; }

.flashcard {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 3rem 2rem;
  text-align: center;
  min-height: 8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
}

.flashcard-service { color: var(--color-muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }

.flashcard-text { font-size: 1.1rem; }

.flashcard-controls { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }

.exam-header { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; font-weight: 600; }

/* The counter is a real heading for AT, but visually it stays the compact
   label the header row was designed around — undo h2 sizing/margins. */
.exam-question-counter { font-size: 1rem; font-weight: 600; margin: 0; }

.exam-timer { font-variant-numeric: tabular-nums; }

.exam-note { color: var(--color-muted); font-size: 0.9rem; }

/* Question navigator: a tight wrapping grid of numbered jump buttons. */
.exam-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 1.5rem; }

.exam-nav-item {
  min-width: 2.25rem;
  padding: 0.25rem 0.35rem;
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
}

.exam-nav-item:hover { background: #f3f4f6; }

.exam-nav-item.is-answered { background: #eff6ff; border-color: var(--color-primary); color: var(--color-primary-dark); }

/* Flagged is marked by an underbar (plus the aria-label), answered by the
   filled tint — the two states combine without relying on color alone. */
.exam-nav-item.is-flagged { box-shadow: inset 0 -3px 0 var(--color-danger); }

.exam-nav-item.is-current { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.exam-nav-item.is-current:hover { background: var(--color-primary-dark); }

/* Previous / Next-or-Submit row (previously carried the .exam-nav class). */
.exam-controls { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }

.exam-flag { background: #fff; color: var(--color-text); margin-top: 1rem; }

.exam-flag:hover { background: #f3f4f6; }

.exam-flag[aria-pressed="true"] { border-color: var(--color-danger); color: var(--color-danger); }

.exam-flag-marker { color: var(--color-danger); }

.exam-unanswered { color: var(--color-muted); font-size: 0.9rem; }

.exam-unanswered-badge { border: 1px solid var(--color-border); border-radius: 999px; padding: 0.15rem 0.65rem; }

.exam-domain-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }

.exam-domain-table th, .exam-domain-table td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--color-border); }

.exam-domain-table th[scope="row"] { font-weight: 500; }

.review-item { border-left: 3px solid var(--color-border); padding-left: 1rem; margin-bottom: 1rem; }

.history-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }

.history-table th, .history-table td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--color-border); }

/* Wide tables scroll inside their wrapper instead of stretching the page —
   this is what keeps a 375px viewport free of horizontal body scroll. */
.table-scroll { overflow-x: auto; }

/* aria-hidden ✓/✗ glyph next to the Correct/Incorrect words; inherits the
   feedback color from its parent. */
.feedback-marker { font-weight: 700; }

/* Destructive actions on the progress view. */
.progress-reset { display: flex; gap: 0.75rem; flex-wrap: wrap; }

button.danger { background: var(--color-danger); border-color: var(--color-danger); }

button.danger:hover { background: #b91c1c; }

/* Skip link: visually hidden until keyboard focus reveals it. */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transform: translateY(-250%);
}

.skip-link:focus { transform: none; }

/* Services at a glance: definition lists grouped under domain headings. */
.services-list { margin: 0 0 1.5rem; }

.services-entry {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.services-entry dt { font-weight: 600; }

.services-entry dd { margin: 0.15rem 0 0; }

@media (max-width: 640px) {
  .site-header { padding: 0.75rem 1rem; }
  #nav { gap: 0.5rem 1rem; }
  #app-content { padding: 1.25rem 1rem; }
  .flashcard { padding: 2rem 1rem; }
  .flashcard-controls, .exam-controls { gap: 0.5rem; }
  .exam-nav { gap: 0.25rem; }
  .exam-nav-item { min-width: 2rem; padding: 0.2rem 0.25rem; }
}

@media print {
  .site-header, .site-footer, .skip-link, .flashcard-controls, .exam-controls,
  .exam-nav, .exam-flag, .progress-reset, button { display: none !important; }
  #app-content { max-width: none; padding: 0; }
  body { color: #000; background: #fff; }
  .study-topic { break-inside: avoid; page-break-inside: avoid; }
  .services-entry { break-inside: avoid; page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
