@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Text:ital,wght@0,300..700;1,300..700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  /* neutral */
  --White: hsl(0, 0%, 100%);
  --Very-dark-blue: hsl(235, 16%, 14%);
  --mostly-dark-blue: hsl(234, 17%, 12%);
  --Dark-desaturated-blue: hsl(236deg 21% 26% / 50%);
  --clock: hsl(355.38deg 7.49% 18.7%);
  --clock-center: hsl(355.38deg 7.49% 18.7%);

  /* primary */
  --Soft-red: hsl(345, 95%, 68%);
  --Grayish-blue: hsl(237, 18%, 59%);

  /* fw */
  --fw-700: 700;

  font-family: 'Red Hat Text', sans-serif;
}

a {
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

main {
  background: url('./assets/images/pattern-hills.svg') no-repeat right 20%
      bottom,
    url('./assets/images/bg-stars.svg') no-repeat top, var(--mostly-dark-blue);
  text-align: center;
  text-transform: uppercase;
  padding: 1em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;

  @media (min-width: 40em) {
    background: url('./assets/images/pattern-hills.svg') no-repeat bottom,
      url('./assets/images/bg-stars.svg') no-repeat top, var(--mostly-dark-blue);
  }
}

section,
footer {
  display: inline-flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

section {
  margin: auto;
}

.title {
  color: var(--White);
  font-size: 1.25rem;
  letter-spacing: 5px;
  flex-basis: 100%;
}

.clock {
  color: var(--White);
  min-width: 21em;
  row-gap: 2.5em;
  font-weight: var(--fw-700);

  @media (min-width: 40em) {
    row-gap: 5em;
  }
}

.time {
  width: 4em;
  aspect-ratio: 1/1;

  @media (min-width: 40em) {
    width: 5em;
  }
}

.time_num {
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
  transition: transform 450ms ease-in-out;

  & > * {
    position: absolute;
  }

  & > .top,
  & > .center,
  & > .bottom,
  & > .time_label {
    right: 0;
    left: 0;
    height: 45%;
  }

  & > .top {
    background: var(--clock);
    border-radius: 0.25em 0.25em 0 0;
    top: 0;
  }

  & > .center {
    background: var(--Dark-desaturated-blue);
    display: flex;
    justify-content: space-between;
    overflow: clip;
    top: 50%;
    height: 10%;
    translate: 0 -50%;
    z-index: 1;

    & > .center_left,
    & > .center_right {
      background: var(--mostly-dark-blue);
      border-radius: 100%;
      max-width: 1em;
      aspect-ratio: 1/1;
    }

    & > .center_left {
      translate: -50% 0;
    }

    & > .center_right {
      translate: 50% 0;
    }
  }

  & > .bottom {
    border-radius: 0 0 0.25em 0.25em;
    background: var(--clock);
    bottom: 0;
  }

  & > .time_num--num {
    color: var(--Soft-red);
    font-size: 1.75rem;
    inset: 0;
    height: auto;
    align-content: center;
  }
}

.time_label {
  color: var(--Grayish-blue);
  font-size: 0.5rem;
  letter-spacing: 1.5px;
  margin: 1.5em auto 0;
  max-width: fit-content;
}

footer {
  margin: 0 auto 3em;
  gap: 2.5em;

  .social {
    color: var(--Soft-red);
    font-size: 1.5rem;
  }
}

.flip-vertical {
  animation: flip 1s ease-in-out;
}

@keyframes flip {
  from {
    transform: rotateX(0);
  }
  to {
    transform: rotateX(360deg);
  }
}
