/* Local LLM — project write-up, plus a real client-side demo.
   Loads shared/design-system.css (copied to design-system.css in this
   directory) first; everything here is local-llm-specific layout on top
   of those tokens. No accent override — this site uses the suite default
   indigo accent defined in design-system.css. */

.eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  margin: 0 0 var(--space-4);
}

/* Deep links (e.g. #models) should land below the sticky nav, not under it. */
section[id] {
  scroll-margin-top: calc(var(--nav-height) + var(--space-4));
}

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

header.hero {
  position: relative;
  isolation: isolate;
  padding: var(--space-section) 0 var(--space-16);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

header.hero::before {
  content: "";
  position: absolute;
  top: -16rem;
  left: 50%;
  width: 50rem;
  height: 30rem;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

header.hero h1 {
  font-size: var(--text-5xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tightest);
  font-weight: 600;
  margin: 0 0 var(--space-6);
}

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--text-dim);
  max-width: 40rem;
  margin: 0 0 var(--space-8);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--text-xs);
  padding: 0.32em 0.75em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-dim);
  white-space: nowrap;
}

.badge .dot {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  flex: none;
}

.dot-good { background: var(--good); }
.dot-warn { background: var(--warn); }
.dot-faint { background: var(--text-faint); }

/* Transient "in progress" state (e.g. a model loading) — distinct from the
   settled good/warn/faint states above. The pulse is a plain CSS animation,
   so it already inherits the sitewide reduced-motion kill-switch in
   design-system.css (animation-duration forced to ~0) with no extra work
   needed here. */
.dot-progress {
  background: var(--accent);
  animation: dot-progress-pulse 1.1s ease-in-out infinite;
}

@keyframes dot-progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.scope-note {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-soft);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-dim);
  background: var(--bg-raised);
  max-width: 40rem;
}
.scope-note strong { color: var(--text); }

/* ---------- sections ---------- */

main { padding: 0 0 var(--space-16); }

section {
  padding: var(--space-section) 0;
  border-bottom: 1px solid var(--border);
}
section:last-of-type { border-bottom: none; }

h2 {
  font-size: var(--text-3xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tighter);
  font-weight: 600;
  margin: 0 0 var(--space-4);
}

.section-intro {
  font-size: var(--text-md);
  color: var(--text-dim);
  margin: 0 0 var(--space-6);
  max-width: 40rem;
}

h3 {
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-tight);
  margin: var(--space-8) 0 var(--space-2);
}
h3:first-child { margin-top: 0; }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

.trailing-note {
  color: var(--text-dim);
  margin-top: var(--space-6);
}

.note {
  font-size: var(--text-sm);
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-6) 0 0;
}
.note:first-child { margin-top: 0; }
.note p:last-child { margin-bottom: 0; }
.note strong { color: var(--text); }

.note.warn { border-left-color: var(--warn-soft); }

/* ---------- models table ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 38rem;
  font-size: var(--text-sm);
}

thead th {
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  font-weight: 600;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-dim);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--duration-fast) var(--ease-standard);
}
tbody tr:hover { background: var(--bg-raised); }

td.model-name { color: var(--text); font-weight: 600; white-space: nowrap; }

.table-caption {
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: var(--space-3);
}

/* ---------- architecture pipeline ---------- */

.pipeline {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  position: relative;
}

.pipeline li {
  counter-increment: step;
  position: relative;
  padding: 0 0 var(--space-6) 2.75rem;
}
.pipeline li:last-child { padding-bottom: 0; }

.pipeline li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: border-color var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard);
}

.pipeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 1.9rem;
  bottom: -0.05rem;
  width: 1px;
  background: var(--border);
}

.pipeline li.is-visible::before {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-strong);
}

.pipeline .step-name {
  color: var(--text);
  font-weight: 600;
  font-size: var(--text-md);
}

.pipeline .step-desc {
  color: var(--text-dim);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

/* ---------- split cards (GPU vs CPU) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-top: var(--space-6);
}

@media (max-width: 42rem) {
  .card-grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard);
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-md);
}

.card .tag-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.card .tag-row .badge { font-size: 0.72rem; padding: 0.2em 0.6em; }

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

/* ---------- status grid ---------- */

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin: var(--space-6) 0 0;
}

@media (max-width: 42rem) {
  .status-grid { grid-template-columns: 1fr; }
}

.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: transform var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard);
}

.status-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-md);
}

.status-card .badge { margin-bottom: var(--space-3); }

.status-card h4 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-md);
}

.status-card p {
  font-size: var(--text-sm);
  color: var(--text-dim);
  margin: 0;
}

/* ---------- engineering-notes list ---------- */

.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.notes-list li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard);
}

.notes-list li:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  box-shadow: var(--shadow-md);
}

.notes-list .note-title {
  color: var(--text);
  font-weight: 600;
  font-size: var(--text-md);
  margin: 0 0 var(--space-2);
}

.notes-list p {
  font-size: var(--text-sm);
  color: var(--text-dim);
}
.notes-list p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .card:hover,
  .status-card:hover,
  tbody tr:hover {
    transform: none;
  }
}

/* ---------- source-link badge ----------
   A .badge rendered as an <a>, for linking out to the project's real
   GitHub repo. Distinct from the plain informational .badge spans: it
   gets a hover/focus state so it reads as interactive. */
.badge--link {
  align-self: flex-start;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.badge--link:hover,
.badge--link:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.badge--link svg { flex: none; }

/* The hero's one call-to-action badge, pointing at #demo. Same interactive
   shape as .badge--link, filled instead of outlined so it reads as the
   primary action among the row of plain informational badges. */
.badge--cta {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.badge--cta:hover,
.badge--cta:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* ---------- buttons (demo panel) ---------- */

/* Both .btn and .demo-chat__form below set their own `display`, which (per
   normal CSS cascade rules) overrides the UA stylesheet's default
   `[hidden] { display: none }` the moment an element carries a class this
   file also styles. demo.js relies on toggling the plain `hidden` attribute
   (e.g. the Stop button, the whole chat form before a model is loaded), so
   restore that semantic here rather than re-deriving "is this hidden" in
   every rule below. */
[hidden] { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.6em 1.1em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard),
              background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}
.btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-strong);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--on-accent);
}

/* ---------- live demo panel ---------- */

.demo-panel {
  margin-top: var(--space-6);
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.demo-panel__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

#demo-file {
  font-size: var(--text-sm);
  color: var(--text-dim);
  max-width: 100%;
}
#demo-file::file-selector-button {
  font: inherit;
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 0.55em 1em;
  margin-right: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard);
}
#demo-file::file-selector-button:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.demo-status .badge { font-size: var(--text-sm); }

.demo-chat__log {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 5rem;
  max-height: 24rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
}
.demo-chat__log:empty::before {
  content: "Load a model above, then say something.";
  color: var(--text-faint);
  font-size: var(--text-sm);
}

.demo-msg__role {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  margin-bottom: var(--space-1);
}
.demo-msg--user .demo-msg__role { color: var(--accent-strong); }
.demo-msg__body {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: var(--leading-normal);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.demo-chat__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
#demo-chat-input {
  flex: 1 1 12rem;
  font: inherit;
  font-size: var(--text-sm);
  padding: 0.6em 0.9em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
#demo-chat-input:disabled { opacity: 0.6; }

.demo-chat__caption {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* ---------- inline code blocks (CLI section) ---------- */

.code-block {
  overflow-x: auto;
  margin: 0 0 var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
}
.code-block code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 0;
  border: none;
  background: none;
  border-radius: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text);
  white-space: pre;
}
