/*
 * Sober layout: full-bleed 16/9 visuals that crossfade (main.js), a thin
 * headline, the contact link, and the feature list on the schoolyard visual.
 * Avenir Next is used where installed (macOS, iOS); Nunito Sans stands in
 * everywhere else.
 */

@font-face {
  font-family: "Nunito Sans";
  src: url("assets/fonts/nunito-sans-var.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --text: #FFFFFF;
  --night: #1E2A22;
  --font: "Avenir Next Cyr", "Avenir Next", "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --gutter-l: max(var(--gutter), env(safe-area-inset-left));
  --gutter-r: max(var(--gutter), env(safe-area-inset-right));
  --veil: 8, 16, 10;
  --shade: 0 1px 14px rgba(0, 0, 0, 0.35);
  --fade: 1.5s;
}

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

html {
  height: 100%;
  background: var(--night);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: var(--night);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  text-shadow: var(--shade);
  -webkit-font-smoothing: antialiased;
}

/* Slideshow */

.slides {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity var(--fade) ease-in-out;
}

.slide.is-active {
  opacity: 1;
}

.slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-place img { object-position: 50% 50%; }
.slide-ecole img { object-position: 55% 50%; }

/* Light veils so the text stays legible: top for the header, bottom for the headline */
.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(var(--veil), 0.4) 0%, rgba(var(--veil), 0) 24%),
    linear-gradient(to top, rgba(var(--veil), 0.5) 0%, rgba(var(--veil), 0) 42%);
}

/*
 * Feature list, left of the schoolyard visual; fades with its slide.
 * Foliage behind it is too busy for bare white text, so it sits on a dark,
 * blurred panel. The slide is the backdrop root, so the blur sees its photo.
 */

.features {
  position: absolute;
  z-index: 1;
  top: clamp(5.5rem, 21vh, 13rem);
  left: var(--gutter-l);
  width: min(21rem, 100% - 2 * var(--gutter));
  margin: 0;
  padding: 1.1em 1.3em;
  list-style: none;
  border-radius: 4px;
  background: rgba(var(--veil), 0.45);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: clamp(1rem, 1.45vw, 1.4rem);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .features {
    background: rgba(var(--veil), 0.65);
  }
}

.features li {
  padding: 0.75em 0;
  text-wrap: balance;
}

.features li + li {
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.features li:first-child {
  padding-top: 0;
}

.features li:last-child {
  padding-bottom: 0;
}

/* Header, headline and footer sit above the slides */

.top,
.stage,
.bottom {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(var(--gutter), env(safe-area-inset-top)) var(--gutter-r) 0 var(--gutter-l);
  /* the header often sits on light facades: a slightly firmer shadow */
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
}

.logo img {
  display: block;
  height: clamp(1.5rem, 3vw, 2rem);
  width: auto;
}

.logo-temp {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  letter-spacing: 0.04em;
}

.logo-temp::before {
  content: "";
  width: 1.45em;
  height: 1.45em;
  background: url("assets/favicon.svg") center / contain no-repeat;
}

.contact {
  color: inherit;
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.25s;
}

.contact:hover,
.contact:focus-visible {
  text-decoration-color: currentColor;
  outline: none;
}

.stage {
  display: flex;
  align-items: flex-end;
  padding: 0 var(--gutter-r) clamp(0.5rem, 2vh, 1.25rem) var(--gutter-l);
}

.headline {
  display: grid;
  margin: 0;
  font-weight: 200;
  font-size: clamp(2.2rem, min(7vw, 13vh), 6.5rem);
  line-height: 1.05;
  letter-spacing: -0.005em;
}

/* Both lines share one cell, bottom-aligned, and crossfade with their slide */
.headline > span {
  grid-area: 1 / 1;
  align-self: end;
  opacity: 0;
  transition: opacity var(--fade) ease-in-out;
}

.headline > span.is-active {
  opacity: 1;
}

.bottom {
  padding: 0 var(--gutter-r) max(clamp(0.75rem, 2.5vh, 1.5rem), env(safe-area-inset-bottom)) var(--gutter-l);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.credit {
  margin: 0;
  opacity: 0.85;
}

.credit sup {
  font-size: 0.65em;
}

.credit a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-color 0.25s;
}

.credit a:hover,
.credit a:focus-visible {
  text-decoration-color: currentColor;
  outline: none;
}

@media (max-width: 640px) {
  .features {
    top: 5.25rem;
    font-size: 0.95rem;
  }

  .features li {
    padding: 0.7em 0;
  }

  .bottom {
    font-size: 0.7rem;
  }
}

/* Landscape phones: keep the list clear of the header and the headline */
@media (max-height: 500px) {
  .features {
    top: 4.75rem;
    font-size: 0.85rem;
    width: min(26rem, 100% - 2 * var(--gutter));
    padding: 0.8em 1em;
  }

  .features li {
    padding: 0.45em 0;
  }
}

/* The crossfade only changes opacity, nothing moves, so it stays for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .contact,
  .credit a {
    transition: none;
  }
}
