/* Day/night toggle: a pixel sun or moon, no frame. */
.mode {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: 0.95rem/1 var(--pixel);
  color: var(--ink);
  background: none;
  border: none;
  padding: 0.5rem 0.4rem;
  min-height: 2.75rem;
  min-width: 2.75rem;
  justify-content: center;
  cursor: pointer;
}

/* The link to the other language, set like the day/night toggle. */
.lang {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 2.25rem;
  padding: 0.5rem 0.3rem;
  font: 0.95rem/1 var(--pixel);
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.lang:hover,
.lang:focus-visible {
  color: var(--accent);
}

.mode:hover {
  color: var(--accent);
}

.mode #mode-icon {
  display: inline-flex;
  color: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
  .mode:hover #mode-icon {
    animation: bob 0.5s steps(2) infinite;
  }
}

@keyframes bob {
  50% { transform: translateY(-3px); }
}

/* Full-bleed pixel landscape under the hero. The canvas height is set from script. */
.sky-band {
  width: 100%;
  margin-top: 1rem;
}

/* The middle banner sits between the two halves of the content. */
.sky-band-mid {
  margin-top: 4rem;
}

/* The closing banner sits between the last section and the footer. */
.sky-band-foot {
  margin-top: 3rem;
}

.scene {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}

/* Seasonal pixels drift down the whole page, behind the text. */
.weather {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
}

/* Sparks that fly off the pointer, above the page but never in the way of a click. */
.sparks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
  image-rendering: pixelated;
}

/* Phones: the toggle keeps only its icon, with the label for screen readers. */
@media (max-width: 30rem) {
  .mode #mode-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Hover the full stop or the blinking cursor after the greeting and a pirate flag is planted there. */
.hero-end {
  position: relative;
  display: inline-block;
  padding: 0.2em 0.35em 0.1em 0.1em;
  margin: -0.2em -0.35em -0.1em -0.1em;
  cursor: pointer;
}

.flag {
  position: absolute;
  left: 0.55em;
  bottom: 0.18em;
  line-height: 0;
  transform-origin: 0 100%;
  transform: scaleY(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s steps(5), opacity 0.2s steps(3);
}

.hero-end:hover .flag,
.hero-end:active .flag {
  transform: scaleY(1);
  opacity: 1;
}

.flag-svg {
  display: block;
  overflow: visible;
}

.flag-pole {
  fill: color-mix(in srgb, var(--ink) 70%, var(--hill-2));
}

.flag-edge {
  fill: var(--accent);
}

.flag-black {
  fill: #17120e;
}

.flag-bone {
  fill: #f2ead3;
}

.hero-end:hover .flag-cloth {
  animation: flutter 0.5s steps(1) infinite;
}

@keyframes flutter {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flag {
    transition: none;
  }
  .hero-end:hover .flag-cloth {
    animation: none;
  }
}

/* The flag is planted where the cursor blinks, so the cursor steps aside while it flies. */
.hero-end:hover .cursor,
.hero-end:active .cursor {
  visibility: hidden;
  animation: none;
}
