/* nihil — the app's design system, rendered as a web page.
   tokens are the single source of truth (see design system spec). */

:root {
  /* color · dark (default) */
  --bg:          #0d0e10;
  --panel:       #141619;
  --line:        #24262b;
  --line-strong: #33363d;
  --fg:          #e9e8e4;
  --dim:         #6b7080;
  --faint:       #3a3d44;
  --accent:      #f26419;
  --accent-hi:   #ff8544;
  --accent-dim:  #7a3a15;
  --online:      #35c46a;
  --warn:        #e0a83d;
  --danger:      #e5484d;

  /* type */
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* space · 4px grid */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --radius: 4px;
  --dur: 160ms;
}

/* faithful light inversion — same accent, ramp flipped */
:root[data-theme="light"] {
  --bg:          #f4f3ef;
  --panel:       #eae9e3;
  --line:        #d6d4cc;
  --line-strong: #bfbdb2;
  --fg:          #17181b;
  --dim:         #6b7080;
  --faint:       #a9a79c;
  --accent:      #d1500f;
  --accent-hi:   #f26419;
  --accent-dim:  #f0d3c2;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur) ease;
}
a:hover { color: var(--accent-hi); }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 3px solid var(--bg);
  border-radius: 6px;
}
::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 2px;
  border-radius: var(--radius);
}

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

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 var(--s7);
}
@media (max-width: 640px) {
  .wrap { padding: 0 var(--s5); }
}

main > section {
  padding: var(--s8) 0;
  border-top: 1px solid var(--line);
}

.micro {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin: 0 0 var(--s4);
}

/* ---- masthead ---- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s6) 0;
}
.logo {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: baseline;
}
.theme-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--dim);
  font-family: inherit;
  font-size: 13px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  transition: border-color var(--dur) ease, color var(--dur) ease;
}
.theme-toggle:hover { border-color: var(--line-strong); color: var(--fg); }
.masthead-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.lang-switch a {
  color: var(--dim);
  transition: color var(--dur) ease;
}
.lang-switch a:hover { color: var(--fg); }
.lang-switch a[aria-current="page"] { color: var(--fg); }
.lang-switch .sep {
  color: var(--line-strong);
  user-select: none;
}

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

.hero { padding-top: var(--s6); border-top: 0; }
.hero h1 {
  font-size: 40px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s5);
  max-width: 16ch;
}
@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
}
.hero .lede {
  font-size: 15px;
  color: var(--dim);
  max-width: 54ch;
  margin: 0 0 var(--s6);
  line-height: 1.6;
}
.hero .lede strong { color: var(--fg); font-weight: 400; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  height: 40px;
  padding: 0 var(--s4);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--dur) ease, background var(--dur) ease, color var(--dur) ease;
}
.btn:hover { border-color: var(--line-strong); color: var(--fg); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0e10;
}
.btn--primary:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  color: #0d0e10;
}

/* ---- hero demo ---- */

.demo {
  margin-top: var(--s8);
}
.demo-devices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
}
@media (max-width: 560px) {
  .demo-devices { grid-template-columns: 1fr; }
}
.device {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-height: 240px;
  display: flex;
  flex-direction: column;
}
.device-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.device-name { font-size: 12px; color: var(--fg); font-weight: 500; }
.airplane {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warn);
}
.device-log {
  flex: 1;
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

/* message row · not a bubble */
.msg { max-width: 88%; }
.msg-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: var(--s1);
}
.msg-body { font-size: 15px; color: var(--fg); }
.msg--mine {
  align-self: flex-end;
  padding-left: var(--s3);
  border-left: 2px solid var(--accent);
}
.msg--theirs { align-self: flex-start; }

.caret {
  display: inline-block;
  width: 1px;
  height: 15px;
  background: var(--accent);
  margin-left: 1px;
  vertical-align: -2px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.demo-caption {
  margin-top: var(--s4);
  font-size: 15px;
  color: var(--fg);
  text-align: center;
  min-height: 1.5em;
}
.demo-caption .off { color: var(--dim); }

/* ---- the one idea ---- */

.idea p {
  font-size: 18px;
  line-height: 1.6;
  color: var(--fg);
  max-width: 60ch;
  margin: 0 0 var(--s5);
}
.idea p:last-child { margin-bottom: 0; }
.idea .lead { color: var(--dim); }
.idea strong { font-weight: 500; color: var(--fg); }
.idea .accent { color: var(--accent); }

/* ---- what it does ---- */

.features { display: flex; flex-direction: column; }
.feature {
  padding: var(--s5) 0;
  border-top: 1px solid var(--line);
}
.feature:first-child { border-top: 0; padding-top: 0; }
.feature h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 var(--s2);
  color: var(--fg);
}
.feature p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--dim);
  max-width: 64ch;
}

/* ---- honesty ---- */

.honesty p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--dim);
  max-width: 60ch;
  margin: 0 0 var(--s5);
}
.honesty strong { color: var(--fg); font-weight: 500; }
.honesty .kicker { color: var(--fg); }

/* ---- open source ---- */

.open p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--dim);
  max-width: 60ch;
  margin: 0 0 var(--s6);
}
.open strong { color: var(--fg); font-weight: 400; }

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- hub ---- */

.hub p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--dim);
  max-width: 64ch;
  margin: 0 0 var(--s5);
}
.hub strong { color: var(--fg); font-weight: 500; }

.code {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin: 0 0 var(--s5);
}
.code pre {
  margin: 0;
  padding: var(--s4);
  padding-right: 88px;
  overflow-x: auto;
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
}
.code .comment { color: var(--dim); }
.copy-btn {
  position: absolute;
  top: var(--s3);
  right: var(--s3);
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--dim);
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color var(--dur) ease, color var(--dur) ease;
}
.copy-btn:hover { border-color: var(--line-strong); color: var(--fg); }

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

footer {
  border-top: 1px solid var(--line);
  padding: var(--s6) 0 var(--s8);
}
footer .note {
  font-size: 12px;
  color: var(--dim);
  margin: 0 0 var(--s4);
  line-height: 1.7;
}
footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
footer .links a { color: var(--dim); }
footer .links a:hover { color: var(--fg); }

.arrow { color: inherit; }

/* ---- motion is feedback only ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .caret { display: none; }
}
