/* Shared finishing pass for the Dutch driving field guide.
   unslop by Damir Sokolovsky (@heydamir), CC BY 4.0.
   https://heydamir.design/unslop
   Unlayered so the same tokens and controls apply across every page. */
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-fast: 160ms;
  --motion-enter: 200ms;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-2: 0 8px 24px rgb(0 0 0 / 0.08);
}
html {
  scrollbar-gutter: stable;
  scroll-padding-top: 0;
}
#page {
  min-height: calc(100vh - 80px);
  view-transition-name: page-content;
}
.site-header {
  view-transition-name: site-header;
}
.app-sidebar {
  view-transition-name: app-sidebar;
}
.site-footer,
footer {
  view-transition-name: site-footer;
}
/* Same left edge and top spacing as the other pages. */
.auth-layout {
  width: min(1280px, calc(100% - 64px));
  max-width: none;
  margin: 64px auto 80px;
  align-items: start;
}
.legal {
  width: min(1280px, calc(100% - 64px));
  max-width: none;
  margin: 64px auto 80px;
}
.legal > * {
  max-width: 760px;
}
.header-context {
  display: none !important;
}
/* Only page content fades. The frame stays still and never scales. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}
::view-transition-group(page-content) {
  animation: none;
}
::view-transition-old(page-content) {
  animation: page-leave 120ms var(--ease-out) both;
  mix-blend-mode: normal;
}
::view-transition-new(page-content) {
  animation: page-arrive var(--motion-enter) var(--ease-out) both;
  mix-blend-mode: normal;
}
@keyframes page-leave {
  to {
    opacity: 0;
  }
}
@keyframes page-arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
::view-transition-group(site-header),
::view-transition-group(app-sidebar),
::view-transition-group(site-footer) {
  animation-duration: 0s;
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}
@media (max-width: 760px) {
  .page-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .page-heading > .button {
    align-self: flex-start;
  }
  .auth-layout,
  .legal {
    width: calc(100% - 40px);
    margin-top: 32px;
  }
}

/* One header for every page: same width, same height, links in the same place. */
@media (min-width: 761px) {
  .site-header .header-inner,
  body[data-app="true"] .site-header .header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: min(1280px, calc(100% - 64px));
    max-width: none;
    height: 80px;
    min-height: 80px;
    gap: 32px;
  }
  .site-header .brand,
  body[data-app="true"] .site-header .brand {
    width: auto;
    justify-self: start;
  }
  .site-header .desktop-nav,
  body[data-app="true"] .site-header .desktop-nav {
    display: flex;
    justify-self: center;
  }
  .site-header .desktop-nav .nav-app-only {
    display: none;
  }
  .site-header .header-actions,
  body[data-app="true"] .site-header .header-actions {
    justify-self: end;
  }
  body[data-app="true"] .site-header .header-actions > .button,
  body[data-app="true"] .site-header .login-link {
    display: inline-flex;
  }
  body[data-app="true"] .brand small {
    display: none;
  }
  /* App pages use the same content width as the header. */
  body[data-app="true"] .container.app-layout {
    width: min(1280px, calc(100% - 64px));
  }
  body[data-app="true"] .app-sidebar {
    top: 80px;
    height: calc(100svh - 80px);
  }
}

.sign-media {
  display: grid;
  place-items: center;
  min-height: 280px;
  background: var(--paper, #fff);
  border-radius: 12px;
}
.sign-media svg {
  width: min(220px, 70%);
  height: auto;
  filter: none;
}

/* ===== Design pass ===================================================== */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1,
h2,
h3 {
  text-wrap: balance;
}
p,
li {
  text-wrap: pretty;
}
h1 {
  letter-spacing: -0.022em;
}
h2 {
  letter-spacing: -0.012em;
}
.qcount,
.time,
.price,
.stat-card b {
  font-variant-numeric: tabular-nums;
}

/* Logo */
.brand {
  gap: 12px !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-icon {
  width: 36px !important;
  height: 28px !important;
  flex: none;
  color: var(--blue);
  --logo-lane: var(--paper);
}
.brand-icon svg {
  width: 36px;
  height: 28px;
  display: block;
}
[data-theme="dark"] .brand-icon {
  color: #a9c4ff;
}

/* One control radius and one timing curve; hover never moves the layout. */
.button,
.answer,
.side-link,
.price-card,
.course-topic,
.topic-card,
.lab-tile,
.icon-button,
.confidence button,
.anim-buttons button,
.anim-buttons select {
  transition:
    background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out);
}
.button:active,
.answer:active {
  transform: none;
}
.button,
.button.secondary {
  border-radius: 8px;
  box-shadow: none;
}
.button.secondary {
  border: 1px solid var(--line);
}
@media (hover: hover) {
  .price-card:hover,
  .course-topic:hover,
  .topic-card:hover,
  .lab-tile:hover {
    transform: none;
    box-shadow: none;
  }
  .course-topic:hover,
  .topic-card:hover,
  .lab-tile:hover {
    background-color: var(--soft);
  }
}
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Quiet surfaces let the traffic illustrations carry the colour. */
.panel,
.price-card,
.qcard,
.auth-form,
.home-example,
.course-hero .preview-card {
  box-shadow: none;
}
.price-card.featured {
  border-color: var(--blue);
  box-shadow: none;
}

/* Hero: the road scene is the thing people remember */
.course-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.course-hero::before {
  content: none;
}
.course-hero h1 {
  font-size: clamp(44px, 5.2vw, 68px);
  line-height: 1.04;
}

/* Flat teaching diagrams: distances and hit targets share one coordinate plane. */
.question-media,
.home-player,
.hero-scene {
  perspective: none;
}
.question-media > svg.scene,
.home-player > svg.scene,
.question-media #animation-host svg.scene {
  transform: none;
  border-radius: 0;
  box-shadow: none;
}
.question-media #animation-host,
.home-player {
  perspective: none;
}
#animation-host > svg.scene,
.home-player > svg.scene {
  transform: none;
  border-radius: 0;
  box-shadow: none;
}
/* Keep moving actors as legible as the static illustrations. */
svg.scene .anim-actor {
  filter: none;
}
@media (prefers-reduced-motion: reduce) {
  .question-media > svg.scene,
  #animation-host > svg.scene,
  .home-player > svg.scene {
    transition: none;
  }
}

/* ===== Interaction feedback =========================================== */
#sound-toggle {
  display: inline-grid;
  place-items: center;
}
.answer.correct,
.answer.wrong {
  animation: none;
}
.feedback,
.lab-card-feedback,
.lab-takeaway,
.home-result:not([hidden]),
.focus-complete,
.qcard.question-arrive,
dialog[open] {
  animation: ww-rise var(--motion-enter) var(--ease-out) both;
}
@keyframes ww-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.feedback.bad,
.lab-card-feedback.bad {
  background: var(--red-wash);
  border-left-color: var(--red);
}
.feedback.bad h3 {
  color: var(--red);
}
@media (prefers-reduced-motion: reduce) {
  .answer.correct,
  .answer.wrong,
  .feedback,
  .lab-card-feedback,
  .lab-takeaway,
  .home-result,
  .focus-complete,
  dialog[open] {
    animation: none;
  }
}

@media (max-width: 760px) {
  .brand-icon {
    width: 32px !important;
    height: 24px !important;
    display: block !important;
  }
  .brand-icon svg {
    width: 32px;
    height: 24px;
  }
}

/* Hero demo: the road is the subject, so give it a portrait frame of its own
   and put the question beside it. */
@media (min-width: 1000px) {
  #home-question {
    display: grid;
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "player prompt"
      "player options"
      "player result";
    grid-template-rows: auto auto auto 1fr;
    column-gap: 24px;
    align-items: start;
  }
  #home-question > .home-example-heading {
    grid-area: head;
  }
  #home-question > .home-player {
    grid-area: player;
    border: 0;
    border-radius: 14px;
    overflow: visible;
  }
  #home-question > h2 {
    grid-area: prompt;
    margin-top: 4px;
  }
  #home-question > .home-options {
    grid-area: options;
    grid-template-columns: 1fr;
  }
  #home-question > .home-result {
    grid-area: result;
    margin-top: 12px;
  }
  #home-question .home-player .scene {
    height: auto;
    aspect-ratio: 3 / 4;
    background: transparent;
  }
  #home-question .home-player .anim-controls {
    padding: 12px 0 0;
  }
}
.home-options .answer {
  min-height: 48px;
  justify-content: flex-start;
}
#home-question [data-speed],
#home-question [data-transport="step"] {
  display: none;
}
#home-question .anim-controls {
  display: grid;
  gap: 8px;
}
#home-question .anim-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
#home-question .anim-buttons .time {
  margin-left: auto;
}
.answer-state {
  display: inline-grid;
  place-items: center;
  margin-left: auto;
}
.feedback h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.question-prompt {
  font-size: clamp(20px, 1.6vw, 24px);
  line-height: 1.4;
  letter-spacing: 0;
}
.question-media svg.scene {
  transform: none;
  border-radius: 0;
  box-shadow: none;
}
.question-media {
  perspective: none;
}
.check-list li::before {
  content: "" !important;
  width: 16px;
  height: 16px;
  flex: none;
  background: var(--blue);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.check-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.price-card {
  display: flex;
  flex-direction: column;
}
.price-card .button {
  margin-top: auto;
  width: 100%;
  justify-content: center;
}
.price-card .check-list {
  margin-bottom: 24px;
}
.price-card .price {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Shared finishing details. The illustrations stay untouched by theme motion. */
.nav-account-only {
  display: none;
}
.site-header .desktop-nav .nav-account-only {
  display: none;
}
.login-link {
  white-space: nowrap;
}
.icon-button {
  border-radius: 8px;
}
.price-card,
.home-example,
.focus-callout,
.lab-callout,
.lab-tile,
.auth-form,
.panel {
  border-radius: 12px;
}
.price-card {
  padding: 24px;
}
.check-list li {
  gap: 8px;
}
.home-example {
  min-height: 560px;
}
.home-example-heading {
  gap: 16px;
}
.home-example-heading > b {
  font-weight: 500;
}
.home-example-heading > span {
  white-space: nowrap;
}
.home-player {
  border-radius: 8px;
  overflow: hidden;
}
.anim-buttons button,
.anim-buttons select {
  border-radius: 8px;
}
.side-link {
  border-radius: 8px;
}
.sign-tile {
  min-width: 0;
  overflow-wrap: anywhere;
}
.sign-tile svg {
  max-width: 100%;
}
.qcard,
.faq-list details,
.rule-details {
  scroll-margin-top: 104px;
}
section[id] {
  scroll-margin-top: 104px;
}
.feedback,
.lab-card-feedback {
  animation-duration: var(--motion-enter);
}
.site-header,
.site-footer,
body,
.panel,
.qcard,
.home-example,
.price-card,
.auth-form,
.app-sidebar,
.lab-callout,
.focus-callout {
  transition:
    background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out);
}

/* The header collapses before its links crowd the account controls. Closed
   links remain out of the focus order; opening only changes opacity/transform. */
@media (max-width: 1100px) {
  .site-header .header-inner,
  body[data-app="true"] .site-header .header-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
  }
  .site-header .header-actions,
  body[data-app="true"] .site-header .header-actions {
    gap: 8px;
    flex: none;
  }
  .site-header .header-actions > .button,
  body[data-app="true"] .site-header .header-actions > .button {
    display: none;
  }
  .site-header .menu-button {
    display: inline-grid;
  }
  .site-header .desktop-nav,
  body[data-app="true"] .site-header .desktop-nav {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 16px max(20px, calc((100vw - 1280px) / 2));
    max-height: calc(100svh - 144px);
    overflow-y: auto;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-2);
    /* Visible (and reachable) from the first frame; only the fade and the
       short slide animate. */
    transition:
      opacity var(--motion-fast) var(--ease-out),
      transform var(--motion-fast) var(--ease-out),
      visibility 0s;
  }
  .site-header .desktop-nav:not([data-open="true"]) {
    /* Hide immediately, including when crossing the mobile breakpoint. */
    transition: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
  }
  .site-header .desktop-nav[data-open="true"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }
  .site-header .desktop-nav a,
  .site-header .desktop-nav a:last-child,
  .site-header .desktop-nav .nav-app-only,
  .site-header .desktop-nav .nav-account-only {
    display: block;
    min-height: 44px;
    padding: 12px 0;
    font-size: 15px;
  }
}
@media (max-width: 760px) {
  .site-header .header-inner,
  body[data-app="true"] .site-header .header-inner {
    width: calc(100% - 40px);
    height: 64px;
    min-height: 64px;
    gap: 8px;
  }
  .site-header .brand {
    gap: 8px !important;
  }
  .site-header .header-actions,
  body[data-app="true"] .site-header .header-actions {
    gap: 4px;
  }
  .site-header .login-link,
  body[data-app="true"] .site-header .login-link {
    display: none;
  }
  .home-example {
    min-height: 680px;
  }
  .home-example-heading {
    flex-wrap: wrap;
    gap: 8px;
  }
  .home-example-heading > b {
    font-size: 12px;
  }
  .course-hero h1 {
    font-size: clamp(36px, 10vw, 44px);
  }
  section[id] {
    scroll-margin-top: 88px;
  }
  .qcard {
    scroll-margin-top: 88px;
  }
}
@media (max-width: 360px) {
  .site-header .brand {
    font-size: 16px;
  }
  .site-header .brand-icon,
  .site-header .brand-icon svg {
    width: 28px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}
