/* Sections: the big page blocks, top to bottom.
   Mobile first. Nav and event rows switch at 50em (800px); the side-by-side
   hero and events layouts switch at 70em (1120px), below which they stack. */

/* Hero --------------------------------------------------------------------
   Stacked (phones, tablets): photo on top, fading into night, text below.
   The photo is sized by --photo-w so Colita stays centred and in proportion.
   Wide (70em+): photo fills the right side; night fades keep the left readable.
   Everything scales with the width so the composition matches Figma. */

.hero {
  --photo-w: min(205vw, 1100px);
  position: relative;
  overflow: hidden;
}

.hero__photo {
  position: relative;
  height: calc(var(--photo-w) * 0.56);
  overflow: hidden;
}

.hero__photo img {
  position: absolute;
  top: calc(var(--photo-w) * 0.024);
  left: calc(50% - var(--photo-w) * 0.49);
  width: var(--photo-w);
  max-width: none;
  height: auto;
}

/* Night fades over the photo: a short one at the top for the nav, a long one at the bottom into the text. */
.hero__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgb(28 30 74 / 0.8), transparent calc(var(--photo-w) * 0.14)),
    linear-gradient(to bottom, transparent 53%, rgb(28 30 74 / 0.85) 89%, var(--night) 100%);
}

.hero__content {
  position: relative;
  margin-top: calc(var(--photo-w) * -0.0975);
  padding: 0 var(--gutter) 3rem;
}

.hero__intro {
  max-width: 32.5rem;
  margin: 1.25rem 0 1.5rem;
}

.hero__credit {
  position: absolute;
  top: calc(var(--photo-w) * 0.424);
  right: var(--gutter);
  font-size: 0.6875rem;
  opacity: 0.7;
}

@media (min-width: 50em) {
  .hero__intro {
    font-size: 1.375rem;
    margin: 1.5rem 0 2.25rem;
  }
}

@media (min-width: 70em) {
  .hero {
    min-height: min(52.8vw, 54rem);
  }

  .hero__photo {
    position: absolute;
    inset: 0;
    height: auto;
  }

  .hero__photo img {
    top: -2vw;
    left: 7.6%;
    width: 118%;
  }

  .hero__photo::after {
    background:
      linear-gradient(to right,
        var(--night) 0%,
        rgb(28 30 74 / 0.9) 9%,
        rgb(28 30 74 / 0.72) 34%,
        rgb(28 30 74 / 0.15) 56%,
        transparent 66%,
        transparent 80.5%,
        rgb(28 30 74 / 0.35) 91%,
        rgb(28 30 74 / 0.75) 100%),
      linear-gradient(to bottom, rgb(28 30 74 / 0.7), transparent 9.7vw);
  }

  .hero__content {
    margin-top: 0;
    padding: 8.3vw var(--gutter) 6rem;
  }

  .hero__intro {
    max-width: min(32.5rem, 36vw);
    font-size: clamp(1.125rem, 1.53vw, 1.375rem);
  }

  .hero__credit {
    top: auto;
    bottom: 1.5rem;
    font-size: 0.8125rem;
  }
}

/* Page header ---------------------------------------------------------------
   The short night band on pages other than home: small wordmark and the nav. */

.site-header {
  position: relative;
  padding: 4rem 1.5rem 1.5rem;
}

.site-header .wordmark {
  display: inline-block;
  text-decoration: none;
}

@media (min-width: 56em) {
  .site-header {
    padding: 2rem var(--gutter);
  }

  .site-header .site-nav {
    top: 50%;
    transform: translateY(-50%);
  }
}

/* Contact ------------------------------------------------------------------- */

.contact {
  max-width: calc(40rem + 3rem);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.contact__intro {
  margin: 1.5rem 0;
}

.contact-form {
  display: grid;
  gap: 1.375rem;
}

.contact-form__row {
  display: grid;
  gap: 1.375rem;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.0625rem;
}

.field .text-field {
  width: 100%;
}

.field textarea {
  min-height: 9.5rem;
  resize: vertical;
}

.contact-form__send {
  justify-self: end;
}

.contact__thanks {
  font-size: 1.375rem;
  color: var(--magenta-deep);
}

.contact__thanks:focus {
  outline: none;
}

@media (min-width: 50em) {
  .contact {
    padding: 6rem 1.5rem 7.5rem;
  }

  .contact__intro {
    font-size: 1.1875rem;
  }

  .contact-form__row {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }

  .contact__thanks {
    font-size: 1.625rem;
  }
}

/* Upcoming events -----------------------------------------------------------
   Mobile: Boquita's head peeks in beside the heading.
   Desktop: the whole Boquita stands to the left of the list. */

.events {
  padding: 2.5rem var(--gutter) 4rem;
}

.events__boquita {
  display: none;
}

.events__heading-row {
  display: flex;
  align-items: flex-end;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.events__boquita-head {
  width: 3.75rem;
  height: auto;
}

.events__signup {
  margin-top: 2rem;
}

@media (min-width: 70em) {
  .events {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 4.5rem;
    padding: 6rem var(--gutter) 7rem;
  }

  .events__boquita {
    display: block;
    flex: 0 1 26.25rem;
    min-width: 12rem;
    height: auto;
  }

  .events__column {
    flex: 0 1 46.25rem;
  }

  .events__boquita-head {
    display: none;
  }

  .events__heading-row {
    margin-bottom: 1.75rem;
  }

  .events__signup {
    margin-top: 2.5rem;
  }
}

/* Footer --------------------------------------------------------------------
   Email list on the left, tip jar on the right (stacked on phones). */

.site-footer {
  padding: 3.5rem 1.5rem 2.5rem;
  font-size: 1.0625rem;
}

.site-footer__columns {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.site-footer__heading {
  font-size: var(--size-subheading);
  margin-bottom: 0.75rem;
}

.site-footer__tip p {
  margin-bottom: 1.25rem;
}

.signup__lists {
  display: grid;
  gap: 0.625rem;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

.signup__lists legend {
  padding: 0;
  margin-bottom: 0.75rem;
}

.signup__row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.signup__row .text-field {
  width: 100%;
}

.signup__thanks {
  font-size: 1.3125rem;
  color: var(--marigold);
}

.signup__thanks:focus {
  outline: none;
}

.site-footer__small {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgb(251 243 228 / 0.2);
  font-size: var(--size-small);
  line-height: 1.5;
  opacity: 0.65;
}

@media (min-width: 50em) {
  .site-footer {
    padding: 5.5rem var(--gutter) 3rem;
  }

  .site-footer__columns {
    flex-direction: row;
    justify-content: space-between;
    gap: 5rem;
    margin-top: 3.5rem;
  }

  .site-footer__email {
    max-width: 35rem;
  }

  .site-footer__tip {
    max-width: 18.75rem;
  }

  .signup__row {
    flex-direction: row;
    align-items: center;
  }

  .signup__row .text-field {
    width: 16.25rem;
  }

  .signup__thanks {
    font-size: 1.5rem;
  }

  .site-footer__small {
    margin-top: 3.5rem;
  }
}

/* About: nice to meet you -----------------------------------------------------
   Phones: heading, photo, story. From 60em (960px): heading and story on the
   left, photo on the right. */

.about-intro {
  display: grid;
  padding: 3rem var(--gutter) 2.5rem;
}

.about-intro__photo {
  margin-top: 1.5rem;
}

.about-intro__text p {
  max-width: 35rem;
  margin-top: 1.25rem;
}

.about-intro__photo {
  margin-inline: 0;
  margin-bottom: 0;
}

.about-intro__photo img {
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.about-intro__photo figcaption {
  margin-top: 0.625rem;
  font-size: var(--size-small);
  opacity: 0.7;
}

@media (min-width: 60em) {
  .about-intro {
    grid-template-columns: minmax(0, 35rem) minmax(0, 35rem);
    grid-template-areas:
      "heading photo"
      "text photo";
    justify-content: center;
    column-gap: 5rem;
    padding: 6rem var(--gutter) 5rem;
  }

  .about-intro__heading {
    grid-area: heading;
    align-self: end;
  }

  .about-intro__text {
    grid-area: text;
  }

  .about-intro__photo {
    grid-area: photo;
    align-self: center;
    margin-top: 0;
  }

  .about-intro__text p {
    font-size: 1.1875rem;
  }
}

/* About: by the numbers -----------------------------------------------------
   Night band. Two by two on phones, one row from 50em. */

.stats {
  padding: 2.25rem var(--gutter);
}

.stats__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem 1rem;
  padding: 0;
  list-style: none;
  text-align: center;
}

.stats__list li {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stats__number {
  font-family: var(--font-wordmark);
  font-weight: 900;
  font-size: 2.75rem;
  line-height: 1;
  color: var(--marigold);
}

.stats__label {
  margin-top: 0.25rem;
  font-family: var(--font-hand);
  font-size: 1.0625rem;
  letter-spacing: 0.03em;
}

@media (min-width: 50em) {
  .stats {
    padding: 3.5rem var(--gutter);
  }

  .stats__list {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats__number {
    font-size: 4rem;
  }

  .stats__label {
    font-size: 1.25rem;
  }
}

/* About: where we've paraded -------------------------------------------------
   The map image and label positions come from tools/parade-map.py.
   Labels are placed in % of the map, and sized with the map (cqi units). */

.paraded {
  padding: 3rem var(--gutter) 4rem;
}

.parade-map {
  position: relative;
  container-type: inline-size;
  margin: 1.75rem 0 0;
  border-radius: 16px;
  overflow: hidden;
}

.parade-map img {
  width: 100%;
  height: auto;
}

.parade-map__labels {
  margin: 0;
  padding: 0;
  list-style: none;
}

.parade-map__labels li {
  position: absolute;
  left: var(--x);
  top: var(--y);
  margin-left: var(--gap);
  transform: translateY(-50%);
  font-family: var(--font-hand);
  font-size: clamp(0.6875rem, 3.2cqi, 0.875rem);
  line-height: 1.15;
  white-space: nowrap;
  color: var(--paper);
  text-shadow: 0 0 4px var(--night-deep), 0 0 4px var(--night-deep);
}

.parade-map__labels li.parade-map__label--left {
  margin-left: calc(-1 * var(--gap));
  transform: translate(-100%, -50%);
  text-align: right;
}

.parade-map__labels--wide {
  display: none;
}

@media (min-width: 50em) {
  .parade-map {
    margin-top: 2.5rem;
  }

  .parade-map__labels--narrow {
    display: none;
  }

  .parade-map__labels--wide {
    display: block;
  }

  .parade-map__labels li {
    font-size: clamp(0.75rem, 1.44cqi, 1.125rem);
  }
}


@media (min-width: 50em) {
  .paraded {
    padding: 5rem var(--gutter) 7rem;
  }
}

/* Gallery ---------------------------------------------------------------------
   Lantern filter, then one section per year: a coloured ribbon, the year and a
   grid of parade cards. Cards are 2 across on phones, 3 from 50em, 4 from 70em.
   The cards are made by tools/gallery.py. */

.gallery {
  padding: 3rem var(--gutter) 5rem;
}

.gallery-intro p {
  max-width: 45rem;
  margin-top: 1.25rem;
}

.lanterns {
  display: flex;
  gap: 0.5rem;
  margin: 1.75rem calc(var(--gutter) * -1) 0;
  padding: 0.5rem var(--gutter);
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
}

.lantern {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 5.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-family: var(--font-hand);
  font-size: 1.0625rem;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
}

.lantern__picture {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  overflow: hidden;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 8%, var(--paper));
  font-family: var(--font-wordmark);
  font-weight: 900;
  font-size: 1.75rem;
  color: color-mix(in srgb, var(--ink) 55%, var(--paper));
  transition: transform 0.1s;
}

.lantern__picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lantern--all .lantern__picture {
  background: var(--marigold);
}

.lantern:hover .lantern__picture {
  transform: scale(1.05);
}

.lantern[aria-pressed="true"] .lantern__picture {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.gallery-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  font-size: 1rem;
}

.gallery-jump a {
  padding: 0.25rem 1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.gallery-jump a:hover {
  background: color-mix(in srgb, var(--ink) 8%, var(--paper));
}

.gallery-empty {
  margin-top: 3rem;
}

.gallery-year {
  margin-top: 4rem;
  scroll-margin-top: 1.5rem;
}

.gallery-year__heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-wordmark);
  font-weight: 900;
  font-size: clamp(2.75rem, 5vw, 4rem);
  line-height: 1;
}

.gallery-year__heading::before {
  content: "";
  align-self: stretch;
  width: 10px;
  border-radius: 5px;
  background: var(--year-colour);
}

.gallery-year__count {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.0625rem;
  opacity: 0.72;
}

.parades {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem 1rem;
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
}

.parade {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* The heading comes first for screen readers; the photo shows on top. */
.parade__photos,
.parade__empty {
  order: -1;
  margin-bottom: 0.625rem;
}

.parade__photos {
  padding: 0;
  list-style: none;
}

.parade__photos img,
.parade__empty {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
}

.parade__photos img {
  height: auto;
  object-fit: cover;
  transition: transform 0.15s;
}

.parade__photos a:hover img {
  transform: rotate(-1deg) scale(1.02);
}

.parade__empty {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--year-colour) 16%, var(--paper));
  font-size: 0.9375rem;
  color: color-mix(in srgb, var(--ink) 60%, transparent);
}

.parade__name {
  font-size: 1.375rem;
}

.parade__meta {
  font-size: 0.9375rem;
  line-height: 1.4;
  opacity: 0.72;
}

.parade__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.parade__count {
  font-family: var(--font-hand);
  font-size: 1.125rem;
  color: var(--magenta-deep);
  text-decoration: none;
}

.parade__count:hover {
  text-decoration: underline;
}

.parade__nth {
  padding: 0.05rem 0.625rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--year-colour) 30%, var(--paper));
  font-size: 0.875rem;
}

@media (min-width: 50em) {
  .gallery {
    padding: 5rem var(--gutter) 7.5rem;
  }

  .lanterns {
    flex-wrap: wrap;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }

  .gallery-year {
    margin-top: 5rem;
  }

  .parades {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem 1.5rem;
  }

  .parade__name {
    font-size: 1.5rem;
  }
}

@media (min-width: 70em) {
  .parades {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Photo viewer ------------------------------------------------------------------
   A polaroid over the dimmed page, with the parade's name and "1 of 8" on the
   frame. Arrows sit beside it on wide screens and below it on phones.
   Built by js/gallery.js. */

.viewer {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.viewer[open] {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "photo photo"
    "prev next";
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 1rem;
}

.viewer::backdrop {
  background: color-mix(in srgb, var(--night) 90%, transparent);
}

.viewer__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.5rem;
  border: 0;
  background: none;
  color: var(--paper);
  font-family: var(--font-hand);
  font-size: 1.375rem;
  cursor: pointer;
}

.viewer__polaroid {
  grid-area: photo;
  width: fit-content;
  margin: 0;
  padding: 0.875rem 0.875rem 1rem;
  border-radius: 4px;
  background: var(--white);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.45);
  transform: rotate(-1.2deg);
}

.viewer__polaroid img {
  width: auto;
  max-width: calc(100vw - 4rem);
  max-height: calc(100dvh - 16rem);
  object-fit: contain;
}

.viewer__caption {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  /* Never wider than the photo above it. */
  width: 0;
  min-width: 100%;
  margin-top: 0.875rem;
}

.viewer__name {
  font-family: var(--font-hand);
  font-size: 1.375rem;
  line-height: 1.1;
}

.viewer__meta,
.viewer__credit {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0.72;
}

.viewer__side {
  flex: none;
  text-align: right;
}

.viewer__count {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  line-height: 1.1;
}

.viewer__arrow {
  width: 3.5rem;
  height: 3.5rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--night-deep);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.viewer__arrow:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--night-deep);
}

.viewer__arrow:disabled {
  visibility: hidden;
}

.viewer__arrow--prev {
  grid-area: prev;
}

.viewer__arrow--next {
  grid-area: next;
}

@media (min-width: 50em) {
  .viewer[open] {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "prev photo next";
    grid-template-rows: 1fr;
    column-gap: 3rem;
    padding: 1.5rem 2.5rem;
  }

  .viewer__arrow--prev {
    justify-self: end;
  }

  .viewer__arrow--next {
    justify-self: start;
  }

  .viewer__close {
    top: 1.5rem;
    right: 2.5rem;
  }

  .viewer__polaroid {
    padding: 1.75rem 1.75rem 2rem;
  }

  .viewer__polaroid img {
    max-width: min(55rem, 100vw - 23rem);
    max-height: calc(100dvh - 18rem);
  }

  .viewer__caption {
    margin-top: 1.5rem;
  }

  .viewer__name {
    font-size: 2rem;
  }

  .viewer__meta {
    font-size: 1rem;
  }

  .viewer__count {
    font-size: 1.5rem;
  }

  .viewer__arrow {
    width: 4rem;
    height: 4rem;
    font-size: 1.75rem;
  }
}

