/**
 * Shared mobile-first styles for the public sign-in page and study application.
 * Base rules fit narrow screens; 700px breakpoints progressively add columns.
 * Source order is deliberate: later welcome/quiz/chart rules extend common cards.
 * Presentation remains in this stylesheet so the app needs no inline CSS.
 */

/* Theme/system fonts avoid remote font requests and privacy dependencies. */
:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: #182c38;
  background: #f6f7f3;
  font-size: 16px;
  --accent: #12665b;
}
/* Border-box keeps control/card padding inside narrow-screen widths. */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
/* Shell gutters align header with the capped main content width. */
header {
  padding: 22px max(20px, calc((100vw - 980px) / 2));
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #d8ded7;
  background: #fff;
}
.brand {
  font-weight: 850;
  font-size: 20px;
  letter-spacing: -1px;
  text-decoration: none;
  color: #182c38;
}
.brand span {
  color: var(--accent);
}
/* Home navigation and sign-out share this row in their respective account states;
   wrap on small screens
   rather than squeezing the account heading or the sign-out button. */
.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-weight: 650;
  text-underline-offset: 3px;
}
.badge {
  font-size: 10px;
  letter-spacing: 1px;
  max-width: 100px;
  text-align: right;
}
main {
  max-width: 980px;
  margin: auto;
  padding: 24px 20px 50px;
}
.intro {
  padding: 18px 0 24px;
  max-width: 680px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 2px;
  color: var(--accent);
}
/* Fluid heading size stays legible without separate phone typography. */
h1 {
  font-size: clamp(32px, 6vw, 54px);
  line-height: 1.08;
  letter-spacing: -1.5px;
  margin: 16px 0;
}
h2 {
  font-size: 24px;
  letter-spacing: -0.6px;
}
h3 {
  font-size: 18px;
}
p {
  line-height: 1.65;
}
.intro > p:last-child {
  color: #51626b;
  font-size: 18px;
}
/* Floating, dismissible feedback reserves no page space. Narrow widths and safe
   area padding keep it reachable on mobile; long messages scroll within it. */
.notice-popup {
  position: fixed;
  z-index: 100;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(380px, calc(100vw - 32px));
  max-height: 40dvh;
  overflow: auto;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: #e5efea;
  font-size: 14px;
  box-shadow: 0 4px 20px #182c3826;
  border-radius: 8px;
}
.notice-popup p {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
/* Compact qualification/language controls fit the mobile baseline. */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 24px 0;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin: 12px 0;
}
/* 16px form text and 48px minimum height support readable touch interaction. */
input,
select {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 16px;
  margin-top: 8px;
  padding: 13px;
  background: #fff;
  border: 1px solid #a5b6b0;
  border-radius: 8px;
  min-height: 48px;
}
/* Equal-width view buttons wrap their labels instead of overflowing. */
nav {
  display: flex;
  gap: 5px;
  border-bottom: 1px solid #bac9c2;
  margin: 22px 0 30px;
}
button {
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  border: 1px solid #9cb0a7;
  border-radius: 8px;
  min-height: 48px;
  padding: 12px 16px;
  background: #fff;
  color: #18382f;
  cursor: pointer;
}
button:hover {
  background: #e5efea;
}
button:disabled {
  cursor: default;
  opacity: 0.65;
}
nav button {
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 14px 10px;
  flex: 1;
}
.active {
  box-shadow: inset 0 -3px var(--accent);
  color: var(--accent);
}
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.primary:hover {
  background: #0b5048;
}
/* Reusable surfaces for questions, sharing information, and charts. */
.card {
  background: #fff;
  border: 1px solid #d6dfd7;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}
.qid {
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #577366;
  font-weight: 750;
}
.card h3 {
  line-height: 1.5;
  margin: 10px 0;
}
/* Native answer disclosure retains keyboard and screen-reader behavior. */
details summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--accent);
  font-weight: 650;
}
.answer {
  background: #e6f1eb;
  padding: 12px;
  border-radius: 6px;
}
.wrong {
  background: #fbede7;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
/* Full-width answer buttons wrap long official wording. */
.choices {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}
.choices button {
  text-align: left;
  padding: 16px;
  font-size: 16px;
  font-weight: 450;
}
/* Unique-question coverage and all-attempt accuracy are separate metrics. */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.stat {
  padding: 18px 10px;
  background: #e5efea;
  border-radius: 10px;
  text-align: center;
}
.stat strong {
  display: block;
  font-size: 28px;
}
.stat span {
  font-size: 12px;
}
.topic-row {
  padding: 12px 0;
  border-bottom: 1px solid #dce2dd;
}
progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}
footer {
  border-top: 1px solid #d8ded7;
  padding: 12px 20px;
  text-align: center;
  color: #566c60;
  font-size: 12px;
}
footer a {
  color: var(--accent);
}
/* Footer text wraps naturally on phones. Empty bank metadata
   reserves no space while signed out; copyright follows any available provenance. */
footer p {
  margin: 3px 0;
  line-height: 1.5;
}
footer #source:empty {
  display: none;
}
/* Long sharing URLs must not force horizontal scrolling. */
.wrap {
  overflow-wrap: anywhere;
}
/* Keyboard focus contrast is independent of chart/status colours. */
:focus-visible {
  outline: 3px solid #be7916;
  outline-offset: 3px;
}
/* Visibility state must override any component grid/flex display rules. */
[hidden] {
  display: none !important;
}
/* Progressively add desktop library columns; phones stay single-column. */
@media (min-width: 700px) {
  #results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  #results .card {
    margin: 0;
  }
  .search {
    max-width: 700px;
  }
  #topic {
    max-width: 400px;
  }
  .intro {
    padding-top: 32px;
  }
}
/* Decorative transitions respect reduced-motion preferences. */
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background 0.15s;
  }
}
/* Welcome action/reference layouts extend the shared theme. */
:root .launch {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  background: var(--accent);
  color: #fff;
  padding: 16px 22px;
  min-height: 52px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  margin: 12px 0;
}
.small {
  font-size: 13px !important;
}
.welcome-grid {
  display: grid;
  gap: 16px;
}
.welcome-grid .card {
  margin: 0;
}
.resources {
  display: grid;
  gap: 12px;
}
.resources a {
  display: block;
  padding: 12px 0;
  min-height: 48px;
  color: var(--accent);
}
@media (min-width: 700px) {
  .welcome-grid {
    grid-template-columns: 1fr 1fr;
  }
}
/* Feedback is a native checkbox with a large labelled target. */
.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}
.toggle input {
  width: 24px;
  min-height: 24px;
  margin: 0;
  accent-color: var(--accent);
}
.topic-row button {
  margin: 10px 0;
}
.selected-answer {
  outline: 2px solid #12665b;
}
#quiz-help,
#exam-description {
  font-size: 13px;
  color: #526959;
}
/* Phone charts stack; SVG viewBoxes scale without fixed-width overflow. */
.charts {
  display: grid;
  gap: 16px;
}
.charts .card {
  margin: 0;
}
/* Decorative surface is independent of chart values/accessibility labels. */
.ring-card {
  text-align: center;
  background: #f0edfc;
}
.ring-card svg {
  width: 200px;
  max-width: 100%;
}
.charts svg {
  display: block;
  width: 100%;
}
.charts .ring-card svg {
  margin: auto;
  width: 200px;
}
.charts p {
  font-size: 13px;
  margin-bottom: 8px;
}
@media (min-width: 700px) {
  .charts {
    grid-template-columns: 1fr 1.5fr;
  }
}

/* Pilot lessons retain native keyboard-operable ranges and readable numeric outputs. */
.lesson-card {
  margin-block: 20px;
}
.lesson-card svg {
  width: 100%;
  max-width: 540px;
  display: block;
}
.lesson-card label {
  display: grid;
  gap: 8px;
  margin-block: 16px;
}
.lesson-card input[type='range'] {
  width: 100%;
  min-height: 44px;
}
.lesson-card button {
  margin: 6px 8px 6px 0;
}
.lesson-card a {
  display: block;
  margin-top: 16px;
}
.lesson-output {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  padding-block: 12px;
}

/* Radio-inspired public landing: scoped rules leave signed-in study tools intact.
   The ham shack is illustrative artwork, never measured or learner data.
   System fonts and same-origin artwork avoid third-party asset requests. */
.signal-landing {
  --signal-ink: #142e35;
  --signal-teal: #14665d;
  color: var(--signal-ink);
  padding-block: 12px 28px;
}
.signal-kicker,
.signal-qualifications,
.signal-number {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.3px;
}
.signal-kicker {
  border-bottom: 1px solid #cbd8d2;
  padding-block: 6px 20px;
  color: #4d6568;
}
.signal-hero {
  display: grid;
  gap: 32px;
  align-items: center;
  padding-block: 36px 44px;
}
.signal-qualifications {
  color: var(--signal-teal);
  margin: 0 0 18px;
}
.signal-copy h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.07;
  letter-spacing: -2px;
  margin: 0 0 24px;
}
.signal-copy h1 span {
  color: var(--signal-teal);
}
.signal-intro {
  max-width: 46ch;
  color: #4b6267;
  font-size: 17px;
  margin-bottom: 28px;
}
.signal-copy .launch {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 14px 24px;
  background: var(--signal-ink);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
}
.signal-copy .launch:hover {
  background: var(--signal-teal);
}
.signal-caption,
.signal-resource-caption {
  font-size: 13px;
  color: #52696c;
}
.signal-features {
  display: grid;
  gap: 24px;
  border-block: 1px solid #cbd8d2;
  padding-block: 28px;
}
/* Self-hosted Kalam Regular supplies natural pen strokes without fake bolding.
   Its unmodified SIL OFL license ships beside the font in kalam-license.txt. */
@font-face {
  font-family: 'Shack Handwriting';
  src: url('./kalam-regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* Square exposure plus a proportional footer gives instant-print proportions.
   The photo uses a central crop; the source artwork remains unchanged. Rotate the
   whole print only. The year occupies a fixed overlay and cannot resize the frame. */
.ham-shack {
  position: relative;
  min-width: 0;
  margin: 8px;
  padding: 3% 3% 15%;
  background: #fffdf7;
  border: 1px solid #e1dfd4;
  /* Upper-left light produces a pale contact highlight there and a restrained
     lower-right shadow. Small offsets keep the print close to the scrapbook. */
  box-shadow:
    -1px -1px 0 #ffffffb3,
    1px 2px 2px #18251b29,
    3px 4px 7px #18251b17;
  transform: rotate(3deg);
}
/* Teal scrapbook pockets match the headline ink. The unclipped wrapper casts a
   tiny contact shadow around its clipped paper face, including the diagonal lip.
   Bevelled tips and broad tonal changes suggest a gently curved fold, not metal. */
.photo-corner {
  position: absolute;
  z-index: 1;
  width: clamp(32px, 9%, 46px);
  aspect-ratio: 1;
  color: var(--signal-ink);
  filter: drop-shadow(1px 1.5px 0.8px #10262b45);
  pointer-events: none;
}
.photo-corner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(
    135deg,
    var(--signal-ink) 0%,
    #1a353c 18%,
    #28454c 32%,
    #29454b 37%,
    #1c353c 44%,
    #10262d 48%,
    #0c2026 50%,
    #0c2026 100%
  );
  /* Small bevels soften all three tips; intermediate points bow the long edge
     by less than a pixel at normal size, suggesting paper wrapping over the print. */
  clip-path: polygon(
    5% 0,
    94% 0,
    97% 2%,
    96% 5%,
    76% 26%,
    51% 52%,
    26% 77%,
    5% 96%,
    2% 97%,
    0 94%,
    0 5%
  );
}
.corner-top-left {
  top: -6px;
  left: -6px;
}
.corner-top-right {
  top: -6px;
  right: -6px;
  transform: rotate(90deg);
  /* Counter-rotate local shadow offsets so light remains upper-left in page space. */
  filter: drop-shadow(1.5px -1px 0.8px #10262b45);
}
.corner-bottom-left {
  bottom: -6px;
  left: -6px;
  transform: rotate(-90deg);
  filter: drop-shadow(-1.5px 1px 0.8px #10262b45);
}
.corner-bottom-right {
  bottom: -6px;
  right: -6px;
  transform: rotate(180deg);
  filter: drop-shadow(-1px -1.5px 0.8px #10262b45);
}
.ham-shack img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border: 1px solid #ddd9cd;
}
/* Centre the modest, single-line season/year within the deeper white border. Its own
   baseline remains parallel with the photo; only the complete print is tilted. */
.ham-shack .photo-year {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 0;
  height: 13%;
  display: grid;
  place-items: center;
  margin: 0;
  color: #252d29;
  font-family: 'Shack Handwriting', 'Segoe Print', cursive;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}
/* The marker flourish tracks the caption's text width. Only the stroke is skewed;
   the handwriting keeps the print's baseline and fixed footer geometry. */
.photo-year span {
  position: relative;
  /* A fractional ink spread slightly thickens the existing handwritten strokes
     without substituting a heavier display face or changing caption dimensions. */
  -webkit-text-stroke: 0.25px currentColor;
}
.photo-year span::after {
  content: '';
  position: absolute;
  left: -3%;
  right: 7%;
  bottom: -5px;
  height: 2px;
  background: currentColor;
  border-radius: 65% 30% 55% 40%;
  transform: rotate(-3deg) skewX(-12deg);
  opacity: 0.85;
  pointer-events: none;
}
@media (max-width: 500px) {
  .ham-shack {
    transform: rotate(1.5deg);
    margin: 6px;
  }
}
.signal-number {
  color: var(--signal-teal);
}
.signal-features h2 {
  font-size: 21px;
  letter-spacing: -0.5px;
  margin: 12px 0 8px;
}
.signal-features p {
  margin: 0;
  color: #52696c;
  font-size: 14px;
}
.signal-resources-heading {
  margin: 30px 0 6px;
  font-size: 24px;
  letter-spacing: -0.7px;
}
.signal-resource-caption {
  margin-top: 0;
}
/* Centre the resources introduction on phones only; tablet/desktop keep the
   editorial left alignment independently of the resource-link grid breakpoint. */
@media (max-width: 599px) {
  /* Fit-content preserves the pill shape while auto margins centre only it. */
  .signal-copy .signal-qualifications {
    display: block;
    width: fit-content;
    margin-inline: auto;
  }
  /* Centre the entry action without stretching it or centring the body copy. */
  .signal-landing .signal-copy .launch {
    display: flex;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    text-align: center;
  }
  .signal-resources-heading,
  .signal-resource-caption {
    text-align: center;
  }
}
.signal-landing .resources a {
  color: var(--signal-teal);
}
/* The hero stacks on phones; desktop uses an asymmetric text/artwork composition.
   The artwork retains its full aspect ratio at every screen width. */
@media (min-width: 760px) {
  .signal-hero {
    grid-template-columns: 1.25fr 1fr;
    gap: 44px;
    padding-block: 56px;
  }
  .signal-features {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
}
/* CSS-only decoration stays behind reading surfaces and needs no remote assets. */
body {
  background-color: #f4f7f2;
  background-image:
    radial-gradient(ellipse at 85% 10%, #b5e9d459, transparent 48%),
    radial-gradient(ellipse at 0% 60%, #f5dba338, transparent 45%),
    linear-gradient(#155d4d08 1px, transparent 1px),
    linear-gradient(90deg, #155d4d08 1px, transparent 1px);
  background-size:
    auto,
    auto,
    32px 32px,
    32px 32px;
}
header {
  border-top: 4px solid #b63c3c;
  background: #ffffffed;
  box-shadow: 0 4px 22px #123a3210;
}
.brand {
  letter-spacing: -0.7px;
}
.brand span {
  font-size: 0.75em;
  letter-spacing: 0;
}
.signal-kicker {
  border-bottom-style: dashed;
}
/* Explicit text carries Canadian identity; the maple leaf is decorative. */
.canada-leaf {
  font-size: 23px;
  letter-spacing: 0;
  vertical-align: middle;
  margin-right: 10px;
}
.canada-context {
  border-left: 3px solid var(--signal-teal);
  padding: 6px 0 6px 16px;
  color: var(--signal-teal);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.1px;
  line-height: 1.6;
  margin: 30px 0;
  max-width: 44ch;
}
/* On phones the editorial callout becomes a centred statement with a short
   green accent above it, avoiding the visual language of an error-side bar. */
@media (max-width: 599px) {
  .signal-copy .canada-context {
    border-left: 0;
    padding: 0;
    margin: 36px auto 30px;
    text-align: center;
  }
  .signal-copy .canada-context::before {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    border-radius: 2px;
    margin: 0 auto 16px;
    background: var(--signal-teal);
  }
}
.signal-qualifications {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid #9ecfbb;
  border-radius: 999px;
  background: #e1f2e8;
}
.signal-copy h1 span {
  color: #14665d;
  text-decoration: underline;
  text-decoration-color: #e7b854;
  text-decoration-thickness: 4px;
  text-underline-offset: 7px;
}
.signal-copy .launch {
  /* One calm ink surface establishes the action without competing with the
     photograph. Gold belongs to the editorial underline, not a heavy button rim. */
  background: #1c514a;
  border: 1px solid #1c514a;
  border-radius: 8px;
  padding: 13px 26px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.1px;
  box-shadow: none;
}
.signal-copy .launch:is(:hover, :focus-visible) {
  background: #153e39;
  border-color: #153e39;
}
.signal-caption {
  margin-top: 24px;
}
.signal-features {
  border: 0;
  gap: 16px;
}
.signal-features > div {
  position: relative;
  padding: 24px;
  border: 1px solid #cfddd4;
  border-top: 4px solid #358879;
  border-radius: 4px 4px 18px 18px;
  background: #ffffffed;
  box-shadow: 0 8px 24px #173f3510;
}
.signal-features > div:nth-child(2) {
  border-top-color: #bb8629;
}
.signal-features > div:nth-child(3) {
  border-top-color: #617cad;
}
.signal-landing .resources {
  grid-template-columns: 1fr;
  gap: 12px;
  justify-items: center;
}
/* Match the feature row's desktop columns, but centre each link on its own
   mobile row. Links remain unboxed and retain generous keyboard/touch targets. */
@media (min-width: 760px) {
  .signal-landing .resources {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}
/* Official references read as links rather than app cards or raised controls.
   Keep generous touch targets and native keyboard focus without boxed chrome. */
.signal-landing .resources a {
  width: fit-content;
  max-width: 100%;
  text-align: center;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.signal-landing .resources a:is(:hover, :focus-visible) {
  color: #103f48;
  text-decoration-thickness: 2px;
}
/* Interaction effects run only on deliberate hover/focus, never in a loop.
   Native focus outlines are preserved, and reduced-motion removes transitions. */
@media (prefers-reduced-motion: no-preference) {
  .signal-copy .launch,
  .signal-features > div {
    transition:
      transform 180ms ease,
      box-shadow 180ms ease;
  }
  .signal-copy .launch:is(:hover, :focus-visible) {
    transform: none;
    box-shadow: none;
  }
  .signal-copy .launch:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 2px #102d3426;
  }
  .signal-features > div:hover {
    transform: translateY(-3px);
  }
}
