@property --background {
  syntax: "<color>";
  inherits: true;
  initial-value: #faeee5;
}

@property --surface {
  syntax: "<color>";
  inherits: true;
  initial-value: #f2e1d5;
}

@property --accent {
  syntax: "<color>";
  inherits: true;
  initial-value: #f7cdb5;
}

@property --drop {
  syntax: "<color>";
  inherits: true;
  initial-value: #f5bca6;
}

@property --bloom {
  syntax: "<color>";
  inherits: true;
  initial-value: #f2cb8d;
}

@property --ring {
  syntax: "<color>";
  inherits: true;
  initial-value: #cbd299;
}

@property --capsule {
  syntax: "<color>";
  inherits: true;
  initial-value: #efb0a1;
}

:root {
  color-scheme: light;
  font-family: Roboto, system-ui, sans-serif;
  color: #2a2320;
  --background: #faeee5;
  --surface: #f2e1d5;
  --accent: #f7cdb5;
  --drop: #f5bca6;
  --bloom: #f2cb8d;
  --ring: #cbd299;
  --capsule: #efb0a1;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
}

.hero {
  position: relative;
  display: grid;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 72px clamp(18px, 5vw, 64px);
  background: var(--background);
}

.shapes {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.shape {
  position: absolute;
  display: block;
  overflow: visible;
  transform: rotate(var(--angle));
}

.shape--drop {
  top: 6%;
  left: clamp(-34px, calc(17vw - 97px), 9vw);
  width: clamp(125px, 20vw, 290px);
  fill: var(--drop);
  --angle: -19deg;
  --drift-x: -13px;
  --drift-y: 22px;
  --drift-angle: 12deg;
  --duration: 14s;
}

.shape--bloom {
  top: 10%;
  right: clamp(-22px, calc(13vw - 62px), 7vw);
  width: clamp(116px, 15vw, 225px);
  fill: var(--bloom);
  --angle: 15deg;
  --drift-x: -24px;
  --drift-y: -13px;
  --drift-angle: 38deg;
  --duration: 19s;
}

.shape--ring {
  bottom: -8%;
  left: clamp(-70px, calc(12vw - 95px), 3vw);
  width: clamp(160px, 27vw, 400px);
  fill: var(--ring);
  --angle: 22deg;
  --drift-x: 17px;
  --drift-y: -24px;
  --drift-angle: 40deg;
  --duration: 18s;
}

.shape--capsule {
  right: clamp(-28px, calc(17vw - 91px), 9vw);
  bottom: 4%;
  width: clamp(137px, 20vw, 300px);
  fill: var(--capsule);
  --angle: -30deg;
  --drift-x: -19px;
  --drift-y: -18px;
  --drift-angle: -12deg;
  --duration: 16s;
}

.content {
  display: grid;
  width: 100%;
  place-items: center;
  gap: clamp(19px, 3.4vw, 46px);
}

h1 {
  margin: 0;
  padding-inline-end: .075em;
  font-size: clamp(2.9rem, 11.8vw, 10.5rem);
  font-weight: 850;
  letter-spacing: -.075em;
  line-height: .9;
}

.countdown:not([hidden]) {
  display: grid;
  width: min(100%, 35.25rem);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(4px, 1vw, 8px);
}

.unit {
  display: grid;
  min-height: clamp(76px, 11vw, 122px);
  min-width: 0;
  align-content: center;
  justify-items: center;
  gap: clamp(3px, .7vw, 9px);
  padding: 8px 2px;
  border-radius: clamp(17px, 2.5vw, 28px);
  background: var(--surface);
  font-size: clamp(.75rem, 1.2vw, .95rem);
  font-weight: 500;
  line-height: 1.15;
}

.unit:first-child {
  border-start-start-radius: clamp(26px, 3.9vw, 42px);
  border-end-start-radius: clamp(26px, 3.9vw, 42px);
  background: var(--accent);
}

.unit:last-child {
  border-start-end-radius: clamp(26px, 3.9vw, 42px);
  border-end-end-radius: clamp(26px, 3.9vw, 42px);
}

.value {
  font-size: clamp(1.95rem, 4.7vw, 3.9rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.055em;
  line-height: .95;
}

.deadline {
  margin: 0;
  text-align: center;
}

.countdown:not([hidden]) + .deadline {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.motion-toggle:not([hidden]) {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.motion-toggle:hover,
.motion-toggle:active {
  background: var(--accent);
}

.motion-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.motion-toggle[aria-pressed="true"] .play-icon,
.motion-toggle[aria-pressed="false"] .pause-icon {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  [data-enter] {
    animation: enter 560ms cubic-bezier(.2, .75, .25, 1) both;
  }
}

[data-motion] .hero {
  animation: palette 72s ease-in-out infinite;
}

[data-motion] .shape {
  animation: drift var(--duration) ease-in-out infinite alternate;
}

[data-motion] .shape path {
  animation: morph var(--duration) ease-in-out infinite alternate;
}

[data-motion="paused"] :is(.hero, .shape, .shape path) {
  animation-play-state: paused;
}

.shape--drop path {
  --morphed-path: path("M102 18C136 6 154 24 167 56C180 89 202 113 178 143C155 172 126 182 98 182C70 182 51 174 24 151C-8 124 24 101 37 74C51 44 66 30 102 18Z");
}

.shape--bloom path {
  --morphed-path: path("M101 28C125 20 146 22 161 40C177 56 183 76 184 100C183 123 177 146 160 160C141 176 123 178 100 176C77 178 59 176 40 160C23 146 17 123 16 100C17 76 23 56 39 40C54 23 77 20 101 28Z");
}

.shape--ring path {
  --morphed-path: path("M99 17C153 7 188 57 186 111C184 165 150 188 98 182C46 176 16 152 15 108C14 64 45 27 99 17ZM101 57C77 63 65 78 63 100C61 122 77 140 102 141C127 142 139 124 140 100C141 76 125 51 101 57Z");
}

.shape--capsule path {
  --morphed-path: path("M65 49C27 48 11 75 13 113C15 148 48 159 76 148L141 133C171 125 186 108 182 86C177 59 154 51 126 50Z");
}

@keyframes enter {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  to {
    transform: translate(var(--drift-x), var(--drift-y)) rotate(var(--drift-angle));
  }
}

@keyframes morph {
  to { d: var(--morphed-path); }
}

@keyframes palette {
  0%, 24%, 100% {
    --background: #faeee5;
    --surface: #f2e1d5;
    --accent: #f7cdb5;
    --drop: #f5bca6;
    --bloom: #f2cb8d;
    --ring: #cbd299;
    --capsule: #efb0a1;
  }

  33%, 57% {
    --background: #e6eff8;
    --surface: #d9e7f4;
    --accent: #bcd9f4;
    --drop: #a6c9ea;
    --bloom: #c3d8ef;
    --ring: #b8d8ca;
    --capsule: #ecb9b1;
  }

  66%, 90% {
    --background: #eef2df;
    --surface: #e1e9ce;
    --accent: #d1e2ac;
    --drop: #c7d792;
    --bloom: #f1d495;
    --ring: #a9ca9d;
    --capsule: #d8dca1;
  }
}

@media (max-height: 500px) and (min-width: 600px) {
  .hero {
    padding-block: 60px;
  }

  .shape {
    max-width: 23vh;
  }

  h1 {
    font-size: clamp(2.9rem, 18vh, 7.25rem);
  }

  .unit {
    min-height: 74px;
  }

  .value {
    font-size: 2.5rem;
  }
}
