@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@300;400;500&display=swap');

:root {
    --bg: #0f131a;
    --bg-2: #131a24;
    --bg-3: #1b2230;
    --panel: rgba(20, 28, 40, 0.8);
    --ink: #e8edf4;
    --muted: #9aa6b2;
    --accent: #2dd4bf;
    --accent-2: #f59e0b;
    --accent-3: #fb7185;
    --line: #243044;
    --glow: rgba(45, 212, 191, 0.2);
    --green: #2dd4bf;
    --yellow: #f59e0b;
    --red: #fb7185;
    --pending: #4a5568;
}

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

.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  background: var(--accent);
  color: #0b0f15;
  padding: 6px 14px;
  border-radius: 0 0 8px 8px;
  z-index: 100;
  font-size: 0.9rem;
  font-weight: 600;
}
.skip-link:focus { top: 0; }

body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(45, 212, 191, 0.15), transparent),
              radial-gradient(900px 500px at 10% 0%, rgba(251, 113, 133, 0.12), transparent),
              linear-gradient(180deg, var(--bg), #0b0f15 55%, #101722 100%);
  color: var(--ink);
  font-family: "Space Grotesk", "Avenir Next", "Futura", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Aurora + gridlines background */
body::before {
  content: '';
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 60vh;
  background: conic-gradient(from 180deg, rgba(45, 212, 191, 0.15), rgba(245, 158, 11, 0.08), rgba(251, 113, 133, 0.12), rgba(45, 212, 191, 0.15));
  filter: blur(90px);
  opacity: 0.7;
  z-index: 0;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.08;
  z-index: 0;
  pointer-events: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #5eead4; }

.shell {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 14px 60px;
}

/* ── Header (matches sab-header) ── */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin: 0 -14px;
  padding-left: 48px;
  padding-right: 48px;
  backdrop-filter: blur(12px);
  background: rgba(10, 15, 22, 0.7);
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.site-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.site-brand .logo-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #0b0f15;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
}

.site-brand .brand-text {
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
}

.nav-links {
  display: flex;
  gap: 6px;
}

.nav-pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}
.nav-pill:hover {
  color: var(--ink);
  background: rgba(45, 212, 191, 0.1);
  text-decoration: none;
}
.nav-pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b0f15;
  font-weight: 600;
  border-color: transparent;
}

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.session-badge {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(20, 28, 40, 0.6);
}

/* ── Panels / Cards ── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(8, 12, 20, 0.3), inset 0 0 20px rgba(45, 212, 191, 0.03);
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 10px;
  line-height: 1.1;
}
h2 { font-size: 1.3rem; margin: 0 0 10px; }
h3 { font-size: 1.1rem; margin: 0 0 8px; }

.meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.spark-content {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.95rem;
  color: #c8d0dc;
}

/* ── Buttons ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

button, .btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 28, 40, 0.6);
  color: var(--ink);
  padding: 8px 16px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  font-size: 0.9rem;
}

button:hover, .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 212, 191, 0.15);
  border-color: var(--accent);
  text-decoration: none;
}

button.primary, .btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b0f15;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(45, 212, 191, 0.2);
}

button.primary:hover, .btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 212, 191, 0.3);
}

button.danger {
  background: linear-gradient(135deg, var(--accent-3), #e11d48);
  color: #fff;
  border-color: transparent;
}

/* ── Forms ── */
textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(10, 15, 22, 0.6);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}
textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  background: rgba(10, 15, 22, 0.9);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%239aa6b2' viewBox='0 0 16 16'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 12px;
  padding-right: 36px;
}

.form-row {
  margin-bottom: 12px;
}
.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--muted);
}

.error {
  color: var(--accent-3);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.error[role="alert"] {
  padding: 8px 14px;
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: 12px;
  background: rgba(251, 113, 133, 0.1);
}

/* ── 17-Dimension Grid ── */
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.dimension-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(16, 24, 35, 0.7);
}

.dimension-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
}

.dimension-meta {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.meter {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(36, 48, 68, 0.6);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.green .meter > span { background: linear-gradient(90deg, var(--green), #5eead4); }
.yellow .meter > span { background: linear-gradient(90deg, var(--yellow), #fbbf24); }
.red .meter > span { background: linear-gradient(90deg, var(--red), #f472b6); }
.pending .meter > span { background: var(--pending); }
.experimental .meter > span { background: linear-gradient(90deg, #6366f1, #818cf8); }

/* ── Mini dimension strip (feed cards) ── */
.mini-strip {
  display: grid;
  grid-template-columns: repeat(18, minmax(8px, 1fr));
  gap: 4px;
  margin-top: 12px;
}

.mini-bar {
  height: 28px;
  border-radius: 6px;
  background: rgba(36, 48, 68, 0.4);
  position: relative;
  overflow: hidden;
}

.mini-bar > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 6px;
  transition: height 0.5s ease;
}

.mini-bar.green > span { background: var(--green); }
.mini-bar.yellow > span { background: var(--yellow); }
.mini-bar.red > span { background: var(--red); }
.mini-bar.pending > span { background: var(--pending); }
.mini-bar.experimental > span { background: #6366f1; }

/* ── Timeline ── */
.timeline {
  border-left: 2px solid var(--line);
  margin-left: 6px;
  padding-left: 14px;
}

.timeline-item {
  margin-bottom: 14px;
}

code, pre {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  background: rgba(10, 15, 22, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
}
pre {
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  white-space: pre-wrap;
  margin: 8px 0;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.experimental-label {
  display: inline-block;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ── Footer ── */
.sab-footer {
  border-top: 1px solid var(--line);
  padding: 24px 48px 40px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

/* ── Responsive ── */
@media (max-width: 760px) {
  .shell { padding: 0 8px 32px; }
  header.site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin: 0 -8px;
  }
  .nav-links { flex-wrap: wrap; gap: 4px; }
  .mini-strip { grid-template-columns: repeat(9, minmax(8px, 1fr)); }
  .dimension-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
}

/* ── Rendered Markdown ── */
.rendered-md h1 { font-size: 1.4rem; margin: 16px 0 8px; color: var(--ink); }
.rendered-md h2 { font-size: 1.2rem; margin: 14px 0 6px; color: var(--ink); }
.rendered-md h3 { font-size: 1.05rem; margin: 12px 0 4px; color: var(--ink); }
.rendered-md p { margin: 8px 0; line-height: 1.6; color: #c8d0dc; }
.rendered-md strong { color: var(--ink); }
.rendered-md em { color: var(--muted); }
.rendered-md ul, .rendered-md ol { margin: 8px 0 8px 20px; color: #c8d0dc; }
.rendered-md li { margin: 4px 0; line-height: 1.5; }
.rendered-md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.88rem; }
.rendered-md th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--line); color: var(--accent); font-weight: 600; }
.rendered-md td { padding: 6px 12px; border-bottom: 1px solid var(--line); color: #c8d0dc; }
.rendered-md tr:hover td { background: rgba(45, 212, 191, 0.05); }
.rendered-md code { background: rgba(10, 15, 22, 0.8); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; color: var(--accent); }
.rendered-md pre { background: rgba(10, 15, 22, 0.8); padding: 14px; border-radius: 10px; overflow-x: auto; margin: 10px 0; }
.rendered-md pre code { padding: 0; background: none; }
.rendered-md blockquote { border-left: 3px solid var(--accent); padding-left: 14px; margin: 10px 0; color: var(--muted); }
.rendered-md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* ── Spark cards in feed ── */
.spark-card .rendered-md h1:first-child { margin-top: 0; }
