/* The mask that opens: a dive club's home page. The night surface has a window shaped like a diving mask, and
   through it you see the water below; scrolling makes the surface grow and blur until you are under. */
:root {
  --night: #0a1430;         /* the sky at the top */
  --foam: #eef8f6;          /* text over the night */
  --deep-ink: #062a3c;      /* text under the water */
  --edge: clamp(18px, 3.2vw, 48px);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--night);
  color: var(--foam);
  font-family: 'Space Grotesk Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px var(--edge);
  font-size: 14px;
  color: var(--foam);
  transition: color 0.5s;
}

/* under the water the bar turns dark */
.bar.is-under {
  color: var(--deep-ink);
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.bar__nav {
  display: flex;
  gap: clamp(16px, 2.4vw, 34px);
}

.bar__nav a {
  transition: opacity 0.2s;
}

@media (hover: hover) {
  .bar__nav a:hover {
    opacity: 0.55;
  }
}

.bar a:focus-visible,
.deep__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* ---------------------------------------------------------------- the pinned screen */
.dive {
  position: relative;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
}

.deep,
.surface {
  position: absolute;
  inset: 0;
}

.deep__art,
.surface__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* the surface grows from the middle of the mask, which is the middle of the screen */
.surface {
  transform-origin: 50% 50%;
  will-change: transform, filter, opacity;
}

.surface__words {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + clamp(90px, 11vw, 150px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  text-align: center;
}

.surface__lead {
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(30px, 3.6vw, 52px);
  font-style: italic;
  line-height: 1.05;
}

/* the words go up into their own mask when the dive starts */
.surface__lead .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0 0.04em 0.08em;
}

.surface__lead .w > span {
  display: inline-block;
}

.surface__hint {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.deep__words {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  text-align: center;
  color: var(--deep-ink);
  transform: translateY(-58%);
}

.deep__title {
  max-width: 11em;
  margin: 0;
  font-size: clamp(40px, 6vw, 92px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.deep__title em {
  display: block;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.deep__link {
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--deep-ink);
  color: #e9fbf7;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: transform 0.25s, background-color 0.25s;
}

@media (hover: hover) {
  .deep__link:hover {
    background: #0b4560;
    transform: translateY(-2px);
  }
}

/* ---------------------------------------------------------------- after the dive */
.after {
  min-height: 60svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px var(--edge);
  background: #bfeee4;
  color: var(--deep-ink);
}

.after__text {
  max-width: 22em;
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(26px, 3vw, 42px);
  font-style: italic;
  line-height: 1.15;
  text-align: center;
}

@media (max-width: 760px) {
  .bar__nav {
    display: none;
  }

  .surface__words {
    top: calc(50% + 74px);
  }
}
