/* ===== Brand Colours (from style guide) ===== */
:root {
  --primary-neutral: #3C3C3C;   /* Slate Grey */
  --accent-orange:  #FF7A00;    /* Warm Orange */
  --accent-orange-hover: #E56D00;
  --accent-yellow:  #FFD95A;    /* Soft Yellow */
  --accent-sky:     #5AC8FA;    /* Sky Blue */
  --accent-corn:    #6495ED;    /* Cornflower Blue */
  --base-light:     #FFFFFF;    /* Pure White */
  --alt-grey:       #F5F5F5;    /* Cloud Grey */
  --shadow:         0 2px 6px rgba(0,0,0,0.1);
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--base-light);       /* Base colour = white */
  color: var(--primary-neutral);
  font-family: 'Nunito Sans', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  line-height: 1.6;
}
body {
  min-height: 100vh;
  overflow-y: scroll; /* keep scrollbar consistent across pages to prevent layout shift */
}

/* ===== Utilities ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Banner ===== */
.banner {
  position: relative;
  z-index: 5;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 16px 0;
  background: var(--alt-grey);
  box-shadow: var(--shadow);
}
.banner img {
  max-width: 100%;      /* allow it to shrink with screen */
  height: auto;         /* keep aspect ratio */
  display: block;
  margin: 0 auto;       /* center the image */
}

/* ===== Navigation ===== */
.banner-nav nav {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.5);
  gap: 0.75rem;
}
.banner-nav nav a {
  font-family: inherit;
  color: inherit;
  text-decoration: none;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  transition: background 120ms ease, color 120ms ease;
}
.banner-nav nav a:visited {
  color: inherit;
}
.banner-nav nav a.nav-active {
  font-weight: 700;
  color: #000;
}
.banner-nav nav a:hover,
.banner-nav nav a:focus-visible {
  background: var(--accent-orange);
  color: #fff;
}

/* ===== Content ===== */
.content {
  max-width: 920px;
  margin: 2rem auto;
  padding: 0 1rem;
}


h1, h2 {
  font-family: 'Montserrat', 'Barlow Condensed', sans-serif;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
h1 { color: var(--accent-orange); }
h2 { color: var(--primary-neutral); }

/* ===== Cards ===== */
.card {
  background: var(--base-light);
  border: 1px solid #e9e9e9;
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

/* ===== Buttons (UI Components) ===== */
.button-group { margin-top: 1rem; display: flex; gap: 0.5rem; }

.btn-primary {
  background: var(--accent-orange); /* Orange background */
  color: #fff;                      /* White text */
  border: none;
  border-radius: 8px;               /* 8px radius */
  padding: 10px 16px;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow);        /* Shadow: 0 2px 6px rgba(0,0,0,0.1) */
}
.btn-primary:hover {
  background: var(--accent-orange-hover); /* Slightly darker on hover */
}

.btn-secondary {
  background: #fff;
  color: var(--primary-neutral);
  border: 2px solid var(--primary-neutral); /* White border/grey text variant per guide */
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* ===== MCQ Styling ===== */
.mcq .option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 120ms ease;
}
.mcq .option:hover {
  background: var(--alt-grey);
}

/* ===== KaTeX tweaks (guide: inline maths ~90% of body size, display centered) ===== */
.katex-inline { font-size: 0.9em; }            /* Inline maths at ~90% */
.display-math   { text-align: center; }        /* Display maths centered with whitespace */
.display-math .katex-display { margin: 1rem 0; }

/* ===== Footer ===== */
.site-footer {
  position: relative;
  z-index: 5;
  background: var(--alt-grey);
  text-align: center;
  padding: 1rem;
  font-size: 0.95rem;
  border-top: 1px solid #e9e9e9;
}

/* ===== Mobile Adjustments ===== */
@media (max-width: 600px) {

  /* Reduce outer margins and card padding */
  .content {
    padding: 0 0.75rem;
  }

  .card {
    padding: 1rem;
    margin: 1rem 0;
  }

  /* Scale headings slightly smaller for phones */
  h1 {
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 0.75rem;
  }

  h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
  }

  /* Slightly smaller body text for tighter layouts */
  p, label, button {
    font-size: 0.95rem;
  }

  /* Buttons: full width stack instead of side-by-side */
  .button-group {
    flex-direction: column;
    gap: 0.75rem;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
  }

  /* Banner padding reduction */
  .banner {
    padding: 6px 0;
  }

  /* Footer spacing */
  .site-footer {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
}

/* ===== Take Quiz Lobby ===== */
.takequiz-lobby {
  max-width: 960px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}

.takequiz-lobby h1 {
  text-align: center;
}

.lobby-card {
  background: var(--base-light);
  border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: var(--shadow);
  border: 1px solid #ececec;
}

.lobby-meta {
  margin: 0.6rem 0 1.2rem;
  color: #4a4a4a;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: center;
}
.lobby-meta-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.lobby-meta-row span {
  flex: 1 1 30%;
}
.lobby-meta-notes {
  justify-content: center;
}

.lobby-help {
  margin: 0;
  color: #3c3c3c;
  font-weight: 500;
}

.alias-grid {
  margin-top: 1.75rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  list-style: none;
  padding: 0;
}

.alias-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms ease;
}
.alias-tile--disabled {
  opacity: 0.35;
  filter: grayscale(90%);
  cursor: not-allowed;
}
.alias-tile--disabled .alias-shape {
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.1);
}
.alias-tile--disabled .alias-shape::before,
.alias-tile--disabled .alias-shape::after {
  display: none;
}

.alias-shape-wrapper {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alias-tile * {
  pointer-events: none;
}

.alias-tile:focus-visible {
  outline: 3px solid var(--accent-orange);
  outline-offset: 4px;
}

.alias-shape {
  --alias-color: var(--accent-sky);
  width: 100%;
  height: 100%;
  background: var(--alias-color);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  clip-path: polygon(8% 0, 92% 0, 100% 15%, 100% 85%, 92% 100%, 8% 100%, 0 85%, 0 15%);
  box-shadow: inset 0 -5px 9px rgba(0,0,0,0.2), 0 10px 18px rgba(0,0,0,0.2);
  color: #111;
  font-size: clamp(0.95rem, 2vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.alias-shape::before,
.alias-shape::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.alias-shape::before {
  background: linear-gradient(145deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 40%);
  mix-blend-mode: screen;
  opacity: 0.7;
}

.alias-shape::after {
  background: linear-gradient(315deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0) 55%);
  mix-blend-mode: multiply;
  opacity: 0.6;
}

.alias-tile--selected .alias-shape {
  opacity: 0.45;
  transform: scale(0.95);
  filter: grayscale(30%);
}

.alias-shape[data-shape="circle"] {
  clip-path: circle(50% at 50% 50%);
}

.alias-shape[data-shape="square"] {
  clip-path: inset(0);
}

.alias-shape[data-shape="rectangle"] {
  clip-path: inset(5% 8%);
}

.alias-shape[data-shape="triangle"] {
  clip-path: polygon(4% 4%, 96% 4%, 50% 96%);
}

.alias-shape[data-shape="pentagon"] {
  clip-path: polygon(50% 4%, 96% 38%, 78% 96%, 22% 96%, 4% 38%);
}

.alias-shape[data-shape="hexagon"] {
  clip-path: polygon(25% 4%, 75% 4%, 96% 50%, 75% 96%, 25% 96%, 4% 50%);
}

.alias-shape[data-shape="trapezoid"] {
  clip-path: polygon(20% 4%, 80% 4%, 96% 96%, 4% 96%);
}

.alias-shape[data-shape="oval"] {
  clip-path: ellipse(45% 38% at 50% 50%);
}

.alias-shape[data-shape="parallelogram"] {
  clip-path: polygon(15% 4%, 100% 4%, 85% 96%, 0% 96%);
}

.alias-shape[data-shape="kite"] {
  clip-path: polygon(50% 6%, 86% 50%, 50% 94%, 14% 50%);
}

.alias-shape[data-shape="rhombus"] {
  clip-path: polygon(50% 4%, 96% 50%, 50% 96%, 4% 50%);
}

.alias-initials {
  text-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.alias-empty {
  margin: 1rem 0 0;
  color: #555;
  font-style: italic;
}

.lobby-footnote {
  margin-top: 1.75rem;
  color: #666;
  font-size: 0.95rem;
}

@media (max-width: 600px) {
  .alias-shape-wrapper {
    width: 90px;
    height: 90px;
  }
}

/* ===== Alias Modal ===== */
.alias-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.alias-modal[hidden] {
  display: none;
}
.alias-modal__card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  width: min(360px, 92vw);
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  position: relative;
}
.alias-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #555;
}
.alias-modal__alias {
  font-weight: 700;
  margin-bottom: 0.75rem;
  text-align: center;
  color: #222;
}
#aliasPinInput {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #ccc;
  margin-top: 0.35rem;
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-align: center;
}
.alias-modal__actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}
.alias-modal__error {
  min-height: 1.2rem;
  color: #c62828;
  font-weight: 600;
  margin: 0.5rem 0 0;
  text-align: center;
}

/* ===== Take Quiz Session ===== */
.takequiz-session {
  max-width: 880px;
  margin: 2rem auto;
  padding: 0 1rem 3rem;
}

.quiz-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

.quiz-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.quiz-card__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  color: #888;
  margin: 0 0 0.1rem;
}

.quiz-card__progress {
  font-weight: 600;
  color: var(--accent-orange);
  margin: 0;
}

.quiz-card__instructions {
  background: #fff6ec;
  border: 1px solid #ffd3a8;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 1rem 0 1.5rem;
  color: #6b3500;
}

.quiz-start {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.quiz-complete {
  text-align: center;
  margin: 2rem 0;
}

.quiz-complete__actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.btn-tertiary {
  border: 1px solid rgba(0,0,0,0.2);
  background: transparent;
  color: #444;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
}

.quiz-question__title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #444;
}

.quiz-stem {
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.quiz-stem img {
  width: 500px;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0.75rem auto;
}

.quiz-choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.choice-btn {
  width: 100%;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: #fff;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(0,0,0,0.06);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.choice-btn:hover,
.choice-btn:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-orange);
  box-shadow: 0 10px 22px rgba(0,0,0,0.1);
  outline: none;
}

.choice-btn.is-static {
  cursor: default;
  box-shadow: none;
  border-style: dashed;
}

.choice-label {
  font-weight: 700;
  color: var(--accent-orange);
  min-width: 24px;
}

.choice-text {
  flex: 1;
  font-size: 1.2rem;
  line-height: 1.6;
}

.quiz-choices.review li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.choice-meta .tag {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.tag-correct {
  background: #e6ffed;
  color: #027a1b;
}

.tag-wrong {
  background: #ffecec;
  color: #b00020;
}

.choice-correct .choice-btn {
  border-color: #86d694;
}

.choice-selected {
  opacity: 0.85;
}

.choice-selected-correct .choice-btn {
  border-color: #0aa53c;
  box-shadow: 0 0 0 2px rgba(10,165,60,0.2);
}

.review-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}
.review-nav span {
  min-height: 1px;
}
.review-done {
  justify-self: center;
}

.quiz-empty {
  margin: 2rem 0 0;
  font-style: italic;
  color: #666;
}
.review-nav a.btn-primary,
.review-nav a.btn-secondary,
.review-nav a.btn-tertiary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
}
.review-nav a.btn-primary {
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
}
.review-nav a.btn-secondary,
.review-nav a.btn-tertiary {
  padding: 0.45rem 1.1rem;
}
.review-nav a.btn-secondary {
  border: none;
  background: #fff;
  box-shadow: var(--shadow);
}
.review-nav a.btn-tertiary {
  border: none;
  box-shadow: var(--shadow);
}
