/* neurohab — paper/lab aesthetic
   IBM Plex Serif body, IBM Plex Mono accents
   ----------------------------------------- */

:root {
  --paper: #f4efe2;
  --paper-2: #ece6d6;
  --ink: #1a1612;
  --ink-2: #44392f;
  --muted: #807366;
  --rust: #a13e2e;
  --rust-soft: #c2614f;
  --rust-bg: rgba(161, 62, 46, 0.07);
  --line: #d8cfb8;
  --line-soft: #e4dcc6;
  --green: #4d7a3c;
  --amber: #c8762d;

  --serif: 'IBM Plex Serif', Georgia, serif;
  --mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-feature-settings: "kern", "liga", "onum";
  font-weight: 400;
  line-height: 1.55;
  /* paper grain */
  background-image:
    radial-gradient(rgba(0,0,0,0.014) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.008) 1px, transparent 1px);
  background-size: 4px 4px, 9px 9px;
  background-position: 0 0, 2px 2px;
}

::selection { background: var(--ink); color: var(--paper); }

a {
  color: var(--rust);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.6px;
  transition: color 0.15s, text-decoration-thickness 0.15s;
}
a:hover { color: var(--ink); text-decoration-thickness: 1.4px; }

.mono {
  font-family: var(--mono);
  font-feature-settings: "ss01";
  letter-spacing: -0.01em;
}

/* Layout shell */
.site {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  position: relative;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 56px;
}

.brand {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand .glyph {
  color: var(--rust);
  font-size: 16px;
  font-family: var(--serif);
  line-height: 0;
}

.nav {
  display: flex;
  gap: 22px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 13px;
}
.nav a {
  color: var(--ink-2);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.nav a:hover { color: var(--rust); text-decoration: none; }
.nav a.cta {
  color: var(--paper);
  background: var(--ink);
  padding: 7px 13px;
  border-radius: 1px;
  border: 1px solid var(--ink);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav a.cta:hover { background: var(--rust); border-color: var(--rust); color: var(--paper); }

/* Hero */
.hero {
  padding: 24px 0 72px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.eyebrow .sep { color: var(--line); }

.h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(40px, 5.6vw, 66px);
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 0;
  max-width: 19ch;
  color: var(--ink);
}
.h1 em {
  font-style: italic;
  color: var(--rust);
  font-weight: 500;
}

.lead {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  max-width: 55ch;
  color: var(--ink-2);
  margin: 0;
}

.cta-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn {
  display: inline-block;
  padding: 11px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 1px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.005em;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover {
  background: var(--rust);
  border-color: var(--rust);
  color: var(--paper);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

/* Status pill */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(77, 122, 60, 0.2);
}

/* Hero figure (terminal output) */
.hero-figure {
  position: relative;
  margin-top: 12px;
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(20, 16, 12, 0.04) 31px,
      rgba(20, 16, 12, 0.04) 32px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 31px,
      rgba(20, 16, 12, 0.04) 31px,
      rgba(20, 16, 12, 0.04) 32px
    ),
    var(--paper-2);
  padding: 22px 24px;
  overflow-x: auto;
}
.terminal {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre;
  margin: 0;
}
.terminal .label { color: var(--muted); }
.terminal .ok { color: var(--green); }
.terminal .warm { color: var(--amber); animation: pulse 1.6s ease-in-out infinite; }
.terminal .num { color: var(--ink); font-weight: 500; }
.terminal .redact {
  color: var(--ink-2);
  letter-spacing: -0.06em;
  background: rgba(0,0,0,0.04);
  padding: 0 2px;
}
.terminal .arrow { color: var(--rust); font-weight: 500; }
.terminal .cursor {
  display: inline-block;
  width: 7px;
  background: var(--rust);
  color: transparent;
  margin-left: 2px;
  animation: blink 1.05s steps(1, end) infinite;
}

@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.45 } }
@keyframes blink { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 0 64px;
  counter-reset: ftr;
}
.features > article {
  padding: 30px 28px 30px 0;
  border-right: 1px solid var(--line);
  counter-increment: ftr;
}
.features > article:last-child { border-right: none; padding-right: 0; }
.features > article:first-child { padding-left: 0; }
.features > article + article { padding-left: 28px; }

.features h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.005em;
  color: var(--rust);
  margin: 0 0 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.features h3::before {
  content: counter(ftr, decimal-leading-zero);
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
}
.features p {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}
.features .note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  display: block;
}

/* Spec list */
.spec {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4px 36px;
  border-top: 1px solid var(--line);
  padding-top: 36px;
  margin-top: 24px;
}
.spec dt {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.spec dd {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
  padding: 4px 0 14px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-soft);
}
.spec dt:last-of-type, .spec dd:last-of-type { border-bottom: none; }

/* Footer */
.footer {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: none; }
.footer-meta { display: flex; gap: 16px; align-items: center; }

/* Article pages (about, privacy, terms, signin, 404) */
.article {
  max-width: 640px;
  padding: 8px 0 24px;
}
.article-narrow { max-width: 460px; }

.kicker {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
}

.article h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.018em;
  line-height: 1.1;
  margin: 0 0 28px;
}

.article h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rust);
  margin: 40px 0 12px;
}

.article p {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-2);
}
.article p:first-of-type { color: var(--ink); }

.article ul, .article ol {
  padding-left: 22px;
  margin: 0 0 18px;
  color: var(--ink-2);
}
.article li { margin-bottom: 6px; line-height: 1.55; }

.article .meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

/* Sign-in form */
.form {
  margin: 28px 0 16px;
}
.form label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 8px;
}
.form input {
  width: 100%;
  background: rgba(255,255,255,0.4);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 1px;
  outline: none;
  margin-bottom: 18px;
  transition: border-color 0.15s, background 0.15s;
}
.form input:focus {
  border-color: var(--ink);
  background: rgba(255,255,255,0.7);
}
.form input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}
.form .submit {
  width: 100%;
  padding: 12px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.005em;
  border: 1px solid var(--ink);
  border-radius: 1px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.form .submit:hover { background: var(--rust); border-color: var(--rust); }
.form .submit[disabled] { opacity: 0.55; cursor: not-allowed; }

.form-msg {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--rust-bg);
  border-left: 2px solid var(--rust);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  display: none;
}
.form-msg.shown { display: block; }
.form-msg .code { color: var(--muted); font-size: 11px; display: block; margin-top: 4px; }

.form-help {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 22px;
  line-height: 1.65;
}
.form-help a { color: var(--ink-2); }

/* 404 */
.not-found {
  text-align: center;
  padding: 40px 0;
}
.not-found pre {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: pre;
  display: inline-block;
  text-align: left;
  margin: 0 0 28px;
  line-height: 1.5;
}
.not-found h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  letter-spacing: -0.012em;
  margin: 0 0 10px;
}
.not-found p {
  font-family: var(--serif);
  color: var(--ink-2);
  margin: 0 0 24px;
}

/* Entrance — very subtle, only on first paint */
.fade-in { animation: fadeUp 0.55s ease-out backwards; }
.fade-in:nth-child(1) { animation-delay: 0s; }
.fade-in:nth-child(2) { animation-delay: 0.06s; }
.fade-in:nth-child(3) { animation-delay: 0.12s; }
.fade-in:nth-child(4) { animation-delay: 0.18s; }
.fade-in:nth-child(5) { animation-delay: 0.24s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 760px) {
  html { font-size: 16px; }
  .site { padding: 20px 22px 32px; }
  .topbar { margin-bottom: 36px; }
  .features { grid-template-columns: 1fr; }
  .features > article { border-right: none; border-bottom: 1px solid var(--line); padding: 24px 0; }
  .features > article + article { padding-left: 0; }
  .features > article:last-child { border-bottom: none; }
  .spec { grid-template-columns: 1fr; gap: 0; }
  .spec dt { padding-top: 16px; padding-bottom: 4px; border-bottom: none; }
  .spec dd { padding-bottom: 18px; }
  .h1 { font-size: clamp(34px, 8vw, 48px); }
  .article h1 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
