/* Theme tokens */
:root {
  --color-brand-blue: #0070b8;
  --color-brand-dark: #2c2c71;
  --color-white: #ffffff;
  --color-black: #000000;

  --color-gray-100: #e2e2e2;
  --color-gray-300: #505559;
  --color-gray-800: #1d2939;

  --font-family-sans: Arial, "Open Sans", system-ui, -apple-system, sans-serif;
  --font-family-headline: "Anton", "Open Sans", sans-serif;

  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.12);
  --shadow-reveal: 0 16px 40px -8px rgba(0, 0, 0, 0.35);
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100dvh;
  font-family: var(--font-family-sans);
  color: var(--color-black);
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow-x: hidden;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Visually hidden, but exposed to assistive tech (e.g. titles rendered in the
   background image still need a text equivalent in the DOM). */
.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;
}

/* Focus visibility — uses currentColor so it adapts to light/dark backgrounds */
:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* Optin radios sit on a white card — ring (on the visible label) uses brand blue */
.optin-input:focus-visible + .optin-btn {
  outline: 3px solid var(--color-brand-blue);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Reveal-card buttons sit on white — use brand blue for the ring */
.reveal-card :focus-visible {
  outline-color: var(--color-brand-blue);
}

/* App shell */
.app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.header {
  width: 100%;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-white);
  z-index: 10;
}

.logo-tdf {
  width: 110px;
  height: auto;
}

.stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.stage-bg {
  inset: 0;
  background-image: url("../assets/background.4523b7bc.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

/* Views */
.view {
  display: none;
  width: 100%;
  position: relative;
  z-index: 1;
  flex-direction: column;
}

.view--active {
  display: flex;
}

/* Scoop layout — shared bits */
.view--scoop {
  justify-content: flex-end;
  pointer-events: none;
}

.view--scoop .scoop {
  pointer-events: auto;
  background-color: var(--color-brand-blue);
  color: var(--color-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: absolute;
}

/* Launch path choices — wrapped in an <ol> so assistive tech announces the two
   options as a set. display:contents removes the list's own boxes so the buttons
   stay direct flex children of .scoop--compact and inherit its existing spacing. */
.path-choices,
.path-choices > li {
  display: contents;
}

/* Sheet layout — shared bits */
.view--sheet {
  justify-content: flex-end;
}

.view--sheet .sheet {
  width: 100%;
  background-color: var(--color-brand-blue);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.view--sheet .sheet--center {
  text-align: center;
}

.view--sheet .sheet .btn--primary {
  margin-block-start: auto;
}

.sheet-title {
  font-family: var(--font-family-headline);
  font-weight: normal;
  color: var(--color-white);
  text-align: center;
}

/* Reveal overlay */
.view--overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(1px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Typography */
.eyebrow {
  font-family: var(--font-family-headline);
  font-weight: normal;
  letter-spacing: 0.6px;
  margin-bottom: 2px;
}

.lead {
  font-weight: normal;
}

.display {
  max-width: 265px;
  font-family: var(--font-family-headline);
  font-weight: normal;
  line-height: 1.25;
  letter-spacing: 0.5px;
  margin-block: 0;
}

.display--lg {
  color: var(--color-white);
}

/* max-width is 240px at every breakpoint, so it lives here rather than being
   repeated in mobile.css and desktop.css */
.display--md {
  max-width: 240px;
}

/* Game */
.game-video {
  width: 100%;
  max-width: 355px;
  border-radius: 30px;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 628px;
}

/* Prize visuals */
.result-img {
  width: 100%;
  aspect-ratio: 980 / 531;
  background-size: cover;
  background-position: center;
}

.prize--postal_card .result-img {
  background-image: url("../assets/postal_card.51ddd931.webp");
}

.prize--photos .result-img {
  background-image: url("../assets/photos.3f5c66a3.webp");
}

.lose--result .result-img {
  background-image: url("../assets/lost_image.d3d04d2c.webp");
}

.result-text {
  font-weight: bold;
  line-height: 1.2;
  color: var(--color-white);
}

.result-disclaimer {
  line-height: 1.2;
  color: var(--color-white);
}

.result-fineprint {
  color: var(--color-white);
  font-style: italic;
}

.accessibility-link {
  color: var(--color-white);
  font-size: 13px;
}

/* Buttons */
.btn {
  width: 100%;
  max-width: 312px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  font-family: var(--font-family-headline);
  font-weight: normal;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    opacity 0.2s ease;
}

a.btn {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background-color: var(--color-brand-dark);
  color: var(--color-white);
}

.btn--loading {
  pointer-events: none;
  color: transparent;
  position: relative;
}

.btn--loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
}

.link-btn.btn--loading {
  color: transparent;
  text-decoration: none;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.link-btn {
  color: var(--color-white);
  text-decoration: underline;
}

/* Rules toggle */
.rules-toggle {
  display: inline-flex;
  gap: 12px;
  color: var(--color-white);
  cursor: pointer;
}

.rules-toggle .rules-text {
  text-align: start;
}

/* The real checkbox: a native <input>, visually hidden but still operable and in
   the a11y tree. These styles vanish when stylesheets are disabled, so the
   browser falls back to a normal, usable checkbox — the control never disappears.
   The visible box and tick are drawn in CSS on the decorative .rules-box span. */
.rules-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.rules-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-white);
  background-color: transparent;
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

/* Tick — a rotated, two-sided border (no SVG), shown when the input is checked. */
.rules-checkbox:checked ~ .rules-box::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--color-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Focus ring on the visible box while the hidden input has keyboard focus. */
.rules-checkbox:focus-visible ~ .rules-box {
  outline: 3px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

.rules-text {
  color: var(--color-white);
}

.rules-text .link {
  color: var(--color-white);
  text-decoration: underline;
}

/* Optin sheet */
.optin-card {
  background-color: var(--color-white);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.optin-group-title {
  color: var(--color-black);
}

.optin-group-title--compact {
  margin: 0;
}

.optin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.optin-row--wide {
  flex-direction: column;
  gap: 20px;
}

.optin-label {
  color: var(--color-gray-800);
  flex: 1;
}

.optin-choice {
  display: flex;
  flex: 2;
}

/* Native radio, visually hidden but operable — falls back to a real radio when
   CSS is off. The visible Oui/Non box is the adjacent <label>.optin-btn. */
.optin-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.optin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--color-brand-blue);
  background-color: var(--color-white);
  color: var(--color-brand-blue);
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.optin-input:checked + .optin-btn {
  background-color: var(--color-brand-blue);
  color: var(--color-white);
}

.optin-row#profilage {
  border-top: 1px solid var(--color-brand-blue);
}

.mentions {
  font-size: 14px;
  color: var(--color-white);
  padding-inline: 15px;
  margin-block-start: 15px;
}

.mentions a {
  color: var(--color-white);
}

.mentions .mentions-block2 {
  display: none;
}

/* Reveal card */
.reveal-card {
  width: 100%;
  background-color: var(--color-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-reveal);
}

.reveal-card .display {
  letter-spacing: 0;
  color: var(--color-brand-blue);
  margin: 0;
}

.reveal-card--error .display {
  color: #da3832;
}

.reveal-status {
  font-weight: bold;
  color: var(--color-brand-blue);
}

.reveal-instructions {
  color: var(--color-brand-blue);
}

.redirect {
  width: 100%;
  margin-block-start: auto;
}

.sheet:not(.mobile) .redirect .content {
  display: none !important;
}

.finish-actions {
  display: flex;
  flex-direction: column;
}

/* Layout shared by every viewport at or above 430px (tablet + desktop).
   Previously duplicated identically in mobile.css and desktop.css. */
@media (min-width: 430px) {
  .stage-bg {
    position: absolute;
    flex: none;
  }

  .view {
    flex: 1 1 auto;
  }

  .view--scoop {
    align-items: center;
  }

  .view--sheet {
    align-items: center;
    justify-content: stretch;
  }
}

/* Honour users who request reduced motion: collapse animations and transitions
   to near-zero so visual effects still complete (state changes work) without
   sustained motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
