/* Animations and small polish, CSS only. Everything is visible by default; motion is layered on
   only when the visitor allows it, and scroll reveals only where supported. */
::selection {
  background: #90d0c8;
  color: #023f34;
}
:focus-visible {
  outline: 2px solid #63a99f;
  outline-offset: 3px;
  border-radius: 4px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
}
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(48px);
  }
}
@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}
@keyframes float {
  50% {
    translate: 0 -8px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* Page load: hero copy staggered, then hero image */
  main > section:first-child .max-w-\[573px\] > * {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  main > section:first-child .max-w-\[573px\] > :nth-child(1) {
    animation-delay: 0.05s;
  }
  main > section:first-child .max-w-\[573px\] > :nth-child(2) {
    animation-delay: 0.15s;
  }
  main > section:first-child .max-w-\[573px\] > :nth-child(3) {
    animation-delay: 0.25s;
  }
  main > section:first-child .max-w-\[573px\] > :nth-child(4) {
    animation-delay: 0.35s;
  }
  main > section:first-child .max-w-\[573px\] > :nth-child(5) {
    animation-delay: 0.45s;
  }
  main > section:first-child .max-w-\[573px\] > :nth-child(6) {
    animation-delay: 0.55s;
  }
  main > section:first-child > div:last-child {
    animation: slide-in 0.9s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  /* Floating overlay cards */
  main .float-card {
    animation: float 7s ease-in-out infinite;
  }
  main .float-card.space-y-3 {
    animation-duration: 8.5s;
    animation-delay: -3s;
  }

  /* Mobile menu fades in when opened */
  #nav-toggle:checked ~ nav {
    animation: drop 0.25s ease-out both;
  }

  /* Hover micro-interactions */
  a[class*="rounded-lg"] > svg {
    transition: transform 0.3s;
  }
  a[class*="rounded-lg"]:hover > svg {
    transform: translateX(4px);
  }
  .lift {
    transition:
      transform 0.3s,
      box-shadow 0.3s;
  }
  .lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 48px -20px rgba(2, 63, 52, 0.28);
  }
  .tile {
    transition: transform 0.3s;
  }
  .lift:hover .tile,
  .grid > div:hover > div:first-child > .tile {
    transform: rotate(-6deg) scale(1.08);
  }

  /* Scroll reveals: .rv is added by the script at the end of the page, so nothing is
     hidden without JS. Fill is backwards only, leaving hover transforms free afterwards. */
  .js .rv {
    opacity: 0;
  }
  .js .rv.in {
    opacity: 1;
    animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s) backwards;
  }

  /* Hero: slow drifting glow behind the copy */
  main > section:first-child::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      radial-gradient(
        38% 46% at 22% 30%,
        rgba(144, 208, 200, 0.2),
        transparent 70%
      ),
      radial-gradient(
        30% 40% at 60% 85%,
        rgba(99, 169, 159, 0.16),
        transparent 70%
      );
    background-size: 140% 140%;
    animation: glow 16s ease-in-out infinite alternate;
  }
  main > section:first-child > div:first-of-type {
    position: relative;
  }

  /* Images ease in closer on hover */
  .overflow-hidden > img {
    transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .overflow-hidden:hover > img,
  .lift:hover .avatar > img,
  .group:hover .overflow-hidden > img {
    transform: scale(1.06);
  }
  .avatar {
    transition: box-shadow 0.3s;
  }
  .lift:hover .avatar {
    box-shadow: 0 0 0 4px #90d0c8;
  }

  /* Buttons lift slightly and press in */
  a[class*="rounded-lg"] {
    transition:
      color 0.3s,
      background-color 0.3s,
      border-color 0.3s,
      transform 0.25s,
      box-shadow 0.25s;
  }
  a[class*="rounded-lg"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -12px rgba(2, 63, 52, 0.45);
  }
  a[class*="rounded-lg"]:active {
    transform: translateY(0) scale(0.98);
  }
}

@keyframes glow {
  from {
    background-position: 0% 0%;
  }
  to {
    background-position: 100% 100%;
  }
}

/* Reading progress + header shadow once scrolled */
#progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: 3px;
  background: linear-gradient(90deg, #63a99f, #90d0c8);
  transform: scaleX(0);
  transform-origin: left;
}
header.scrolled {
  box-shadow: 0 10px 30px -18px rgba(2, 63, 52, 0.35);
}

/* Nav links: underline draws in from the left */
header nav a:not([class*="rounded-lg"]) {
  position: relative;
  padding-bottom: 6px;
}
header nav a:not([class*="rounded-lg"])::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: #63a99f;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}
header nav a:not([class*="rounded-lg"]):hover::after {
  transform: scaleX(1);
}
h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif !important;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h4,
h5,
h6,
button,
input,
textarea,
select {
  font-family: "DM Sans", system-ui, sans-serif;
}
p {
  text-wrap: pretty;
}

/* French text runs 15-30% longer: let buttons wrap instead of stretching */
html[lang="fr"] a.whitespace-nowrap {
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

/* Header button: cap its width so the header stays on one row */
html[lang="fr"] header a.whitespace-nowrap {
  max-width: 15rem;
  padding: 0.85rem 1.1rem;
  font-size: 14px;
}

/* Keep menu items on one line */
header nav a { white-space: nowrap; }

/* Long French headings break cleanly instead of overflowing */
html[lang="fr"] h1,
html[lang="fr"] h2,
html[lang="fr"] h3 {
  hyphens: auto;
  overflow-wrap: break-word;
}