@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap");

:root {
  --background-color: #000000;
  --font-size: clamp(300px, calc(((100vw - 1024px) / 2) + 300px), 730px);
  --font-color: #b9b9b9;
  --top-color: #0f0f0f;
  --bottom-color: #0e0e0e;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  font-family: "Bebas Neue", serif;
}

.countdown {
  width: 100vw;
  min-height: 100vh;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  background-color: var(--background-color);
  overflow: hidden;
}

.time-section {
  flex: 1;
  display: flex;
  gap: 10px;
}

.time-segment {
  display: block;
  font-size: var(--font-size);
  flex: 1;
}

.segment-display {
  position: relative;
  height: 100%;
}

.segment-display__top,
.segment-display__bottom {
  overflow: hidden;
  text-align: center;
  width: 100%;
  height: 50%;
  position: relative;
  border-radius: 20px;
}

.segment-display__top {
  line-height: var(--font-size);
  color: var(--font-color);
  background-color: var(--top-color);
}

.segment-display__bottom {
  line-height: 0;
  color: var(--font-color);
  background-color: var(--bottom-color);
  border-top: 4px solid var(--background-color);
}

.segment-overlay {
  position: absolute;
  top: 0;
  perspective: 1500px;
  height: 100%;
  width: 100%;
}

.segment-overlay__top,
.segment-overlay__bottom {
  position: absolute;
  overflow: hidden;
  text-align: center;
  width: 100%;
  height: 50%;
  border-radius: 20px;
}

.segment-overlay__top {
  top: 0;
  line-height: var(--font-size);
  color: var(--font-color);
  background-color: var(--top-color);
  transform-origin: bottom;
}

.segment-overlay__bottom {
  bottom: 0;
  line-height: 0;
  color: var(--font-color);
  background-color: var(--bottom-color);
  border-top: 4px solid var(--background-color);
  transform-origin: top;
}

.segment-overlay.flip .segment-overlay__top {
  animation: flip-top 0.7s linear;
}

.segment-overlay.flip .segment-overlay__bottom {
  animation: flip-bottom 0.7s linear;
}

@keyframes flip-top {
  0% {
    transform: rotateX(0deg);
  }
  50%,
  100% {
    transform: rotateX(-90deg);
  }
}

@keyframes flip-bottom {
  0%,
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}
