/* Kranium family sites: kranium.co (parent) and kranium.ai (child).
   v2, the A+C hybrid (Score's 2026-11-12 hybrid addendum and its parent spec).
   Every value below is a GL-003 token or a GL-008 §2 reserved literal
   (breakpoints, column counts, container widths). Nothing else.
   This file is byte-identical in kranium.co/ and kranium.ai/. Edit both. */

/* ------------------------------------------------------------------ fonts */

/* Instrument Sans, fontsource-variable 5.3.0 "standard" file: wght 400-700
   and wdth 75-100, so the display line can run condensed (GL-003 §3). */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  font-stretch: 75% 100%;
  src: url("../fonts/instrument-sans-latin-standard-normal.woff2?v=8b74e9bc6e") format("woff2-variations");
}

@font-face {
  font-family: "Spline Sans Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("../fonts/spline-sans-mono-latin-wght-normal.woff2?v=46b7dcafe3") format("woff2-variations");
}

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

:root {
  /* GL-003 §2.1 child fields and their on-colours */
  --field-so: #0090FF;
  --on-so: #111111;
  --field-ai: #6E56CF;
  --on-ai: #FFFFFF;
  --field-games: #FF5CAA;
  --on-games: #111111;
  /* GL-003 §2.5 named text-safe token */
  --field-ai-text-dark: #9887F0;

  /* GL-003 §3 type */
  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --text-display: clamp(48px, 8vw, 112px);
  --text-display-lh: 0.92;
  --text-display-stretch: 75%; /* "condensed width": the axis floor */
  --text-heading: 40px;
  --text-heading-lh: 1.10;
  --text-title: 24px;
  --text-title-lh: 1.25;
  --text-body: 16px;
  --text-body-lh: 1.55;
  --text-label: 12px;
  --text-label-lh: 16px;
  --text-label-tracking: 0.06em;

  /* GL-003 §4 spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;
  --space-5xl: 128px;
  --space-6xl: 192px;

  /* GL-003 §7 components, §1.5 item 1 mark */
  --rule-width: 1px;
  --radius-none: 0;
  --dot-size: 8px;
  --header-height: 64px;
  --mark-height: 32px;
  --icon-label: 16px;
  --icon-title: 24px;
  --icon-stroke: 1.5;

  /* GL-003 §2.6 focus ring */
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;

  /* GL-003 §7.7 motion */
  --duration-instant: 0ms;
  --duration-short: 160ms;
  --easing-standard: cubic-bezier(0.2, 0, 0, 1);

  /* GL-008 §2.2 grid (bp-wide values) and §2.3 containers */
  --grid-columns: 12;
  --gutter: var(--space-lg);
  --page-margin: var(--space-2xl);
  --container-wide: 1440px;
  --container-measure: 720px;
}

/* GL-003 §7.7 reduced-motion default: colour changes become instant. */
@media (prefers-reduced-motion: reduce) {
  :root { --duration-short: 0ms; }
}

/* GL-008 §2.1 tiers: bp-medium 768-991, bp-narrow 480-767, bp-compact to 479. */
@media (max-width: 991px) {
  :root { --page-margin: var(--space-lg); }
}
@media (max-width: 767px) {
  :root { --grid-columns: 6; --gutter: var(--space-md); }
}
@media (max-width: 479px) {
  :root { --grid-columns: 4; --page-margin: var(--space-md); }
}

/* ---------------------------------------------------- modes and surfaces */
/* GL-003 §2.2: one ladder, two modes. A surface sets its mode's ladder and
   names the roles its contents read. */

.surface--dark {
  --color-neutral-0: #111111;
  --color-neutral-1: #1F1F1F;
  --color-neutral-2: #7A7A7A;
  --color-neutral-3: #8F8F8F;
  --color-neutral-4: #CFCFCF;
  --color-neutral-5: #FFFFFF;
}

.surface--light {
  --color-neutral-0: #FFFFFF;
  --color-neutral-1: #F4F4F4;
  --color-neutral-2: #E0E0E0;
  --color-neutral-3: #6B6B6B;
  --color-neutral-4: #3A3A3A;
  --color-neutral-5: #111111;
}

.surface--dark,
.surface--light {
  --surface-bg: var(--color-neutral-0);
  --surface-ink: var(--color-neutral-5);
  --surface-body: var(--color-neutral-4);
  --surface-quiet: var(--color-neutral-3);
  --surface-rule: var(--color-neutral-2);
  --surface-outline: var(--color-neutral-5);
  --surface-focus: var(--color-neutral-5);
  --surface-glyph: var(--color-neutral-5);
}

/* A field: everything on it is the on-colour (GL-003 §2.1, §7.1). */
.surface--so { --field: var(--field-so); --on: var(--on-so); }
.surface--ai { --field: var(--field-ai); --on: var(--on-ai); }
.surface--games { --field: var(--field-games); --on: var(--on-games); }

.surface--so,
.surface--ai,
.surface--games {
  --surface-bg: var(--field);
  --surface-ink: var(--on);
  --surface-body: var(--on);
  --surface-quiet: var(--on);
  --surface-rule: var(--on);
  --surface-outline: var(--on);
  --surface-focus: var(--on);
  --surface-glyph: var(--on);
}

/* kranium.ai is a child: on its dark neutral surfaces the focus ring and
   glyphs take its text-safe dark violet (GL-003 §2.5, §2.6). Links stay n5. */
.property-ai .surface--dark {
  --surface-focus: var(--field-ai-text-dark);
  --surface-glyph: var(--field-ai-text-dark);
}

.surface {
  background-color: var(--surface-bg);
  color: var(--surface-ink);
}

/* ------------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* In-page targets land below the fixed header. Jumps stay instant. */
  scroll-padding-top: var(--header-height);
}

/* Focus scrolling and legal TOC jumps clear the header by a step, so a
   focus ring (offset plus width) and a section's index rule stay in view. */
a,
button,
[tabindex],
.legal-section {
  scroll-margin-top: var(--space-sm);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
  font-weight: 400;
}

h1, h2, h3, p, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.2em;
  text-decoration-thickness: var(--rule-width);
}

/* Standalone links: no underline at rest; underline on hover and focus. */
a:hover,
a:focus-visible {
  text-decoration-line: underline;
}

:focus-visible {
  outline: var(--focus-ring-width) solid var(--surface-focus);
  outline-offset: var(--focus-ring-offset);
}

/* Skip-link targets take focus programmatically; no ring for that. */
[tabindex="-1"]:focus {
  outline: none;
}

svg {
  display: block;
}

/* ----------------------------------------------------------------- layout */

/* container-wide: the viewport less the page margin, up to its maximum. */
.container {
  width: min(var(--container-wide), 100% - 2 * var(--page-margin));
  margin-inline: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  column-gap: var(--gutter);
}

/* ------------------------------------------------------------- type roles */

.t-heading,
.t-title,
.t-body {
  font-family: var(--font-sans);
  letter-spacing: normal;
  text-transform: none;
}

.t-heading {
  font-size: var(--text-heading);
  line-height: var(--text-heading-lh);
  font-weight: 600;
  color: var(--surface-ink);
}

.t-title {
  font-size: var(--text-title);
  line-height: var(--text-title-lh);
  font-weight: 500;
}

.t-body {
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
  font-weight: 400;
  color: var(--surface-body);
}

.t-label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: var(--text-label-lh);
  font-weight: 500;
  letter-spacing: var(--text-label-tracking);
  text-transform: uppercase;
}

.t-quiet {
  color: var(--surface-quiet);
}

/* GL-003 §3: `Kranium` and domains are never case-transformed. */
.nt {
  text-transform: none;
}

/* ------------------------------------------------------------- components */

/* Swatch dot (parent) and bullet dot (GL-003 §2.1, §7.4). */
.dot {
  display: inline-block;
  flex: none;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background-color: var(--dot, var(--surface-glyph));
}
.dot--so { --dot: var(--field-so); }
.dot--ai { --dot: var(--field-ai); }
.dot--games { --dot: var(--field-games); }

/* Hint tag (GL-003 §7.3). A state tag never inverts; a link tag does. */
.tag {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  border: var(--rule-width) solid var(--surface-outline);
  border-radius: var(--radius-none);
  color: var(--surface-ink);
  white-space: nowrap;
}

a.tag:hover,
a.tag:focus-visible,
a.tag:active {
  background-color: var(--surface-outline);
  color: var(--surface-bg);
  text-decoration-line: none;
  transition: background-color var(--duration-instant), color var(--duration-instant);
}

/* Arrow link (GL-003 §7.4): text, then Lucide move-right. */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--surface-ink);
  overflow-wrap: anywhere;
}

.arrow {
  flex: none;
  width: var(--icon-title);
  height: var(--icon-title);
  fill: none;
  stroke: var(--surface-glyph);
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--duration-short) var(--easing-standard);
}

.arrow-link:hover .arrow,
.arrow-link:focus-visible .arrow {
  transform: translateX(var(--space-xs));
}

@media (prefers-reduced-motion: reduce) {
  .arrow-link:hover .arrow,
  .arrow-link:focus-visible .arrow {
    transform: none;
  }
}

/* Bullet label: dot, then label text. */
.bullet {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Ruled display headline (GL-003 §7.5): every line between full-width
   rules, the index number on the top rule at the left. */
.ruled {
  border-top: var(--rule-width) solid var(--surface-rule);
}

.ruled__index {
  display: block;
  padding-top: var(--space-sm);
}

.ruled__line {
  display: block;
  border-bottom: var(--rule-width) solid var(--surface-rule);
  font-size: var(--text-display);
  line-height: var(--text-display-lh);
  font-weight: 600;
  font-stretch: var(--text-display-stretch);
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

/* bp-compact: swap to a ruled heading, sentence case (hybrid §2, §3). */
@media (max-width: 479px) {
  .ruled__line {
    font-size: var(--text-heading);
    line-height: var(--text-heading-lh);
    font-stretch: 100%;
    text-transform: none;
    /* Sentence case has descenders; keep them clear of the rule beneath. */
    padding-bottom: var(--space-sm);
  }
}

/* ------------------------------------------------------------------- skip */

/* Visible only on keyboard focus, as a hint tag on the header's surface. */
.skip-link {
  position: absolute;
  top: calc((var(--header-height) - var(--text-label-lh) - 2 * var(--space-xs)) / 2 - var(--rule-width));
  left: var(--page-margin);
  z-index: 1;
  background-color: var(--surface-bg);
  transform: translateY(-200%);
}

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

/* While the skip link is showing, it stands in for the K beneath it. Opacity,
   not visibility, so the K stays focusable and Tab goes skip link -> K -> nav
   (Vera M1). When the K takes focus the skip link loses :focus and leaves. */
.skip-link:focus + .site-header__inner .mark-link {
  opacity: 0;
}

/* ----------------------------------------------------------------- header */

/* Fixed; takes the surface of the section under its centre line
   (GL-003 §7.6, header.js). Without script it holds dark n0. */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  height: var(--header-height);
  transition:
    background-color var(--duration-short) var(--easing-standard),
    color var(--duration-short) var(--easing-standard);
}

.site-header.is-instant {
  transition: none;
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.mark-link {
  display: block;
  color: var(--surface-ink);
}

.mark {
  height: var(--mark-height);
  width: auto;
  fill: currentColor;
}

.site-nav ul {
  display: flex;
  gap: var(--space-lg);
}

.site-nav a {
  display: block;
  padding-block: var(--space-xs);
  white-space: nowrap;
}

@media (max-width: 479px) {
  .site-nav ul { gap: var(--space-md); }
}

/* ------------------------------------------------------------- P1 hero */

.hero {
  padding-top: calc(var(--header-height) + var(--space-4xl));
  padding-bottom: var(--space-3xl);
}

/* The tag sits on the h1's last baseline. */
.hero__grid {
  align-items: last baseline;
}

.hero__title { grid-column: 1 / span 8; }
.hero__action { grid-column: 9 / -1; justify-self: end; }

@media (max-width: 991px) {
  .hero__title { grid-column: 1 / span 9; }
  .hero__action { grid-column: 10 / -1; }
}

@media (max-width: 767px) {
  .hero__grid { row-gap: var(--space-lg); }
  .hero__title,
  .hero__action { grid-column: 1 / -1; justify-self: start; }
}

/* ----------------------------------------------------- P1 family index */

.family {
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-4xl);
}

.family__heading {
  margin-bottom: var(--space-2xl);
}

.index {
  border-top: var(--rule-width) solid var(--surface-rule);
}

.index__item {
  border-bottom: var(--rule-width) solid var(--surface-rule);
}

.index__row {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: center;
  padding-block: var(--space-md);
  /* The fill grows outward by the inset, so nothing moves at rest but the
     inverted key keeps clear space around 01 and the arrow (GL-003 §7.3). */
  --index-inset: var(--space-md);
  margin-inline: calc(-1 * var(--index-inset));
  padding-inline: var(--index-inset);
  color: var(--surface-ink);
}

/* Hover, focus and press invert the row like a key, instantly. */
.index__row:hover,
.index__row:focus-visible,
.index__row:active {
  --surface-bg: var(--color-neutral-5);
  --surface-ink: var(--color-neutral-0);
  --surface-quiet: var(--color-neutral-0);
  --surface-outline: var(--color-neutral-0);
  --surface-glyph: var(--color-neutral-0);
  background-color: var(--color-neutral-5);
  color: var(--color-neutral-0);
  text-decoration-line: none;
  transition: background-color var(--duration-instant), color var(--duration-instant);
}

.index__row:focus-visible {
  outline-color: var(--color-neutral-5);
}

.index__num { grid-column: 1; color: var(--surface-quiet); }

.index__domain {
  grid-column: 2 / span 4;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.index__role { grid-column: 6 / span 3; color: var(--surface-quiet); }
.index__tag { grid-column: 9 / span 3; justify-self: start; }

.index__arrow {
  grid-column: 12;
  justify-self: end;
  stroke: var(--surface-glyph);
}

@media (max-width: 767px) {
  .index__row { row-gap: var(--space-xs); }
  .index__num { grid-row: 1; }
  .index__domain { grid-column: 2 / span 4; grid-row: 1; }
  .index__role { grid-column: 2 / span 4; grid-row: 2; }
  .index__tag { grid-column: 2 / span 4; grid-row: 3; }
  .index__arrow { grid-column: 6; grid-row: 1; }
}

@media (max-width: 479px) {
  /* The page margin is --space-md here: a step less keeps the focus ring
     (offset plus width) inside the viewport. */
  .index__row { --index-inset: var(--space-sm); }
  .index__domain {
    grid-column: 2 / span 3;
    padding-right: calc(var(--icon-title) + var(--space-sm));
  }
  .index__role,
  .index__tag { grid-column: 2 / span 3; }
  .index__arrow { grid-column: 4; }
}

/* ------------------------------------------------------------ P1 fields */

.field {
  padding-block: var(--space-5xl);
}

.field__label {
  margin-bottom: var(--space-md);
}

.field__body {
  margin-top: var(--space-5xl);
}

.field__body > * { grid-column: 1 / span 6; }

@media (max-width: 991px) {
  .field__body > * { grid-column: 1 / span 8; }
}

@media (max-width: 767px) {
  .field { padding-block: var(--space-4xl); }
  .field__body { margin-top: var(--space-3xl); }
  .field__body > * { grid-column: 1 / -1; }
}

/* Bottom row on a full-width rule: arrow link left, tag right. If both do
   not fit, the tag drops beneath the link, left-aligned. */
.bottom-row {
  margin-top: var(--space-3xl);
  padding-top: var(--space-md);
  border-top: var(--rule-width) solid var(--surface-rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-md);
  row-gap: var(--space-sm);
}

.bottom-row > .tag:only-child {
  margin-left: auto;
}

/* ------------------------------------------------- P5 kranium.ai field */

.field--page {
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(var(--header-height) + var(--space-4xl));
}

.field--page .field__body > * { grid-column: 1 / span 8; }

@media (max-width: 991px) {
  .field--page .field__body > * { grid-column: 1 / span 10; }
}

@media (max-width: 767px) {
  .field--page .field__body > * { grid-column: 1 / -1; }
}

/* ------------------------------------------------------ P4, P6 404 */

.notfound {
  padding-top: calc(var(--header-height) + var(--space-5xl));
  padding-bottom: var(--space-5xl);
}

.notfound__text > * { grid-column: 1 / span 8; }

.notfound__sentence { margin-top: var(--space-lg); }
.notfound__link { margin-top: var(--space-md); }

@media (max-width: 767px) {
  .notfound__text > * { grid-column: 1 / -1; }
}

/* ---------------------------------------------------- P2, P3 legal */

.legal-title {
  padding-top: calc(var(--header-height) + var(--space-4xl));
  padding-bottom: var(--space-3xl);
}

.legal-title__head { grid-column: 1 / span 8; }

.legal-title__meta {
  margin-top: var(--space-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.legal-title__intro {
  grid-column: 5 / -1;
  max-width: var(--container-measure);
  margin-top: var(--space-lg);
}

.legal-body {
  padding-bottom: var(--space-4xl);
}

.legal-body__grid {
  align-items: start;
}

.toc {
  grid-column: 1 / span 3;
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
}

.toc a {
  display: flex;
  gap: var(--space-sm);
  padding-block: var(--space-xs);
}

.toc__num { color: var(--surface-quiet); }

.legal-sections {
  grid-column: 5 / -1;
  max-width: var(--container-measure);
}

.legal-section + .legal-section {
  margin-top: var(--space-3xl);
}

.legal-section__index {
  display: block;
  padding-top: var(--space-sm);
  border-top: var(--rule-width) solid var(--surface-rule);
  color: var(--surface-quiet);
}

.legal-section h2 {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
}

.legal-section p,
.legal-section ul {
  color: var(--surface-body);
}

.legal-section p + p,
.legal-section p + ul,
.legal-section ul + p {
  margin-top: var(--space-md);
}

.legal-section ul {
  list-style: disc;
  padding-left: var(--space-lg);
}

/* Links inside legal text are underlined at rest: they sit in running prose. */
.legal-section a {
  color: var(--surface-ink);
  text-decoration-line: underline;
}

@media (max-width: 767px) {
  .legal-title__head,
  .legal-title__intro,
  .toc,
  .legal-sections { grid-column: 1 / -1; }
  .toc {
    position: static;
    margin-bottom: var(--space-3xl);
  }
}

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

.site-footer {
  padding-top: var(--space-4xl);
  padding-bottom: var(--space-2xl);
}

.footer__row > * {
  grid-column: span 3;
  min-width: 0;
}

/* The footer K is sized to the mark, like the header's, not its column. */
.site-footer .mark-link {
  width: max-content;
}

.footer__row + .footer__row {
  margin-top: var(--space-6xl);
}

.footer__list li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer__list a,
.footer__text,
.footer__heading,
.footer__bottom > * {
  display: inline-block;
  padding-block: var(--space-xs);
}

.footer__heading,
.footer__bottom > * {
  color: var(--surface-quiet);
}

.footer__bottom a {
  /* A 24px-tall target (SC 2.5.8) without changing the row's rhythm. */
  display: inline-block;
  padding-block: var(--space-xs);
  margin-block: calc(-1 * var(--space-xs));
  color: var(--surface-ink);
}

.email {
  overflow-wrap: anywhere;
}

@media (max-width: 991px) {
  .footer__row + .footer__row { margin-top: var(--space-4xl); }
}

@media (max-width: 767px) {
  .footer__row { row-gap: var(--space-2xl); }
}

@media (max-width: 479px) {
  .footer__row { row-gap: var(--space-lg); }
  .footer__row > * { grid-column: 1 / -1; }
  .footer__row + .footer__row { margin-top: var(--space-3xl); }
}
