/* TCast site: shared design system (v3)
   Dark control-room look. Brand: blue #005DAB, dark blue #1A2833,
   dark brown #332C1A, yellow #AB7D00. Helvetica, tight tracking. */

:root {
  /* color */
  --bg: #0d141b;
  --bg-deep: #090e13;
  --surface: #1a2833;
  --surface-2: #223341;
  --warm: #332c1a;
  --warm-2: #403722;
  --ink: #e9f0f6;
  --ink-mut: #a9bccb;
  --ink-dim: #8299ab;
  --line: rgba(233, 240, 246, 0.09);
  --line-strong: rgba(233, 240, 246, 0.16);
  --blue: #005dab;
  --blue-hover: #076ac0;
  --blue-text: #4ea3e8;
  --yellow: #ab7d00;
  --yellow-text: #e3b23c;
  --tally: #e5484d;
  --ok: #3fb96a;

  /* type */
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --track-display: -0.03em;
  --track-title: -0.022em;
  --track-sub: -0.012em;

  /* shape: containers 16, interactive 10, chips pill */
  --r-box: 16px;
  --r-ui: 10px;

  /* space */
  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2.5rem;
  --sp-5: 4rem;
  --sp-6: 6.5rem;
  --sp-7: 9rem;

  /* z scale */
  --z-nav: 100;

  --shell: 1160px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

/* Any author rule that sets `display` beats the browser's own
   [hidden] { display: none }, regardless of specificity — so `.btn`'s
   inline-flex silently defeated `hidden` on the buy button, and it shipped
   visible. Every `hidden` on the site depends on this holding. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Sticky footer: short pages (activate, the legal pages) don't fill the
     viewport, and without this the footer floats mid-screen. dvh so mobile
     browser chrome doesn't push it below the fold; the vh line is the
     fallback. Safe to make body a flex container — none of its direct
     children carry vertical margins, so nothing was relying on collapsing. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--blue); color: #fff; }

img, svg, video { max-width: 100%; display: block; }

a { color: var(--blue-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  text-wrap: balance;
  color: var(--ink);
}

p { margin: 0; }

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* ---------- nav ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--z-nav);
  background: rgba(13, 20, 27, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.site-header .shell {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 66px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-size: 1.1rem;
  letter-spacing: var(--track-sub);
  font-weight: 400;
}
.wordmark:hover { text-decoration: none; }
.wordmark strong { font-weight: 700; }

.nav-links {
  display: flex;
  gap: clamp(1rem, 2.5vw, 1.9rem);
  margin-left: auto;
  align-items: center;
}

/* :not(.btn) so a button in the nav keeps its own colour — this selector is
   more specific than .btn-primary and would otherwise mute it to --ink-mut,
   which reads as disabled. */
.nav-links a:not(.btn) {
  color: var(--ink-mut);
  font-size: 0.95rem;
  letter-spacing: var(--track-sub);
  transition: color 140ms var(--ease-out);
}
.nav-links a:not(.btn):hover { color: var(--ink); text-decoration: none; }
.nav-links .btn { font-size: 0.95rem; letter-spacing: var(--track-sub); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.68rem 1.25rem;
  border-radius: var(--r-ui);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: var(--track-sub);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  cursor: pointer;
  transition: background 140ms var(--ease-out), border-color 140ms var(--ease-out),
    transform 140ms var(--ease-out);
}
.btn:hover { text-decoration: none; background: rgba(233, 240, 246, 0.06); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  /* Deeper than --blue: clears WCAG AA with margin even under Lighthouse's
     conservative background resolution (fixed header has backdrop-filter). */
  background: #00518f;
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); }

.btn-large { padding: 0.9rem 1.6rem; font-size: 1.05rem; }

:where(a, button, summary):focus-visible {
  outline: 2px solid var(--blue-text);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--bg);
  color: var(--ink);
  padding: 0.6rem 1rem;
}
.skip-link:focus { left: 0; }

/* ---------- screenshot placeholder slots ---------- */

.shot {
  position: relative;
  border-radius: var(--r-box);
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(0, 93, 171, 0.14), transparent 60%),
    var(--surface);
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Real screenshots: drop the placeholder chrome (border, blue glow, forced
   aspect) and show the image as-is at its own ratio, rounded. */
.shot:has(> img) {
  border: none;
  background: none;
  aspect-ratio: auto;
  display: block;
}
.shot:has(> img)::after { display: none; }
.shot > img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-box);
}

.shot::after {
  /* top edge catching light */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: rgba(233, 240, 246, 0.18);
}

.shot > .shot-note {
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.92rem;
  letter-spacing: var(--track-sub);
}
.shot > .shot-note strong {
  display: block;
  color: var(--ink-mut);
  font-weight: 500;
  margin-bottom: 0.15rem;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: auto;              /* pins to the bottom on short pages */
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
  padding-block: var(--sp-5) var(--sp-4);
  color: var(--ink-mut);
  font-size: 0.95rem;
}

.site-footer a { color: var(--ink-mut); }
.site-footer a:hover { color: var(--ink); }

.footer-cols {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-4);
}

.footer-cols nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-cols h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.footer-legal {
  border-top: 1px solid var(--line);
  padding-top: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  color: var(--ink-dim);
  font-size: 0.88rem;
}

/* ---------- prose (docs, legal, long-form) ---------- */

.prose {
  max-width: 70ch;
  text-wrap: pretty;
}
.prose h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); letter-spacing: var(--track-title); line-height: 1.1; margin-bottom: 1.2rem; }
.prose h2 { font-size: 1.45rem; letter-spacing: var(--track-sub); margin: 2.4rem 0 0.8rem; }
.prose h3 { font-size: 1.15rem; margin: 1.8rem 0 0.6rem; }
.prose p, .prose ul, .prose ol { color: var(--ink-mut); margin-bottom: 1rem; }
.prose li { margin-bottom: 0.35rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12em 0.4em;
  color: var(--ink);
}
.prose pre {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-ui);
  padding: 1rem 1.25rem;
  overflow-x: auto;
}
.prose pre code { background: none; border: 0; padding: 0; }
.prose img { margin-block: 1.25rem; }
/* Window captures already carry macOS's own rounded edge (build_docs.py finds
   them by their transparent corner and withholds .framed). Only flat crops —
   strips, browser shots, panes cut out of a window — get an edge drawn for
   them, at the radius the real windows measure: 63px at 2x, so ~30 CSS px. */
.prose img.framed {
  border-radius: 14px;
  border: 1px solid var(--line-strong);
}
.prose table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; }
.prose th, .prose td {
  text-align: left;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-mut);
}
.prose th { color: var(--ink); font-weight: 600; }
.prose blockquote {
  margin: 0 0 1rem;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 1px solid var(--line-strong);
  color: var(--ink-dim);
}

/* ---------- reveal motion (progressive enhancement) ---------- */

.reveal { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  html.js-motion .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
  }
  html.js-motion .reveal.in {
    opacity: 1;
    transform: none;
  }
}

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

@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
