/* Mindstate Systems: shared styles.
   One thread runs through the site: the North Star, in the warm accent.
   Nothing else uses --accent. */

@font-face {
  font-family: "Inter Tight";
  src: url("/fonts/inter-tight.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Dark is the default look. */
:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --fg: #f2f1ee;
  --muted: #8f8d88;
  --faint: #4a4844;
  --line: rgba(242, 241, 238, 0.09);
  --accent: #f2b56b;
  --accent-ink: #1a1206;
  --glow: rgba(242, 181, 107, 0.22);

  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --max: 72rem;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f4f0;
    --fg: #121212;
    --muted: #66645f;
    --faint: #b9b6af;
    --line: rgba(18, 18, 18, 0.1);
    --accent: #b8701c;
    --accent-ink: #fffaf2;
    --glow: rgba(184, 112, 28, 0.18);
  }
}

* { box-sizing: border-box; }

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: inherit; }

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- North Star mark ---------- */

.star {
  display: inline-block;
  width: 1em;
  height: 1em;
  color: var(--accent);
  flex: none;
  filter: drop-shadow(0 0 0.35em var(--glow));
}

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

.site-header {
  position: relative;
  z-index: 2;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand .star { font-size: 1.15rem; }

.nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"] { color: var(--fg); }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
}

.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--fg); }

/* ---------- Type ---------- */

.display {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.lead {
  margin: 0;
  font-size: clamp(1.125rem, 2vw, 1.3rem);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.lead strong {
  color: var(--fg);
  font-weight: 600;
}

.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Kernel canvas ---------- */

canvas.kernel {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Home ---------- */

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: clamp(4rem, 10vh, 7rem);
}

.home-hero .field {
  width: 100%;
  height: clamp(18rem, 50vh, 32rem);
}

.home-hero .display {
  max-width: 15ch;
  margin-top: -1rem;
}

.home-hero .next {
  margin-top: 2.5rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s, gap 0.2s;
}

.text-link:hover { color: var(--fg); gap: 0.75rem; }

/* ---------- Button ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 2rem var(--glow);
}

/* ---------- Neurokernel hero ---------- */

.nk-hero .wrap {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 1rem;
  padding-bottom: clamp(3rem, 8vh, 6rem);
}

.nk-hero .field {
  height: clamp(16rem, 42vh, 26rem);
  order: -1;
}

.nk-hero .copy {
  display: grid;
  gap: 1.5rem;
  max-width: 34rem;
}

.nk-hero .display { font-size: clamp(3rem, 8vw, 5.75rem); }

.nk-hero .actions { margin-top: 0.75rem; }

@media (min-width: 56rem) {
  .nk-hero .wrap {
    grid-template-columns: 1.05fr 1fr;
    min-height: min(78vh, 46rem);
  }
  .nk-hero .field {
    order: 0;
    height: 100%;
    min-height: 30rem;
  }
}

/* ---------- Levels: a thread from the star that deepens ---------- */

.levels-section {
  border-top: 1px solid var(--line);
  padding: clamp(4rem, 10vh, 7rem) 0;
}

.levels-section .label { margin: 0 0 2.5rem; }

.levels {
  --x: 0.6rem; /* centre of the thread */
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 2.75rem;
  display: grid;
  gap: 2.25rem;
  max-width: 44rem;
}

/* The thread: faint at the top, warm at the bottom. */
.levels::before {
  content: "";
  position: absolute;
  left: var(--x);
  top: 0.6rem;
  bottom: -2.75rem;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, var(--line), var(--accent));
}

.levels li {
  position: relative;
  display: grid;
  gap: 0.2rem;
}

/* Each node grows and warms with depth (--d = 1..4). */
.levels li::before {
  content: "";
  position: absolute;
  left: calc(var(--x) - 2.75rem);
  top: 0.85rem;
  width: calc(0.25rem + var(--d) * 0.12rem);
  height: calc(0.25rem + var(--d) * 0.12rem);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: color-mix(in srgb, var(--accent) calc(var(--d) * 25%), var(--faint));
  box-shadow: 0 0 calc(var(--d) * 0.35rem) color-mix(in srgb, var(--glow) calc(var(--d) * 25%), transparent);
}

.levels h3 {
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.levels p {
  margin: 0;
  color: var(--muted);
  font-size: 1.0625rem;
}

.levels-close {
  position: relative;
  margin: 4.25rem 0 0;
  padding-left: 2.75rem;
  font-size: clamp(1.5rem, 3.4vw, 2.25rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 44rem;
}

/* The thread ends in the star. */
.levels-close .star {
  position: absolute;
  left: 0.6rem;
  top: 0.55em;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
}

.patent {
  margin: 3.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Contact ---------- */

.contact-section {
  border-top: 1px solid var(--line);
  padding: clamp(4rem, 10vh, 7rem) 0;
  scroll-margin-top: 1rem;
}

.contact-section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.contact-section .lead { margin-bottom: 2.5rem; }

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  max-width: 44rem;
}

.contact-list a {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0.25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 0.2s, padding 0.2s;
}

.contact-list a:hover {
  background: color-mix(in srgb, var(--fg) 4%, transparent);
  padding-left: 0.75rem;
}

.contact-list .value {
  font-size: 1.125rem;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.contact-list .arrow {
  font-family: var(--mono);
  color: var(--muted);
}

.contact-list a:hover .arrow { color: var(--accent); }

@media (max-width: 30rem) {
  .contact-list a { grid-template-columns: 1fr auto; }
  .contact-list .label { grid-column: 1 / -1; }
}

/* ---------- 404 ---------- */

.notfound {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8rem var(--gutter);
  gap: 1rem;
}

.notfound .star { font-size: 2rem; margin-bottom: 1rem; }
.notfound p { margin: 0; color: var(--muted); }
