/* ==========================================================================
   TOEIC placement-test result pages + pathway estimator — shared components
   Scope: the 9 result pages, their shared template, and estimateur-parcours.html.
   Uses the Hublingua design-system tokens (Poppins/DM Sans, blue/orange/cream
   palette) so these pages read as part of the same site as the rest of
   Hublingua Online, including the placement test itself.
   ========================================================================== */

:root {
  --brand-blue: #175984;
  --brand-blue-dark: #0E3A56;
  --brand-blue-soft: #EAF2F7;
  --accent-orange: #FD9905;
  --accent-orange-dark: #A85F00;
  --accent-orange-soft: #FFF1DC;
  --page-bg: #FBF8F3;
  --surface: #FFFFFF;
  --text-main: #1A2430;
  --text-muted: #4A5663;
  --border: #D9E1E6;
  --scale-point-inactive: #C7D1D9;

  --font-body: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Poppins", "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-main);
  background: var(--page-bg);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.8rem, 5vw, 4.8rem); line-height: 1; font-weight: 800; }
h2 { font-size: clamp(1.9rem, 3vw, 2.8rem); line-height: 1.1; font-weight: 700; }
h3 { font-size: 1.25rem; line-height: 1.3; font-weight: 700; }
h4 { font-size: 1.1rem; line-height: 1.35; font-weight: 700; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-blue); }
a:hover { color: var(--brand-blue-dark); }

:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* Shared Hublingua Online navigation */

.site-header {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 230px;
  height: auto;
}

.site-nav {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--brand-blue);
}

.header-booking {
  flex: none;
  padding: 8px 14px;
  border: 2px solid var(--brand-blue);
  border-radius: 7px;
  color: var(--brand-blue);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}

.header-booking:hover {
  color: #fff;
  background: var(--brand-blue);
}

.result-context-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 42px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.result-context-nav a {
  color: var(--brand-blue);
  font-size: .88rem;
  font-weight: 700;
  text-underline-offset: 4px;
}

@media (max-width: 980px) {
  .site-header__inner {
    flex-wrap: wrap;
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-top: 2px;
    white-space: nowrap;
  }

  .header-booking {
    margin-left: auto;
  }
}

@media (max-width: 520px) {
  .site-header {
    padding: 14px 0;
  }

  .site-header__inner {
    gap: 13px;
    padding: 0 18px;
  }

  .brand img {
    width: 185px;
  }

  .header-booking {
    padding: 7px 9px;
    font-size: 12px;
  }

  .site-nav {
    gap: 16px;
  }
}

/* ==========================================================================
   Layout
   ========================================================================== */

.result-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 28px 96px;
  text-align: left;
}

.section {
  margin-top: 72px;
}

.section:first-child {
  margin-top: 0;
}

.prose {
  max-width: 680px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

/* ==========================================================================
   Card
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 4px 18px rgba(23, 89, 132, 0.06);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.button-primary,
.button-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 9px;
  padding: 14px 22px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

@media (min-width: 480px) {
  .button-primary,
  .button-accent {
    width: auto;
  }
}

.button-primary {
  background: var(--brand-blue);
  color: #FFFFFF;
}

.button-primary:hover {
  background: var(--brand-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(14, 58, 86, 0.24);
}

.button-primary:focus-visible {
  background: var(--brand-blue-dark);
}

/* Orange is too light for AA-reliable white text at rest, so buttons use
   dark text by default; on hover the darker orange swatch does clear AA
   with white, which is when the swap happens. */
.button-accent {
  background: var(--accent-orange);
  color: var(--text-main);
}

.button-accent:hover {
  background: var(--accent-orange-dark);
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(168, 95, 0, 0.22);
}

.button-accent:focus-visible {
  background: var(--accent-orange-dark);
  color: #FFFFFF;
}

/* ==========================================================================
   Urgent box
   ========================================================================== */

.urgent-box {
  background: var(--accent-orange-soft);
  border-left: 5px solid var(--accent-orange);
  border-radius: 10px;
  padding: 24px;
}

/* ==========================================================================
   CEFR scale
   Mobile-first: a vertical line with ticks to one side, base layout below.
   A min-width media query switches it to the familiar horizontal scale.

   Two moving parts:
   - current level: no separate marker — the matching tick is switched to
     the .cefr-scale__tick--current state by cefr-scale.js, so it can never
     collide with anything else on the line.
   - target score: a continuous position along the line, set by
     cefr-scale.js as the --pos custom property (a percentage), since a
     score can fall anywhere between two ticks.
   ========================================================================== */

.cefr-scale {
  --track-length-vertical: 300px;
}

.cefr-scale__track {
  position: relative;
  width: 4px;
  height: var(--track-length-vertical);
  margin: 8px 0 8px 140px;
  background: var(--border);
  border-radius: 2px;
}

.cefr-scale__tick {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(-50%);
}

.cefr-scale__tick:nth-child(1) { top: 0%; }
.cefr-scale__tick:nth-child(2) { top: 14.2857%; }
.cefr-scale__tick:nth-child(3) { top: 28.5714%; }
.cefr-scale__tick:nth-child(4) { top: 42.8571%; }
.cefr-scale__tick:nth-child(5) { top: 57.1429%; }
.cefr-scale__tick:nth-child(6) { top: 71.4286%; }
.cefr-scale__tick:nth-child(7) { top: 85.7143%; }
.cefr-scale__tick:nth-child(8) { top: 100%; }

.cefr-scale__tick-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--scale-point-inactive);
  transform: translateX(-50%);
}

.cefr-scale__tick-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform: translateX(-3px);
}

.cefr-scale__tick-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cefr-scale__tick-qualifier {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 170px;
  line-height: 1.3;
}

.cefr-scale__tick--current .cefr-scale__tick-dot {
  width: 16px;
  height: 16px;
  background: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--brand-blue-soft);
}

.cefr-scale__tick--current .cefr-scale__tick-label {
  color: var(--brand-blue);
  font-weight: 800;
}

/* Current position is never conveyed by color alone: the label always
   gets an explicit text suffix too. */
.cefr-scale__tick--current .cefr-scale__tick-label::after {
  content: " · vous";
  font-weight: 700;
}

.cefr-scale__target {
  position: absolute;
  top: var(--pos, 0%);
  right: calc(100% + 14px);
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(-50%);
  white-space: nowrap;
}

.cefr-scale__target-pin {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50% 50% 50% 0;
  background: var(--accent-orange);
  transform: rotate(-45deg);
}

.cefr-scale__target-label {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent-orange-dark);
}

.cefr-scale__legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin: 28px 0 0;
  padding: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.cefr-scale__legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cefr-scale__legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.cefr-scale__legend-swatch--current { background: var(--brand-blue); }
.cefr-scale__legend-swatch--target { background: var(--accent-orange); }

@media (min-width: 640px) {
  .cefr-scale__track {
    width: 100%;
    height: 4px;
    margin: 56px 0 70px;
  }

  .cefr-scale__tick {
    top: 50% !important;
    left: 0;
    flex-direction: column;
    gap: 12px;
    transform: translate(-50%, -50%);
  }

  .cefr-scale__tick:nth-child(1) { left: 0%; align-items: flex-start; transform: translate(0, -50%); }
  .cefr-scale__tick:nth-child(2) { left: 14.2857%; }
  .cefr-scale__tick:nth-child(3) { left: 28.5714%; }
  .cefr-scale__tick:nth-child(4) { left: 42.8571%; }
  .cefr-scale__tick:nth-child(5) { left: 57.1429%; }
  .cefr-scale__tick:nth-child(6) { left: 71.4286%; }
  .cefr-scale__tick:nth-child(7) { left: 85.7143%; }
  .cefr-scale__tick:nth-child(8) { left: 100%; align-items: flex-end; transform: translate(-100%, -50%); }

  .cefr-scale__tick-dot {
    transform: none;
  }

  .cefr-scale__tick-text {
    align-items: center;
    text-align: center;
    transform: none;
  }

  .cefr-scale__tick:nth-child(1) .cefr-scale__tick-text { align-items: flex-start; text-align: left; }
  .cefr-scale__tick:nth-child(8) .cefr-scale__tick-text { align-items: flex-end; text-align: right; }

  .cefr-scale__tick-qualifier {
    max-width: 120px;
  }

  .cefr-scale__target {
    top: auto;
    left: var(--pos, 0%);
    right: auto;
    bottom: calc(100% + 14px);
    flex-direction: column-reverse;
    gap: 6px;
    transform: translateX(-50%);
  }

  .cefr-scale__target-pin {
    transform: rotate(135deg);
  }
}

/* ==========================================================================
   Result-page specific pieces: level heading, target display, pathway
   timeline, "primary" card variant, footer disclaimer.
   ========================================================================== */

.level-heading {
  margin-bottom: 4px;
}

.level-qualifier {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.target-display {
  margin-bottom: 8px;
}

.target-display__label {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent-orange-dark);
  letter-spacing: -0.01em;
}

.target-display__note {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 680px;
  margin-top: 6px;
}

/* Primary recommendation card: white background with a small blue top
   border and label, not a fully blue card, per spec — blue still reads
   as "this is the important one" without competing with the CEFR scale's
   own use of blue for the current-level marker. */
.card--primary {
  border-top: 4px solid var(--brand-blue);
}

.card-label {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-blue);
  margin-bottom: 10px;
}

.card-secondary-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: underline;
}

.card-secondary-link:hover {
  color: var(--brand-blue);
}

/* Pathway timeline: simple text-with-arrows, wraps on narrow screens
   instead of scrolling. */
.pathway {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.pathway__step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.pathway__step-course {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pathway__arrow {
  color: var(--scale-point-inactive);
  font-size: 1.2rem;
  flex: none;
}

.pathway-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 16px;
  max-width: 680px;
}

.footer-disclaimer {
  margin-top: 96px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Toggled by result-page.js depending on whether the engine's override
   fired; keeps the show/hide logic declarative rather than scattered
   through JS. */
[data-hide-on-override] { }
body.is-override [data-hide-on-override] { display: none; }
body.is-override [data-show-on-override] { display: block; }
[data-show-on-override] { display: none; }

/* ==========================================================================
   Pathway estimator — shared by result pages and standalone estimator
   ========================================================================== */

.estimator-intro {
  max-width: 720px;
  color: var(--text-muted);
}

.estimator-current {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.estimator-current__label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.estimator-current__value {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-blue);
}

.estimator-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 720px) {
  .estimator-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .estimator-fields--standalone {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.estimator-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.estimator-field select {
  width: 100%;
  min-height: 50px;
  padding: 10px 42px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-main);
  font: inherit;
}

.estimator-field select:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 2px;
}

.estimator-help {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.estimator-error {
  min-height: 1.5em;
  margin-top: 14px;
  color: #8A2A1F;
  font-weight: 600;
  font-size: 0.9rem;
}

.estimator-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 22px 0 28px;
}

@media (min-width: 640px) {
  .estimator-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

.estimator-summary__item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.estimator-summary__label {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.estimator-summary__value {
  font-family: var(--font-heading);
  font-weight: 800;
}

.estimator-objective {
  max-width: 760px;
  margin-bottom: 26px;
  padding: 18px 20px;
  border-left: 4px solid var(--brand-blue);
  background: var(--brand-blue-soft);
  border-radius: 8px;
}

.estimator-steps {
  display: grid;
  gap: 16px;
}

.estimator-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.estimator-step__number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-weight: 800;
}

.estimator-step--choice .estimator-step__number {
  width: auto;
  min-width: 78px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.estimator-step__body h3 {
  margin-bottom: 5px;
}

.estimator-step__meta {
  margin-bottom: 8px;
  color: var(--brand-blue);
  font-weight: 700;
  font-size: 0.92rem;
}

.estimator-step__note {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.estimator-step__product {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.estimator-verdict {
  max-width: 760px;
  margin-top: 24px;
}

.estimator-hours {
  font-weight: 700;
  color: var(--text-main);
}

.estimator-actions {
  display: block;
  margin-top: 24px;
}

.estimator-actions .button-primary,
.estimator-actions .button-accent {
  width: auto;
}

.next-step__heading {
  margin-top: 0;
  margin-bottom: 8px;
}

.next-step__intro {
  max-width: 780px;
  color: var(--text-muted);
}

.next-step__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.next-step__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  border: 2px solid var(--brand-blue);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
}

.next-step__course {
  margin-bottom: 6px;
}

.next-step__product {
  margin-bottom: 12px;
  color: var(--brand-blue);
  font-weight: 700;
}

.next-step__schedule {
  margin: 2px 0 10px;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.next-step__schedule li + li {
  margin-top: 5px;
}

.next-step__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: auto;
  padding-top: 10px;
}

.next-step__actions .button-primary {
  width: auto;
  border: 2px solid var(--brand-blue);
  background: transparent;
  color: var(--brand-blue);
  box-shadow: none;
}

.next-step__actions .button-primary:visited {
  color: var(--brand-blue);
}

.next-step__actions .button-primary:hover,
.next-step__actions .button-primary:focus-visible,
.next-step__actions .button-primary:active {
  border-color: var(--brand-blue);
  background: var(--brand-blue);
  color: #FFFFFF;
}

.next-step__actions .button-primary:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(14, 58, 86, 0.18);
}

.trademark-notice {
  display: block;
  margin-top: 14px;
  font-size: 0.78rem;
  line-height: 1.55;
}

.contact-action,
.all-courses-link {
  display: inline-flex;
  margin-top: 18px;
}

.urgent-box .next-step__grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.urgent-box .next-step__card {
  border-width: 1px;
  border-color: var(--accent-orange-dark);
}

.below-entry-card {
  max-width: 780px;
}

.below-entry-card + .below-entry-card {
  margin-top: 18px;
}

.secondary-note {
  color: var(--text-muted);
  font-size: 0.95rem;
}
