/* ==========================================================================
   TORKIV DESIGN SYSTEM
   Editorial foundry sheet: one display face, system body, mono for facts,
   and a recurring "datum rule" (hairline with an accent origin segment)
   as the visual signature. Zero client JavaScript; motion is CSS-only and
   respects prefers-reduced-motion.

   TYPE SCALE (fluid, ~major third)
     --step--1  0.875rem        captions, fine print
     --step-0   1.0625rem       body
     --step-1   1.25rem         cluster headings, ledes
     --step-2   1.5 → 1.9rem    section headings (h2)
     --step-3   1.9 → 2.6rem    product names on the index
     --step-4   2.5 → 4rem      page masthead (h1)

   SPACING SCALE (4px base)
     --space-1 0.25  --space-2 0.5  --space-3 0.75  --space-4 1
     --space-5 1.5   --space-6 2    --space-8 3     --space-10 4.5
     --space-12 6    (rem units; sections breathe at 10/12)

   SHAPE  interactive elements 6px, containers 10px. Nothing pill-shaped.
   ACCENT one blue, used identically everywhere: datum marks, links, CTAs.
   ========================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --bg: #fbfbfa;
  --bg-raised: #ffffff;
  --text: #1a1c1f;
  --text-muted: #565d66;
  --accent: #2456d6;          /* 6.2:1 on --bg */
  --accent-contrast: #ffffff;
  --border: #e6e6e2;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", var(--font);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.5rem, 1.2rem + 1.4vw, 1.9rem);
  --step-3: clamp(1.9rem, 1.5rem + 2vw, 2.6rem);
  --step-4: clamp(2.5rem, 1.9rem + 3.2vw, 4rem);

  --space-1: 0.25rem; --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;    --space-5: 1.5rem;  --space-6: 2rem;
  --space-8: 3rem;    --space-10: 4.5rem; --space-12: 6rem;

  --radius-ui: 6px;
  --radius-box: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --bg-raised: #171b22;
    --text: #e8eaed;
    --text-muted: #a4acb8;
    --accent: #7ba3ff;        /* 7.5:1 on --bg */
    --accent-contrast: #0c1730;
    --border: #2a2f38;
  }
}

/* ── Base ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

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

.container { max-width: 66rem; margin-inline: auto; padding-inline: 1.25rem; }

h1, h2 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); margin: 0 0 var(--space-4); }
h2 { font-size: var(--step-2); margin: 0 0 var(--space-4); }
h3 { font-size: var(--step-1); line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 var(--space-2); }

p { margin: 0 0 var(--space-4); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

code {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 4px; padding: 0.1em 0.35em;
}

.muted { color: var(--text-muted); }
.lede { font-size: var(--step-1); line-height: 1.55; color: var(--text-muted); max-width: 46rem; margin-bottom: 0; }

/* Mono is for facts: status lines, stack names, gate values. */
.fact {
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* ── The datum rule (visual signature) ─────────────────────────────────────
   A hairline with a short, thick accent segment at its origin, like the
   datum mark on an engineering drawing. Used under mastheads and between
   sections; echoed in miniature by cluster list markers. */
.datum {
  border: 0; height: 1px; background: var(--border);
  position: relative; overflow: visible;
  margin: var(--space-8) 0 0;
}
.datum::before {
  content: ""; position: absolute; left: 0; top: -1px;
  width: 3.5rem; height: 3px; background: var(--accent);
}

/* ── Skip link ─────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  background: var(--accent); color: var(--accent-contrast);
  padding: 0.5rem 1rem; border-radius: 0 0 var(--radius-ui) 0;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ── Header / nav ──────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.site-header nav { display: flex; align-items: center; justify-content: space-between; min-height: 3.6rem; }
.brand {
  font-family: var(--display); font-weight: 600; font-size: 1.2rem;
  letter-spacing: -0.02em; color: var(--text); text-decoration: none;
}
.nav-links { display: flex; gap: var(--space-5); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--text-muted); text-decoration: none; font-weight: 500;
  transition: color 160ms var(--ease);
}
.nav-links a:hover { color: var(--text); }

/* ── Masthead ──────────────────────────────────────────────────────────── */
.masthead { padding: var(--space-10) 0 0; }
.masthead .status { margin: 0 0 var(--space-4); }

@media (prefers-reduced-motion: no-preference) {
  .masthead > * {
    animation: rise 700ms var(--ease) both;
  }
  .masthead > *:nth-child(2) { animation-delay: 70ms; }
  .masthead > *:nth-child(3) { animation-delay: 140ms; }
  .masthead > *:nth-child(4) { animation-delay: 210ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ── Sections ──────────────────────────────────────────────────────────── */
main { padding-bottom: var(--space-12); }
.section { padding-top: var(--space-8); }
.section > .datum { margin: 0 0 var(--space-6); }
.section h2 + p, .section .lede + * { margin-top: 0; }
.prose { max-width: 46rem; }

/* ── Product index (home) ──────────────────────────────────────────────── */
.entry {
  display: grid; gap: var(--space-2) var(--space-8);
  padding: var(--space-6) var(--space-4);
  margin-inline: calc(-1 * var(--space-4));
  border-radius: var(--radius-box);
  color: inherit; text-decoration: none;
  transition: background-color 160ms var(--ease);
}
.entry + .entry { border-top: 1px solid var(--border); }
.entry:hover { background: var(--bg-raised); }
.entry h3 {
  font-family: var(--display); font-size: var(--step-3);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.05;
  margin: 0;
}
.entry .fact { margin: var(--space-1) 0 0; }
.entry p { margin: 0; }
.entry .go { color: var(--accent); font-weight: 600; margin-top: var(--space-3); }
.entry:hover .go { text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 48rem) {
  .entry { grid-template-columns: 2fr 3fr; align-items: start; }
  .entry .entry-body { grid-column: 2; grid-row: 1 / span 2; }
}

/* ── Capability clusters ───────────────────────────────────────────────── */
.clusters {
  display: grid; gap: var(--space-6) var(--space-8);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin: var(--space-5) 0 var(--space-2);
}
.cluster h3 { margin-bottom: var(--space-3); }
.cluster ul { list-style: none; margin: 0; padding: 0; }
.cluster li { position: relative; padding-left: 1.6rem; margin-bottom: var(--space-2); }
.cluster li::before {
  content: ""; position: absolute; left: 0; top: 0.72em;
  width: 1rem; height: 2px; background: var(--accent);
}

/* ── Gate list (mono verification facts) ───────────────────────────────── */
.gates { list-style: none; margin: var(--space-4) 0 0; padding: 0; max-width: 46rem; }
.gates li {
  font-family: var(--mono); font-size: var(--step--1); letter-spacing: 0.01em;
  padding: var(--space-2) 0 var(--space-2) 1.6rem; position: relative;
}
.gates li::before {
  content: ""; position: absolute; left: 0; top: 1.05em;
  width: 1rem; height: 2px; background: var(--accent);
}

/* ── Two-mode split ────────────────────────────────────────────────────── */
.split {
  display: grid; gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  margin: var(--space-5) 0 var(--space-2);
}
.split > div {
  border: 1px solid var(--border); border-radius: var(--radius-box);
  background: var(--bg-raised); padding: var(--space-5);
}
.split p { margin: 0; }

/* ── Product screenshot ────────────────────────────────────────────────── */
.shot { margin: var(--space-6) 0 0; }
.shot img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-box);
}
.shot figcaption {
  font-family: var(--mono); font-size: var(--step--1);
  color: var(--text-muted); margin-top: var(--space-2);
}

/* ── Status line ───────────────────────────────────────────────────────── */
.status { font-family: var(--mono); font-size: var(--step--1); letter-spacing: 0.02em; color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 0.6rem 1.3rem;
  border-radius: var(--radius-ui); font-weight: 600; text-decoration: none;
  border: 1px solid var(--border); color: var(--text); background: var(--bg-raised);
  transition: border-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.08); }
.cta-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-8) 0; margin-top: var(--space-8);
  color: var(--text-muted); font-size: 0.95rem;
}
.site-footer p { margin: 0 0 var(--space-2); }
.fine { font-size: var(--step--1); }

@media (max-width: 40rem) {
  .masthead { padding-top: var(--space-8); }
  .nav-links { gap: var(--space-4); }
  .entry { margin-inline: 0; padding-inline: var(--space-3); }
}

/* "Coming soon" tag: mono fact styling, datum-accent border. Honest dev-phase
   signal on product entries and mastheads. */
.soon {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.15em 0.55em;
  vertical-align: middle;
  margin-left: 0.6em;
  white-space: nowrap;
}

/* Founder block (contact page): photo + identity, datum-consistent. */
.founder-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--s5, 1.5rem);
  align-items: start;
}
.founder-row img {
  border-radius: 10px;
  border: 1px solid var(--line, currentColor);
}
@media (max-width: 560px) {
  .founder-row { grid-template-columns: 1fr; }
  .founder-row img { width: 96px; height: 96px; }
}

/* Logo mark in the header: monochrome monogram, inverted for dark scheme. */
.brand { display: inline-flex; align-items: center; gap: 0.5em; }
.logo-mark { display: inline-block; }
@media (prefers-color-scheme: dark) {
  .logo-mark { filter: invert(1) brightness(1.15); }
}
