/* ==========================================================================
   Exemple : Horizon Jeunes, association de quartier (fictive)

   Direction : l'affiche de quartier imprimée en risographie. Deux encres
   (vert et rose fluo) sur papier grenu, photos en bichromie, scotch,
   gommettes, annonces à languettes. Anybody pour les titres (sa largeur
   variable fait littéralement bouger les mots), Atkinson Hyperlegible pour
   le texte, dessinée pour être lisible par tout le monde.
   Mouvement joueur : rebonds, gommettes qui se collent, languettes qui
   tombent quand on les détache.
   ========================================================================== */

@font-face {
  font-family: "Anybody";
  src: url("../fonts/anybody-100-900.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-200-800.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

.assoc {
  --paper: #F4F1EA;
  --ink: #1B1B1F;
  --green: #00A95C;
  --green-deep: #00733F;
  --pink: #FF48B0;
  --pink-deep: #B8196F;
  --tape: rgba(250, 243, 214, 0.78);

  --display: "Anybody", "Arial Black", sans-serif;
  --text: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --gutter: clamp(18px, 5vw, 64px);

  --reveal-from: translateY(28px) rotate(-1.5deg);
  --reveal-duration: 0.75s;
  --reveal-ease: var(--spring);
  --reveal-stagger: 120ms;

  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  /* grain du papier : un bruit SVG très léger, répété */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.assoc :focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.assoc a {
  color: inherit;
}

.assoc h1,
.assoc h2,
.assoc h3 {
  font-family: var(--display);
  font-weight: 900;
  line-height: 0.92;
  text-transform: uppercase;
  text-wrap: balance;
}

/* Repérage approximatif : la seconde encre est légèrement décalée */
.assoc h1,
.assoc h2 {
  text-shadow: 0.045em 0.035em 0 var(--pink);
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */

.a-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 28px;
  padding: 18px var(--gutter);
}

.a-logo {
  display: inline-block;
  padding: 6px 14px 8px;
  background: var(--green);
  color: var(--ink) !important;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 900;
  font-stretch: 70%;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  rotate: -2deg;
  transition: rotate 0.4s var(--spring);
}

.a-logo span {
  color: #fff;
}

.a-logo:hover {
  rotate: 2deg;
}

.a-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.a-nav a {
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(var(--pink), var(--pink)) no-repeat 0 100% / 100% 0;
  transition: background-size 0.25s var(--spring);
}

.a-nav a:hover {
  background-size: 100% 0.45em;
}

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */

.a-btn {
  display: inline-block;
  padding: 12px 20px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--green);
  color: var(--ink) !important;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.3s var(--spring),
    box-shadow 0.3s var(--spring);
}

.a-btn:hover {
  transform: translate(-2px, -3px) rotate(-1.5deg);
  box-shadow: 4px 5px 0 var(--ink);
}

.a-btn--pink {
  background: var(--pink);
}

/* --------------------------------------------------------------------------
   Tirages photo : bichromie (photo en niveaux de gris « imprimée »
   dans une encre), trame, morceau de scotch
   -------------------------------------------------------------------------- */

.a-print {
  position: relative;
  isolation: isolate;
  rotate: var(--r, 0deg);
}

.a-print img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.2) brightness(1.08);
  mix-blend-mode: multiply;
}

.a-print--pink {
  background: var(--pink);
}

.a-print--green {
  background: var(--green);
}

.a-print::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(27, 27, 31, 0.2) 0.8px, transparent 1.3px) 0 0 / 4px 4px;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.a-print::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: -14px;
  left: 50%;
  width: 96px;
  height: 28px;
  background: var(--tape);
  translate: -50% 0;
  rotate: -4deg;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.a-print figcaption {
  position: absolute;
  z-index: 1;
  right: -8px;
  bottom: -14px;
  padding: 4px 10px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  rotate: 2deg;
}

/* --------------------------------------------------------------------------
   Affiche d'accueil
   -------------------------------------------------------------------------- */

/* Le titre occupe toute la largeur ; les photos remontent à droite de ses
   lignes courtes (2 à 4), comme sur une affiche collée. */
.a-hero {
  --title-size: clamp(2.4rem, 6.9vw, 6.5rem);
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas:
    "title title"
    "text photos";
  align-items: start;
  overflow-x: clip;
  gap: 32px clamp(28px, 5vw, 72px);
  padding: clamp(24px, 4vw, 48px) var(--gutter) clamp(64px, 9vw, 120px);
}

.a-hero__title {
  grid-area: title;
  position: relative;
  z-index: 1;
  font-size: var(--title-size);
  line-height: 0.86;
  mix-blend-mode: multiply;
}

.a-line {
  display: block;
  width: fit-content;
  font-stretch: 100%;
  transition: font-stretch 0.6s var(--spring);
}

.a-line--wide {
  font-stretch: 135%;
}

.a-line--narrow {
  font-stretch: 58%;
  color: var(--green-deep);
}

/* Les mots se déplient à l'ouverture de la page */
.js .a-line {
  animation: unfold 1s var(--spring) both;
}

.js .a-line:nth-child(2) { animation-delay: 0.12s; }
.js .a-line:nth-child(3) { animation-delay: 0.24s; }
.js .a-line:nth-child(4) { animation-delay: 0.36s; }

@keyframes unfold {
  from {
    opacity: 0;
    font-stretch: 100%;
    transform: translateY(0.25em);
  }
}

@media (hover: hover) {
  .a-hero__title:hover .a-line--narrow {
    font-stretch: 130%;
  }
}

.a-hero__text {
  grid-area: text;
  max-width: 34em;
}

.a-hero__text p {
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
}

.a-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.a-hero__photos {
  grid-area: photos;
  position: relative;
  display: grid;
  margin-top: calc(var(--title-size) * -2.45 - 32px);
}

.a-hero__photos .a-print:first-child {
  aspect-ratio: 9 / 6.4;
}

.a-hero__photos .a-print:nth-child(2) {
  width: 72%;
  aspect-ratio: 7 / 5.6;
  margin: -18% 0 0 auto;
}

.js .a-hero__photos .a-print {
  animation: drop 0.9s var(--spring) both;
}

.js .a-hero__photos .a-print:nth-child(2) {
  animation-delay: 0.25s;
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-30px) rotate(-6deg) scale(1.04);
  }
}

/* Gommette : se colle en dernier, avec un petit écrasement */
.a-sticker {
  position: absolute;
  left: -6%;
  bottom: 8%;
  z-index: 2;
  display: grid;
  place-content: center;
  width: clamp(120px, 12vw, 156px);
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  rotate: -10deg;
}

.a-sticker strong {
  display: block;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 900;
  font-stretch: 80%;
  line-height: 1;
}

.js .a-sticker {
  animation: slap 0.7s var(--spring) 0.9s both;
}

@keyframes slap {
  from {
    opacity: 0;
    transform: scale(1.7) rotate(-18deg);
  }

  60% {
    opacity: 1;
    transform: scale(0.94);
  }
}

/* --------------------------------------------------------------------------
   Titres de section
   -------------------------------------------------------------------------- */

.a-head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: end;
  gap: 16px clamp(28px, 5vw, 72px);
  margin-bottom: clamp(36px, 5vw, 60px);
}

.a-head h2 {
  font-size: clamp(2.4rem, 6vw, 5rem);
}

.a-head p {
  max-width: 30em;
}

/* --------------------------------------------------------------------------
   Programme de la semaine
   -------------------------------------------------------------------------- */

.a-week {
  padding: clamp(64px, 9vw, 120px) var(--gutter);
  border-top: 3px solid var(--ink);
}

.a-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.a-day {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.a-day__name {
  padding-bottom: 8px;
  border-bottom: 3px solid var(--ink);
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 900;
  font-stretch: 75%;
  text-transform: uppercase;
}

.a-slot {
  padding: 16px 16px 20px;
  border: 3px solid var(--ink);
  border-radius: 14px;
}

.a-day:nth-child(odd) .a-slot {
  rotate: -1deg;
}

.a-day:nth-child(even) .a-slot {
  rotate: 1.2deg;
}

.a-slot--green {
  background: var(--green);
}

.a-slot--pink {
  background: var(--pink);
}

.a-slot--ink {
  background: var(--ink);
  color: var(--paper);
}

.a-slot__time {
  font-weight: 700;
}

.a-slot h3 {
  margin-block: 10px 8px;
  font-size: 1.45rem;
  font-stretch: 85%;
  line-height: 1;
}

.a-slot p:last-child {
  font-size: 0.97rem;
  line-height: 1.4;
}

/* Le jour même, entouré au feutre */
.a-day.is-today .a-day__name::after {
  content: "aujourd’hui";
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  font-stretch: 100%;
  text-transform: none;
  vertical-align: 4px;
  rotate: -4deg;
}

.a-day.is-today .a-slot {
  box-shadow: 6px 6px 0 var(--ink);
}

.a-week__more {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  align-items: center;
  gap: 48px clamp(28px, 6vw, 88px);
  margin-top: clamp(64px, 8vw, 104px);
}

.a-rules h3 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-stretch: 80%;
}

.a-rules ol {
  margin-top: 20px;
  counter-reset: rule;
}

.a-rules li {
  position: relative;
  padding: 14px 0 14px 64px;
  border-top: 3px solid var(--ink);
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  font-weight: 700;
  line-height: 1.3;
  counter-increment: rule;
}

.a-rules li::before {
  content: counter(rule);
  position: absolute;
  left: 0;
  top: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pink);
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}

.a-week__photo {
  aspect-ratio: 10 / 6.2;
}

/* --------------------------------------------------------------------------
   Bénévolat : annonces à languettes
   -------------------------------------------------------------------------- */

.a-help {
  padding: clamp(64px, 9vw, 120px) var(--gutter);
  background: var(--green);
}

.a-help h2 {
  text-shadow: 0.045em 0.035em 0 #fff;
}

.a-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(20px, 3vw, 40px);
}

.a-notice {
  position: relative;
  padding: 26px 22px 0;
  background: #FFFEFA;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  rotate: var(--r, 0deg);
}

.a-notice::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 84px;
  height: 26px;
  background: var(--tape);
  translate: -50% 0;
  rotate: 3deg;
}

.a-notice h3 {
  font-size: 1.6rem;
  font-stretch: 80%;
  line-height: 1;
}

.a-notice > p {
  margin-top: 12px;
  font-size: 1rem;
}

.a-tabs {
  display: flex;
  margin: 22px -22px 0;
  border-top: 2px dashed #9A9A94;
}

.a-tabs li {
  flex: 1;
  border-left: 1px dashed #9A9A94;
}

.a-tabs li:first-child {
  border-left: 0;
}

.a-tabs button {
  display: block;
  width: 100%;
  height: 120px;
  padding: 10px 4px;
  border: 0;
  background: #FFFEFA;
  font-size: 0.8rem;
  font-weight: 700;
  writing-mode: vertical-rl;
  text-align: center;
  cursor: pointer;
  transform-origin: 50% 0;
  transition: rotate 0.2s var(--spring);
}

.a-tabs button:hover {
  rotate: -3deg;
}

/* La languette détachée tombe, puis laisse un trou comme sur une vraie annonce */
.a-tabs button.is-torn {
  animation: tear 0.8s cubic-bezier(0.5, 0, 0.75, 0) forwards;
  pointer-events: none;
}

@keyframes tear {
  15% {
    transform: translateY(6px) rotate(6deg);
  }

  to {
    opacity: 0;
    transform: translateY(140px) rotate(-28deg);
  }
}

.a-help__message {
  max-width: 40em;
  min-height: 1.5em;
  margin-top: 36px;
  font-weight: 700;
}

.a-help__message:empty {
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   Don : le curseur et ce qu'il finance
   -------------------------------------------------------------------------- */

.a-give {
  padding: clamp(64px, 9vw, 120px) var(--gutter);
}

.a-give__inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: 28px clamp(28px, 6vw, 88px);
}

.a-give h2 {
  font-size: clamp(2.4rem, 6vw, 5rem);
}

.a-give__text p {
  max-width: 28em;
  margin-top: 20px;
}

.a-gift {
  display: grid;
  gap: 16px;
  padding: clamp(22px, 3vw, 36px);
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: #FFFEFA;
}

.a-gift__label {
  font-weight: 700;
}

/* Plus le don est grand, plus le chiffre s'élargit (--w, réglé par le script) */
.a-gift__amount {
  font-family: var(--display);
  font-size: clamp(3.2rem, 8vw, 6rem);
  font-weight: 900;
  font-stretch: var(--w, 90%);
  line-height: 1;
  text-shadow: 0.04em 0.035em 0 var(--pink);
  transition: font-stretch 0.35s var(--spring);
}

.a-gift__effect {
  min-height: 3.1em;
  font-size: 1.2rem;
  font-weight: 700;
}

.a-gift__effect.is-new {
  animation: pop 0.5s var(--spring);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) rotate(-1deg);
  }
}

.a-gift .a-btn {
  justify-self: start;
}

.a-gift__note:empty {
  display: none;
}

.a-gift__note {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--paper);
  font-size: 0.95rem;
}

.a-gift__range {
  width: 100%;
  height: 34px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.a-gift__range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(var(--green), var(--green)) no-repeat 0 0 / var(--fill, 17%) 100%, var(--ink);
}

.a-gift__range::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--ink);
}

.a-gift__range::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.a-gift__range::-webkit-slider-thumb {
  width: 34px;
  height: 34px;
  margin-top: -13px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--pink);
  appearance: none;
  transition: transform 0.25s var(--spring);
}

.a-gift__range::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--pink);
}

.a-gift__range:active::-webkit-slider-thumb {
  transform: scale(1.2);
}

/* --------------------------------------------------------------------------
   Le local
   -------------------------------------------------------------------------- */

.a-info {
  padding: clamp(48px, 7vw, 88px) var(--gutter);
  background: var(--ink);
  color: var(--paper);
}

.a-info :focus-visible {
  outline-color: var(--pink);
}

.a-info__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px clamp(24px, 4vw, 56px);
}

.a-info__label {
  margin-bottom: 8px;
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 900;
  font-stretch: 70%;
  line-height: 1;
  text-transform: uppercase;
  color: var(--pink);
}

.a-info a {
  font-weight: 700;
}

.a-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px var(--gutter);
  background: var(--ink);
  border-top: 1px solid rgba(244, 241, 234, 0.2);
  color: #BDB9AF;
  font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   Écrans moyens et petits
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .a-days {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 28px;
  }

  .a-board {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
  }
}

@media (max-width: 800px) {
  .a-hero,
  .a-head,
  .a-give__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .a-hero {
    grid-template-areas:
      "title"
      "text"
      "photos";
  }

  .a-hero__photos {
    width: min(100%, 460px);
    margin-top: 12px;
  }

  .a-week__more {
    grid-template-columns: minmax(0, 1fr);
  }

  .a-sticker {
    left: auto;
    right: -4px;
    bottom: -24px;
  }

  .a-info__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Sur téléphone, le titre passe sur cinq lignes plutôt que de rétrécir */
@media (max-width: 600px) {
  .a-hero {
    --title-size: 12.4vw;
  }

  .a-line--wide {
    font-stretch: 100%;
  }

  .a-days {
    grid-template-columns: minmax(0, 1fr);
  }
}
