/* The skywritten footer: the footer of a small travel agency on a white page, all of it sky, deeper towards the
   bottom, with the sun just off its top corner. Along the top the planes write in smoke; under it the fare letter,
   three columns of links and the small print. */
:root {
  --page: #ffffff;          /* the page */
  --sky-top: #3a7fdc;       /* the sky at the top, where the planes fly */
  --sky-mid: #275fbe;       /* the sky in the middle */
  --sky-low: #12306f;       /* the sky at the bottom of the footer */
  --sun: #ffd9a3;           /* the warm light of the sun, just off the top right corner */
  --smoke: #ffffff;         /* the smoke, where the sun lights it */
  --smoke-shade: #a9bfe4;   /* the smoke's shaded underside */
  --plane: #f0513a;         /* the planes */
  --plane-trim: #fff4e6;    /* the stripe and the wings of the planes */
  --canopy: #182b55;        /* the planes' canopies and propellers */
  --field: #183f8c;         /* the email field */
  --line: #4170c2;          /* the edge of the field, and the rule over the small print */
  --ink: #f6f9ff;           /* titles, the link pointed at, the button */
  --muted: #c6d7f4;         /* links and text */
  --faint: #9ab3df;         /* the small print and the help under the field */
  --button-ink: #112a5e;    /* the word on the button */
  --focus: #ffd9a3;         /* the focus ring, the little plane over a link, and the thanks */
  --wrong: #ffb4a3;         /* an email that does not look right */
  --sky: 148px;             /* how tall the band of sky over the links is */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Archivo Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 40px 16px;
}

/* ---------------------------------------------------------------- the footer, all sky */
.fw {
  position: relative;
  width: min(1100px, 100%);
  padding: var(--sky) 48px 0;
  border-radius: 28px;
  overflow: clip;
  background:
    radial-gradient(120% 90% at 92% -18%, color-mix(in srgb, var(--sun) 42%, transparent) 0, transparent 44%),
    linear-gradient(180deg, var(--sky-top) 0, var(--sky-mid) 46%, var(--sky-low) 100%);
  color: var(--muted);
  isolation: isolate;
}

/* the smoke and the planes are drawn on one canvas over the band of sky, fading out before the links */
.fw__sky {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: calc(var(--sky) + 24px);
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 34px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 34px), transparent 100%);
  /* a finger dragged sideways blows the smoke; up and down still scrolls the page */
  touch-action: pan-y;
  cursor: crosshair;
  -webkit-tap-highlight-color: transparent;
}

.fw__top,
.fw__base {
  position: relative;
  z-index: 1;
}

.fw__top {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------------------------------------------------------------- the fare letter */
.fw__form {
  margin: 0;
}

.fw__title {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  font-weight: 640;
  font-stretch: 88%;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.fw__lede {
  margin: 8px 0 16px;
  font-size: 15px;
  line-height: 22px;
  text-wrap: pretty;
}

.fw__field {
  --send-w: 118px;
  position: relative;
  height: 52px;
  border-radius: 999px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.25s ease;
}

.fw__field:has(.fw__input:focus) {
  box-shadow: inset 0 0 0 1px var(--muted), 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent);
}

.fw__field.is-wrong,
.fw__field.is-wrong:has(.fw__input:focus) {
  box-shadow: inset 0 0 0 1px var(--wrong), 0 0 0 4px color-mix(in srgb, var(--wrong) 18%, transparent);
}

.fw__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 calc(var(--send-w) + 14px) 0 22px;
  border: 0;
  border-radius: inherit;
  outline: none;
  background: transparent;
  color: var(--ink);
  caret-color: var(--focus);
  font: 450 16px/normal 'Archivo Variable', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.fw__input::placeholder {
  color: var(--faint);
  opacity: 1;
}

/* the browser's autofill paints the field light blue: back to the field's own colours */
.fw__input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 60px var(--field) inset;
  caret-color: var(--focus);
}

.fw__input[readonly] {
  color: var(--muted);
}

/* the button: the elastic pill, its word widening while the colour swells under the pointer */
.fw__send {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  width: var(--send-w);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--button-ink);
  font: 650 15px/1 'Archivo Variable', system-ui, sans-serif;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.fw__send > * {
  grid-area: 1 / 1;
}

.fw__send-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(17, 42, 94, 0.14);
  transition: inset 0.6s cubic-bezier(0.3, 1.7, 0.45, 1), transform 0.16s ease-out;
}

.fw__send-label {
  display: block;
  font-stretch: 84%;
  white-space: nowrap;
  transition: font-stretch 0.6s cubic-bezier(0.3, 1.7, 0.45, 1);
}

@media (hover: hover) and (pointer: fine) {
  .fw__send:not([aria-disabled='true']):hover .fw__send-bg {
    inset: -2px -4px;
  }

  .fw__send:not([aria-disabled='true']):hover .fw__send-label {
    font-stretch: 106%;
  }
}

.fw__send:not([aria-disabled='true']):active .fw__send-bg {
  transform: scale(1.03, 0.88);
}

.fw__send[aria-disabled='true'] {
  cursor: default;
}

.fw__send:focus {
  outline: none;
}

.fw__send:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.fw__spin,
.fw__done {
  width: 22px;
  height: 22px;
  overflow: visible;
  opacity: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fw__spin {
  stroke-width: 2.4;
  stroke-dasharray: 30 60;
}

.fw__done {
  stroke-width: 2.6;
}

/* the line under the field: help, then what went wrong, then the thanks */
.fw__note {
  position: relative;
  min-height: 20px;
  margin: 12px 0 0 22px;
  color: var(--faint);
  font-size: 13.5px;
  line-height: 20px;
}

.fw__line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.fw__line.is-going {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  pointer-events: none;
}

.fw__line svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 2.5px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fw__line.is-wrong {
  color: var(--wrong);
}

.fw__line.is-done {
  color: var(--ink);
}

.fw__line.is-done svg {
  color: var(--focus);
}

/* ---------------------------------------------------------------- the links */
.fw__cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  justify-self: end;
  width: min(100%, 560px);
  padding-top: 3px;
}

.fw__head {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  font-stretch: 88%;
  line-height: 20px;
}

.fw__cols ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* a link pointed at: a tiny plane flies over it from left to right, and each letter is lifted in its wake as it
   passes, tipped up like a plane leaving the ground, then lands with a little bounce */
.fw__link {
  position: relative;
  display: inline-block;
  padding: 4px 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 22px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.fw__word {
  display: inline-block;
}

.fw__ch {
  display: inline-block;
  white-space: pre;
  transform-origin: 30% 90%;
}

/* the little plane: it waits off the start of the word, and crosses just over the letters */
.fw__jet {
  position: absolute;
  left: 0;
  top: -4px;
  width: 18px;
  height: 8.4px;
  opacity: 0;
  pointer-events: none;
  fill: var(--focus);
}

.fw__link.is-on,
.fw__link:focus-visible {
  color: var(--ink);
}

.fw__link.is-on .fw__ch,
.fw__link:focus-visible .fw__ch {
  animation: fw-lift 0.66s cubic-bezier(0.3, 0.7, 0.4, 1) both;
  animation-delay: calc(var(--d) * 1ms);
}

.fw__link.is-on .fw__jet,
.fw__link:focus-visible .fw__jet {
  animation: fw-jet calc(var(--fly) * 1ms) cubic-bezier(0.45, 0.1, 0.5, 1) both;
}

@media (hover: hover) and (pointer: fine) {
  .fw__link:hover {
    color: var(--ink);
  }

  .fw__link:hover .fw__ch {
    animation: fw-lift 0.66s cubic-bezier(0.3, 0.7, 0.4, 1) both;
    animation-delay: calc(var(--d) * 1ms);
  }

  .fw__link:hover .fw__jet {
    animation: fw-jet calc(var(--fly) * 1ms) cubic-bezier(0.45, 0.1, 0.5, 1) both;
  }
}

/* a letter in the little plane's wake: pulled up and tipped back, then down past its place and settled */
@keyframes fw-lift {
  0% {
    transform: none;
  }

  30% {
    transform: translateY(-4px) rotate(-9deg);
  }

  60% {
    transform: translateY(1px) rotate(2deg);
  }

  80% {
    transform: translateY(-0.5px) rotate(-0.6deg);
  }

  100% {
    transform: none;
  }
}

/* the little plane comes in climbing from the left, crosses the word and climbs away past its end */
@keyframes fw-jet {
  0% {
    opacity: 0;
    transform: translate(-22px, 5px) rotate(-14deg);
  }

  14% {
    opacity: 1;
  }

  82% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(calc(var(--w) * 1px + 8px), -9px) rotate(-16deg);
  }
}

.fw__link:focus {
  outline: none;
}

.fw__link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- the small print */
.fw__base {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 22px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
  line-height: 20px;
}

.fw__brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
}

.fw__mark {
  flex: none;
  width: 28px;
  height: 13px;
  margin-right: -4px;
  fill: var(--focus);
}

.fw__name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  font-stretch: 88%;
}

.fw__copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* the copyright sign, drawn: the character can turn into an emoji on some phones */
.fw__copy svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
}

.fw__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 22px;
}

.fw__link--small {
  padding: 3px 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--faint);
}

/* for screen readers only */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- a narrower screen */
@media (max-width: 900px) {
  .fw__top {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }

  .fw__form {
    max-width: 480px;
  }

  .fw__cols {
    justify-self: stretch;
    width: 100%;
  }

  .fw__base {
    flex-wrap: wrap;
  }
}

/* a phone: a lower band of sky, and the columns stack, two side by side and the third under them */
@media (max-width: 600px) {
  .fw {
    --sky: 112px;
    padding: var(--sky) 20px 0;
    border-radius: 24px;
  }

  .fw__title {
    font-size: 23px;
  }

  .fw__field {
    --send-w: 108px;
    height: 54px;
  }

  .fw__input {
    padding-left: 18px;
  }

  /* room for two lines, so a longer message never moves the rest of the footer */
  .fw__note {
    min-height: 40px;
    margin-left: 18px;
  }

  .fw__top {
    gap: 22px;
  }

  .fw__cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
  }

  .fw__head {
    margin-bottom: 4px;
  }

  /* a row a thumb can hit */
  .fw__link {
    padding: 6px 0;
  }

  .fw__base {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 24px;
  }

  .fw__hours {
    width: 100%;
  }

  .fw__legal {
    gap: 0 20px;
  }

  .fw__link--small {
    padding: 10px 0;
  }
}

/* la casella bassa dell'anteprima sul telefono: una fascia di cielo un po' più bassa, le righe dei link più basse e
   spazi più stretti, così il piede si vede intero */
@media (max-width: 600px) and (max-height: 760px) {
  .fw {
    --sky: 92px;
  }

  .stage {
    padding: 10px 16px;
  }

  .fw__lede {
    margin-bottom: 10px;
  }

  .fw__note {
    min-height: 20px;
  }

  .fw__top {
    gap: 12px;
  }

  .fw__cols {
    gap: 8px 16px;
  }

  .fw__link {
    padding: 1px 0;
    font-size: 14px;
  }

  .fw__base {
    gap: 6px 24px;
    margin-top: 10px;
    padding: 8px 0 10px;
  }

  .fw__link--small {
    padding: 2px 0;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fw__send-label,
  .fw__send-bg {
    transition: none;
  }

  /* nothing flies: the word only takes the light colour */
  .fw__link .fw__ch,
  .fw__link.is-on .fw__ch,
  .fw__link:focus-visible .fw__ch {
    animation: none;
  }

  .fw__link .fw__jet,
  .fw__link.is-on .fw__jet,
  .fw__link:focus-visible .fw__jet {
    animation: none;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) and (hover: hover) and (pointer: fine) {
  .fw__link:hover .fw__ch,
  .fw__link:hover .fw__jet {
    animation: none;
  }
}
