/* The tram nav: the top bar of a heritage tram company, alone on a white page. Under the bar hangs the contact wire
   and runs the rail, drawn by the script, which reads the colours of the tram from here. */
:root {
  --page: #ffffff;          /* the page */
  --bar: #173a33;           /* the bar, the bottle green of an old tram depot */
  --bar-edge: rgba(255, 255, 255, 0.08);  /* the bar's edge */
  --text: #f5eedd;          /* the name, the current link and the one pointed at */
  --dim: #9db5ab;           /* the other links */
  --cream: #f3e6c8;         /* the upper half of the tram */
  --livery: #b8392b;        /* the lower half of the tram, tomato red */
  --brass: #d8a446;         /* the brass lining, the handrails and the button */
  --glass: #20343a;         /* the windows */
  --roof: #3b3f3d;          /* the roof, the trucks and the pantograph */
  --steel: #8d9693;         /* the rail and the wire */
  --sleeper: #8a6a4a;       /* the wooden sleepers */
  --spark: #ffb547;         /* the sparks */
  --on-cta: #23180a;        /* the words on the button */
  --ring: #d8a446;          /* the outline of the keyboard focus */
}

* {
  box-sizing: border-box;
}

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: 40px 16px;
}

/* the bar and the track under it: one piece */
.line {
  position: relative;
  width: min(940px, 100%);
}

/* ---------------------------------------------------------------- the bar */
.bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 10px 0 18px;
  border-radius: 18px 18px 12px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 55%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 7px),
    var(--bar);
  box-shadow:
    inset 0 0 0 1px var(--bar-edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 14px 30px -20px rgba(23, 58, 51, 0.55);
}

/* the track: wire under the bar, the tram and the rail, drawn by the script */
.track {
  position: absolute;
  left: 0;
  top: 58px;
  width: 100%;
  height: 66px;
  pointer-events: none;
  z-index: 2;
}

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

a:focus {
  outline: none;
}

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

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

.brand__wire,
.brand__rail {
  fill: none;
  stroke: var(--dim);
  stroke-width: 1.2;
  stroke-linecap: round;
}

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

.brand__body {
  fill: var(--livery);
  stroke: var(--cream);
  stroke-width: 1.2;
}

.brand__glass {
  fill: var(--cream);
}

.brand__wheel {
  fill: var(--bar);
  stroke: var(--dim);
  stroke-width: 1.1;
}

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

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

.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; the script widens and weighs the word */
.link {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  color: var(--dim);
  font-size: 15px;
  font-stretch: 90%;
  font-weight: 560;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.35s ease;
}

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

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

/* the keys: a ring round the word */
.link::after {
  content: '';
  position: absolute;
  inset: 16px 6px;
  border: 1.5px solid var(--ring);
  border-radius: 9px;
  opacity: 0;
  pointer-events: none;
}

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

/* ---------------------------------------------------------------- the button */
.cta {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e6b75d, var(--brass) 60%, #b98a33);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 6px 14px -8px rgba(0, 0, 0, 0.5);
  color: var(--on-cta);
  font-size: 14.5px;
  font-stretch: 92%;
  font-weight: 680;
}

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

.cta__label {
  display: block;
}

/* ---------------------------------------------------------------- phones: the button goes, the name too */
@media (max-width: 640px) {
  .bar {
    height: 60px;
    gap: 4px;
    padding: 0 6px 0 12px;
  }
  .track {
    top: 54px;
  }
  .brand__name,
  .cta {
    display: none;
  }
  .list {
    justify-content: space-around;
  }
  .link {
    padding: 0 9px;
    font-size: 14px;
  }
}
