:root {
  --color-primary: #28348b;
  --color-secondary: #e30613;
  --color-tertiary: #3db56a;
  --color-tertiary-dark: #00782f;
  --color-background: #ffffff;
  --color-text: #28348b;
  --content-width: 80rem;
  --page-padding: clamp(1.25rem, 5vw, 4rem);
  --logo-width: 80rem;
  --title-size: clamp(1.5rem, 1rem + 2.6vw, 2.5rem);
  --date-size: clamp(0.8rem, 1.4vw, 1.05rem);
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 20rem;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--color-text);
  background: var(--color-background);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

img,
svg,
picture,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

main {
  display: flex;
  width: min(100%, var(--content-width));
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  padding-block: clamp(2rem, 8vh, 6rem);
  /* respecte les encoches / bords arrondis des téléphones */
  padding-left: max(var(--page-padding), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-padding), env(safe-area-inset-right, 0px));
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

main > a[aria-label='Accueil POUR'] {
  display: block;
  width: min(100%, var(--logo-width));
}

main > a[aria-label='Accueil POUR'] img {
  width: 100%;
}

.logo {
  width: 100%;
  height: 500px; /* hauteur desktop d'origine (était en style inline) */
  object-fit: contain;
}

.date {
  margin: clamp(1.5rem, 4vw, 3rem) 0 0;
  color: var(--color-primary);
  font-size: var(--date-size);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.rule {
  width: min(100%, 30rem);
  height: 0.75rem;
  margin: clamp(1rem, 3vw, 2rem) auto;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px #d8dbe8;
  background: linear-gradient(
    90deg,
    var(--color-primary) 0 25%,
    var(--color-background) 25% 50%,
    var(--color-background) 50% 75%,
    var(--color-secondary) 75% 100%
  );
}

h1 {
  max-width: none;
  margin: 0;
  color: var(--color-primary);
  font-size: var(--title-size);
  line-height: 1.12;
  font-weight: 500;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* h1::after {
  display: block;
  width: clamp(3rem, 8vw, 6rem);
  height: 0.35rem;
  margin: clamp(1.25rem, 3vw, 2rem) auto 0;
  border-radius: 999px;
  background: var(--color-secondary);
  content: '';
} */

/* ---------- Tablette (portrait et paysage) ---------- */
@media (max-width: 64rem) {
  :root {
    --page-padding: 2.5rem;
    --logo-width: min(100%, 44rem);
  }

  /* le saut de ligne forcé casse mal le titre sur écran étroit :
     le texte se répartit tout seul grâce à text-wrap: balance */
  h1 br {
    display: none;
  }

  /* la hauteur suit la largeur : plus de logo géant sur tablette/téléphone.
     !important pour passer devant un éventuel style="height" inline */
  .logo {
    height: auto !important;
    max-height: 60vh;
  }

  .rule {
    width: min(100%, 24rem);
  }
}

/* ---------- Grand téléphone / petite tablette ---------- */
@media (max-width: 48rem) {
  :root {
    --page-padding: 1.5rem;
    --logo-width: min(100%, 28rem);
  }

  main {
    padding-block: 3rem;
  }

  .date {
    letter-spacing: 0.08em;
  }

  .rule {
    height: 0.625rem;
  }
}

/* ---------- Téléphone ---------- */
@media (max-width: 30rem) {
  :root {
    --page-padding: 1rem;
    --logo-width: 100%;
  }

  main {
    min-height: 100svh;
    padding-block: 2rem;
  }

  .date {
    max-width: 28ch;
    letter-spacing: 0.06em;
  }

  .rule {
    width: min(100%, 16rem);
    height: 0.5rem;
  }
}

/* ---------- Très petit écran ---------- */
@media (max-width: 22.5rem) {
  .date {
    font-size: 0.75rem;
  }
}

/* ---------- Téléphone en mode paysage (hauteur réduite) ---------- */
@media (max-height: 30rem) and (orientation: landscape) {
  :root {
    --logo-width: min(100%, 20rem);
  }

  main {
    min-height: 0;
    padding-block: 1.5rem;
  }

  .date {
    margin-top: 1rem;
    max-width: none;
  }

  .rule {
    margin-block: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Page 404 ---------- */
.page-404 .logo {
  height: auto;
  max-height: 16rem;
}

.text {
  max-width: 36rem;
  margin: 1.25rem 0 0;
  color: var(--color-text);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  line-height: 1.6;
  text-wrap: balance;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

.btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  border: 2px solid var(--color-primary);
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s,
    border-color 0.2s;
}

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

.btn-outline {
  color: var(--color-primary);
  background: transparent;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  color: var(--color-background);
  background: var(--color-primary);
}

.btn:focus-visible {
  outline: 3px solid var(--color-tertiary);
  outline-offset: 3px;
}

@media (max-width: 30rem) {
  .actions {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}
