/* The sailboat nav: the top bar of a sailing school, alone on a white page. Along the bottom of the bar runs a strip
   of water drawn by the script, which reads the colours of the water and of the boat from here. */
:root {
  --page: #ffffff;          /* the page */
  --bar: #0e2233;           /* the bar, the evening sky over the harbour */
  --bar-edge: rgba(255, 255, 255, 0.07);  /* the bar's edge */
  --water: #2f86a8;         /* the water at its surface */
  --deep: #123d58;          /* the water at the bottom of the strip */
  --foam: #d9f1f7;          /* the line of light along the surface and the crests */
  --hull: #f6f1e6;          /* the hull of the boat */
  --stripe: #e2553b;        /* the stripe along the hull and the pennant */
  --sail: #fbf7ee;          /* the mainsail */
  --jib: #f2cf9f;           /* the small sail at the front */
  --text: #f4efe4;          /* the name, the current link and the one pointed at */
  --dim: #8fa6b4;           /* the other links */
  --cta: #f2b544;           /* the button */
  --on-cta: #1c1406;        /* the words on the button */
  --ring: #f2b544;          /* the outline of the keyboard focus */
}

* {
  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(--text);
  font-family: 'Bricolage Grotesque Variable', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- the bar */
/* --water-h is the depth of the strip of water along the bottom, read by the script */
.bar {
  --water-h: 10px;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: min(960px, 100%);
  height: 64px;
  padding: 0 9px 0 20px;
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 60%),
    var(--bar);
  box-shadow:
    inset 0 0 0 1px var(--bar-edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 18px 36px -22px rgba(14, 34, 51, 0.55),
    0 2px 6px -2px rgba(14, 34, 51, 0.25);
}

/* the water and the boat, drawn by the script over the whole bar, under the words */
.sea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

a,
button {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

a:focus,
button:focus {
  outline: none;
}

/* ---------------------------------------------------------------- the name */
.brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  margin-top: 6px;
  padding: 0 6px 0 0;
  border-radius: 10px;
}

.brand__mark {
  width: 20px;
  height: 22px;
  flex: none;
  overflow: visible;
}

.brand__pole {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.brand__flag {
  fill: var(--stripe);
  transform-box: fill-box;
  transform-origin: 0% 50%;
}

.brand__name {
  font-size: 18px;
  font-stretch: 88%;
  font-weight: 720;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------- the links */
.nav {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  align-self: stretch;
}

/* the panel's own water, only on a phone */
.nav__sea {
  display: none;
}

.list {
  display: flex;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  height: 100%;
}

/* each link is as tall as the bar, so a touch on the water under a word chooses it too; the word sits in the top row */
.link {
  display: block;
  height: 100%;
  padding: 11px 14px 0;
  color: var(--dim);
  font-size: 14.5px;
  font-stretch: 92%;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 18px;
  white-space: nowrap;
  transition: color 0.35s ease;
}

.link__word {
  position: relative;
  display: block;
  transition: transform 0.16s ease-out;
}

/* each letter rides the water under it: the script moves them */
.link__char {
  display: inline-block;
  white-space: pre;
}

/* the keys: a ring round the word, above the water */
.link__word::after {
  content: '';
  position: absolute;
  inset: -4px -8px -4px;
  border: 1.5px solid var(--ring);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
}

.link:focus-visible .link__word::after {
  opacity: 1;
}

.link[aria-current='page'] {
  color: var(--text);
}

.link:focus-visible {
  color: var(--text);
}

@media (hover: hover) {
  .link:hover {
    color: var(--text);
  }
}

.link:active .link__word {
  transform: translateY(1px);
}

/* ---------------------------------------------------------------- the button */
/* the pill of the bar: the words widen on the width axis, the pill swells with a bounce (in the script) */
.cta {
  position: relative;
  z-index: 1;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 138px;
  height: 38px;
  margin-top: 7px;
  color: var(--on-cta);
  font-size: 14px;
  font-stretch: 90%;
  font-weight: 680;
  white-space: nowrap;
  isolation: isolate;
  transition: font-stretch 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.16s ease-out;
}

.cta__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 999px;
  background: var(--cta);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(80, 50, 0, 0.18);
}

@media (hover: hover) {
  .cta:hover {
    font-stretch: 100%;
  }
}

.cta:active {
  transform: scale(0.96);
}

.brand:focus-visible,
.cta:focus-visible,
.toggle:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.cta:focus-visible,
.toggle:focus-visible {
  border-radius: 999px;
}

/* ---------------------------------------------------------------- the menu button, only on a phone */
.toggle {
  position: relative;
  z-index: 1;
  display: none;
  flex: none;
  align-items: center;
  gap: 7px;
  height: 38px;
  margin: 6px 0 0 auto;
  padding: 0 15px 0 11px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  font: inherit;
  font-size: 14px;
  font-stretch: 92%;
  font-weight: 640;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.16s ease-out;
}

.toggle__icon {
  width: 22px;
  height: 22px;
  overflow: visible;
}

.toggle__line {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.toggle__label {
  display: inline-block;
  min-width: 38px;
}

@media (hover: hover) {
  .toggle:hover {
    background: rgba(255, 255, 255, 0.13);
  }
}

.toggle:active {
  transform: scale(0.96);
}

/* ---------------------------------------------------------------- the phone: the links open in a panel of moorings */
@media (max-width: 760px) {
  .bar {
    --water-h: 10px;
    height: 60px;
    padding: 0 8px 0 16px;
    border-radius: 18px;
  }

  .brand {
    margin-top: 6px;
  }

  .cta {
    display: none;
  }

  .toggle {
    display: flex;
  }

  /* the panel hangs under the bar; one row for each link, each with its own strip of water */
  .nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 2;
    flex: none;
    border-radius: 18px;
    background: var(--bar);
    box-shadow:
      inset 0 0 0 1px var(--bar-edge),
      0 22px 40px -24px rgba(14, 34, 51, 0.6);
    clip-path: inset(0 0 100% 0 round 18px);
    visibility: hidden;
  }

  .bar.is-open .nav {
    clip-path: inset(0 0 0 0 round 18px);
    visibility: visible;
  }

  .nav__sea {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    pointer-events: none;
  }

  .list {
    position: relative;
    flex-direction: column;
    height: auto;
  }

  .item {
    height: 58px;
  }

  .link {
    padding: 12px 20px 0;
    font-size: 18px;
    line-height: 22px;
  }

  .link__word {
    display: inline-block;
  }
}

/* with less motion: no presses that shrink, and the button keeps its width */
@media (prefers-reduced-motion: reduce) {
  .cta {
    font-stretch: 90%;
  }
  @media (hover: hover) {
    .cta:hover {
      font-stretch: 90%;
    }
  }

  .cta:active,
  .toggle:active,
  .link:active .link__word {
    transform: none;
  }
}
