/* The popping cork toast: a notification made of sparkling wine foam on a black page. The bottle, its foil and cage,
   the cork, the foam and the bubbles are painted by script.js in the colours below; the words are HTML on top.
   In a real page the cellar sits where the notifications go (at the top or the bottom of the window, with
   position: fixed); here it stands in the middle of the page. */
:root {
  --page: #000000;          /* the page */
  --foam-top: #fff8e6;      /* the foam at the top of the notification */
  --foam: #f6e0a2;          /* the foam in the middle */
  --foam-deep: #e5b552;     /* the foam at the bottom, where it turns back into wine */
  --foam-shade: #a8721f;    /* the rims of the bubbles and the shade at the edges */
  --ink: #2e1c07;           /* the title */
  --muted: #6e4c1a;         /* the line under it */
  --glass: #1b5a35;         /* the bottle's green glass */
  --glass-dark: #051a0e;    /* its glass at the edges */
  --foil: #e6c066;          /* the gold foil on the neck */
  --foil-dark: #74500f;     /* its folds */
  --collar: #6d1d2a;        /* the band round the neck */
  --cork: #d8ae74;          /* the cork */
  --cork-dark: #94652f;     /* its shaded side */
  --wire: #d9dce2;          /* the wire cage */
  --mist: #f3f0ea;          /* the breath of gas when the cork pops */
  --trigger-ink: #f1e2bb;   /* the words on the button */
  --trigger-line: rgba(241, 226, 187, 0.26);   /* its outline */
  --trigger-hover: rgba(241, 226, 187, 0.08);  /* its fill under the pointer */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap, no zoom */
html {
  touch-action: manipulation;
}

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

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

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

/* the cork and the spray fly a little out of the notification: they never make the page scroll */
.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 120px 16px 40px;
  overflow: clip;
}

/* the notification's place and, under it, the button that brings the news */
.cellar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  width: min(380px, 100%);
}

.slot {
  position: relative;
  width: 100%;
  height: 70px;
}

/* the painting: wider and taller than the place, for the bottle, the cork and the spray (script.js sizes it) */
.fizz {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the notification (the foam is under it) */
.card {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 0 16px;
  border-radius: 18px;
  -webkit-tap-highlight-color: transparent;
}

.card[inert] {
  pointer-events: none;
}

.card__icon {
  flex: none;
  width: 28px;
  height: 28px;
  overflow: visible;
}

.card__glass {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__wine {
  fill: var(--foam-deep);
}

.card__text {
  flex: 1;
  min-width: 0;
}

.card__title,
.card__body {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__title {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 16px;
  line-height: 21px;
  font-weight: 620;
  font-variation-settings: 'SOFT' 100, 'WONK' 0;
  letter-spacing: -0.005em;
}

/* the letters of the title are written one by one (script.js) */
.card__title .ch {
  display: inline-block;
  white-space: pre;
}

.card__body {
  margin-top: 2px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 480;
  font-stretch: 100%;
  color: var(--muted);
}

.card__close {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.2s ease, color 0.2s ease, scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* a bigger area for a finger than the drawn one */
.card__close::after {
  content: '';
  position: absolute;
  inset: -6px;
}

@media (hover: hover) and (pointer: fine) {
  .card__close:hover {
    background: rgba(110, 76, 26, 0.12);
    color: var(--ink);
  }
}

.card__close:active {
  scale: 0.9;
}

.card__close:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.card__close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
}

/* ---------------------------------------------------------------- the button that brings the news */
.trigger {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--trigger-line);
  color: var(--trigger-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 540;
  letter-spacing: 0.005em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, scale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) and (pointer: fine) {
  .trigger:hover {
    background: var(--trigger-hover);
    box-shadow: inset 0 0 0 1px var(--trigger-ink);
  }
}

.trigger:active {
  scale: 0.96;
}

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

/* the words roll to the next piece of news (both lines share one cell while they pass) */
.trigger__label {
  display: grid;
  overflow: hidden;
  line-height: 22px;
  white-space: nowrap;
}

.trigger__label > span {
  grid-area: 1 / 1;
  text-align: center;
}

/* ---------------------------------------------------------------- the phone */
@media (max-width: 420px) {
  .card {
    gap: 10px;
    padding: 0 8px 0 14px;
  }

  .card__title {
    font-size: 15.5px;
  }

  .card__body {
    font-size: 12.5px;
  }
}
