/* The shop sign tab bar: a cream board alone on a white page, with a brass rail along its top and an oxblood enamel
   sign hanging from it on two cords. The sign is placed by the script on every frame; the colours are here. */
:root {
  --page: #ffffff;          /* the page */
  --board: #f6f0e5;         /* the bar, a cream painted board */
  --icon: #928474;          /* an icon at rest */
  --icon-hover: #6c5d50;    /* an icon under the pointer */
  --ink: #2a201b;           /* the icon under the sign */
  --brass: #c49d55;         /* the rail, the hooks and the clips */
  --brass-light: #f4e2b0;   /* their lit side */
  --brass-dark: #7a5a24;    /* their shaded side */
  --cord: #3a2c24;          /* the two cords */
  --enamel: #7e2433;        /* the sign */
  --enamel-dark: #4f1320;   /* the sign's lower edge */
  --letter: #f8ebd2;        /* the letters on the sign and its fine border */
}

* {
  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: 'Fraunces Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ---------------------------------------------------------------- the bar */
/* as wide as a phone's tab bar, never wider than 420 pixels nor than the screen */
.bar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(420px, 100%);
  height: 72px;
  padding: 0 6px;
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--board) 70%, #ffffff) 0%, var(--board) 38%, color-mix(in srgb, var(--board) 94%, #6b4a2a) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(90, 60, 30, 0.06),
    0 0 0 1px rgba(90, 62, 34, 0.09),
    0 18px 30px -18px rgba(70, 45, 20, 0.36),
    0 4px 10px -5px rgba(70, 45, 20, 0.14);
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.tab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: end;
  padding: 0 0 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--icon);
  font: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.25s ease-out;
}

/* the icon: its wrapper hops and gives way under the sign (the script), the icon inside answers the pointer (here) */
.tab__lift {
  display: block;
  width: 24px;
  height: 24px;
  transform-origin: 50% 100%;
  will-change: transform;
}

.tab__icon {
  display: block;
  width: 24px;
  height: 24px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* the tint inside the icon under the sign, in the sign's own colour */
.tab__fill {
  fill: color-mix(in srgb, var(--enamel) 24%, var(--board));
  stroke: none;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.tab.is-lit {
  color: var(--ink);
}

.tab.is-lit .tab__fill {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .tab:not(.is-lit):hover {
    color: var(--icon-hover);
  }

  .tab:not(.is-lit):hover .tab__icon {
    transform: translateY(-1px);
  }
}

.tab:active .tab__icon {
  transform: scale(0.88);
  transition: transform 0.08s ease-out;
}

/* the focus, from the keyboard only: a ring round the icon, clear of the sign above it */
.tab::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 40px;
  height: 32px;
  margin-left: -20px;
  border-radius: 11px;
  box-shadow: inset 0 0 0 2px var(--ink);
  opacity: 0;
  pointer-events: none;
}

.tab:focus-visible::after {
  opacity: 1;
}

html[data-using='pointer'] .tab:focus-visible::after {
  opacity: 0;
}

/* ---------------------------------------------------------------- the rail */
/* a thin brass rod held off the board by a bracket at each end */
.rail {
  position: absolute;
  left: 17px;
  right: 17px;
  top: 4.6px;
  height: 2.4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brass-light) 0%, var(--brass) 45%, var(--brass-dark) 100%);
  box-shadow: 0 1.6px 1.4px -0.2px rgba(80, 52, 20, 0.28);
  pointer-events: none;
}

.rail::before,
.rail::after {
  content: '';
  position: absolute;
  top: -2.2px;
  width: 4.4px;
  height: 6.8px;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--brass) 0%, var(--brass-dark) 55%, color-mix(in srgb, var(--brass-dark) 70%, #2a1a08) 100%);
  box-shadow: 0 1px 1.2px rgba(80, 52, 20, 0.3), inset 0 0.6px 0 rgba(255, 240, 200, 0.45);
}

.rail::before {
  left: -3px;
}

.rail::after {
  right: -3px;
}

/* ---------------------------------------------------------------- what hangs from it */
.hanger {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cords {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cords path {
  fill: none;
  stroke-linecap: round;
}

.cords__line path {
  stroke: var(--cord);
  stroke-width: 1.05;
}

.cords__shade path {
  stroke: rgba(80, 50, 25, 0.16);
  stroke-width: 1.4;
}

/* a hook: a brass sleeve round the rod, which runs along it */
.hook {
  position: absolute;
  left: 0;
  top: 2.4px;
  width: 5px;
  height: 7.4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brass-dark) 0%, var(--brass-light) 36%, var(--brass) 68%, var(--brass-dark) 100%);
  box-shadow: 0 1px 1.2px rgba(70, 45, 15, 0.35);
  will-change: transform;
}

/* the sign's shadow on the board */
.shade {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 18px;
  border-radius: 4px;
  background: rgba(74, 40, 22, 0.24);
  filter: blur(2.2px);
  will-change: transform;
}

/* the sign: placed, turned and tilted by the script */
.sign {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 18px;
  will-change: transform;
}

.sign__plate {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 3.6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--enamel) 84%, #ffffff) 0%, var(--enamel) 42%, color-mix(in srgb, var(--enamel) 70%, var(--enamel-dark)) 100%);
  box-shadow:
    inset 0 0 0 0.6px rgba(40, 6, 12, 0.6),
    inset 0 1px 0 rgba(255, 220, 210, 0.28),
    inset 0 -1.2px 0 var(--enamel-dark);
}

/* the fine border painted round the edge, as on enamel shop signs */
.sign__rule {
  position: absolute;
  inset: 2.2px;
  border: 0.75px solid color-mix(in srgb, var(--letter) 80%, var(--enamel));
  border-radius: 2px;
}

.sign__words {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.sign__word {
  grid-area: 1 / 1;
  padding-left: 0.14em;
  color: var(--letter);
  font-size: 8.6px;
  font-weight: 640;
  font-variation-settings: 'opsz' 9, 'SOFT' 50, 'WONK' 0;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: pre;
  text-shadow: 0 0.6px 0 rgba(40, 6, 12, 0.55);
}

.sign__letter {
  display: inline-block;
}

/* the side of the sign turned away, a little darker */
.sign__side {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(30, 0, 8, 0) 25%, rgba(30, 0, 8, 0.36) 100%);
  opacity: 0;
}

/* the gloss on the enamel: it slides as the sign turns and tilts */
.sign__gloss {
  position: absolute;
  inset: -2px -30px;
  background: linear-gradient(104deg, rgba(255, 255, 255, 0) 38%, rgba(255, 244, 236, 0.2) 47%, rgba(255, 255, 255, 0.04) 53%, rgba(255, 255, 255, 0) 60%);
  will-change: transform;
}

/* the two brass clips where the cords are tied */
.sign__clip {
  position: absolute;
  top: -1.6px;
  left: 9px;
  width: 3.6px;
  height: 4.6px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--brass-dark) 0%, var(--brass-light) 40%, var(--brass) 70%, var(--brass-dark) 100%);
  box-shadow: 0 0.6px 0.8px rgba(40, 10, 10, 0.45);
}

.sign__clip--right {
  left: auto;
  right: 9px;
}
