@font-face {
  font-family: 'Shin Retro Maru Gothic';
  src: url('ShinRetroMaruGothic-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000000;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-hover: rgba(255, 255, 255, 0.06);
  --text: #d9d9d9;
  --text-dim: #7A7A7A;

  --font-body: 'Rubik', sans-serif;
  --font-title: 'Red Hat Mono', monospace;
  --font-jp: 'Shin Retro Maru Gothic', var(--font-body);

  --tile-size: clamp(4rem, 9vw, 5.5rem);
  --tile-gap: clamp(0.25rem, 1vw, 0.375rem);
}

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

html {
  font-size: 16px;
}

html, body {
  height: 100%;
}

body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
}

main {
  width: 100%;
  max-width: 45rem;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  row-gap: 2.5rem;
}

#top-group {
  align-self: end;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* day progress rail */
#rail-wrap {
  width: 100%;
  max-width: calc(5 * var(--tile-size) + 4 * var(--tile-gap));
  margin-bottom: 2.75rem;
}

#rail {
  position: relative;
  width: 100%;
  height: 0.0625rem;
  background: var(--panel-hover);
}

#rail-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--text-dim);
  width: 0%;
  transition: width 1s linear;
}

#rail-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 0.375rem;
  height: 0.375rem;
  background: var(--text-dim);
  transform: translate(-50%, -50%);
  transition: left 1s linear;
}

#rail-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-family: var(--font-title);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

/* cock */
#clock {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: clamp(4rem, 13vw, 8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

#date {
  font-family: var(--font-body);
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 0.625rem;
  text-transform: uppercase;
}

#greeting {
  font-family: var(--font-jp);
  font-size: 1.25rem;
  font-weight: 400;
  margin-top: 2rem;
  color: var(--text);
}

/* search */
#search {
  width: 100%;
  max-width: calc(5 * var(--tile-size) + 4 * var(--tile-gap));
}

#search input {
  width: 100%;
  height: 3.25rem;
  padding: 0 1.375rem;
  border-radius: 0;
  border: none;
  background: var(--panel);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: var(--font-title);
  outline: none;
  transition: background-color 0.15s ease;
}

#search input::placeholder {
  color: var(--text-dim);
}

#search input:focus {
  background: var(--panel-hover);
}

/* quick links */
#links {
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--tile-gap);
  width: 100%;
  max-width: calc(5 * var(--tile-size) + 4 * var(--tile-gap));
  background: transparent;
  border: none;
}

.link-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 0.5rem;
  width: var(--tile-size);
  aspect-ratio: 1 / 1;
  border-radius: 0;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  transition: background-color 0.15s ease;
}

.link-tile:hover {
  background: var(--panel-hover);
}

.link-tile:focus-visible {
  background: var(--panel-hover);
  outline: 0.0625rem solid var(--text);
  outline-offset: 0.125rem;
}

.link-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: 0.75rem;
}

.link-label {
  font-size: 0.75rem;
  font-weight: 400;
  text-align: center;
  color: var(--text-dim);
}

@media (prefers-reduced-motion: reduce) {
  #rail-fill, #rail-marker {
    transition: none;
  }
}
