/* Hourmonger — base styles.
   A black instrument frame holding a dark, fog-lit panel. The only warm colour is the
   ember that glows inside the clocks; everything else stays cold and quiet. */

:root {
  color-scheme: dark;

  --frame: #000000;          /* outer instrument frame */
  --panel: #050505;          /* panel floor */
  --panel-up: #0b0b0b;       /* raised surfaces */
  --fog-sage: #8f8f8f;       /* dim silver */
  --fog-silver: #d8d8d8;     /* silver: primary button, highlights */
  --ember: #f2f2f2;          /* bright silver: live dot, second hands */
    --text: #ededed;
  --muted: #8c8c8c;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.24);

  --display: "Unbounded", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans: "Manrope", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;

  --step--1: 0.8125rem;   /* 13 */
  --step-0: 1rem;         /* 16 */
  --step-1: 1.25rem;      /* 20 */
  --step-2: 1.75rem;      /* 28 */
  --step-3: 2.75rem;      /* 44 */

  --radius-panel: 28px;
  --gap: clamp(16px, 2.4vw, 32px);
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--frame);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

:focus-visible {
  outline: 2px solid var(--fog-silver);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- frame */

.frame {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px;
  display: flex;
}

.panel {
  position: relative;
  flex: 1;
  border-radius: var(--radius-panel);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 85% 10%, #121212 0%, transparent 60%),
    linear-gradient(180deg, var(--panel-up), var(--panel));
  display: flex;
  flex-direction: column;
}

/* Notches cut into the panel edge, in the frame colour, with inverted corners. */
.notch {
  --r: 22px;
  position: absolute;
  z-index: 20;
  background: var(--frame);
}
.notch::before, .notch::after {
  content: "";
  position: absolute;
  width: var(--r);
  height: var(--r);
  pointer-events: none;
}

.notch--top {
  top: 0; left: 0;
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 36px);
  padding: 14px 26px 14px 22px;
  border-bottom-right-radius: var(--r);
}
.notch--top::after {
  left: 100%; top: 0;
  background: radial-gradient(circle at 100% 100%, transparent calc(var(--r) - .5px), var(--frame) var(--r));
}
.notch--top::before {
  top: 100%; left: 0;
  background: radial-gradient(circle at 100% 100%, transparent calc(var(--r) - .5px), var(--frame) var(--r));
}

.notch--status {
  bottom: 0; left: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 22px 14px 22px;
  border-top-right-radius: var(--r);
  font-size: var(--step--1);
  color: var(--muted);
}
.notch--status::after {
  left: 100%; bottom: 0;
  background: radial-gradient(circle at 100% 0%, transparent calc(var(--r) - .5px), var(--frame) var(--r));
}
.notch--status::before {
  bottom: 100%; left: 0;
  background: radial-gradient(circle at 100% 0%, transparent calc(var(--r) - .5px), var(--frame) var(--r));
}

.notch--handle {
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 18px;
  border-radius: 14px 14px 0 0;
}
.notch--handle span {
  position: absolute; left: 50%; top: 8px;
  width: 64px; height: 3px; margin-left: -32px;
  border-radius: 3px;
  background: var(--fog-silver);
  opacity: .8;
}
.notch--handle::before {
  right: 100%; bottom: 0;
  background: radial-gradient(circle at 0% 0%, transparent calc(var(--r) - .5px), var(--frame) var(--r));
  width: 14px; height: 14px;
  --r: 14px;
}
.notch--handle::after {
  left: 100%; bottom: 0;
  background: radial-gradient(circle at 100% 0%, transparent calc(var(--r) - .5px), var(--frame) var(--r));
  width: 14px; height: 14px;
  --r: 14px;
}

.side {
  position: absolute;
  z-index: 20;
  top: 14px; right: 18px;
  display: flex; align-items: center; gap: 16px;
}

/* ---------------------------------------------------------------- header */

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0;
  white-space: nowrap;
}
.brand .mark { width: 28px; height: 28px; color: var(--fog-silver); }
.brand .wordmark { font-size: 1rem; color: var(--text); }

/* ---------------------------------------------------------------- wordmark
   HOURMONGER in light wide capitals; the gold hourglass ring stands in for the first O. */
.wordmark { display: inline-flex; flex-direction: column; align-items: center; gap: .9em; line-height: 1; }
.wm-line {
  --track: .24em;
  display: inline-flex; align-items: center;
  font-family: var(--display); font-weight: 300;
  letter-spacing: var(--track);
  text-transform: uppercase; white-space: nowrap;
}
.wm-line > .wm-l:last-child { margin-right: calc(-1 * var(--track)); }  /* no tracking after the last R */
.wm-o {
  flex: none;
  width: .86em; height: .86em;
  margin: 0 var(--track) 0 0;
  color: var(--wm-accent, #e0b154);
  transform: translateY(-.02em);
}
.wm-tag {
  font-family: var(--sans); font-weight: 500;
  font-size: .3em; letter-spacing: .55em; margin-right: -.55em;
  text-transform: uppercase; color: var(--muted);
}

.tabs { display: flex; gap: 4px; }
.tabs a {
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .9375rem;
  transition: color .2s, background-color .2s;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] {
  color: var(--frame);
  background: var(--fog-silver);
}

.mini {
  font-size: var(--step--1);
  color: var(--muted);
  white-space: nowrap;
}
.mini-value {
  font-family: var(--display);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0;
  font-variant-numeric: lining-nums tabular-nums;
}

.lang select {
  appearance: none;
  background: rgba(0, 0, 0, .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23d8d8d8' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 32px 6px 14px;
  font-size: .875rem;
  cursor: pointer;
}
.lang select option { background: #111111; color: var(--text); }

/* ---------------------------------------------------------------- fog */

.fog { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.fog i {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .1;   /* black site: only a faint silver sheen */
}
.fog i:nth-child(1) { width: 60vw; height: 55vh; right: -12vw; top: -10vh; background: radial-gradient(closest-side, rgba(220,220,220,.55), transparent); animation: drift-a 38s ease-in-out infinite alternate; }
.fog i:nth-child(2) { width: 45vw; height: 50vh; left: -14vw; bottom: -18vh; background: radial-gradient(closest-side, rgba(160,160,160,.45), transparent); animation: drift-b 46s ease-in-out infinite alternate; }
.fog i:nth-child(3) { width: 30vw; height: 30vh; left: 38vw; top: 40vh; background: radial-gradient(closest-side, rgba(160,160,160,.18), transparent); animation: drift-a 52s ease-in-out infinite alternate-reverse; }

@keyframes drift-a { to { transform: translate(-6vw, 8vh) scale(1.12); } }
@keyframes drift-b { to { transform: translate(7vw, -6vh) scale(1.08); } }

/* ---------------------------------------------------------------- content */

.content {
  position: relative;
  z-index: 5;
  flex: 1;
  padding: calc(84px + var(--gap)) var(--gap) calc(72px + var(--gap));
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

/* Headings in the serif: the voice of a watchmaker's catalogue. */
h1, dialog h2 {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -.03em;
}
h1 {
  font-size: calc(var(--step-3) * .85);
  line-height: 1.08;
  margin: 0 0 .4em;
}
dialog h2 { font-size: calc(var(--step-2) * .85); }
.lead {
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.5;
  max-width: 34ch;
  margin: 0;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .5);
  color: var(--text);
  text-decoration: none;
  font-size: .9375rem;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s;
}
.btn:hover { border-color: var(--fog-silver); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn--light {
  background: var(--fog-silver);
  border-color: var(--fog-silver);
  color: var(--frame);
  font-weight: 500;
}
.btn--light:hover { background: #ffffff; }

.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 0 rgba(242, 242, 242, .6);
  animation: pulse 2s infinite;
}
.live-dot.is-off { background: var(--muted); animation: none; box-shadow: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(242, 242, 242, .55); }
  70% { box-shadow: 0 0 0 9px rgba(242, 242, 242, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 242, 242, 0); }
}

/* ---------------------------------------------------------------- toast */

.toasts {
  position: fixed; z-index: 100;
  right: 24px; bottom: 24px;
  display: grid; gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  background: rgba(12, 12, 12, .94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: .9375rem;
  animation: toast-in .35s var(--ease);
}
.toast a { color: var(--fog-silver); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- dialog */

dialog {
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: #0c0c0c;
  color: var(--text);
  padding: 28px;
  width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(6px); }
dialog h2 { font-weight: 400; font-size: var(--step-2); line-height: 1.15; margin: 0 0 .4em; }
dialog p { color: var(--muted); margin: 0 0 20px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .875rem; color: var(--muted); }
.field input, .field select {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #030303;
}
.field input:focus-visible, .field select:focus-visible { outline-offset: 0; }
.error { color: #ff9b7d; font-size: .875rem; margin: 0 0 12px; }

/* ---------------------------------------------------------------- signature */

.btn--small { min-height: 36px; padding: 6px 14px; font-size: .8125rem; }
.sigpad-area {
  position: relative;
  height: 170px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, .02);
  touch-action: none;
}
.sigpad-area canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
  filter: invert(1);           /* dark ink shown as white on the dark site */
}
.sigpad-hint {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  pointer-events: none;
}
.sigpad-line {
  position: absolute; left: 24px; right: 24px; bottom: 34px;
  border-bottom: 1px solid var(--line-strong);
  pointer-events: none;
}
.sigpad-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sigpad-upload { cursor: pointer; }
.sigpad-upload:focus-within { outline: 2px solid var(--fog-silver); outline-offset: 3px; }
.sigpad-error { color: #ff9b7d; font-size: .875rem; margin: 8px 0 0; }
.sig-img { display: block; max-width: 100%; max-height: 120px; filter: invert(1); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 760px) {
  .frame { padding: 6px; }
  :root { --radius-panel: 20px; }
  .notch--top { padding: 10px 16px 10px 14px; gap: 10px; flex-wrap: wrap; max-width: calc(100% - 22px); }
  .brand .wm-l { display: none; }                         /* phones: the ring alone is the logo */
  .brand .wm-o { width: 28px; height: 28px; margin: 0; }
  .tabs a { padding: 6px 10px; font-size: .875rem; }
  .side { top: auto; bottom: 12px; right: 12px; }
  .mini { display: none; }
  .content { padding-top: 96px; }
}

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

.legal-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 36px 0 8px; font-size: .8125rem; }
.legal-links a { color: var(--muted); text-decoration: none; }
.legal-links a:hover { color: var(--text); text-decoration: underline; }
.page-home .legal-links { position: absolute; right: 26px; bottom: 20px; margin: 0; z-index: 15; }
@media (max-width: 720px) { .page-home .legal-links { right: 16px; left: 16px; bottom: 64px; justify-content: center; } }
