/*
 * Site chrome shared by every page: navigation, the ribbon page transition,
 * the closing call-to-action band and the footer.
 */

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(6, 46, 37, .92);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__brand {
  display: block;
  line-height: 0;
  border-radius: 8px;
}

.nav__brand img {
  display: block;
  height: 34px;
  width: auto;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.6vw, 14px);
}

.nav-link {
  position: relative;
  padding: 9px 14px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 600;
  font-size: .98rem;
  text-decoration: none;
  color: var(--mist);
  transition: color .25s;
}

.nav-link:hover {
  color: var(--starch);
}

.nav-link[aria-current="page"] {
  color: var(--forest);
  background: var(--ochre);
}

/* Reading progress, driven by --scroll-progress (scroll-effects.js). */
.nav__progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  background: var(--ochre);
  transform-origin: 0 50%;
  transform: scaleX(var(--scroll-progress, 0));
}

.pages {
  padding-top: var(--nav-height);
}

@media (max-width: 520px) {
  .nav__brand img {
    height: 28px;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: .9rem;
  }
}

/* ---------- Page transition ----------
 * Two ribbons sweep across the viewport while the page underneath is swapped.
 * The sweep itself is animated from page-wipe.js.
 */

.page-wipe {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-wipe.is-busy {
  pointer-events: all;
}

.page-wipe__ribbon {
  fill: none;
  stroke-width: 40;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.page-wipe__ribbon--ochre {
  stroke: var(--ochre);
}

.page-wipe__ribbon--green {
  stroke: var(--green);
}

.page-wipe-label {
  position: fixed;
  inset: 0;
  z-index: 91;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 14vw, 11rem);
  letter-spacing: -.045em;
  color: var(--starch);
}

.page-wipe-label__brand {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: var(--fs-small);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ochre);
}

.page-wipe-label__name {
  display: inline-block;
}

/* ---------- Closing call to action ---------- */

.call-to-action {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding-block: clamp(64px, 10vw, 130px);
  background: var(--ochre);
  color: var(--forest);
}

.call-to-action h2 {
  font-size: clamp(2.3rem, 7vw, 6rem);
  max-width: 14ch;
}

.call-to-action p {
  margin: 20px 0 30px;
  max-width: 44ch;
  font-size: 1.2rem;
}

.call-to-action .btn {
  background: var(--forest);
  color: var(--starch);
}

.call-to-action .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -12px rgba(6, 46, 37, .8);
}

.call-to-action__art {
  position: absolute;
  right: -4%;
  top: 50%;
  width: min(46vw, 520px);
  transform: translateY(-50%);
  opacity: .9;
}

@media (max-width: 860px) {
  .call-to-action__art {
    opacity: .28;
  }
}

/* ---------- Footer ---------- */

.footer {
  position: relative;
  z-index: 1;
  padding-block: 44px calc(44px + env(safe-area-inset-bottom, 0px));
  background: var(--forest);
  border-top: 1px solid var(--line);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
}

.footer__logo {
  display: block;
  height: 40px;
  width: auto;
}

.footer__tagline {
  font-family: var(--mono);
  font-size: var(--fs-small);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mist);
}

.footer__links {
  display: flex;
  gap: 6px;
}

/* Where the footer reaches the screen edge, keep its links clear of the WhatsApp bubble. */
@media (max-width: 1320px) {
  .footer__inner {
    padding-right: calc(var(--bubble-size) + var(--bubble-inset) * 2);
  }
}

@media (max-width: 520px) {
  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- WhatsApp bubble ----------
 * Fixed to the corner on every page; sits above the nav but under the page wipe.
 */

.whatsapp-bubble {
  position: fixed;
  right: calc(var(--bubble-inset) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--bubble-inset) + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: grid;
  place-items: center;
  width: var(--bubble-size);
  height: var(--bubble-size);
  border-radius: 50%;
  background: var(--whatsapp);
  box-shadow: 0 10px 26px -8px rgba(4, 31, 25, .7);
  color: #fff;
  transform-origin: 100% 100%; /* grows out of its corner, so the big bubble stays on screen */
  transition: transform .35s var(--ease), box-shadow .35s;
  /* Waits for the page's own entrance animations, then makes its entrance.
     "backwards" hides it during the wait without blocking the hover lift afterwards. */
  animation: bubble-in 1.9s 3.2s backwards;
}

/* Arrives four times its size, shrinks into place, then bounces twice. */
@keyframes bubble-in {
  0% { opacity: 0; transform: scale(4); }
  10% { opacity: 1; transform: scale(4); animation-timing-function: var(--ease-io); }
  48% { transform: none; animation-timing-function: ease-out; }
  60% { transform: translateY(-20px); animation-timing-function: ease-in; }
  72% { transform: none; animation-timing-function: ease-out; }
  82% { transform: translateY(-9px); animation-timing-function: ease-in; }
  92%, 100% { transform: none; }
}

.whatsapp-bubble:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 16px 30px -10px rgba(4, 31, 25, .8);
}

.whatsapp-bubble svg {
  fill: currentColor;
}
