/* Le calendrier de l’Avent des crevettes.
   Same look as lavoixdescrevettes.org: blue, navy and yellow, Bricolage Grotesque,
   riso grain, hard shadows, tape. Plus a deep-sea calendar with snow and a garland. */

/* ---------- Font (variable: wdth 75–100, wght 200–800) ---------- */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens (from lavoixdescrevettes.org) ---------- */
:root {
  --bleu: #9cb3f7;
  --bleu-pale: #c9d6fb;
  --marine: #00192e;
  --jaune: #ffc907;
  --blanc: #eef2ff;
  --font: "Bricolage Grotesque", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --border: 3px solid var(--marine);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%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 .1 0 0 0 0 .18 1.7 0 0 0 -1.08'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .6 0 0 0 0 .7 0 0 0 0 .97 1.6 0 0 0 -1.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--grain-light), var(--marine);
  color: var(--marine);
  font-family: var(--font);
  font-variation-settings: "opsz" 28;
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--marine);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--jaune);
}

.defs {
  position: absolute;
}

.cache {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 52px;
  padding: 0.5em 1.1em 0.45em;
  font: inherit;
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 1.3rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--marine);
  text-decoration: none;
  border: var(--border);
  background: var(--jaune);
  box-shadow: 5px 5px 0 var(--ombre, var(--marine));
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ombre, var(--marine));
}
.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--ombre, var(--marine));
}
.btn .fleche {
  transition: transform 0.15s;
}
.btn:hover .fleche {
  transform: translate(3px, 2px);
}
/* the example button in test mode has no link */
.btn:not([href]) {
  cursor: default;
}

/* ---------- Test mode banner ---------- */
.bandeau-test {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 40;
  margin: 0;
  translate: -50% 0;
  padding: 0.25em 0.8em 0.15em;
  background: var(--marine);
  color: var(--jaune);
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ---------- Top: the live shrimp behind the title ---------- */
.haut {
  display: grid;
  place-items: center;
  min-height: min(92svh, 940px);
  padding: 64px var(--gutter) 96px;
  background: var(--grain), var(--bleu);
  text-align: center;
}
.haut-contenu {
  display: grid;
  justify-items: center;
  gap: clamp(14px, 2.6vh, 26px);
}
.titre-boite {
  position: relative;
}
/* Same placement as lavoixdescrevettes.org: the eye just left of the title. */
.crevette-stage {
  left: 4%;
  top: 50%;
  width: 150%;
  transform: translate(-19.1%, -47%);
}
@media (max-width: 767px) {
  .haut {
    min-height: 76svh;
  }
  .crevette-stage {
    left: 5%;
    width: 125%;
  }
}
.titre {
  margin: 0;
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.8;
  letter-spacing: -0.012em;
}
.titre .petit {
  display: block;
  font-weight: 500;
  font-size: clamp(1.5rem, min(5.4vw, 6.2vh), 3.5rem);
  line-height: 1;
  margin-bottom: 0.08em;
  letter-spacing: -0.015em;
}
.titre .grand {
  display: block;
  font-size: clamp(3.6rem, min(20vw, 20vh), 11.5rem);
}
.intro {
  margin: 0;
  max-width: 30ch;
  font-stretch: 75%;
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  line-height: 1.08;
  text-wrap: balance;
}
.statut {
  margin: 0;
  padding: 0.18em 0.6em 0.1em;
  background: var(--blanc);
  border: 2px solid var(--marine);
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.05em;
  rotate: -2deg;
}

/* ---------- Calendar: the deep sea, with snow and a garland ---------- */
.calendrier {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(92px, 12vw, 130px) 0 clamp(64px, 9vw, 110px);
}

/* Marine snow: dots in two tiles that fall at different speeds.
   Each layer moves exactly a whole number of tiles (420 px), so the loop has no jump. */
.neige {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.neige::before,
.neige::after {
  content: "";
  position: absolute;
  inset: -420px 0 0;
  background-image:
    radial-gradient(circle at 24px 36px, var(--blanc) 0 2.2px, transparent 3px),
    radial-gradient(circle at 118px 160px, var(--blanc) 0 1.6px, transparent 2.4px),
    radial-gradient(circle at 176px 70px, var(--blanc) 0 2.6px, transparent 3.4px),
    radial-gradient(circle at 70px 120px, var(--blanc) 0 1.3px, transparent 2px);
  background-size: 210px 210px;
  opacity: 0.5;
  animation: tombe 34s linear infinite;
  will-change: transform;
}
.neige::after {
  background-size: 140px 140px;
  background-position: 60px 0;
  opacity: 0.28;
  animation-duration: 52s;
}
@keyframes tombe {
  to {
    transform: translateY(420px);
  }
}

/* String of lights: each bulb hangs from its own dip of wire. */
.guirlande {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  height: 60px;
  pointer-events: none;
}
.guirlande i {
  position: relative;
  flex: 1;
  color: var(--jaune);
}
.guirlande i:nth-child(3n + 2) {
  color: var(--blanc);
}
/* a deeper blue than --bleu, so it reads as blue next to the white bulb */
.guirlande i:nth-child(3n) {
  color: #3d6bff;
}
.guirlande i::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -24px;
  height: 48px;
  border-bottom: 2px solid var(--bleu-pale);
  border-radius: 0 0 50% 50%;
}
.guirlande i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 21px;
  width: 13px;
  height: 20px;
  margin-left: -6.5px;
  border-radius: 45% 45% 50% 50% / 35% 35% 65% 65%;
  background: linear-gradient(var(--bleu-pale) 0 5px, currentColor 5px);
  box-shadow: 0 6px 16px 1px currentColor;
  animation: brille 2.6s ease-in-out infinite;
}
.guirlande i:nth-child(2n)::after {
  animation-delay: -1.3s;
}
.guirlande i:nth-child(3n)::after {
  animation-delay: -0.6s;
}
@keyframes brille {
  50% {
    opacity: 0.5;
    box-shadow: 0 6px 6px -2px currentColor;
  }
}
@media (max-width: 699px) {
  .guirlande i:nth-child(n + 9) {
    display: none;
  }
}

/* ---------- The doors ---------- */
.portes {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  width: min(100% - 2 * var(--gutter), 980px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(18px, 3vw, 34px) clamp(14px, 2.6vw, 30px);
}
@media (min-width: 700px) {
  .portes {
    grid-template-columns: repeat(6, 1fr);
  }
}

.case {
  position: relative;
  aspect-ratio: 4 / 5;
}
/* a slightly hand-made grid */
.case:nth-child(3n + 1) {
  rotate: -1.2deg;
}
.case:nth-child(4n + 2) {
  rotate: 1deg;
}
.case.ouverte {
  z-index: 2;
}

.case-bouton {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--marine);
  cursor: pointer;
  perspective: 800px;
  -webkit-tap-highlight-color: transparent;
}
.case-bouton:focus-visible {
  outline: 3px solid var(--jaune);
  outline-offset: 7px;
  box-shadow: none;
}
.case[data-etat="futur"] .case-bouton {
  cursor: not-allowed;
}

/* what's behind the door */
.dedans {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--grain), var(--bleu-pale);
  box-shadow: inset 7px 7px 0 rgb(0 25 46 / 0.28);
}
/* the drawings: yellow crayon like the shrimp, no outline.
   The yellow stroke only rounds the corners. The crayon texture is the #crayon filter in index.html. */
.dedans svg {
  width: 60%;
  fill: var(--jaune);
  stroke: var(--jaune);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  overflow: visible;
}
.dedans .point {
  fill: var(--marine);
  stroke: none;
}
.dedans .sombre {
  fill: var(--marine);
  stroke: var(--marine);
}
.dedans .trait-clair {
  fill: none;
  stroke: var(--bleu);
  stroke-width: 4;
}
/* lines drawn in the background colour: the shell's ribs, the seaweed's middle */
.dedans .creux {
  fill: none;
  stroke: var(--bleu-pale);
  stroke-width: 3.5;
}
.dedans .bulle {
  fill: none;
  stroke-width: 3;
}
.dedans .branche {
  fill: none;
  stroke-width: 12;
}
.ouverte .dedans svg {
  animation: etoile 0.6s 0.35s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
@keyframes etoile {
  from {
    scale: 0.3;
    rotate: -40deg;
  }
}

/* the door itself, hinged on the left */
.porte {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.35, 1.35, 0.5, 1);
}
.ouverte .porte {
  transform: rotateY(-112deg);
}
@media (hover: hover) {
  .case:not([data-etat="futur"]):not(.ouverte) .case-bouton:hover .porte {
    transform: rotateY(-16deg);
    transition-duration: 0.35s;
  }
}
.face,
.dos {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face {
  display: grid;
  place-items: center;
  background: var(--grain), var(--jaune);
  box-shadow: 5px 5px 0 var(--bleu);
  transition: box-shadow 0.3s;
}
.dos {
  transform: rotateY(180deg);
  background: var(--grain), color-mix(in srgb, var(--jaune) 72%, var(--marine));
}
.ouverte .face {
  box-shadow: none;
}
.case[data-etat="futur"] .face {
  background: var(--grain), var(--bleu);
  box-shadow: 5px 5px 0 var(--bleu-pale);
}

/* snow on top of each door */
.face::before {
  content: "";
  position: absolute;
  top: -9px;
  left: -5px;
  right: -4px;
  height: 17px;
  background: var(--blanc);
  border-radius: 12px 14px 9px 7px / 10px 12px 8px 9px;
}
.num {
  font-stretch: 75%;
  font-weight: 800;
  font-size: clamp(2.3rem, 7.4vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* today's door: a strip of tape and a little knock now and then */
.case[data-etat="aujourdhui"]::after {
  content: "Aujourd’hui";
  position: absolute;
  z-index: 3;
  top: -16px;
  left: 50%;
  translate: -50% 0;
  rotate: -5deg;
  padding: 0.2em 0.55em 0.12em;
  background: color-mix(in srgb, var(--blanc) 88%, transparent);
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(0.72rem, 1.6vw, 0.95rem);
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.case[data-etat="aujourdhui"]:not(.ouverte) .case-bouton {
  animation: toc 3.4s ease-in-out infinite;
}
@keyframes toc {
  0%,
  82%,
  100% {
    rotate: 0deg;
  }
  86% {
    rotate: -3deg;
  }
  90% {
    rotate: 3deg;
  }
  94% {
    rotate: -1.5deg;
  }
}

/* a locked door shakes its head */
.case.non .case-bouton {
  animation: non 0.45s ease-in-out;
}
@keyframes non {
  20% {
    translate: -7px 0;
  }
  40% {
    translate: 6px 0;
  }
  60% {
    translate: -4px 0;
  }
  80% {
    translate: 2px 0;
  }
}

.sans-js {
  margin: 2em var(--gutter) 0;
  text-align: center;
  color: var(--bleu);
  font-weight: 700;
}

/* ---------- Message for a locked door ---------- */
.message {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 0.55em 1em 0.45em;
  background: var(--jaune);
  border: var(--border);
  box-shadow: 4px 4px 0 var(--bleu);
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  translate: -50% calc(100% + 40px);
  transition: translate 0.3s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.message.visible {
  translate: -50% 0;
}

/* ---------- The card behind a door ---------- */
.carte {
  width: min(100% - 32px, 480px);
  max-height: calc(100% - 32px);
  padding: 0;
  border: var(--border);
  background: var(--grain), var(--bleu);
  color: var(--marine);
  box-shadow: 9px 9px 0 var(--jaune);
  overflow: visible;
}
.carte[open] {
  animation: carte 0.4s cubic-bezier(0.3, 1.45, 0.5, 1);
}
@keyframes carte {
  from {
    opacity: 0;
    scale: 0.82;
    rotate: -4deg;
  }
}
/* custom properties don't reach ::backdrop everywhere, so the navy is written out */
.carte::backdrop {
  background: rgb(0 25 46 / 0.72);
}
.carte-contenu {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: 30px clamp(22px, 5vw, 36px) 34px;
}
.etiquette {
  margin: -48px 0 0;
  padding: 0.2em 0.6em 0.12em;
  background: var(--jaune);
  border: 2px solid var(--marine);
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  rotate: -3deg;
}
.carte-titre {
  margin: 0;
  padding-right: 28px;
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(2.1rem, 8vw, 3.1rem);
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.carte-texte {
  margin: 0;
  font-weight: 500;
}
.carte .btn {
  margin-top: 6px;
}
.fermer {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 2rem;
  line-height: 1;
  color: var(--marine);
  cursor: pointer;
}
.fermer:hover {
  background: var(--marine);
  color: var(--bleu);
}

/* ---------- Footer ---------- */
.pied {
  padding: 0 var(--gutter) clamp(48px, 7vw, 72px);
  text-align: center;
}
/* on navy, the hard shadow is blue */
.pied .btn {
  --ombre: var(--bleu);
}
.insta {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

/* ---------- People who turn off animations get a still calendar ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .neige::before,
  .neige::after,
  .guirlande i::after,
  .case-bouton,
  .dedans svg,
  .carte[open] {
    animation: none !important;
  }
  .porte,
  .message {
    transition: none;
  }
}
