@font-face {
  font-family: "Gilroy";
  src: url("../assets/fonts/Gilroy-Light.ttf") format("truetype");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Gilroy";
  src: url("../assets/fonts/Gilroy-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Gilroy";
  src: url("../assets/fonts/Gilroy-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Gilroy";
  src: url("../assets/fonts/Gilroy-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  /* Brand */
  --blue: #003f73;
  --blue-deep: #002a4d;
  --teal: #42b0b4;
  --off-white: #fcf9f9;

  /* Interface */
  --ink: #0a0a0a;
  --live: #d92d20;

  --gutter: clamp(20px, 5vw, 88px);

  /* Motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: #fff;
  font-family: "Gilroy", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

a,
button {
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
}

/* White on dark grounds; light grounds and dialogs switch it to blue. */
:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

::selection {
  background: var(--blue-deep);
  color: #fff;
}

/* Buttons. The fill spreads from where the pointer enters (see data-fill in main.js). */

.pill {
  --fill: #fff;
  --fill-ink: var(--ink);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: clamp(48px, 4.4vw, 64px);
  padding: 0 clamp(26px, 2.5vw, 38px);
  border-radius: 12px;
  border: 2px solid #fff;
  font-size: clamp(15px, 1.15vw, 18px);
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    transform 160ms var(--ease-out);
}

.pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--fill);
  clip-path: circle(0 at var(--x, 50%) var(--y, 50%));
  transition: clip-path 180ms ease;
}

.pill:active {
  transform: scale(0.97);
}

.pill--solid {
  --fill: var(--blue-deep);
  --fill-ink: #fff;
  background: #fff;
  color: var(--ink);
}

.pill--outline {
  background: transparent;
  color: #fff;
}

.pill--navy {
  --fill: var(--ink);
  --fill-ink: #fff;
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.pill__play {
  width: 0.62em;
  height: auto;
}

@media (hover: hover) and (pointer: fine) {
  /* The text changes colour just after the fill has spread under it, so it is never white on white. */
  .pill:hover {
    border-color: var(--fill);
    color: var(--fill-ink);
    transition:
      color 160ms ease 110ms,
      border-color 180ms ease,
      transform 160ms var(--ease-out);
  }

  /* The navy fill keeps a white edge so it never sinks into a navy section. */
  .pill--solid:hover {
    border-color: #fff;
  }

  .pill:hover::before {
    clip-path: circle(140% at var(--x, 50%) var(--y, 50%));
    transition: clip-path 340ms var(--ease-out);
  }
}

/* Header */

.site-header {
  --strip: 40px;
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  color: #fff;
  transition: transform 280ms var(--ease-out);
}

/* Past the top the service strip slides away, leaving the main bar. */
.site-header[data-scrolled] {
  transform: translateY(calc(var(--strip) * -1));
}

.site-header[data-tucked] {
  transform: translateY(-100%);
}

/* A keyboard user tabbing to the strip has to be able to see it. */
.site-header:has(.utility :focus-visible) {
  transform: none;
}

/* Service strip */

.utility {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--strip);
  padding-inline: var(--gutter);
  background: var(--blue);
  font-size: clamp(13px, 0.95vw, 14px);
}

.utility__info {
  margin: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.utility__where {
  font-weight: 400;
}

/* Main bar */

.site-bar {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.4vw, 36px);
  padding: clamp(14px, 1.5vw, 22px) var(--gutter);
  transition: background-color 200ms ease;
}

.site-header[data-scrolled] .site-bar {
  background: var(--blue);
}

.site-logo {
  flex: none;
}

.site-logo img {
  width: clamp(136px, 12.5vw, 188px);
  height: auto;
}

.site-nav {
  position: relative;
  display: flex;
  gap: clamp(20px, 2.2vw, 36px);
  margin-left: auto;
  font-size: clamp(14px, 1.1vw, 16px);
  font-weight: 500;
}

.site-nav a {
  padding: 8px 0;
  white-space: nowrap;
}

/* One marker travels between links; main.js positions it. */
.site-nav__marker {
  position: absolute;
  left: 0;
  bottom: 1px;
  width: 1px;
  height: 2px;
  background: #fff;
  transform-origin: left center;
  pointer-events: none;
}

.site-nav__marker[data-ready] {
  transition: transform 280ms var(--ease-out);
}

.site-header__cta {
  min-height: 46px;
  padding-inline: 24px;
  font-size: clamp(14px, 1.1vw, 16px);
}

/* Countdown, in the service strip */

.service {
  position: relative;
  flex: none;
}

.countdown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--strip);
  padding: 0;
  border: 0;
  background: none;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}

.countdown:active {
  transform: scale(0.97);
}

/* The chevron says this opens something. */
.countdown::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: -3px 2px 0 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 200ms var(--ease-out);
}

.countdown[aria-expanded="true"]::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.countdown__time {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--live);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.countdown[data-live] .countdown__label {
  display: none;
}

.countdown[data-live] .countdown__time {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.countdown[data-live] .countdown__time::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

@media (prefers-reduced-motion: no-preference) {
  .countdown[data-live] .countdown__time::before {
    animation: live-pulse 1400ms ease-in-out infinite;
  }

  @keyframes live-pulse {
    50% { opacity: 0.25; }
  }
}

/* Digits are split so only the one that changed rolls. */
.digit {
  display: inline-block;
}

/* Service card, opened from the countdown */

.service-card {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  padding: 22px;
  border-radius: 20px;
  background: var(--off-white);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); /* taste-skill-ignore: a real overlay */
  transform-origin: var(--origin-x, 80%) top;
  display: none;
  opacity: 0;
  transform: scale(0.96) translateY(-4px);
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    display 120ms allow-discrete;
}

.service-card[data-open] {
  display: block;
  opacity: 1;
  transform: none;
  transition:
    opacity 180ms var(--ease-out),
    transform 220ms var(--ease-out),
    display 220ms allow-discrete;

  @starting-style {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
}

.service-card__when {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.service-card__where {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

.service-card__clock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 18px 0 0;
}

.service-card__clock div {
  padding: 10px 8px 8px;
  border-radius: 10px;
  background: #efeaea;
  text-align: center;
}

.service-card__clock dd {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.service-card__clock dt {
  margin-top: 2px;
  font-size: 12px;
}

.service-card__clock[hidden],
.service-card__now[hidden] {
  display: none;
}

.service-card__now {
  margin: 18px 0 0;
  padding: 14px;
  border-radius: 10px;
  background: #efeaea;
  font-size: 15px;
  line-height: 1.4;
}

.service-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.service-card__actions .pill {
  min-height: 46px;
  padding-inline: 22px;
  font-size: 15px;
}

.service-card__link {
  padding: 10px 0;
  font-size: 15px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  white-space: nowrap;
}

/* Mobile menu */

.menu-toggle {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.menu-toggle span {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 2px;
  background: currentColor;
  transition: transform 240ms var(--ease-out);
}

.menu-toggle span:first-child {
  transform: translateY(-4px);
}

.menu-toggle span:last-child {
  transform: translateY(4px);
}

.menu-toggle[aria-expanded="true"] span:first-child {
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:last-child {
  transform: rotate(-45deg);
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  gap: 28px;
  padding: 96px var(--gutter) calc(32px + env(safe-area-inset-bottom));
  background: var(--blue);
  clip-path: inset(0 0 100% 0);
  transition:
    clip-path 200ms var(--ease-out),
    display 200ms allow-discrete;
}

.mobile-menu[data-open] {
  display: flex;
  clip-path: inset(0);
  transition:
    clip-path 420ms var(--ease-drawer),
    display 420ms allow-discrete;

  @starting-style {
    clip-path: inset(0 0 100% 0);
  }
}

.mobile-menu nav {
  display: grid;
  gap: 4px;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.mobile-menu a {
  padding: 6px 0;
}

.mobile-menu p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.mobile-menu[data-open] a,
.mobile-menu[data-open] p {
  transition:
    opacity 300ms ease calc(90ms + var(--i) * 45ms),
    transform 420ms var(--ease-out) calc(90ms + var(--i) * 45ms);

  @starting-style {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* Hero */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100svh;
  min-height: 640px;
  max-height: 72vw;
  overflow: hidden;
  isolation: isolate;
  padding: 0 var(--gutter) clamp(32px, 4.4vw, 72px);
}

/* Slightly oversized so the pointer drift never shows an edge. */
.hero__media {
  position: absolute;
  inset: -16px;
  z-index: -2;
}

.hero__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 32%;
  /* The church's photos are brightly lit, so they are taken down to keep the hero's dark mood. */
  filter: grayscale(1) contrast(1.12) brightness(0.62);
}

/* Home slideshow: photos stack, and each new one fades in over the last. */
.hero__media--slides .hero__photo {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: none;
}

.hero__media--slides .hero__photo.is-leaving {
  z-index: 1;
  opacity: 1;
}

.hero__media--slides .hero__photo.is-active {
  z-index: 2;
  opacity: 1;
  transition: opacity 1400ms ease;
}

@media (prefers-reduced-motion: no-preference) {
  .hero__media--slides .hero__photo.is-active {
    animation: settle 1800ms var(--ease-out) both;
  }
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  /* taste-skill-ignore: neutral scrim over the photo, for text legibility */
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.62) 0, rgba(0, 0, 0, 0) 24%), /* taste-skill-ignore */
    linear-gradient(to top, rgba(0, 0, 0, 0.82) 0, rgba(0, 0, 0, 0.42) 34%, rgba(0, 0, 0, 0) 62%), /* taste-skill-ignore */
    linear-gradient(to right, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0) 58%); /* taste-skill-ignore */
}

.hero__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  width: 100%;
}

.hero__copy {
  max-width: 60rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 9.4vw, 44px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.024em;
}

.hero h1 .line {
  display: block;
  /* Room for descenders inside the reveal mask. */
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  overflow: hidden;
}

.hero h1 .line > span {
  display: block;
  white-space: nowrap;
}

.hero p {
  max-width: 30em;
  margin: clamp(14px, 1.2vw, 20px) 0 0;
  font-size: clamp(16px, 1.6vw, 24px);
  font-weight: 400;
  line-height: 1.38;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1vw, 14px);
  margin-top: clamp(20px, 2vw, 30px);
}

@media (min-width: 600px) {
  .hero h1 {
    font-size: clamp(44px, 5.2vw, 88px);
  }
}

@media (min-width: 961px) {
  .hero p {
    font-weight: 300;
  }
}

/* Entrance */

@media (prefers-reduced-motion: no-preference) {
  .hero__photo {
    animation: settle 1800ms var(--ease-out) both;
  }

  .site-header > * {
    animation: fade 500ms ease 120ms both;
  }

  .hero h1 .line > span {
    animation: line-up 860ms var(--ease-out) both;
  }

  .hero h1 .line:nth-child(2) > span { animation-delay: 80ms; }

  .hero p,
  .hero__buttons {
    animation: rise 640ms var(--ease-out) both;
  }

  .hero p { animation-delay: 220ms; }
  .hero__buttons { animation-delay: 290ms; }
  @keyframes settle {
    from { transform: scale(1.05); }
    to { transform: scale(1); }
  }

  @keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes line-up {
    from { transform: translateY(105%); }
    to { transform: translateY(0); }
  }

  @keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .countdown::after,
  .site-nav__marker[data-ready] {
    transition: none;
  }

  .mobile-menu,
  .mobile-menu[data-open],
  .mobile-menu[data-open] a,
  .mobile-menu[data-open] p {
    clip-path: none;
    transition: none;
  }

  .service-card,
  .service-card[data-open] {
    transform: none;
    transition: none;
  }

  .pill:active,
  .countdown:active {
    transform: none;
  }
}

/* Small screens */

@media (max-width: 960px) {
  .site-header {
    --strip: 44px;
  }

  .utility__where,
  .site-nav {
    display: none;
  }

  .site-header__cta {
    min-height: 42px;
    margin-left: auto;
    padding-inline: 18px;
  }

  .menu-toggle {
    display: block;
    margin-left: -8px;
    margin-right: -10px;
  }

  /* The card spans the screen, so it anchors to the header rather than the countdown. */
  .service {
    position: static;
  }

  .service-card {
    top: calc(var(--strip) + 8px);
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    max-width: 420px;
    margin-left: auto;
  }

  .hero {
    max-height: none;
  }

  .hero__photo {
    object-position: 52% 30%;
  }

}

@media (max-width: 480px) {
  .site-bar {
    gap: 12px;
  }

  .site-logo img {
    width: 128px;
  }

  .hero__buttons .pill {
    flex: 1 1 100%;
  }
}

@media (max-width: 440px) {
  .countdown__label {
    display: none;
  }
}
