/* The fluid menu: a white frame with its Menu button; the ink that fills it is a fluid simulated in WebGL on the
   canvas, the links are HTML over it. */
:root {
  --page: #ffffff;          /* the page and the inside of the frame */
  --edge: #e8e7ee;          /* the frame's hairline */
  --indigo: #2f22c4;        /* the ink */
  --indigo-deep: #160f63;   /* the ink where it is thick */
  --orange: #ff6a1a;        /* the second ink */
  --button: #15131f;        /* the Menu button */
  --paper: #ffffff;         /* the words on the ink */
}

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

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

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px 16px;
}

/* ---------------------------------------------------------------- the frame */
.panel {
  position: relative;
  width: min(1060px, 100%);
  height: clamp(520px, calc(100svh - 40px), 700px);
  overflow: hidden;
  border-radius: 28px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--edge);
  isolation: isolate;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.panel__ink,
.panel__still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.panel__still {
  display: none;
  opacity: 0;
  background:
    radial-gradient(60% 50% at 88% 6%, color-mix(in srgb, var(--orange) 85%, transparent), transparent 70%),
    radial-gradient(45% 40% at 22% 78%, color-mix(in srgb, var(--orange) 45%, transparent), transparent 70%),
    radial-gradient(90% 80% at 70% 30%, var(--indigo), transparent 80%),
    var(--indigo-deep);
}

.is-still .panel__still {
  display: block;
}

.is-still .panel__ink {
  display: none;
}

/* ---------------------------------------------------------------- the button */
.toggle {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  height: 50px;
  padding: 0 20px 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--paper);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.4s ease, color 0.4s ease, transform 0.25s cubic-bezier(0.34, 1.6, 0.5, 1);
}

@media (hover: hover) and (pointer: fine) {
  .toggle:hover {
    transform: scale(1.04);
  }
}

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

.toggle:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 4px;
}

.toggle[aria-expanded='true'] {
  background: var(--paper);
  color: var(--indigo-deep);
}

.toggle[aria-expanded='true']:focus-visible {
  outline-color: var(--paper);
}

.toggle__words {
  display: inline-block;
  overflow: hidden;
  height: 1.3em;
  line-height: 1.3;
}

.toggle__word {
  display: inline-block;
}

/* two lines that cross into an X when the menu is open */
.toggle__icon {
  position: relative;
  width: 20px;
  height: 10px;
}

.toggle__icon i {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1), top 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}

.toggle__icon i:first-child {
  top: 0;
}

.toggle__icon i:last-child {
  top: 8px;
}

.toggle[aria-expanded='true'] .toggle__icon i:first-child {
  top: 4px;
  transform: rotate(45deg);
}

.toggle[aria-expanded='true'] .toggle__icon i:last-child {
  top: 4px;
  transform: rotate(-45deg);
}

/* ---------------------------------------------------------------- the menu, over the ink */
.menu {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 92px clamp(24px, 6vw, 72px) clamp(24px, 4vw, 40px);
  color: var(--paper);
  pointer-events: none;
}

.menu:not([inert]) {
  pointer-events: auto;
}

.menu__list {
  align-self: center;
  display: grid;
  justify-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: inline-flex;
  align-items: center;
  gap: 0.22em;
  padding: 0.02em 0.12em 0.06em 0;
  border-radius: 10px;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(46px, 8.2vw, 104px);
  font-weight: 380;
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0;
  opacity: 0;
  transition: font-variation-settings 0.5s ease, font-weight 0.5s ease;
}

.item__word {
  display: inline-block;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.item__arrow {
  width: 0.42em;
  height: 0.26em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: translateX(-0.3em);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* the link pointed at goes soft and heavy, and its arrow slides in */
.item:focus-visible {
  font-weight: 560;
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
}
@media (hover: hover) {
  .item:hover {
    font-weight: 560;
    font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
  }
}

.item:focus-visible .item__word {
  transform: translateX(0.08em);
}
@media (hover: hover) {
  .item:hover .item__word {
    transform: translateX(0.08em);
  }
}

.item:focus-visible .item__arrow {
  opacity: 1;
  transform: translateX(0.1em);
}
@media (hover: hover) {
  .item:hover .item__arrow {
    opacity: 1;
    transform: translateX(0.1em);
  }
}

.item:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 4px;
}

.item[aria-current='page'] .item__word {
  font-style: normal;
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.12em;
}

.menu__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-size: 15px;
  font-weight: 560;
  opacity: 0;
}

.menu__foot a {
  border-radius: 4px;
  color: color-mix(in srgb, var(--paper) 78%, transparent);
  transition: color 0.25s ease;
}

.menu__foot a:focus-visible {
  color: var(--paper);
}
@media (hover: hover) {
  .menu__foot a:hover {
    color: var(--paper);
  }
}

.menu__foot a:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .panel {
    border-radius: 22px;
  }

  .toggle {
    top: 16px;
    right: 16px;
    height: 46px;
    padding: 0 17px 0 20px;
  }

  .menu {
    padding-top: 84px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toggle,
  .toggle__icon i,
  .item,
  .item__word,
  .item__arrow {
    transition: none;
  }
}
