:root {
  color-scheme: dark;
  --white: #f8fbff;
  --muted: rgba(237, 244, 255, 0.7);
  --faint: rgba(237, 244, 255, 0.48);
  --line: rgba(255, 255, 255, 0.16);
  --glass: rgba(7, 20, 38, 0.32);
  --accent: #ffca9f;
  --shadow: 0 32px 100px rgba(0, 7, 18, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  height: 100%;
  background: #071426;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--white);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  pointer-events: none;
}

body::before {
  background:
    url("../resource/alpine-dawn.png") center center / cover no-repeat,
    #071426;
  transform: scale(1.025);
  animation: reveal-background 1.6s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

body::after {
  z-index: -1;
  background:
    radial-gradient(
      circle at 50% 47%,
      rgba(8, 24, 45, 0.08) 0%,
      rgba(4, 15, 30, 0.34) 58%,
      rgba(1, 7, 17, 0.7) 100%
    ),
    linear-gradient(
      180deg,
      rgba(3, 14, 29, 0.42) 0%,
      rgba(4, 15, 30, 0.08) 38%,
      rgba(2, 10, 23, 0.58) 100%
    );
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}

.page-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  padding: clamp(24px, 4vw, 52px) clamp(22px, 5vw, 76px)
    clamp(22px, 3vw, 38px);
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  animation: fade-down 0.8s 0.2s ease both;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.34em;
}

.brand-mark {
  position: relative;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 7px;
  background: var(--white);
  border-radius: 99px;
  content: "";
  transform-origin: 50% 100%;
}

.brand-mark::before {
  transform: translate(-50%, -100%) rotate(35deg);
}

.brand-mark::after {
  height: 5px;
  opacity: 0.7;
  transform: translate(-50%, -100%) rotate(130deg);
}

.format-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 4px;
  color: var(--muted);
  background: rgba(4, 14, 29, 0.28);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease;
}

.format-toggle:hover {
  background: rgba(10, 26, 48, 0.46);
  border-color: rgba(255, 255, 255, 0.28);
}

.format-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.format-option {
  min-width: 42px;
  padding: 7px 9px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  transition:
    color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.format-option.is-active {
  color: #101b2a;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 12px rgba(0, 5, 16, 0.12);
}

.clock-stage {
  display: grid;
  place-items: center;
  padding-block: clamp(52px, 8vh, 92px);
}

.clock-card {
  position: relative;
  width: min(760px, 100%);
  padding: clamp(34px, 6vw, 68px);
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.12),
      rgba(255, 255, 255, 0.035)
    ),
    var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(118%);
  -webkit-backdrop-filter: blur(24px) saturate(118%);
  animation: card-in 1s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.clock-card::before {
  position: absolute;
  top: -20%;
  left: 12%;
  width: 76%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.75),
    transparent
  );
  box-shadow: 0 0 38px 14px rgba(255, 209, 171, 0.12);
  content: "";
}

.eyebrow {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(20px, 4vw, 30px);
  color: var(--muted);
  font-size: clamp(0.68rem, 1.4vw, 0.78rem);
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.pulse {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(255, 202, 159, 0.12);
  animation: breathe 2.4s ease-in-out infinite;
}

.time-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.time {
  font-size: clamp(4.5rem, 14vw, 9.4rem);
  font-weight: 250;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.075em;
  line-height: 0.84;
  text-indent: -0.075em;
  text-shadow: 0 8px 42px rgba(0, 9, 22, 0.28);
}

.time-detail {
  display: grid;
  gap: 9px;
  margin: clamp(1px, 1vw, 8px) 0 0 clamp(13px, 2vw, 20px);
  color: var(--muted);
  font-size: clamp(0.68rem, 1.5vw, 0.82rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
  line-height: 1;
  text-align: left;
}

.seconds {
  color: var(--white);
}

.period:empty {
  display: none;
}

.date {
  margin: clamp(22px, 4vw, 34px) 0 0;
  color: rgba(248, 251, 255, 0.85);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2.3vw, 1.28rem);
  font-style: italic;
  letter-spacing: 0.015em;
}

.clock-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.9fr);
  gap: 28px;
  align-items: end;
  margin-top: clamp(34px, 6vw, 54px);
  padding-top: clamp(23px, 4vw, 30px);
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.location {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
  text-align: left;
}

.location svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.location span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-progress {
  display: grid;
  gap: 10px;
  text-align: right;
}

.progress-track {
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.66), var(--accent));
  border-radius: inherit;
  box-shadow: 0 0 12px rgba(255, 202, 159, 0.7);
  transition: width 600ms ease;
}

.site-footer {
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: fade-up 0.8s 0.55s ease both;
}

.coordinates {
  font-variant-numeric: tabular-nums;
}

@keyframes reveal-background {
  from {
    opacity: 0;
    transform: scale(1.08);
  }
  to {
    opacity: 1;
    transform: scale(1.025);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@media (max-width: 620px) {
  .page-shell {
    padding-inline: 16px;
  }

  .clock-stage {
    padding-block: 42px;
  }

  .clock-card {
    padding-inline: 22px;
  }

  .clock-meta {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .location {
    justify-content: center;
    text-align: center;
  }

  .day-progress {
    text-align: center;
  }

  .site-footer {
    justify-content: center;
  }

  .coordinates {
    display: none;
  }
}

@media (max-width: 400px) {
  .format-option {
    min-width: 38px;
    padding-inline: 7px;
  }

  .clock-card {
    padding-inline: 16px;
  }

  .time {
    font-size: clamp(4rem, 24vw, 5.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  .clock-card {
    background: rgba(2, 12, 26, 0.78);
    border-color: rgba(255, 255, 255, 0.55);
  }
}
