/* ==========================================================================
   StockMetric — static site stylesheet
   No remote fonts, no external assets, no tracking.
   Theme: system preference by default, optional manual override.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef0f8;
  --border: #e2e5f0;
  --border-strong: #cfd4e6;

  --text: #12142a;
  --text-soft: #3d4262;
  --muted: #5d6384;

  --brand: #5b3fd6;
  --brand-strong: #4a2fc0;
  --brand-hover: #3f27a8;
  --brand-soft: #ece8fd;
  --brand-contrast: #ffffff;
  --ring: #7c5cf0;

  --shadow-sm: 0 1px 2px rgba(18, 20, 42, 0.05), 0 1px 3px rgba(18, 20, 42, 0.04);
  --shadow-md: 0 2px 4px rgba(18, 20, 42, 0.04), 0 16px 36px -14px rgba(18, 20, 42, 0.22);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --wrap: 1120px;
  --wrap-narrow: 780px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dark theme values — applied by explicit choice and by system preference. */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0c0d17;
  --surface: #14161f;
  --surface-2: #1c1f2e;
  --border: #272b3c;
  --border-strong: #363b52;

  --text: #eceefb;
  --text-soft: #c4c9e2;
  --muted: #9ba1bd;

  --brand: #b9a6ff;
  --brand-strong: #8f74f5;
  --brand-hover: #a08bf7;
  --brand-soft: #241f3f;
  --brand-contrast: #0b0c14;
  --ring: #a48cff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 40px -16px rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0c0d17;
    --surface: #14161f;
    --surface-2: #1c1f2e;
    --border: #272b3c;
    --border-strong: #363b52;

    --text: #eceefb;
    --text-soft: #c4c9e2;
    --muted: #9ba1bd;

    --brand: #b9a6ff;
    --brand-strong: #8f74f5;
    --brand-hover: #a08bf7;
    --brand-soft: #241f3f;
    --brand-contrast: #0b0c14;
    --ring: #a48cff;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 40px -16px rgba(0, 0, 0, 0.7);
  }
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 0.6em;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem);
  font-weight: 750;
}

h2 {
  font-size: clamp(1.4rem, 1.05rem + 1.4vw, 1.95rem);
  font-weight: 700;
}

h3 {
  font-size: 1.06rem;
  font-weight: 680;
}

p {
  margin: 0 0 1rem;
  text-wrap: pretty;
}

a {
  color: var(--brand-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand-hover);
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.3rem;
}

strong {
  font-weight: 680;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

.wrap-narrow {
  max-width: var(--wrap-narrow);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand-strong);
  color: var(--brand-contrast);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

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

/* --------------------------------------------------------------------------
   3. Header / navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-block: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 730;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  display: block;
}

.site-nav {
  order: 3;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 560;
  font-size: 0.94rem;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.site-nav a[aria-current="page"] {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.theme-toggle {
  order: 2;
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.theme-toggle svg {
  width: 19px;
  height: 19px;
}

.theme-toggle .icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  html:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

html.no-js .theme-toggle {
  display: none;
}

@media (min-width: 800px) {
  .header-inner {
    flex-wrap: nowrap;
    gap: 16px;
    padding-block: 12px;
  }

  .site-nav {
    order: 2;
    width: auto;
    margin-inline-start: auto;
    overflow: visible;
  }

  .theme-toggle {
    order: 3;
    margin-inline-start: 4px;
  }
}

/* --------------------------------------------------------------------------
   4. Layout helpers
   -------------------------------------------------------------------------- */
.section {
  padding-block: clamp(42px, 6vw, 78px);
}

.section-tight {
  padding-block: clamp(30px, 4vw, 52px);
}

.section-alt {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 62ch;
  margin-bottom: clamp(24px, 3vw, 38px);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
  font-size: 0.8rem;
  font-weight: 620;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lede {
  font-size: clamp(1.02rem, 0.98rem + 0.3vw, 1.14rem);
  color: var(--text-soft);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.stack-sm > * + * {
  margin-top: 0.75rem;
}

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding-block: clamp(44px, 7vw, 88px) clamp(38px, 5vw, 66px);
  background-image:
    radial-gradient(
      760px 460px at 6% -6%,
      color-mix(in srgb, var(--brand) 24%, transparent),
      transparent 72%
    ),
    radial-gradient(
      620px 420px at 102% 108%,
      color-mix(in srgb, var(--brand) 16%, transparent),
      transparent 72%
    );
}

.hero-grid {
  display: grid;
  gap: clamp(30px, 4vw, 52px);
  align-items: center;
}

@media (min-width: 920px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  }
}

.hero h1 {
  margin-bottom: 0.5em;
}

.hero .lede {
  max-width: 56ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.cta-note {
  margin: 16px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 46ch;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.97rem;
  font-weight: 620;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.btn-primary {
  background: var(--brand-strong);
  color: var(--brand-contrast);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--brand-hover);
  color: var(--brand-contrast);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.62;
  cursor: not-allowed;
}

.btn:disabled:hover,
.btn[aria-disabled="true"]:hover {
  transform: none;
}

/* Decorative app preview */
.app-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 20px;
  transform: rotate(-0.4deg);
}

.app-preview-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.app-preview-head .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
}

.app-preview-title {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-preview-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-preview-rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px;
  border-bottom: 1px dashed var(--border);
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-soft);
}

.app-preview-rows li:last-child {
  border-bottom: 0;
}

.app-preview-rows strong {
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 0.08em;
}

.app-preview-note {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 600px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cards > li {
  margin: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card h3 {
  margin-bottom: 0.45em;
}

.card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.945rem;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

/* Two-column feature split */
.split {
  display: grid;
  gap: clamp(22px, 3vw, 44px);
  align-items: start;
}

@media (min-width: 880px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-list li {
  position: relative;
  padding-left: 30px;
  margin-top: 10px;
  color: var(--text-soft);
}

.check-list li:first-child {
  margin-top: 0;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 32%, transparent);
}

.check-list li::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.62em;
  width: 5px;
  height: 8px;
  border: solid var(--brand-strong);
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

/* Plan cards */
.plan-grid {
  display: grid;
  gap: 16px;
  margin-top: clamp(24px, 3vw, 34px);
}

@media (min-width: 760px) {
  .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.plan {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.plan h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.plan-tag {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.plan-tag-brand {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.plan ul {
  margin: 0;
}

.plan li {
  color: var(--text-soft);
  font-size: 0.945rem;
}

/* Callouts */
.callout {
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--brand);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

.callout h2,
.callout h3 {
  margin-bottom: 0.5em;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-legal {
  border-left-color: var(--brand-strong);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 26%, transparent);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 18px;
}

/* --------------------------------------------------------------------------
   7. Legal / prose pages
   -------------------------------------------------------------------------- */
.page-head {
  padding-block: clamp(34px, 5vw, 58px) clamp(18px, 2vw, 26px);
  border-bottom: 1px solid var(--border);
}

.legal-meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.page-head .lede {
  max-width: 60ch;
}

.prose {
  font-size: 1.005rem;
}

.prose h1 {
  font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.3rem);
}

.prose h2 {
  font-size: clamp(1.14rem, 1.02rem + 0.5vw, 1.32rem);
  margin-top: 2.4rem;
  margin-bottom: 0.55rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 90px;
}

.prose h2:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.prose p,
.prose li {
  color: var(--text-soft);
}

.prose > p:first-of-type {
  color: var(--text);
}

.prose-tight h2:first-of-type {
  margin-top: 0;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 2.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}

.disclaimer-block {
  margin-top: 2.5rem;
  padding: 20px 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.disclaimer-block p:last-child {
  margin-bottom: 0;
}

/* Contact page */
.contact-grid {
  display: grid;
  gap: clamp(24px, 3vw, 40px);
  align-items: start;
}

@media (min-width: 880px) {
  .contact-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  }
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.contact-card dl {
  margin: 0;
  display: grid;
  gap: 16px;
}

.contact-card dt {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.contact-card dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   8. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: clamp(48px, 6vw, 84px);
  padding-block: 34px 44px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 40px;
  align-items: flex-start;
  justify-content: space-between;
}

.footer-copy {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
}

.footer-links li + li {
  margin-top: 0;
}

.footer-links li + li::before {
  content: "·";
  margin-right: 10px;
  color: var(--border-strong);
}

.footer-links a {
  color: var(--text-soft);
  font-weight: 560;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   9. Utility / 404
   -------------------------------------------------------------------------- */
.center-block {
  max-width: 56ch;
  margin-inline: auto;
  text-align: center;
}

.center-block .cta-row {
  justify-content: center;
}

.code-display {
  font-family: var(--mono);
  font-size: clamp(3.4rem, 2rem + 8vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 0 0 0.3em;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Print: keep legal text readable and clean. */
@media print {
  .site-header,
  .site-footer,
  .legal-actions,
  .cta-row,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11.5pt;
  }

  .prose,
  .wrap-narrow {
    max-width: none;
  }

  a {
    color: #000;
  }
}
