/* The watercolour nav: the top bar of an illustrator's studio on a white page, a strip of watercolour paper with the
   current link on a wet stroke of ultramarine. The paper and the paint are drawn by the script with the colours below. */
:root {
  --page: #ffffff;          /* the page */
  --paper: #fbf8f1;         /* the watercolour paper */
  --pigment: #8f9cd6;       /* the pigment, as a thin wash of it looks on white: French ultramarine */
  --ink: #1d1f2c;           /* the brand, the current link and the one pointed at */
  --muted: #6e6a66;         /* the other links */
  --ring: #2e3f9e;          /* 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(--ink);
  font-family: 'Literata Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- the strip of paper */
.bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(880px, 100%);
  height: 64px;
  padding: 0 14px 0 22px;
  isolation: isolate;
}

/* the paper with its grain, its fibres and its deckled edge, drawn once; the soft shadow it casts on the page */
.bar__paper {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(70, 58, 40, 0.1)) drop-shadow(0 10px 16px rgba(70, 58, 40, 0.09));
}

/* the paint: how much light the pigment and the water let through, laid on the paper like a glaze */
.bar__paint {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* with less motion, the old stroke fades away over the new one */
.bar__paint--old {
  opacity: 0;
}

/* the shine of the water on the paper while it is wet */
.bar__sheen {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

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

a:focus {
  outline: none;
}

/* ---------------------------------------------------------------- the brand */
.brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 6px 0 2px;
  border-radius: 10px;
}

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

.brand__handle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
}

.brand__ferrule {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 0.6;
  stroke-linejoin: round;
}

.brand__tip {
  fill: var(--ring);
  stroke: var(--ring);
  stroke-width: 0.5;
  stroke-linejoin: round;
}

.brand__name {
  font-size: 21px;
  font-style: italic;
  font-weight: 520;
  letter-spacing: -0.015em;
  line-height: 1;
}

/* ---------------------------------------------------------------- the links */
.bar__nav {
  display: flex;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.bar__list {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar__link {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 15.5px;
  font-weight: 460;
  letter-spacing: -0.004em;
  white-space: nowrap;
  transition: color 0.25s ease;
}

.bar__word {
  display: block;
  transition: transform 0.16s ease-out;
}

.bar__link[aria-current='page'],
.bar__link:focus-visible {
  color: var(--ink);
}

@media (hover: hover) {
  .bar__link:hover {
    color: var(--ink);
  }
}

.bar__link:active .bar__word {
  transform: translateY(1px);
}

/* ---------------------------------------------------------------- the button */
.bar__cta {
  display: flex;
  flex: none;
  align-items: center;
  height: 38px;
  padding: 0 17px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.25px var(--ink);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 520;
  letter-spacing: -0.004em;
  white-space: nowrap;
  transition: background-color 0.22s ease, color 0.22s ease, transform 0.16s ease-out;
}

@media (hover: hover) {
  .bar__cta:hover {
    background: var(--ink);
    color: var(--paper);
  }
}

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

/* ---------------------------------------------------------------- the keys */
/* a ring of ultramarine drawn close round the word, inside the paper */
.bar__link:focus-visible,
.brand:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ring);
}

.bar__cta:focus-visible {
  box-shadow: inset 0 0 0 1.25px var(--ink), 0 0 0 2px var(--paper), 0 0 0 4px var(--ring);
}

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 900px) {
  .bar__cta {
    display: none;
  }

  .bar {
    padding-right: 10px;
  }
}

/* on a phone the brand keeps its mark, and the links close up to fit beside it */
@media (max-width: 560px) {
  .bar {
    gap: 2px;
    height: 60px;
    padding: 0 4px 0 8px;
  }

  .brand {
    padding: 0 4px 0 2px;
  }

  .brand__mark {
    width: 21px;
    height: 21px;
  }

  .brand__name {
    display: none;
  }

  .bar__list {
    gap: 0;
  }

  .bar__link {
    padding: 0 clamp(4px, 1.5vw, 9px);
    font-size: clamp(12.5px, 3.5vw, 15px);
  }
}

/* the narrowest phones: a little less air round the words */
@media (max-width: 380px) {
  .bar {
    padding: 0 2px 0 6px;
  }

  .bar__link {
    padding: 0 4.5px;
    font-size: 12.5px;
  }
}

@media (max-width: 340px) {
  .brand {
    display: none;
  }

  .bar__link {
    padding: 0 4px;
    font-size: 12px;
  }
}

/* with less motion, the presses do not move anything */
@media (prefers-reduced-motion: reduce) {
  .bar__link:active .bar__word,
  .bar__cta:active {
    transform: none;
  }
}
