:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050706;
}

#clock-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #050706;
  user-select: none;
}

#clock-stage.horizon-mode {
  background:
    radial-gradient(ellipse at 50% 42%, #10100f 0%, #070706 46%, #020202 100%);
}

#clock-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#clock-overlay {
  position: absolute;
  pointer-events: none;
}

#horizon-clock {
  --minute-position: 0%;
  --second-width: 0%;
  --seam-alpha: .22;
  --seam-halo-alpha: .045;
  --seam-blur: 3px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 1320px);
  aspect-ratio: 3.55 / 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 28px 42px rgb(0 0 0 / 72%));
}

#horizon-clock[hidden] { display: none; }

.horizon-shell {
  position: absolute;
  inset: 0;
  padding: clamp(8px, 1.05vw, 16px);
  border-radius: clamp(26px, 3vw, 52px);
  background:
    linear-gradient(165deg, #787978 0%, #303130 19%, #111211 47%, #4d4f4e 76%, #171817 100%);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 38%),
    inset 0 -2px 3px rgb(0 0 0 / 75%),
    0 2px 0 #080808;
}

.horizon-glass {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgb(218 164 78 / var(--seam-alpha));
  border-radius: clamp(20px, 2.35vw, 42px);
  background:
    linear-gradient(150deg, rgb(255 255 255 / 8%) 0 8%, transparent 29%),
    linear-gradient(105deg, #111211 0%, #070807 58%, #030403 100%);
  box-shadow:
    0 0 var(--seam-blur) rgb(218 164 78 / var(--seam-halo-alpha)),
    inset 0 0 var(--seam-blur) rgb(218 164 78 / var(--seam-halo-alpha)),
    inset 0 1px 1px rgb(255 255 255 / 7%);
}

.horizon-number,
.horizon-date,
.horizon-period {
  position: absolute;
  color: #e7e4dc;
  font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 1px 2px rgb(0 0 0 / 80%);
}

.horizon-number {
  top: 50%;
  font-size: clamp(42px, 6.1vw, 102px);
  transform: translateY(-52%);
}

.horizon-hour { left: 5.8%; }
.horizon-minute { right: 5.8%; }

.horizon-period {
  left: 6.1%;
  top: 68%;
  color: rgb(231 228 220 / 52%);
  font-size: clamp(9px, .9vw, 15px);
  font-weight: 500;
  letter-spacing: .18em;
}

.horizon-track {
  position: absolute;
  left: 17%;
  right: 17%;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, #282927, #77756d 48%, #292a28);
  box-shadow: 0 1px 1px rgb(0 0 0 / 70%);
}

#horizon-marker {
  position: absolute;
  left: var(--minute-position);
  top: 50%;
  width: clamp(12px, 1.4vw, 24px);
  aspect-ratio: 1.12;
  border: 1px solid #7b4f19;
  border-radius: 2px;
  background: linear-gradient(135deg, #8a5718, #f2d48b 48%, #a56a21 100%);
  box-shadow: 0 2px 4px rgb(0 0 0 / 75%);
  transform: translate(-50%, -50%);
  will-change: left;
}

.horizon-date {
  right: 6.2%;
  bottom: 11%;
  color: rgb(231 228 220 / 82%);
  font-size: clamp(16px, 2vw, 32px);
}

#horizon-second {
  position: absolute;
  left: 17%;
  bottom: 8.5%;
  width: var(--second-width);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #e0b86d 92%, #fff0c7);
  opacity: .42;
  filter: drop-shadow(0 0 2px rgb(225 180 98 / 28%));
  will-change: width;
}

.hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: var(--hand-width);
  height: var(--hand-length);
  border-radius: 999px;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: 50% 100%;
  background: var(--hand-color);
  box-shadow: var(--hand-shadow);
  will-change: transform;
}

.hand-hour { z-index: 2; }
.hand-minute { z-index: 3; }
.hand-second { z-index: 4; }

#hand-cap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--cap-size);
  height: var(--cap-size);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--cap-color);
  box-shadow: var(--hand-shadow);
  z-index: 5;
}

#date-window {
  position: absolute;
  display: grid;
  place-items: center;
  color: var(--date-color);
  background: var(--date-background);
  border: var(--date-border);
  border-radius: 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 2px rgb(0 0 0 / 35%);
  z-index: 6;
}

.toolbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  display: flex;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 16px;
  background: rgb(8 11 10 / 72%);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  opacity: .18;
  transition: opacity .2s ease;
}

.toolbar:hover, .toolbar:focus-within { opacity: 1; }

button {
  padding: 8px 12px;
  border: 0;
  border-radius: 11px;
  color: #f6f7f6;
  background: rgb(255 255 255 / 10%);
  cursor: pointer;
}

button:hover, button[aria-pressed="true"] { background: rgb(255 255 255 / 22%); }

#status {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: rgb(255 255 255 / 55%);
  font-size: 12px;
}

body.fullscreen .toolbar { opacity: 1; }
body.fullscreen #status { opacity: 0; }

/* Final Horizon design: the approved photorealistic image is the immutable
   visual base; only the live values and gold indicators are overlaid. */
#horizon-clock {
  width: min(100vw, calc(100vh * 1.776833));
  aspect-ratio: 1672 / 941;
  filter: none;
}

.horizon-shell {
  padding: 0;
  border-radius: 0;
  background: url("../assets/horizon-clock-clean.png") center / 100% 100% no-repeat;
  box-shadow: none;
}

.horizon-glass {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.horizon-number {
  top: 50%;
  font-size: clamp(20px, 3.45vw, 58px);
  transform: translateY(-52%);
}

.horizon-hour { left: 15%; }
.horizon-minute { right: 18.1%; }
.horizon-period { display: none; }

.horizon-track {
  left: 22%;
  right: 26%;
  top: 51.3%;
  transform: rotate(2.35deg);
  transform-origin: left center;
}

#horizon-marker {
  width: clamp(8px, 2.35vw, 39px);
}

.horizon-date {
  right: 16.4%;
  bottom: 30.2%;
  font-size: clamp(10px, 1.65vw, 28px);
}

#horizon-second {
  left: 28.1%;
  bottom: 34.4%;
}
