/* Shared color for the navbar and homepage panels. */
:root {
  --site-blue: #517699;
}

.navbar {
  background-color: var(--site-blue);
}

/* Ford background: behind homepage content, without blocking clicks. */
body:has(.ford-controls) {
  isolation: isolate;
}

#ford-background {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Compact shared sliders */
.ford-controls {
  width: 190px;
  max-width: 100%;
  margin: 20px 0;
  font: inherit;
  color: var(--bs-secondary-color, #666);
}

.ford-controls label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ford-controls input,
.ford-controls output {
  font: inherit;
}

.ford-controls output {
  color: var(--bs-body-color, #333);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}

.ford-controls input[type="range"] {
  --thumb-size: 16px;
  --thumb-border: 0px;
  display: block;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 2px 0 10px;
  background: transparent;
  color: var(--bs-body-color, #333);
  cursor: pointer;
}

.ford-controls input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: currentColor;
  opacity: 1;
}

.ford-controls input[type="range"]::-moz-range-track {
  height: 2px;
  background: currentColor;
  opacity: 1;
}

.ford-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  box-sizing: border-box;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border: var(--thumb-border) solid transparent;
  background-clip: content-box;
  margin-top: calc((2px - var(--thumb-size)) / 2);
  border-radius: 50%;
  background-color: currentColor;
}

.ford-controls input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border: var(--thumb-border) solid transparent;
  background-clip: content-box;
  border-radius: 50%;
  background-color: currentColor;
}

/* Larger touch targets, with a 28px visible handle on phones and tablets. */
@media (any-pointer: coarse) {
  .ford-controls input[type="range"] {
    --thumb-size: 44px;
    --thumb-border: 8px;
    height: 48px;
  }
}

.ford-controls input[type="range"]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* Opaque panels keep homepage text and controls clear of the circles. */
body:has(.ford-controls) .home-cover {
  --bs-body-bg: var(--site-blue);
  --bs-body-color: #fff;
  --bs-secondary-color: #fff;
  position: relative;
  background: var(--site-blue);
  color: #fff;
  padding: 16px 20px;
  margin: 20px 0 24px;
  border-radius: 6px;
}

body:has(.ford-controls) .home-cover > :last-child {
  margin-bottom: 0;
}

.home-background-controls {
  width: fit-content;
  max-width: 100%;
}

.home-background-controls .ford-controls {
  margin: 0 0 12px;
}

.home-cover a,
.home-cover a:hover,
.home-cover a:focus-visible {
  color: inherit;
}

/* Let the content column shrink to fit narrow screens. */
#quarto-document-content {
  min-width: 0;
}

/* Keep the entire photo upright, with controls alongside it. */
.home-photo-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 20px 0 24px;
}

.homepage-photo-frame {
  position: relative;
  flex: 0 1 220px;
  min-width: 0;
  aspect-ratio: 3 / 4;
}

.homepage-photo-frame .homepage-photo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 133.333333%;
  max-width: none;
  height: 75%;
  transform: translate(-50%, -50%) rotate(90deg);
}

body:has(.ford-controls) .home-photo-controls .home-background-controls {
  flex: 0 1 230px;
  min-width: 0;
  margin: 0;
}

@media (max-width: 480px) {
  .home-photo-controls {
    gap: 12px;
  }

  body:has(.ford-controls) .home-photo-controls .home-background-controls {
    padding: 12px;
  }
}

.watermelon-photo-frame {
  position: relative;
  flex: 1 1 300px;
  min-width: 0;
  max-width: 400px;
  aspect-ratio: 4 / 3;
}

.watermelon-photo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 75%;
  max-width: none;
  height: 133.333333%;
  transform: translate(-50%, -50%) rotate(-90deg);
}

@media (max-width: 600px) {
  .home-photo-controls {
    flex-wrap: wrap;
  }

  .homepage-photo-frame {
    flex-basis: calc(45% - 6px);
  }

  body:has(.ford-controls) .home-photo-controls .home-background-controls {
    flex-basis: calc(55% - 6px);
    box-sizing: border-box;
  }

  .watermelon-photo-frame {
    flex-basis: 100%;
  }
}
