/* Shared primitives for every Torusframe site.
 *
 * Only structure and behaviour live here: reset, layout, and components that
 * read the semantic roles from tokens.css. How a site looks is decided in that
 * site's own stylesheet, so the three can differ as much as they need to
 * without this file growing a branch per product.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  font-weight: 600;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition), text-decoration-color var(--transition);
}

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
}

pre {
  margin: 0;
  padding: var(--space-5);
  overflow-x: auto;
  line-height: 1.7;
}

pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; }

kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-size: var(--text-xs);
  line-height: 1.5;
  white-space: nowrap;
}

::selection { background: var(--accent); color: var(--accent-text); }

/* Layout -------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measure { max-width: 62ch; }

.section { padding-block: var(--space-10); }
.section-tight { padding-block: var(--space-8); }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }

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

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

/* Site chrome ----------------------------------------------------------------
   Structure only. Each site paints its own header. */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding-block: var(--space-2);
}

.brand {
  display: inline-flex;
  gap: var(--space-3);
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand svg { flex: none; }

.nav {
  display: flex;
  gap: var(--space-5);
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

/* Components -------------------------------------------------------------- */

.button {
  display: inline-flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--transition),
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0); }

.button-secondary {
  border-color: currentColor;
  background: transparent;
  color: var(--text);
}

.button-secondary:hover { background: var(--accent-quiet); }

.button .arrow { transition: transform var(--transition); }
.button:hover .arrow { transform: translateX(3px); }

.badge {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* A standing notice, not a dismissible alert. Used wherever a page states its
   own maturity, which both product sites currently must. */
.notice {
  padding: var(--space-5);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.notice strong { color: var(--text); }

.lead {
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: 1.55;
}

.label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table td { color: var(--text-muted); }

/* Marks a block that is not finished, so nobody mistakes scaffolding for a
   decision. Remove the class, not the styles, when a section is real. */
.placeholder {
  position: relative;
  padding: var(--space-6) var(--space-5) var(--space-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
}

.placeholder::before {
  content: "Placeholder";
  position: absolute;
  top: -0.7em;
  left: var(--space-4);
  padding: 0 var(--space-2);
  background: var(--bg);
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .section { padding-block: var(--space-8); }
  .section-tight { padding-block: var(--space-7); }
  .nav { gap: var(--space-4); }
}
