/*
  Nision — shared stylesheet for the whole static site.
  Design tokens copied verbatim from src/shared/ui/tokens.ts and
  .taskard/context/specs/design-language.md (§2–§4, §9). Flat, sharp, no shadow,
  no gradient, no glow outside the one place the app spec allows it (not this site).

  Surfaces used here: .landing / .landing-min (this page + the /e/ fallback),
  .doc (privacy, terms, acceptable-use — plain semantic HTML, no classes of their own),
  .site-header / .site-footer (shared chrome on every page except the landing hero itself,
  though the footer nav is reused on the landing too).
*/

/* ---------- Fonts (self-hosted, SIL OFL — see fonts/OFL.txt) ---------- */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */

:root {
  /* colour — §2 */
  --surface-base: #060608;
  --surface-raised: #101014;
  --surface-overlay: #16161b;
  --border-subtle: #22222a;
  --border-strong: #34343e;
  --border-interactive: #5f606a;
  --text-primary: #f4f5f2;
  --text-secondary: #9a9ba3;
  --text-muted: #82838b;
  --accent-base: #abe633;
  --accent-press: #8fc91f;
  --accent-dim: #4bbb14;
  --accent-on: #07100a;
  --state-danger: #ff5a4e;
  --state-warning: #ffb020;

  /* spacing — §4.1, 4pt grid expressed in rem so it scales with root font-size */
  --space-2xs: 0.25rem; /* 4 */
  --space-xs: 0.5rem; /* 8 */
  --space-sm: 0.75rem; /* 12 */
  --space-md: 1rem; /* 16 */
  --space-lg: 1.25rem; /* 20 */
  --space-xl: 1.5rem; /* 24 */
  --space-2xl: 2rem; /* 32 */
  --space-3xl: 2.5rem; /* 40 */
  --space-4xl: 3rem; /* 48 */
  --space-5xl: 4rem; /* 64 */

  /* radius — §4.2 */
  --radius-sm: 0.5rem; /* 8 */
  --radius-md: 0.75rem; /* 12 */
  --radius-lg: 1rem; /* 16 */
  --radius-xl: 1.5rem; /* 24 */
  --radius-full: 999px;

  /* borders — §4.3 */
  --border-hairline: 1px;
  --border-regular: 1.5px;
  --border-focus: 2px;

  color-scheme: dark; /* one theme, dark only — no light mode in v1 */
}

/* ---------- Minimal hand-written reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
h1,
h2,
h3,
p,
figure {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

ul {
  padding: 0;
}

table {
  border-collapse: collapse;
}

/* ---------- Base ---------- */

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

body {
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

/* visible focus ring everywhere — accent/base is the one token §2.2 reserves for focus */
:focus-visible {
  outline: var(--border-focus) solid var(--accent-base);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Shared chrome: header wordmark + footer nav ---------- */

.site-header {
  padding: var(--space-md);
}

.site-header .wordmark {
  display: inline-block;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.site-header .wordmark:hover,
.site-header .wordmark:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm) var(--space-lg);
  padding: var(--space-2xl) var(--space-md) var(--space-3xl);
  font-size: 0.8125rem; /* body-sm */
  line-height: 1.125rem;
  text-align: center;
}

.site-footer nav a {
  color: var(--text-muted);
}

.site-footer nav a:hover,
.site-footer nav a:focus-visible {
  color: var(--text-secondary);
}

/* ---------- Landing hero (index.html) ---------- */

.landing {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
}

.landing__mark {
  width: clamp(4.5rem, 4rem + 5vw, 8rem);
}

.landing__name {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.landing__tagline {
  max-width: 32ch;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  line-height: 1.5;
  color: var(--text-secondary);
}

.landing__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.landing__badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-sm) var(--space-lg);
  border: var(--border-regular) solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  font-size: 0.8125rem; /* body-sm */
  line-height: 1.125rem;
  color: var(--text-muted); /* disabled/lowest-emphasis, correct until the link is real */
}

/* ---------- Landing-min (used by the /e/ universal-link fallback page) ----------
   That page ships plain semantic HTML with no classes of its own, same convention as
   .doc below, so bare h1/p/a inside this container get the styling. */

.landing-min {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  max-width: 34rem;
  margin-inline: auto;
  padding: var(--space-3xl) var(--space-md);
  text-align: center;
}

.landing-min h1 {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 1.5rem; /* heading-lg */
  line-height: 1.875rem;
  color: var(--text-primary);
}

.landing-min p {
  font-size: 1.0625rem; /* body-lg — this is the page's one piece of reading content */
  line-height: 1.5rem;
  color: var(--text-primary);
}

.landing-min a {
  color: var(--accent-base); /* a real primary action (get the app), not decoration */
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.landing-min a:hover,
.landing-min a:focus-visible {
  color: var(--accent-press);
}

/* ---------- .doc: privacy / terms / acceptable-use long-form reading ---------- */

.doc {
  max-width: 70ch;
  margin-inline: auto;
  padding: var(--space-2xl) var(--space-md) var(--space-5xl);
}

.doc h1 {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 1.5rem; /* heading-lg */
  line-height: 1.875rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.doc-meta {
  margin-top: var(--space-xs);
  margin-bottom: var(--space-2xl);
  font-size: 0.8125rem; /* body-sm — secondary/meta text is exactly this token's job */
  line-height: 1.125rem;
  color: var(--text-muted);
}

.doc h2 {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  font-size: 1.25rem; /* heading-md */
  line-height: 1.625rem;
  color: var(--text-primary);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-sm);
}

.doc h3 {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  font-size: 1.0625rem; /* heading-sm */
  line-height: 1.375rem;
  color: var(--text-primary);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-2xs);
}

.doc p {
  font-size: 1.0625rem; /* body-lg: primary reading text */
  line-height: 1.5rem;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.doc ul {
  margin: 0 0 var(--space-md);
  padding-left: var(--space-lg);
  color: var(--text-primary);
}

.doc li {
  font-size: 1.0625rem;
  line-height: 1.5rem;
  margin-bottom: var(--space-xs);
}

.doc a {
  color: var(--accent-base);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.doc a:hover,
.doc a:focus-visible {
  color: var(--accent-press);
}

.doc table {
  width: 100%;
  margin: var(--space-md) 0 var(--space-xl);
  font-size: 0.9375rem; /* body-md */
  line-height: 1.3125rem;
}

.doc th,
.doc td {
  padding: var(--space-sm);
  border-bottom: var(--border-hairline) solid var(--border-subtle);
  text-align: left;
  color: var(--text-primary);
  vertical-align: top;
}

.doc th {
  font-weight: 600;
  background: var(--surface-raised);
}

/* ---------- Small screens: keep the 320px floor honest ---------- */

@media (max-width: 360px) {
  .landing,
  .landing-min {
    padding-inline: var(--space-sm);
  }
}
