/*
 * Senbit web site: one small stylesheet shared by every page.
 *
 * Kept deliberately cheap to render: system fonts, flat colors, no blur, no fixed
 * overlay, no animation. Colors are variables, redefined for the light theme.
 */

:root {
  color-scheme: dark light;

  --bg: #0b1020;
  --surface: #121a2e;
  --surface-2: #19233d;
  --border: #25314f;
  --text: #e8edf7;
  --muted: #9aa6bf;
  --accent: #4aa8f5;
  --accent-text: #06101f;
  --ok: #3ccf91;
  --warn: #f0a03c;

  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-2: #eef2f9;
    --border: #d5ddeb;
    --text: #15203a;
    --muted: #54617d;
    --accent: #0b6fc4;
    --accent-text: #ffffff;
    --ok: #12855a;
    --warn: #a35f00;
  }
}

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

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

html {
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

a:hover {
  text-decoration: none;
}

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

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

code {
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1em;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

section {
  padding: 2.5rem 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
}

.menu-toggle {
  display: none;
  margin-left: auto;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

/* ---------------------------------------------------------------- Hero and titles */

.hero {
  padding: 4rem 0 2.5rem;
}

.page-title {
  padding: 3rem 0 0.5rem;
}

.lead {
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.intro {
  max-width: 44rem;
  color: var(--muted);
}

.pill {
  display: inline-block;
  margin-bottom: 1.2rem;
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn.primary:hover {
  opacity: 0.9;
}

/* ---------------------------------------------------------------- Facts, cards, grids */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.facts div {
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.facts dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.facts dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card p:last-child {
  margin-bottom: 0;
}

.card.link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card.link:hover {
  border-color: var(--accent);
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
}

.warning {
  display: inline-block;
  padding: 0.7rem 1rem;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  color: var(--text);
}

/* ---------------------------------------------------------------- Layers */

.stack {
  display: grid;
  gap: 0.5rem;
  max-width: 44rem;
}

.layer {
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.layer span {
  color: var(--muted);
  font-size: 0.9rem;
}

.layer.accent {
  border-color: var(--accent);
}

.layer.kernel {
  background: var(--surface-2);
}

/* ---------------------------------------------------------------- Lists */

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checks.cols {
  columns: 2 22rem;
  column-gap: 2rem;
}

.checks.cols li {
  break-inside: avoid;
}

.checks li {
  position: relative;
  padding: 0.25rem 0 0.25rem 1.6rem;
}

.checks li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}

.checks li.done::before {
  content: "\2713";
  color: var(--ok);
}

.checks li.wip::before {
  content: "\25CF";
  color: var(--warn);
}

.legend {
  color: var(--warn);
}

.legend.off {
  color: var(--muted);
}

.checks li.todo::before {
  content: "\25CB";
  color: var(--muted);
}

.checks.plain li::before {
  content: "\2022";
  color: var(--accent);
}

.checks + .note {
  margin-top: 0.9rem;
}

.phase .count {
  float: right;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  max-width: 44rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.5rem 0 0.5rem 2.6rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7rem;
  text-align: center;
}

.steps small {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------- Code */

.cmd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 44rem;
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.cmd code {
  padding: 0;
  background: none;
  overflow-x: auto;
  white-space: nowrap;
}

.cmd button {
  flex: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}

.code {
  max-width: 44rem;
  margin: 0 0 1rem;
  padding: 1rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.code code {
  padding: 0;
  background: none;
}

.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.pipeline span {
  padding: 0.25rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------- Terminal */

.terminal {
  max-width: 34rem;
  margin: 2rem 0 0;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  line-height: 1.5;
}

.terminal code {
  padding: 0;
  background: none;
}

.terminal code > span {
  display: block;
  white-space: pre;
}

.caret::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.15em;
  vertical-align: text-bottom;
  background: var(--accent);
}

/* ---------------------------------------------------------------- Motion
 *
 * Only opacity and transform are animated: the browser does that without
 * redoing the layout. Everything is switched off for people who asked their
 * system for less motion.
 */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* The hero builds up when the page opens. */
.hero .wrap > * {
  animation: rise 0.6s ease both;
}

.hero .wrap > :nth-child(2) { animation-delay: 0.08s; }
.hero .wrap > :nth-child(3) { animation-delay: 0.16s; }
.hero .wrap > :nth-child(4) { animation-delay: 0.24s; }
.hero .wrap > :nth-child(5) { animation-delay: 0.32s; }

/* Terminal lines are typed one after the other. */
.terminal code > span {
  animation: appear 0.3s ease both;
}

.terminal code > span:nth-child(1) { animation-delay: 0.5s; }
.terminal code > span:nth-child(2) { animation-delay: 0.9s; }
.terminal code > span:nth-child(3) { animation-delay: 1.0s; }
.terminal code > span:nth-child(4) { animation-delay: 1.1s; }
.terminal code > span:nth-child(5) { animation-delay: 1.7s; }
.terminal code > span:nth-child(6) { animation-delay: 2.4s; }
.terminal code > span:nth-child(7) { animation-delay: 3.0s; }

.caret::after {
  animation: blink 1.1s steps(1) infinite 3.2s;
}

/* Cards and layers fade in when they reach the screen (see site.js). */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.js .reveal.visible {
  opacity: 1;
  transform: none;
}

.grid > .reveal:nth-child(2n) { transition-delay: 0.06s; }
.grid > .reveal:nth-child(3n) { transition-delay: 0.12s; }

/* Small feedback on hover. */
.card.link,
.btn {
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.card.link:hover,
.btn:hover {
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .hero .wrap > *,
  .terminal code > span,
  .caret::after {
    animation: none;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .card.link,
  .btn {
    transition: none;
  }

  .card.link:hover,
  .btn:hover {
    transform: none;
  }
}

/* ---------------------------------------------------------------- Footer */

.site-footer {
  margin-top: 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin-bottom: 0.5rem;
}

/* ---------------------------------------------------------------- Small screens */

@media (max-width: 760px) {
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    margin: 0;
    padding: 0.5rem 1.25rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .site-nav.open {
    display: flex;
  }

  .hero {
    padding-top: 2.5rem;
  }
}
