/* The cable car boarding pass: a pass of deep mountain blue on a white page, its head the line itself in the
   morning, with snow on the peak, pale concrete stations, a red cabin and a blue one. Boarding is amber, the
   light inside the cabins and the stations is the warm yellow of a lamp. */
:root {
  --page: #ffffff;          /* the page */
  --card: #0e2a43;          /* the pass */
  --ink: #f1f5f9;           /* the words on the pass */
  --muted: #93abc2;         /* the small labels */
  --rule: #23435f;          /* the thin lines between the parts */
  --sky-top: #163a5d;       /* the sky over the line, high up */
  --sky-low: #4a7ba3;       /* the sky down by the peaks */
  --haze: #b9d0e2;          /* the morning haze round the summit */
  --far: #2b5479;           /* the range behind */
  --rock: #11314d;          /* the mountain the line climbs */
  --snow: #eaf1f7;
  --snow-shade: #b6cadb;
  --trees: #0a2238;
  --wall: #cfdae4;          /* the concrete of the stations */
  --hall: #0a1c2d;          /* inside the stations */
  --roof: #8aa3bb;
  --steel: #b3c6d7;         /* the tower and the hangers */
  --cable: #e8f0f6;         /* the near track cable */
  --cable-far: #7e9cb8;     /* the far track cable */
  --red: #ff4a2c;           /* your cabin */
  --red-dark: #c3301b;
  --blue: #7f9fc0;          /* the other cabin */
  --blue-dark: #5c7fa3;
  --glass: #14324d;         /* the cabins' windows, the lights off */
  --lit: #ffd27a;           /* the lights on, in the cabins and the stations */
  --amber: #ffc24a;         /* boarding now */
  --amber-ink: #241902;
  --ride: #86e3b8;          /* on the way */
  --code-ink: #0e2a43;      /* the code, open */
  --code-dim: #c4d0dc;      /* the code, not open yet or used */
}

* {
  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: 'Encode Sans Variable', system-ui, sans-serif;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

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

.pass {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: min(360px, 100%);
}

/* ---------------------------------------------------------------- the pass */
.card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(14, 42, 67, 0.18), 0 12px 28px -8px rgba(14, 42, 67, 0.34), 0 32px 64px -24px rgba(14, 42, 67, 0.4);
}

/* ---------------------------------------------------------------- the line */
.scene {
  position: relative;
  touch-action: pan-y;
}

.scene__svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 196;
  overflow: hidden;
}

.g-sky-top { stop-color: var(--sky-top); }
.g-sky-low { stop-color: var(--sky-low); }
.g-haze { stop-color: var(--haze); }
.g-lit { stop-color: var(--lit); }
.g-rock { stop-color: var(--rock); }
.g-card { stop-color: var(--card); }

.far {
  fill: var(--far);
}

.far-snow {
  fill: var(--snow-shade);
  opacity: 0.75;
}

.snow {
  fill: var(--snow);
}

.snow--shade {
  fill: var(--snow-shade);
}

.trees {
  fill: var(--trees);
}

.station__wall {
  fill: var(--wall);
}

.station__hall {
  fill: var(--hall);
}

.station__floor {
  fill: var(--roof);
}

.station__glass {
  fill: var(--hall);
}

.station__frame {
  fill: none;
  stroke: var(--wall);
  stroke-width: 1.2;
}

.station__roof {
  fill: var(--roof);
}

.tower {
  fill: none;
  stroke: var(--steel);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.tower__arm {
  stroke-width: 2.2;
}

.cable {
  fill: none;
  stroke: var(--cable);
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.cable--far {
  stroke: var(--cable-far);
  stroke-width: 1;
}

/* a cabin: the carriage on the cable, and the hanger with the cabin under it (the script draws both) */
.cabin__carriage {
  fill: var(--roof);
}

.cabin__wheels {
  fill: none;
  stroke: var(--hall);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.cabin__hanger {
  fill: none;
  stroke: var(--steel);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.cabin--red .cabin__body,
.cabin--red .cabin__leaf {
  fill: var(--red);
}

.cabin--red .cabin__skirt {
  fill: var(--red-dark);
}

.cabin--blue .cabin__body,
.cabin--blue .cabin__leaf {
  fill: var(--blue);
}

.cabin--blue .cabin__skirt {
  fill: var(--blue-dark);
}

.cabin__roof {
  fill: #ffffff;
  opacity: 0.22;
}

.cabin__glass {
  fill: var(--glass);
}

.cabin__lamp {
  fill: var(--lit);
}

.cabin__mullion {
  fill: none;
  stroke-width: 1.4;
}

.cabin--red .cabin__mullion {
  stroke: var(--red);
}

.cabin--blue .cabin__mullion {
  stroke: var(--blue);
}

/* the name of the line over the sky */
.brand {
  position: absolute;
  z-index: 1;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  pointer-events: none;
}

.brand__mark {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand__cab {
  fill: var(--red);
  stroke: none;
}

.brand__text {
  display: grid;
  gap: 1px;
}

.brand__name {
  font-size: 13px;
  font-weight: 640;
  line-height: 16px;
  letter-spacing: 0.005em;
}

.brand__kind {
  color: var(--haze);
  font-size: 12px;
  font-weight: 480;
  line-height: 16px;
}

/* ---------------------------------------------------------------- what is happening now */
.status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 20px;
  color: var(--ink);
  transition: color 0.3s ease;
}

/* the amber band of boarding, wiped in and out by the script */
.status__band {
  position: absolute;
  inset: 0;
  background: var(--amber);
  clip-path: inset(0 100% 0 0);
}

.status.is-boarding {
  color: var(--amber-ink);
}

.status__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
}

.status__icon svg {
  width: 26px;
  height: 26px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status--ride .status__icon {
  color: var(--ride);
}

.status__text {
  position: relative;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.status__title {
  overflow: hidden;
  font-size: 20px;
  font-weight: 680;
  font-stretch: 92%;
  line-height: 24px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status__sub {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color 0.3s ease;
}

.status.is-boarding .status__sub {
  color: var(--amber-ink);
}

/* ---------------------------------------------------------------- from and to */
.route {
  display: grid;
  gap: 4px;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--rule);
}

.stop {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: baseline;
  margin: 0;
}

.stop__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
  line-height: 16px;
}

/* the name and the height of a station move together when the pass turns to the other half of the ticket */
.stop__move {
  display: flex;
  transform-origin: 0 50%;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.stop__name {
  overflow: hidden;
  font-size: 28px;
  font-weight: 700;
  font-stretch: 78%;
  line-height: 32px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stop__alt {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the details */
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 20px 16px;
}

.fact dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
  line-height: 16px;
}

.fact dd {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 640;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fact dd span {
  display: inline-block;
}

/* ---------------------------------------------------------------- the code and the passenger */
.ticket {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--rule);
}

.code {
  position: relative;
  width: 116px;
  height: 116px;
}

.code__svg {
  display: block;
  width: 116px;
  height: 116px;
  shape-rendering: crispEdges;
}

.code__paper {
  fill: #ffffff;
}

.code__dim {
  fill: var(--code-dim);
}

.code__ink {
  fill: var(--code-ink);
}

.code__glare {
  fill: var(--lit);
  opacity: 0;
  shape-rendering: geometricPrecision;
}

.holder {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.holder__list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.holder__list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
  line-height: 16px;
}

.holder__list dd {
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.holder__note {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 16px;
}

.holder__note.is-open {
  color: var(--amber);
}

/* ---------------------------------------------------------------- under the pass */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 0 8px;
}

.bar__updated {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  color: #5d6f80;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.act {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  min-width: 132px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 620 15px/1 'Encode Sans Variable', system-ui, sans-serif;
  letter-spacing: 0.005em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s cubic-bezier(0.23, 1, 0.32, 1), background-color 0.2s ease, opacity 0.25s ease;
}

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

/* on the button the word stretches a little on the width axis, and the arrow of Refresh turns a quarter on its way */
.act__label,
.act__icon {
  transition: font-stretch 0.34s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) and (pointer: fine) {
  .act:not([aria-disabled='true']):hover {
    background: #1b3d5c;
  }

  .act:not([aria-disabled='true']):hover .act__label {
    font-stretch: 112%;
  }

  .act:not([aria-disabled='true']):hover .act__icon[data-icon='refresh'] {
    transform: rotate(50deg);
  }

  .act:not([aria-disabled='true']):hover .act__icon[data-icon='swap'] {
    transform: scaleX(-1);
  }
}

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

.act[aria-disabled='true'] {
  opacity: 0.42;
  cursor: default;
}

.act[aria-disabled='true']:active {
  transform: none;
}

.act__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
}

.act__icon svg {
  width: 20px;
  height: 20px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.act__label {
  display: inline-block;
  white-space: nowrap;
}

.act__short {
  display: none;
}

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

/* a narrow phone: the names and the details a little smaller */
@media (max-width: 359px) {
  .act__long {
    display: none;
  }

  .act__short {
    display: inline;
  }

  .status__title {
    font-size: 18px;
    font-stretch: 86%;
  }

  .stop__name {
    font-size: 25px;
  }

  .fact dd {
    font-size: 16px;
  }

  .ticket {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .code,
  .code__svg {
    width: 104px;
    height: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .act {
    transition: background-color 0.2s ease, opacity 0.25s ease;
  }

  .act__label,
  .act__icon {
    transition: none;
  }

  .act__icon[data-icon] {
    transform: none !important;
  }

  .act:active {
    transform: none;
  }
}
