/* sstanek.dev — shared components (built on tokens.css).
 *
 * Framework-agnostic, prefixed `.ss-` so it never collides with Tailwind utilities.
 * Link AFTER tokens.css. These classes are the 1:1 contract: the same markup +
 * classes render identically in the Astro site and in any plain-HTML app (ipintel).
 * See /sdk/samples for reference markup. */

/* ── Base ──────────────────────────────────────────────────────────────── */
/* Box model: the system is framework-agnostic, so it can't rely on a framework
   reset being present. Without this, .ss-container is wider by its padding
   (default content-box) on apps that don't load Tailwind — which made ipintel
   render ~3rem wider than the main site. */
*, *::before, *::after { box-sizing: border-box; }

.ss-body {
  margin: 0;
  background: var(--ss-bg);
  color: var(--ss-ink-soft);
  font-family: var(--ss-font-sans);
  font-size: var(--ss-text-base);
  line-height: var(--ss-leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ss-container {
  width: 100%;
  max-width: var(--ss-container);
  margin-inline: auto;
  padding-inline: var(--ss-gutter);
}

.ss-measure { max-width: var(--ss-measure); margin-inline: auto; }

.ss-link { color: var(--ss-accent); text-decoration: none; }
.ss-link:hover { text-decoration: underline; }

.ss-meta { color: var(--ss-muted); font-size: var(--ss-text-sm); }

/* ── Page heading (non-prose pages: apps, blog index) ──────────────────── */
.ss-page-title {
  margin: 0 0 .5rem;
  color: var(--ss-ink);
  font-size: var(--ss-text-4xl);
  font-weight: var(--ss-weight-bold);
  line-height: var(--ss-leading-tight);
  letter-spacing: var(--ss-tracking-tight);
}
.ss-page-intro {
  margin: 0 0 2.5rem;
  color: var(--ss-muted);
  font-size: var(--ss-text-lg);
}

/* ── Navbar (identical across all apps) ────────────────────────────────── */
.ss-nav { background: var(--ss-surface); border-bottom: 1px solid var(--ss-border); }
.ss-nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--ss-nav-h);
}
.ss-nav__brand {
  color: var(--ss-ink); text-decoration: none;
  font-size: var(--ss-text-lg); font-weight: var(--ss-weight-bold);
  letter-spacing: -.01em;
}
.ss-nav__links { display: flex; align-items: center; gap: 2rem; }
.ss-nav__link {
  color: var(--ss-muted); text-decoration: none;
  font-size: var(--ss-text-sm); font-weight: var(--ss-weight-medium);
  transition: color .15s ease;
}
.ss-nav__link:hover { color: var(--ss-ink); }
.ss-nav__link[aria-current="page"] { color: var(--ss-ink); }

/* CSS-only mobile menu: a hidden checkbox toggles the panel (no JS needed). */
.ss-nav__checkbox { display: none; }
.ss-nav__toggle {
  display: none; cursor: pointer; color: var(--ss-ink-soft);
  padding: .5rem; margin: -.5rem; border: 0; background: none;
}
.ss-nav__toggle svg { width: 1.5rem; height: 1.5rem; display: block; }
.ss-nav__mobile { display: none; }
.ss-nav__mobile .ss-nav__link { display: block; padding: .5rem 0; }

@media (max-width: 1023px) {
  .ss-nav__links { display: none; }
  .ss-nav__toggle { display: inline-flex; }
  .ss-nav__checkbox:checked ~ .ss-nav__mobile { display: block; padding-bottom: 1rem; }
}

/* ── Card ──────────────────────────────────────────────────────────────── */
.ss-card {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-lg);
  padding: 1.25rem 1.5rem;
}
.ss-card--pad-sm { padding: 1rem 1.25rem; }
.ss-card__title { margin: 0; color: var(--ss-ink); font-size: var(--ss-text-xl); font-weight: var(--ss-weight-semibold); }

/* Section label inside cards/results (small uppercase) */
.ss-eyebrow {
  margin: 0 0 .75rem; color: var(--ss-muted);
  font-size: var(--ss-text-xs); font-weight: var(--ss-weight-semibold);
  text-transform: uppercase; letter-spacing: .05em;
}

/* ── Badge ─────────────────────────────────────────────────────────────── */
.ss-badge {
  display: inline-flex; align-items: center;
  padding: .125rem .625rem; border-radius: var(--ss-radius-full);
  font-size: var(--ss-text-xs); font-weight: var(--ss-weight-medium);
  white-space: nowrap;
}
.ss-badge--ok      { background: var(--ss-ok-bg);      color: var(--ss-ok-fg); }
.ss-badge--warn    { background: var(--ss-warn-bg);    color: var(--ss-warn-fg); }
.ss-badge--info    { background: var(--ss-info-bg);    color: var(--ss-info-fg); }
.ss-badge--danger  { background: var(--ss-danger-bg);  color: var(--ss-danger-fg); }
.ss-badge--neutral { background: var(--ss-neutral-bg); color: var(--ss-neutral-fg); }

/* ── Tag / chip ────────────────────────────────────────────────────────── */
.ss-tag {
  display: inline-block; padding: .125rem .5rem;
  border-radius: var(--ss-radius-sm); font-size: var(--ss-text-xs);
  background: var(--ss-neutral-bg); color: var(--ss-neutral-fg);
}
.ss-chip {
  display: inline-block; padding: .125rem .5rem; margin: .125rem;
  border-radius: var(--ss-radius-sm); font-size: var(--ss-text-xs);
  background: var(--ss-accent-soft); color: var(--ss-accent-hover);
  border: 1px solid var(--ss-accent-border);
}

/* ── Button ────────────────────────────────────────────────────────────── */
.ss-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: var(--ss-radius);
  font-size: var(--ss-text-sm); font-weight: var(--ss-weight-semibold);
  font-family: inherit; line-height: 1; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s ease, color .15s ease;
}
.ss-btn--primary { background: var(--ss-accent); color: var(--ss-on-accent); }
.ss-btn--primary:hover { background: var(--ss-accent-hover); }
.ss-btn--ghost {
  background: var(--ss-surface); color: var(--ss-accent);
  border-color: var(--ss-border-strong);
}
.ss-btn--ghost:hover { background: var(--ss-surface-2); }
.ss-btn:disabled { opacity: .5; cursor: default; }

/* ── Input ─────────────────────────────────────────────────────────────── */
.ss-input {
  width: 100%; padding: .65rem .85rem;
  background: var(--ss-surface); color: var(--ss-ink);
  border: 1px solid var(--ss-border-strong); border-radius: var(--ss-radius);
  font-family: inherit; font-size: var(--ss-text-base);
}
.ss-input::placeholder { color: var(--ss-faint); }
.ss-input:focus { outline: none; border-color: var(--ss-accent); box-shadow: 0 0 0 3px var(--ss-accent-ring); }
.ss-input--sm { padding: .5rem .65rem; font-size: var(--ss-text-sm); }
.ss-label { display: block; margin-bottom: .35rem; color: var(--ss-muted); font-size: var(--ss-text-sm); }

/* ── Terminal (the home hero motif; reusable accent) ───────────────────── */
.ss-terminal {
  background: #18181b; border-radius: var(--ss-radius-lg);
  overflow: hidden; box-shadow: var(--ss-shadow);
}
.ss-terminal__bar { display: flex; align-items: center; gap: .5rem; padding: .75rem 1rem; background: #27272a; }
.ss-terminal__dot { width: .75rem; height: .75rem; border-radius: 50%; }
.ss-terminal__dot--red    { background: #ef4444; }
.ss-terminal__dot--yellow { background: #eab308; }
.ss-terminal__dot--green  { background: #22c55e; }
.ss-terminal__body {
  padding: 1.25rem 1.5rem; min-height: 12rem;
  font-family: var(--ss-font-mono); font-size: .9rem; line-height: 1.6;
  color: #e4e4e7; white-space: pre-wrap;
}
.ss-terminal__cursor {
  display: inline-block; width: .5rem; height: 1.1em;
  background: #e4e4e7; vertical-align: text-bottom;
}

/* ── Post list (blog index) ────────────────────────────────────────────── */
.ss-post-list { list-style: none; margin: 0; padding: 0; }
.ss-post-list__item {
  padding-bottom: 1.5rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--ss-border);
}
.ss-post-list__item:last-child { border-bottom: 0; margin-bottom: 0; }
.ss-post-list__link { display: block; text-decoration: none; }
.ss-post-list__title {
  margin: 0; color: var(--ss-ink);
  font-size: var(--ss-text-2xl); font-weight: var(--ss-weight-semibold);
  line-height: var(--ss-leading-snug); transition: color .15s ease;
}
.ss-post-list__link:hover .ss-post-list__title { color: var(--ss-accent); }
.ss-post-list__excerpt { margin: .6rem 0 0; color: var(--ss-ink-soft); }

/* ── Article header (blog post / about title block) ────────────────────── */
.ss-article-title {
  margin: 0; color: var(--ss-ink);
  font-size: var(--ss-text-4xl); font-weight: var(--ss-weight-bold);
  line-height: var(--ss-leading-tight); letter-spacing: var(--ss-tracking-tight);
}

/* ── Prose (blog posts + about + any long-form: ONE rhythm everywhere) ──── */
.ss-prose {
  color: var(--ss-ink-soft);
  font-size: var(--ss-text-md);
  line-height: var(--ss-leading-body);
  max-width: var(--ss-measure);
  margin-inline: auto;
}
.ss-prose > * + * { margin-top: 1.25em; }
.ss-prose h1, .ss-prose h2, .ss-prose h3, .ss-prose h4 {
  color: var(--ss-ink); font-weight: var(--ss-weight-bold);
  line-height: var(--ss-leading-tight); letter-spacing: var(--ss-tracking-tight);
}
.ss-prose h1 { font-size: var(--ss-text-4xl); margin-top: 0; }
.ss-prose h2 { font-size: var(--ss-text-2xl); margin-top: 2em; }
.ss-prose h3 { font-size: var(--ss-text-xl); margin-top: 1.6em; }
.ss-prose h4 { font-size: var(--ss-text-lg); margin-top: 1.4em; }
.ss-prose p, .ss-prose ul, .ss-prose ol, .ss-prose blockquote { margin-block: 0; }
.ss-prose a { color: var(--ss-accent); text-decoration: underline; text-underline-offset: 2px; }
.ss-prose a:hover { color: var(--ss-accent-hover); }
.ss-prose strong { color: var(--ss-ink); font-weight: var(--ss-weight-semibold); }
.ss-prose ul, .ss-prose ol { padding-left: 1.4em; }
.ss-prose li { margin-top: .4em; }
.ss-prose blockquote {
  padding-left: 1em; border-left: 3px solid var(--ss-accent);
  color: var(--ss-muted); font-style: italic;
}
.ss-prose code {
  font-family: var(--ss-font-mono); font-size: .875em;
  background: var(--ss-neutral-bg); color: var(--ss-ink);
  padding: .15em .4em; border-radius: var(--ss-radius-sm);
}
.ss-prose pre {
  background: #18181b; color: #e4e4e7;
  padding: 1rem 1.25rem; border-radius: var(--ss-radius);
  overflow-x: auto; font-size: var(--ss-text-sm); line-height: 1.6;
}
.ss-prose pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.ss-prose img { max-width: 100%; height: auto; border-radius: var(--ss-radius); }
.ss-prose hr { border: 0; border-top: 1px solid var(--ss-border); }
.ss-prose table { width: 100%; border-collapse: collapse; font-size: var(--ss-text-sm); }
.ss-prose th, .ss-prose td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--ss-border); }
.ss-prose th { color: var(--ss-muted); font-weight: var(--ss-weight-semibold); }
