/*
  BACKGROUND IMAGE
  To change the picture: put it in the "images" folder and change the URLs below, e.g.
    --background-image: url("images/background.jpg");
  --background-image-mobile is used on phones (portrait). You can use the same picture
  for both, or a separate portrait crop for phones.
  --background-position decides which part of the photo stays visible when it is cropped
  (e.g. "center", "30% 50%", "left bottom").
*/
:root {
  --background-image: url("images/background.png");
  --background-image-mobile: url("images/background.png");
  --background-position: center;
  /* size of the sharp photo on portrait phones: "contain" = whole photo visible,
     e.g. "auto 45%" = bigger, sides slightly cropped */
  --background-size-mobile: contain;
  /* darkening on top of the photo, strongest in the middle behind the text */
  --overlay: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.3) 45%, rgba(0, 0, 0, 0.15) 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  color: #fff;
  background-color: #111;
}

/* Background sits in its own fixed layer, so it doesn't jump when the
   phone's address bar shows/hides while scrolling */
.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #222;
  /* dark overlay keeps the text readable on any photo */
  background-image: var(--overlay), var(--background-image);
  background-size: cover;
  background-position: var(--background-position);
  background-repeat: no-repeat;
}

.logo {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  z-index: 10;
}

.logo img {
  display: block;
  width: 100px;
  height: auto;
}

.hero {
  min-height: 100vh;
  min-height: 100svh; /* correct full height on phones with browser bars */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px max(16px, env(safe-area-inset-right)) 80px max(16px, env(safe-area-inset-left));
}

.hero h1 {
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 1.15;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 4px 24px rgba(0, 0, 0, 0.6);
}

.hero h1 span {
  white-space: nowrap; /* never break the date in the middle */
}

.hero p {
  margin-top: 0.75em;
  font-size: clamp(1.1rem, 2.5vw, 1.75rem);
  letter-spacing: 0.3em;
  margin-right: -0.3em; /* compensates letter-spacing so it stays visually centred */
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Phones & small tablets */
@media (max-width: 700px) {
  .logo {
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
  }

  .logo img {
    width: 72px;
  }

  /* Two clean lines instead of an awkward wrap:
       2. LMKS_GC Duathlon
       25. April 2027 */
  .hero h1 {
    font-size: clamp(1.4rem, 6.6vw, 2.8rem);
    line-height: 1.2;
  }

  .hero h1 span {
    display: block;
    white-space: normal; /* on very narrow phones the name may wrap instead of being cut off */
  }

  .hero h1 .dash {
    display: none;
  }

  .hero p {
    margin-top: 1em;
    font-size: 1.05rem;
  }
}

/* Portrait phones: the landscape photo would be cropped to a narrow strip with "cover",
   so show it in full (sharp, centred) and fill the space above/below with a blurred copy */
@media (max-width: 700px) and (orientation: portrait) {
  .background {
    background-image: none;
    overflow: hidden;
  }

  .background::before,
  .background::after {
    content: "";
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-position: center;
  }

  /* blurred fill */
  .background::before {
    background-image: var(--background-image-mobile);
    background-size: cover;
    filter: blur(24px) brightness(0.85);
    transform: scale(1.15); /* hides the soft blurred edges */
  }

  /* the full, sharp photo + darkening overlay */
  .background::after {
    background-image: var(--overlay), var(--background-image-mobile);
    background-size: 100% 100%, var(--background-size-mobile);
  }
}

/* Phones turned sideways: very little height, keep things compact */
@media (max-height: 500px) and (orientation: landscape) {
  .logo img {
    width: 56px;
  }

  .hero {
    padding-top: 80px;
    padding-bottom: 32px;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 6vw, 2.6rem);
  }

  .hero h1 span {
    display: inline;
  }

  .hero h1 .dash {
    display: inline;
  }
}
