@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@300;400;500;600&family=DM+Mono:wght@300;400;500&display=swap');

:root {
  --space: #07171d;
  --space-soft: #0d2830;
  --cream: #f2e8cc;
  --paper: #d9d0b7;
  --amber: #ef9f48;
  --coral: #e66e52;
  --teal: #55c5bd;
  --ink: #132b31;
  --line: rgba(242, 232, 204, .26);
}

* { box-sizing: border-box; }

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

body {
  color: var(--cream);
  background: var(--space);
  font-family: "DM Mono", monospace;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 480px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 15%, rgba(85,197,189,.09), transparent 30%),
    radial-gradient(circle at 83% 82%, rgba(230,110,82,.08), transparent 33%),
    linear-gradient(135deg, #061318, #0a2027 55%, #07171d);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .22;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.018) 3px 4px);
  mix-blend-mode: screen;
}

.clock-shell {
  position: relative;
  width: min(92vw, 1180px);
  aspect-ratio: 16 / 9;
  min-height: 430px;
  padding: clamp(22px, 3.2vw, 48px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid rgba(242,232,204,.22);
  border-radius: 42px 8px 42px 8px;
  background: rgba(5, 19, 24, .78);
  box-shadow: 0 45px 100px rgba(0,0,0,.36), inset 0 0 70px rgba(85,197,189,.025);
  backdrop-filter: blur(8px);
}

.clock-shell::before, .clock-shell::after {
  content: "";
  position: absolute;
  background: var(--amber);
}
.clock-shell::before { width: 106px; height: 7px; top: -4px; left: 70px; border-radius: 9px; }
.clock-shell::after { width: 7px; height: 76px; bottom: 38px; right: -4px; border-radius: 9px; background: var(--teal); }

.masthead, .footer-grid { display: flex; align-items: center; }
.masthead { gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.eyebrow, .subhead, .zone, .date { margin: 0; letter-spacing: .18em; }
.eyebrow { font: 500 clamp(15px, 1.55vw, 22px)/1 "Barlow Condensed", sans-serif; }
.subhead { margin-top: 7px; color: var(--paper); opacity: .55; font-size: clamp(7px, .72vw, 10px); }
.brand-mark { display: flex; width: 51px; height: 21px; align-items: flex-end; gap: 4px; }
.brand-mark i { display: block; width: 13px; border-radius: 9px 9px 2px 2px; transform: skewX(-20deg); }
.brand-mark i:nth-child(1) { height: 9px; background: var(--coral); }
.brand-mark i:nth-child(2) { height: 16px; background: var(--amber); }
.brand-mark i:nth-child(3) { height: 21px; background: var(--teal); }
.sync { margin-left: auto; font-size: 9px; letter-spacing: .15em; color: var(--teal); }
.sync span { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 14px currentColor; }

.instrument { min-height: 0; display: grid; grid-template-columns: minmax(280px, .85fr) 1.15fr; align-items: center; }
.dial { width: min(49vh, 100%); justify-self: center; overflow: visible; }
.dial-ring { fill: none; stroke: var(--line); }
.dial-ring.outer { stroke-width: 2; stroke-dasharray: 2 12; }
.dial-ring.inner { stroke-width: 1; }
.tick { stroke: var(--cream); stroke-width: 2; opacity: .45; }
.tick.major { stroke: var(--amber); stroke-width: 5; opacity: 1; }
.hand { stroke-linecap: round; transform-origin: 300px 300px; }
.hand.hour { stroke: var(--cream); stroke-width: 16; }
.hand.minute { stroke: var(--paper); stroke-width: 8; }
.hand.second { stroke: var(--coral); stroke-width: 3; }
.pin-outer { fill: var(--space); stroke: var(--amber); stroke-width: 5; }
.pin { fill: var(--cream); }

.readout { padding: 20px clamp(10px, 3vw, 40px); border-left: 1px solid var(--line); }
.zone { color: var(--teal); font-size: clamp(8px, .9vw, 12px); }
.digital {
  display: block;
  margin: clamp(10px, 2vw, 23px) 0;
  white-space: nowrap;
  color: var(--cream);
  font: 300 clamp(48px, 8.5vw, 126px)/.9 "Barlow Condensed", sans-serif;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 34px rgba(242,232,204,.09);
}
.digital span { color: var(--amber); animation: pulse 1s steps(1) infinite; }
.date { color: var(--paper); font-size: clamp(8px, 1vw, 13px); }

.footer-grid { gap: clamp(22px, 5vw, 72px); padding-top: 14px; border-top: 1px solid var(--line); }
.footer-grid div { display: grid; gap: 5px; }
.footer-grid span { font-size: 7px; letter-spacing: .18em; opacity: .45; }
.footer-grid strong { font-size: 9px; letter-spacing: .14em; font-weight: 400; }
.footer-grid .signal { margin-left: auto; display: flex; align-items: flex-end; gap: 4px; }
.signal i { display: block; width: 5px; background: var(--teal); border-radius: 2px; }
.signal i:nth-child(1) { height: 4px; }.signal i:nth-child(2) { height: 7px; }.signal i:nth-child(3) { height: 10px; }.signal i:nth-child(4) { height: 13px; }.signal i:nth-child(5) { height: 16px; }

.orbit { position: absolute; border: 1px solid rgba(239,159,72,.11); border-radius: 50%; pointer-events: none; }
.orbit-wide { width: 86vw; height: 86vw; transform: rotate(-12deg) scaleY(.38); }
.star { position: absolute; width: 17px; height: 17px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 28px rgba(239,159,72,.5); }
.star::before, .star::after { content: ""; position: absolute; inset: 7px -20px; height: 2px; background: inherit; }
.star::after { transform: rotate(90deg); }
.star-a { left: 6vw; top: 18vh; transform: scale(.7); }
.star-b { right: 5vw; bottom: 13vh; background: var(--teal); transform: scale(.45); }

.controls { position: fixed; right: 18px; bottom: 18px; display: flex; gap: 7px; opacity: 0; transform: translateY(12px); transition: .25s ease; }
body:hover .controls, .controls:focus-within { opacity: .8; transform: none; }
.controls button { border: 1px solid var(--line); padding: 8px 11px; color: var(--cream); background: rgba(7,23,29,.88); font: 500 8px/1 "DM Mono", monospace; letter-spacing: .1em; cursor: pointer; }
.controls button:hover { color: var(--space); background: var(--cream); }

body.hide-seconds .digital .seconds, body.hide-seconds .digital .seconds-colon { display: none; }
body.hide-seconds .second { opacity: 0; }

body.overlay { background: transparent; }
body.overlay .stage { background: transparent; }
body.overlay .stage::before, body.overlay .orbit, body.overlay .star { display: none; }
body.overlay .clock-shell { background: rgba(5,19,24,.9); }

body.palette-alt { --space: #1d1124; --space-soft: #321a38; --cream: #ffe5bd; --paper: #e4c8aa; --amber: #f2bd55; --coral: #ef6b85; --teal: #76d4c4; --ink: #26122d; }

@keyframes pulse { 50% { opacity: .35; } }

@media (max-aspect-ratio: 1/1) {
  .clock-shell { width: min(92vw, 720px); height: 92vh; aspect-ratio: auto; min-height: 620px; }
  .instrument { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .dial { width: min(42vh, 80vw); }
  .readout { text-align: center; border-left: 0; border-top: 1px solid var(--line); }
  .digital { font-size: clamp(56px, 17vw, 112px); }
}

@media (max-width: 620px) {
  .clock-shell { border-radius: 24px 6px; padding: 20px; }
  .subhead, .footer-grid div:nth-child(2) { display: none; }
  .controls { flex-wrap: wrap; justify-content: flex-end; left: 18px; }
}

@media (prefers-reduced-motion: reduce) { .digital span { animation: none; } }
