:root{
  --bg:#ffffff;
  --bg-alt:#f4f5f8;
  --card:#fbfbfd;
  --border:#e2e4ea;
  --text:#1a1d24;
  --text-dim:#666d7d;
  --accent:#2f6fed;
  --accent-2:#7c5cff;
  --on-accent:#ffffff;
  --ok:#1f9d55;
  --mono:'JetBrains Mono',monospace;
}

*{box-sizing:border-box;margin:0;padding:0}

html{scroll-behavior:smooth}

body{
  background:var(--bg);
  color:var(--text);
  font-family:'Inter',system-ui,-apple-system,Segoe UI,sans-serif;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

.wrap{max-width:960px;margin:0 auto;padding:0 1.5rem}

.bg-grid{
  position:fixed;inset:0;z-index:-1;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(47,111,237,.08), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(124,92,255,.07), transparent 40%),
    linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px);
  background-size:auto,auto,48px 48px,48px 48px;
}

/* Header */
.site-header{
  position:sticky;top:0;z-index:20;
  background:rgba(255,255,255,.75);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
}
.header-inner{display:flex;align-items:center;justify-content:space-between;height:64px}
.brand{
  font-family:var(--mono);
  font-weight:700;
  letter-spacing:.08em;
  color:var(--text);
  text-decoration:none;
  font-size:1.1rem;
}
.site-nav{display:flex;gap:1.75rem}
.site-nav a{
  color:var(--text-dim);
  text-decoration:none;
  font-size:.92rem;
  font-weight:500;
  transition:color .15s ease;
}
.site-nav a:hover{color:var(--text)}

.nav-toggle{
  display:none;
  flex-direction:column;
  gap:4px;
  background:none;border:0;cursor:pointer;padding:.5rem;
}
.nav-toggle span{width:22px;height:2px;background:var(--text)}

/* Hero */
.hero{
  padding:6.5rem 1.5rem 4.5rem;
  text-align:center;
}
.eyebrow{
  font-family:var(--mono);
  font-size:.8rem;
  color:var(--accent);
  letter-spacing:.1em;
  text-transform:uppercase;
  margin-bottom:1.25rem;
}
.hero-title{
  font-size:clamp(3.5rem, 12vw, 7rem);
  font-weight:800;
  letter-spacing:-.03em;
  background:linear-gradient(135deg, var(--text) 30%, var(--accent) 70%, var(--accent-2) 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  line-height:1;
}
.hero-sub{
  max-width:38rem;
  margin:1.5rem auto 0;
  color:var(--text-dim);
  font-size:1.1rem;
}
.hero-actions{
  display:flex;gap:1rem;justify-content:center;flex-wrap:wrap;
  margin-top:2.25rem;
}

.btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:.75rem 1.5rem;
  border-radius:.6rem;
  font-weight:600;
  font-size:.95rem;
  text-decoration:none;
  border:1px solid transparent;
  cursor:pointer;
  transition:transform .15s ease, opacity .15s ease, border-color .15s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn-primary{
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  color:var(--on-accent);
}
.btn-primary:hover{opacity:.92}
.btn-primary:disabled{opacity:.5;cursor:default;transform:none}
.btn-ghost{
  background:transparent;
  color:var(--text);
  border-color:var(--border);
}
.btn-ghost:hover{border-color:var(--accent)}
.btn-small{padding:.6rem 1.1rem;font-size:.88rem}
.btn-tiny{padding:.25rem .6rem;font-size:.72rem;font-weight:500;gap:.3rem;border-radius:.45rem}
.btn-pale{
  background:rgba(47,111,237,.07);
  color:var(--accent);
  border-color:rgba(47,111,237,.22);
}
.btn-pale:hover{background:rgba(47,111,237,.12);border-color:rgba(47,111,237,.4)}
.btn-pale:active{transform:none}
.btn-icon{width:.9em;height:.9em;flex:0 0 auto}

/* Sections */
.section{padding:4rem 1.5rem}
.section-title{
  font-size:1.9rem;
  font-weight:700;
  letter-spacing:-.01em;
  margin-bottom:1rem;
}
.section-lead{color:var(--text-dim);margin-bottom:1.75rem}

/* About */
.about-grid{
  display:grid;
  grid-template-columns:1.4fr 1fr;
  gap:2.5rem;
  align-items:start;
}
.about-copy p{color:var(--text-dim);margin-bottom:1rem}
.about-copy em{color:var(--text);font-style:normal;font-weight:600}

.acronym-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:1rem;
  padding:1.5rem 1.75rem;
}
.acronym-row{
  font-family:var(--mono);
  color:var(--text-dim);
  padding:.4rem 0;
  font-size:.95rem;
}
.acronym-row .letter{
  color:var(--accent);
  font-weight:700;
  font-size:1.1rem;
  margin-right:.15rem;
}

/* Chat */
.chat-note{
  /* Shares the row under the chat box with the Download Chat button; when
     open it takes the width and the button stays at the top of the row. */
  flex:1 1 auto;
  min-width:0;
  margin:0;
  font-size:.86rem;
  line-height:1.55;
  color:var(--text-dim);
}
.chat-note > summary{
  /* Same height as the status pill and the Download Chat button. */
  display:inline-flex;align-items:center;justify-content:center;
  width:22px;height:22px;
  box-sizing:border-box;
  font-weight:700;font-size:.78rem;line-height:1;
  color:var(--accent);
  background:rgba(47,111,237,.07);
  border:1px solid rgba(47,111,237,.22);
  border-radius:50%;
  cursor:pointer;
  list-style:none;
  user-select:none;
}
.chat-note > summary::-webkit-details-marker{display:none}
.chat-note > summary:hover{background:rgba(47,111,237,.14);border-color:rgba(47,111,237,.45)}
.chat-note > summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.chat-note[open] > summary{margin-bottom:.5rem}
.chat-note-body{
  padding:.85rem 1rem;
  background:rgba(47,111,237,.05);
  border:1px solid rgba(47,111,237,.18);
  border-left:3px solid var(--accent);
  border-radius:.5rem;
}
.chat-note-body p + p{margin-top:.6rem}
.chat-window{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:1rem;
  overflow:hidden;
  max-width:640px;
  box-shadow:0 20px 45px -25px rgba(20,25,40,.25);
}
.chat-window-head{
  display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;
  padding:.9rem 1.1rem;
  border-bottom:1px solid var(--border);
  background:var(--bg-alt);
}
.chat-dots{display:flex;gap:5px}
.chat-dots span{width:9px;height:9px;border-radius:50%;background:var(--border)}
.chat-window-title{font-weight:600;font-size:.9rem;margin-right:auto}
.chat-who{font-size:.78rem;color:var(--text-dim);white-space:nowrap}
.chat-who strong{color:var(--text);font-weight:600}
.chat-who-link{
  background:none;border:none;padding:0;margin:0;
  font:inherit;font-size:.78rem;color:var(--accent);
  cursor:pointer;text-decoration:underline;
}
.chat-who-link:hover{color:var(--accent-2)}
.status-pill{
  /* Fixed height + inline-flex centring rather than vertical padding: the
     text is monospace and the label changes at runtime, so a padded box
     sized by the line box leaves descenders ("dreaming...", "engine only")
     sitting against the bottom stroke while descender-free labels
     ("online") look clear. Integral height also keeps the 1px rounded
     border crisp. nowrap + no shrink stop the longer labels wrapping
     inside the radius once the header runs out of room. */
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  height:22px;
  box-sizing:border-box;
  white-space:nowrap;
  font-family:var(--mono);
  font-size:.7rem;
  line-height:1;
  color:var(--accent-2);
  background:rgba(124,92,255,.08);
  border:1px solid rgba(124,92,255,.25);
  padding:0 .55rem;
  border-radius:999px;
}
.status-pill.online{
  color:var(--ok);
  background:rgba(31,157,85,.08);
  border-color:rgba(31,157,85,.3);
}
.status-pill.offline{
  color:#c0392b;
  background:rgba(192,57,43,.08);
  border-color:rgba(192,57,43,.3);
}
.status-pill.dreaming{
  color:var(--accent-2);
  background:rgba(124,92,255,.16);
  border-color:rgba(124,92,255,.5);
  animation:dream-pulse 1.8s ease-in-out infinite;
}
/* Pulses the fill and border rather than the element's opacity. Animating
   opacity promotes the pill to its own compositing layer, which re-rasterises
   the 1px rounded border every frame and makes the outline look ragged
   while dreaming -- the one state that animates. */
@keyframes dream-pulse{
  0%,100%{background:rgba(124,92,255,.16);border-color:rgba(124,92,255,.5)}
  50%{background:rgba(124,92,255,.04);border-color:rgba(124,92,255,.18)}
}
.chat-actions{
  display:flex;align-items:flex-start;justify-content:space-between;gap:.6rem;
  max-width:640px;
  margin:.6rem 0 0;
}
.chat-actions > .btn{flex:0 0 auto}   /* never squeezed by the open note */
.chat-input-row input:disabled{opacity:.6;cursor:not-allowed}
.chat-input-row button:disabled{opacity:.6;cursor:not-allowed}
.chat-log{
  padding:1.25rem;
  min-height:140px;
  max-height:360px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:.6rem;
}
.msg{
  max-width:80%;
  padding:.6rem .9rem;
  border-radius:.75rem;
  font-size:.92rem;
}
.msg-bot{
  background:var(--bg-alt);
  border:1px solid var(--border);
  align-self:flex-start;
  color:var(--text-dim);
}
.msg-user{
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  color:var(--on-accent);
  align-self:flex-end;
  font-weight:500;
}
.chat-input-row{
  display:flex;gap:.6rem;
  padding:1rem;
  border-top:1px solid var(--border);
}
.chat-input-row input{
  flex:1;
  background:var(--bg-alt);
  border:1px solid var(--border);
  border-radius:.6rem;
  padding:.65rem .9rem;
  color:var(--text);
  font-size:.92rem;
  font-family:inherit;
}
.chat-input-row input:focus{outline:1px solid var(--accent)}
.chat-input-row input::placeholder{color:var(--text-dim)}

/* Timeline */
.timeline{list-style:none;display:flex;flex-direction:column;gap:1.5rem}
.timeline li{
  display:grid;
  grid-template-columns:7rem 1fr;
  gap:1.25rem;
  padding-bottom:1.5rem;
  border-bottom:1px solid var(--border);
}
.timeline li:last-child{border-bottom:0}
.tl-year{
  font-family:var(--mono);
  color:var(--accent);
  font-weight:600;
  font-size:.9rem;
}
.tl-text{color:var(--text-dim)}

/* Footer */
.site-footer{
  border-top:1px solid var(--border);
  padding:2.5rem 1.5rem;
  margin-top:2rem;
}
.footer-inner{
  display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:1rem;
  color:var(--text-dim);
  font-size:.9rem;
}
.footer-inner a{color:var(--text-dim)}
.footer-inner a:hover{color:var(--accent)}

/* Responsive */
@media (max-width:760px){
  .about-grid{grid-template-columns:1fr}
  .nav-toggle{display:flex}
  .site-nav{
    position:absolute;
    top:64px;left:0;right:0;
    background:var(--bg);
    border-bottom:1px solid var(--border);
    flex-direction:column;
    padding:1rem 1.5rem;
    gap:1rem;
    display:none;
  }
  .site-nav.open{display:flex}
  .timeline li{grid-template-columns:1fr}
}

/* Belief store (beliefs.html) */
.belief-toolbar{
  display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;
  margin:0 0 1.25rem;
}
.belief-toolbar input[type=search]{
  flex:1 1 14rem;min-width:0;
  padding:.5rem .75rem;
  font:inherit;font-size:.9rem;
  color:var(--text);
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:.6rem;
}
.belief-toolbar input[type=search]:focus{outline:2px solid var(--accent);outline-offset:-1px}
.belief{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:.75rem;
  padding:.85rem 1rem;
  margin-bottom:.6rem;
}
.belief-head{display:flex;align-items:baseline;gap:.6rem;flex-wrap:wrap}
.belief-statement{font-weight:600;margin-right:auto}
.belief-status{
  font-family:var(--mono);font-size:.68rem;
  padding:.1rem .5rem;border-radius:999px;
  border:1px solid var(--border);color:var(--text-dim);
  white-space:nowrap;
}
.belief-confirmed{color:var(--ok);border-color:rgba(31,157,85,.35);background:rgba(31,157,85,.07)}
.belief-contradicted{color:#c0392b;border-color:rgba(192,57,43,.35);background:rgba(192,57,43,.07)}
.belief-hypothesis{color:var(--accent-2);border-color:rgba(124,92,255,.35);background:rgba(124,92,255,.07)}
.belief-confidence{font-family:var(--mono);font-size:.8rem;color:var(--text-dim)}
.belief-evidence{list-style:none;margin:.55rem 0 0;padding:0;font-size:.85rem;color:var(--text-dim)}
.belief-evidence li{padding:.12rem 0 .12rem .75rem;border-left:2px solid var(--border)}
.belief-evidence li.belief-supports{border-left-color:rgba(31,157,85,.45)}
.belief-evidence li.belief-disputes{border-left-color:rgba(192,57,43,.45)}
.belief-person{padding:.2rem 0;font-size:.9rem;color:var(--text-dim)}
.belief-questions{margin:0;padding-left:1.1rem;font-size:.9rem;color:var(--text-dim)}
.belief-questions li{padding:.18rem 0}
.belief-reason{
  font-family:var(--mono);font-size:.68rem;color:var(--accent-2);
  margin-right:.35rem;
}
.belief-empty,.belief-none{color:var(--text-dim);font-size:.9rem}
