/* Watchtower marketing site — base styles, layout, components. */

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img, svg { display: block; max-width: 100%; }

::selection { background: rgba(255,255,255,0.16); color: #fff; }

/* ─── Backdrop: faint dotted grid + vignette (Effects.tsx: DotGridBackdrop) ─── */
.dot-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--line) 0.9px, transparent 0.9px);
  background-size: 22px 22px;
  opacity: 0.6;
}
.dot-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 75% 60% at 50% 40%, transparent 35%, rgba(0,0,0,0.95) 100%);
}

/* ─── Layout shell ─── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ─── Top progress rail (ProgressRail.tsx) ─── */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.rail-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 18px;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.rail-brand svg { width: 22px; height: 22px; }
.rail-brand span {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2.6px;
  color: var(--text);
}
.rail-track {
  position: relative;
  flex: 1;
  height: 9px;
  display: none;
}
.rail-track-line { position: absolute; left: 0; right: 0; top: 4px; height: 1px; background: var(--line); }
.rail-track-fill {
  position: absolute;
  left: 0;
  top: 4px;
  height: 1px;
  width: 0%;
  background: var(--text);
  box-shadow: 0 0 4px rgba(255,255,255,0.9);
  transition: width 80ms linear;
}
@media (min-width: 860px) {
  .rail-track { display: block; }
}
.rail-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--dim);
  white-space: nowrap;
  display: none;
}
@media (min-width: 860px) { .rail-label { display: block; } }
.rail-nav {
  display: none;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.4px;
}
@media (min-width: 720px) {
  .rail-nav { display: flex; }
}
.rail-nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.rail-nav a:hover, .rail-nav a:focus-visible { color: var(--text); }
.rail-menu-btn {
  display: inline-flex;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}
.rail-menu-btn svg { width: 16px; height: 16px; }
@media (min-width: 720px) { .rail-menu-btn { display: none; } }

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(0,0,0,0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 2px;
  transform: translateY(-100%);
  transition: transform var(--dur-med) var(--ease-out);
}
.mobile-nav.open { transform: translateY(0); }
.mobile-nav a { color: var(--muted); text-decoration: none; }
.mobile-nav a:hover, .mobile-nav a:focus-visible { color: var(--text); }
@media (min-width: 720px) { .mobile-nav { display: none; } }

/* ─── Typography ─── */
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kicker::before {
  content: '';
  width: 9px;
  height: 9px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
}
.title {
  font-family: var(--font-sans);
  font-weight: 300;
  letter-spacing: 0.2px;
  color: var(--text);
  margin: 0 0 14px;
  font-size: clamp(26px, 4.4vw, 40px);
  line-height: 1.14;
}
.title-hero {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: clamp(4px, 1.4vw, 11px);
  font-size: clamp(34px, 9.5vw, 84px);
  color: #fff;
  text-shadow: 0 0 24px rgba(255,255,255,0.35);
  margin: 0;
  line-height: 1.05;
}
.body-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 56ch;
}
.body-text:last-child { margin-bottom: 0; }

/* ─── Feature list (ui.tsx: FeatureList) ─── */
.feature-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 13px; }
.feature-list li { display: flex; align-items: flex-start; gap: 13px; }
.feature-dot {
  width: 9px; height: 9px; flex-shrink: 0; margin-top: 6px;
  border: 1px solid var(--dot-color, #fff);
  background: color-mix(in srgb, var(--dot-color, #fff) 25%, transparent);
  transform: rotate(45deg);
}
.feature-list .label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.6px;
  color: var(--dot-color, #fff);
  margin-right: 6px;
}
.feature-list .text { color: var(--muted); font-size: 14.5px; line-height: 1.55; }

/* ─── Corner-bracket buttons (ui.tsx: HudButton / CornerBrackets) ─── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2.2px;
  text-decoration: none;
  border: 1px solid var(--text);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast);
}
.btn:hover, .btn:focus-visible { background: rgba(255,255,255,0.14); }
.btn:active { transform: scale(0.98); }
.btn .corner { position: absolute; width: 7px; height: 7px; border-color: currentColor; }
.btn .corner.tl { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.btn .corner.tr { top: -1px; right: -1px; border-top: 1px solid; border-right: 1px solid; }
.btn .corner.bl { bottom: -1px; left: -1px; border-bottom: 1px solid; border-left: 1px solid; }
.btn .corner.br { bottom: -1px; right: -1px; border-bottom: 1px solid; border-right: 1px solid; }

.btn-solid {
  background: #fff;
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 14px rgba(255,255,255,0.5);
}
.btn-solid:hover, .btn-solid:focus-visible { background: rgba(255,255,255,0.86); }
.btn-solid .corner { display: none; }

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  letter-spacing: 2px;
}
.btn-ghost:hover, .btn-ghost:focus-visible { color: var(--text); background: rgba(255,255,255,0.06); }
.btn-ghost .corner { display: none; }

.btn-disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ─── Store badges ─── */
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-hi);
  padding: 10px 18px;
  min-height: 52px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-elevated);
}
.store-btn svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--muted); }
.store-btn .lines { display: flex; flex-direction: column; gap: 2px; }
.store-btn .eyebrow { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1.4px; color: var(--dim); text-transform: uppercase; }
.store-btn .name { font-size: 15px; font-weight: 500; }
.store-btn[aria-disabled="true"] { opacity: 0.55; cursor: default; pointer-events: none; }

/* ─── Sections ─── */
section { position: relative; z-index: 1; }
.section {
  padding: 96px 0;
  border-bottom: 1px solid var(--line);
}
.section:last-of-type { border-bottom: none; }
.section-grid {
  display: grid;
  gap: 48px;
  align-items: center;
}
@media (min-width: 900px) {
  .section-grid { grid-template-columns: 1fr 1fr; gap: 64px; }
  .section-grid.reverse .scene-col { order: 2; }
  .section-grid.reverse .text-col { order: 1; }
}
.scene-col { display: flex; align-items: center; justify-content: center; }
.scene-frame {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 42%, rgba(255,255,255,0.035), transparent 65%);
}

/* ─── Reveal-on-scroll ─── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ─── Footer ─── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  position: relative;
  z-index: 1;
}
.footer-grid {
  display: grid;
  gap: 36px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand svg { width: 24px; height: 24px; }
.footer-brand span { font-family: var(--font-mono); font-weight: 700; letter-spacing: 2px; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { color: var(--muted); text-decoration: none; font-size: 14.5px; }
.footer-col a:hover, .footer-col a:focus-visible { color: var(--text); }
.footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--faint);
}

/* ─── Simple content pages (privacy/terms/support/sources) ─── */
.doc {
  padding: 140px 0 100px;
  max-width: 820px;
}
.doc h1 { font-family: var(--font-sans); font-weight: 300; font-size: clamp(28px, 5vw, 44px); margin: 0 0 6px; }
.doc .updated { font-family: var(--font-mono); font-size: 12px; letter-spacing: 1.4px; color: var(--dim); margin-bottom: 44px; }
.doc h2 {
  font-weight: 400;
  font-size: 21px;
  margin: 44px 0 14px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.doc h2:first-of-type { border-top: none; padding-top: 0; }
.doc h3 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; color: var(--text); }
.doc p, .doc li { color: var(--muted); font-size: 15.5px; line-height: 1.7; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin-bottom: 8px; }
.doc a { color: #fff; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-hi); }
.doc a:hover { text-decoration-color: var(--text); }
.doc strong { color: var(--text); font-weight: 600; }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; }
.doc th, .doc td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: top; }
.doc th { color: var(--dim); font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 400; }
.doc-toc { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 40px; padding: 16px 18px; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.6px; }
.doc-toc a { color: var(--muted); text-decoration: none; }
.doc-toc a:hover { color: var(--text); }
.callout {
  border: 1px solid var(--line-hi);
  background: var(--bg-elevated);
  padding: 16px 18px;
  margin: 0 0 20px;
  font-size: 14.5px;
  color: var(--muted);
}
.callout strong { color: var(--text); }

/* ─── Utility ─── */
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.hidden { display: none !important; }
.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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: #fff; color: #000; padding: 10px 16px; font-family: var(--font-mono);
  font-size: 13px; transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 12px; }
