/* The delayed flight notification: the live notification of an airline app in smoked glass, on a near black page
   with two soft lights behind it and a fine grain. .live is moved only by GSAP (x, y, scale, rotation, height, radius);
   everything that the CSS shapes or transforms is a child of it. */
:root {
  --page: #08090c;           /* the page */
  --glass: rgba(30, 32, 40, 0.52);  /* the glass of the notification */
  --edge: rgba(255, 255, 255, 0.1); /* its 1px edge */
  --ink: #f1f1f4;            /* the words */
  --muted: #8e909c;          /* the small words */
  --accent: #ffb44c;         /* the delay: amber */
  --cool: #7aa2ff;           /* on time, and the light behind */
  --button: #f3f3f5;         /* the Got it button */
  --button-ink: #0b0b0e;     /* its words */
}

@property --beam {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

* {
  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;
}

button {
  font: inherit;
  color: inherit;
}

.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: 16px;
  overflow: hidden;
  isolation: isolate;
}

/* the lights behind: a cool one high on the left, a warm one low on the right that wakes up with the delay */
.aura {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.aura span {
  position: absolute;
  border-radius: 50%;
  filter: blur(min(9vw, 9vh, 60px));
}

.aura__a {
  left: calc(50% - min(46vw, 46vh, 230px));
  top: calc(50% - min(30vh, 34vw, 170px));
  width: min(52vw, 46vh, 260px);
  height: min(36vw, 30vh, 170px);
  background: color-mix(in srgb, var(--cool) 46%, transparent);
  opacity: 0.55;
}

.aura__b {
  left: calc(50% + min(2vw, 2vh, 10px));
  top: calc(50% - min(4vh, 4vw, 20px));
  width: min(44vw, 40vh, 220px);
  height: min(30vw, 26vh, 150px);
  background: color-mix(in srgb, var(--accent) 50%, transparent);
  opacity: var(--warm, 0.12);
  transition: opacity 1.2s ease;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the slot keeps the room of the open notification, so nothing around it jumps when it opens */
.slot {
  position: relative;
  width: min(92vw, 360px);
  height: var(--open, 300px);
  max-height: calc(100svh - 32px);
}

.live {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 70px;
  border-radius: 26px;
  overflow: clip;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 46px),
    var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 10px 24px -8px rgba(0, 0, 0, 0.55),
    0 36px 70px -30px rgba(0, 0, 0, 0.85);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  will-change: transform;
}

/* the light under the pointer */
.live__light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(180px circle at var(--mx, 50%) var(--my, -40%), rgba(255, 255, 255, 0.075), transparent 70%);
}

/* the amber light that crosses the glass when the news comes in */
.live__wash {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 60%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 22%, transparent) 55%, color-mix(in srgb, #fff 18%, transparent) 70%, transparent);
  opacity: 0;
}

/* a light that runs once around the 1px edge */
.live__beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: conic-gradient(from var(--beam), transparent 0deg 250deg, color-mix(in srgb, var(--accent) 80%, transparent) 320deg, #fff 345deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
}

.live__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 70px;
  padding: 0 14px 0 13px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.live__head:focus-visible {
  outline: none;
}

.live:has(.live__head:focus-visible) {
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--cool) 70%, transparent),
    0 10px 24px -8px rgba(0, 0, 0, 0.55),
    0 36px 70px -30px rgba(0, 0, 0, 0.85);
}

/* the tile of the app: the plane, which becomes a clock when the flight is late */
.tile {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.22), transparent 60%),
    linear-gradient(160deg, #3a63d8, #1d2f73);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), inset 0 -2px 4px rgba(0, 0, 0, 0.25), 0 4px 10px -4px rgba(20, 40, 120, 0.8);
}

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.3), transparent 60%),
    linear-gradient(160deg, #ffbf5e, #c36b12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 12px -4px rgba(255, 150, 40, 0.75);
  opacity: var(--late, 0);
}

.tile svg {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
}

.tile__plane {
  fill: #fff;
}

.tile__clock {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.head__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.head__title {
  font-size: 14.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head__sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 0;
}

.head__status {
  color: color-mix(in srgb, var(--cool) 70%, #fff);
  font-weight: 560;
}

.is-late .head__status {
  color: var(--accent);
}

.head__dot {
  opacity: 0.6;
}

/* the gate on the right */
.gate {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-left: 4px;
}

.gate__label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.gate__code {
  font-size: 21px;
  line-height: 1.05;
  font-weight: 640;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.02em;
}

/* words that roll: the old line and the new one share one grid cell */
.roll {
  display: inline-grid;
  justify-items: start;
  overflow: hidden;
  vertical-align: bottom;
  padding: 0.08em 0;
  margin: -0.08em 0;
  white-space: nowrap;
}

.gate__code.roll {
  justify-items: end;
}

.roll > .r {
  grid-area: 1 / 1;
  display: block;
}

/* digits that roll one by one */
.chars {
  display: inline-flex;
  font-feature-settings: 'tnum' 0;
}

.chars > .c {
  display: inline-grid;
  justify-items: center;
  overflow: hidden;
  padding: 0.08em 0;
  margin: -0.08em 0;
}

.chars > .c > .r {
  grid-area: 1 / 1;
  display: block;
  text-align: center;
}

/* the open part */
.live__more {
  position: relative;
  padding: 0 16px 16px;
}

.rule {
  display: block;
  height: 1px;
  margin: 0 -16px 14px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1) 18%, rgba(255, 255, 255, 0.1) 82%, transparent);
}

.route {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.route__end {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.route__end--to {
  align-items: flex-end;
}

.route__code {
  font-size: clamp(20px, min(6.4vw, 5vh), 24px);
  font-weight: 650;
  font-variation-settings: 'wdth' 100;
  letter-spacing: -0.01em;
  line-height: 1;
}

.route__time {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-weight: 560;
}

.is-late .route__time > .chars {
  color: var(--accent);
}

/* the old time, struck by a line drawn across it */
.was {
  position: relative;
  font-size: 11.5px;
  font-weight: 450;
  color: var(--muted);
  opacity: 0;
}

.was i,
.pill i {
  position: absolute;
  left: -2px;
  right: -2px;
  top: 52%;
  height: 1.2px;
  border-radius: 1px;
  background: currentColor;
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.route__track {
  position: relative;
  height: 30px;
  margin-top: -16px;
}

.route__dash {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  margin-top: -1px;
  overflow: visible;
}

.route__dash path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.2;
  stroke-dasharray: 2.4 3;
  vector-effect: non-scaling-stroke;
}

.route__go {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.route__plane {
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  fill: var(--ink);
  transform: rotate(90deg);
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.9));
}

.route__go::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 26px;
  height: 18px;
  margin: -9px 0 0 -13px;
  background: radial-gradient(closest-side, rgba(20, 21, 27, 0.95), rgba(20, 21, 27, 0));
}

.route__len {
  position: absolute;
  left: 50%;
  top: calc(50% + 10px);
  transform: translateX(-50%);
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* the gate change, in a small glass card of its own */
.change {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 12px 11px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.change__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.change__title {
  font-size: 13.5px;
  font-weight: 600;
}

.change__note {
  font-size: 12px;
  color: var(--muted);
  max-width: 100%;
}

.change__note > .r {
  overflow: hidden;
  text-overflow: ellipsis;
}

.change__gates {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 30px;
  padding: 0 9px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 640;
  font-variation-settings: 'wdth' 98;
}

.pill--old {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.is-late .pill--old {
  color: var(--muted);
}

.pill--old i {
  left: 8px;
  right: 8px;
}

.pill--new {
  color: #1b1206;
  background: linear-gradient(180deg, #ffd08a, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(120, 60, 0, 0.35), 0 6px 16px -6px color-mix(in srgb, var(--accent) 80%, transparent);
  opacity: 0;
}

.change__arrow {
  width: 20px;
  height: 12px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* the two buttons */
.acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.act {
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.act__face {
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: inherit;
  font-size: 13.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.act__face .roll {
  justify-items: center;
}

.act--ghost {
  background: none;
}

.act--ghost .act__face {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.act--solid {
  background: none;
  color: var(--button-ink);
}

.act--solid .act__face {
  background: linear-gradient(180deg, #ffffff, var(--button));
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 18px -8px rgba(255, 255, 255, 0.35);
}

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

/* the words of Rebook shimmer while it looks for seats */
.is-busy .act__face .r {
  background: linear-gradient(90deg, var(--muted) 30%, #fff 50%, var(--muted) 70%) 0 0 / 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.1s linear infinite;
}

@keyframes shimmer {
  from { background-position: 110% 0; }
  to { background-position: -110% 0; }
}

@media (hover: hover) {
  .live:hover {
    --edge: rgba(255, 255, 255, 0.16);
  }

  .act--ghost:hover .act__face {
    background: rgba(255, 255, 255, 0.11);
  }

  .act--solid:hover .act__face {
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 24px -8px rgba(255, 255, 255, 0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-busy .act__face .r {
    animation: none;
    color: var(--muted);
    background: none;
  }

  .aura__b {
    transition: none;
  }
}
