/* The droplet nav bar: the main nav of Verdant Atelier (benches, shelters and signs in wood and steel) on an ivory
   page with a fine grain. The pills are drawn in an SVG behind the HTML buttons: the SVG takes the measures of the
   buttons, the buttons only carry the words and take the clicks. On a narrow screen the bar turns into a column. */
:root {
  --page: #f1ece2;          /* the ivory page */
  --page-light: #f8f5ef;    /* the light in the middle of the page */
  --page-edge: #e4ddcf;     /* the page at its edges */
  --lacquer: #241f21;       /* the pills, a dark lacquer */
  --lacquer-lift: #3a3236;  /* the pill under the pointer, in reduced motion */
  --accent: #e9e778;        /* the chosen pill and the light */
  --label: #f3eee3;         /* the words on the pills */
  --label-on: #241f21;      /* the words on the chosen pill */
  --ink: #241f21;           /* the brand and the line under the bar */
  --muted: #8b8274;         /* the line under the bar */
  --gap: 6px;               /* set again from script.js */
  --push: 28px;             /* set again from script.js */
  --h: clamp(40px, min(4.1vw, 8.2vh), 62px); /* the height of a pill */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px 16px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 50% 46%, var(--page-light) 0%, rgba(248, 245, 239, 0) 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, rgba(228, 221, 207, 0) 55%, var(--page-edge) 100%),
    var(--page);
}

/* the grain of the page */
.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .33 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 3.4vh, 30px);
  opacity: 0;
}

.brand {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(13px, min(1.35vw, 2.6vh), 20px);
  font-weight: 620;
  font-variation-settings: 'wdth' 112;
  letter-spacing: 0.02em;
}

.brand__mark {
  width: 1.4em;
  height: 1.4em;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0 calc(var(--push) * 2);
  touch-action: none;
}

/* the soft contact shadow of the row on the paper */
.nav::before {
  content: '';
  position: absolute;
  left: calc(var(--push) * 2 + 2%);
  right: calc(var(--push) * 2 + 2%);
  top: calc(100% - var(--h) * 0.2);
  height: calc(var(--h) * 0.75);
  border-radius: 50%;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(70, 54, 36, 0.3), rgba(70, 54, 36, 0) 100%);
  filter: blur(8px);
  pointer-events: none;
}

.is-column .nav::before {
  display: none;
}

.nav__shine {
  fill: url(#shine);
  filter: blur(1.4px);
  pointer-events: none;
}

.nav__liquid {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}

.nav__bridges,
.nav__drops {
  fill: var(--lacquer);
}

.nav__glow {
  mix-blend-mode: difference;
}

.nav__item {
  position: relative;
  z-index: 1;
  height: var(--h);
  padding: 0 clamp(16px, 1.75vw, 26px);
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--label);
  font: inherit;
  font-size: clamp(11.5px, min(1.22vw, 2.4vh), 18px);
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.35s ease, font-variation-settings 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  will-change: transform;
}

.nav__item.is-hot {
  font-variation-settings: 'wdth' 112;
}

.nav__item.is-on {
  color: var(--label-on);
}

.nav__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.nav__item--cart {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 clamp(13px, 1.4vw, 20px);
}

.nav__bag {
  width: 1.3em;
  height: 1.3em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.nav__count {
  position: relative;
  display: inline-block;
  width: 1ch;
  height: 1.2em;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1.2;
}

.nav__count span {
  position: absolute;
  left: 0;
  top: 0;
}

.caption {
  position: relative;
  margin: 0;
  height: 1.45em;
  min-width: min(380px, 90vw);
  overflow: hidden;
  text-align: center;
  font-size: clamp(12.5px, min(1.2vw, 2.4vh), 16px);
  color: var(--muted);
  font-variation-settings: 'wdth' 104;
}

.caption__line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  white-space: nowrap;
}

/* the column, when the row does not fit */
.is-column .nav {
  flex-direction: column;
  padding: calc(var(--push) * 2) 0;
}

.is-column {
  --h: clamp(24px, 6.6vh, 36px);
}

.is-column .nav__item {
  padding: 0 16px;
  font-size: 11.5px;
}

.is-column .nav__item--cart {
  padding: 0 14px;
}

@media (max-height: 430px) {
  .is-column .brand {
    display: none;
  }
}

/* the pointer drawn on the page */
.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 24px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(36, 31, 33, 0.28));
}

.cursor svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: #ffffff;
  stroke: var(--lacquer);
  stroke-width: 1.4;
  stroke-linejoin: round;
}
