/* FILE: src/iskreet/static/styles/iskreet.css
   VERSION: 0.1.0
   START_MODULE_CONTRACT
     PURPOSE: Custom design overrides for Pico CSS v2.1 light theme — amperka brand colors, layout, components.
     SCOPE: Design tokens, header, footer, hero, step-cards, guide-blocks, log-terminal, realtime page layout, responsive breakpoints.
     DEPENDS: pico.min.css (vendor baseline), M-HOME-HTML, M-REALTIME-HTML
     LINKS: M-ISKREET-CSS, M-HOME-HTML, M-REALTIME-HTML, M-DOC-STATIC
     ROLE: RUNTIME
     MAP_MODE: EXPORTS
   END_MODULE_CONTRACT
   START_MODULE_MAP
      Design tokens, header, footer, hero, step-cards, guide-blocks, log-terminal, realtime layout, chart rows, responsive breakpoints.
   END_MODULE_MAP
   START_CHANGE_SUMMARY
       LAST_CHANGE: v0.3.0 - Add sparkline chart row styles for realtime viewer.
      PREVIOUS_CHANGE: v0.1.0 - Initial GRACE-lite markup.
   END_CHANGE_SUMMARY */

/* iskreet — custom design overrides for Pico CSS v2.1.1 light theme */

/* ------------------------------------------------------------------ */
/* Design Tokens                                                      */
/* ------------------------------------------------------------------ */
:root {
  /* Brand */
  --isk-blue: #007bbd;
  --isk-orange: #f6871f;
  --isk-dark: #363636;
  --isk-dark-hover: #4a4a4a;
  --isk-surface: #ffffff;
  --isk-surface-raised: #f8f9fa;
  --isk-border: #e2e8f0;
  --isk-muted: #6b7280;
  --isk-code-bg: #f1f5f9;
  --isk-code-border: #dde4ed;
  --isk-terminal-bg: #1a1d23;
  --isk-terminal-text: #a9b4c2;
  --isk-terminal-accent: #10b981;
  --isk-terminal-border: #2d3139;

  /* Typography */
  --pico-font-family: "Roboto", system-ui, -apple-system, sans-serif;
  --pico-font-family-monospace:
    "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", "Consolas",
    monospace;

  /* Pico overrides — brand blue as primary */
  --pico-primary: var(--isk-blue);
  --pico-primary-hover: var(--isk-orange);
  --pico-primary-focus: rgba(0, 123, 189, 0.25);
  --pico-primary-background: var(--isk-blue);
  --pico-primary-border: var(--isk-blue);
  --pico-primary-underline: rgba(0, 123, 189, 0.3);

  /* Secondary maps to orange for accent contrast */
  --pico-secondary: var(--isk-orange);
  --pico-secondary-hover: #e0781b;
  --pico-secondary-background: var(--isk-orange);
  --pico-secondary-border: var(--isk-orange);

  /* Link underline uses blue */
  --pico-text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/* Base & Typography                                                   */
/* ------------------------------------------------------------------ */
html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #fafbfc;
  color: #1f2937;
}

body > main {
  flex: 1;
}

a {
  transition: color 0.18s ease;
}

code {
  background: var(--isk-code-bg);
  border: 1px solid var(--isk-code-border);
  border-radius: 4px;
  padding: 0.15em 0.45em;
  font-size: 0.9em;
  color: #1e293b;
  font-family: var(--pico-font-family-monospace);
}

span.nowrap {
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */
header {
  background: var(--isk-dark);
  color: #fff;
  padding: 0 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

header.container {
  max-width: 100%;
}

header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

header nav ul {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

header nav ul:first-child {
  gap: 0.5rem;
}

header nav ul li {
  margin: 0;
  padding: 0;
}

header nav ul li strong {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -0.01em;
  margin-left: 0.25rem;
}

header a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.925rem;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  transition:
    color 0.18s ease,
    background 0.18s ease;
}

header a:hover,
header a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

header a img {
  display: block;
  height: 28px;
  width: auto;
}

/* Brand badge — small colored chip next to logo */
header .brand-line {
  display: inline-block;
  width: 3px;
  height: 20px;
  background: var(--isk-orange);
  border-radius: 2px;
  margin: 0 0.35rem 0 0.15rem;
  vertical-align: middle;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */
footer {
  background: var(--isk-dark);
  color: rgba(255, 255, 255, 0.5);
  padding: 1.25rem 0;
  margin-top: auto;
  font-size: 0.85rem;
}

footer.container {
  max-width: 100%;
}

footer p {
  margin: 0 auto;
  max-width: 960px;
  padding: 0 1.5rem;
  text-align: center;
  color: #fff;
}

footer a {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: color 0.18s ease;
}

footer a:hover {
  color: var(--isk-orange);
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
main.container {
  max-width: 960px;
  padding: 2.5rem 1.5rem 4rem;
}

section {
  margin-bottom: 3.5rem;
}

section:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Hero                                                                */
/* ------------------------------------------------------------------ */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--isk-border);
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin-bottom: 0.75rem;
}

.hero .hero-sub {
  font-size: 1.1rem;
  color: var(--isk-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.hero .hero-accent {
  display: inline-block;
  width: 48px;
  height: 3px;
  background: var(--isk-blue);
  border-radius: 2px;
  margin-bottom: 1.5rem;
}

/* ------------------------------------------------------------------ */
/* Section Headings                                                    */
/* ------------------------------------------------------------------ */
section h2 {
  font-size: 1.55rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  position: relative;
}

section h2::after {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  background: var(--isk-blue);
  border-radius: 2px;
  margin-top: 0.45rem;
}

/* ------------------------------------------------------------------ */
/* Step Cards (Subscribe / Write / Notify)                             */
/* ------------------------------------------------------------------ */
.step-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.step-card {
  background: var(--isk-surface);
  border: 1px solid var(--isk-border);
  border-radius: 10px;
  padding: 1.75rem 1.5rem 1.5rem;
  position: relative;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.18s ease;
}

.step-card:hover {
  border-color: var(--isk-blue);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  transform: translateY(-2px);
}

.step-card .step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--isk-blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.step-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.4rem;
}

.step-card p {
  color: var(--isk-muted);
  font-size: 0.925rem;
  line-height: 1.55;
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Guide Section                                                       */
/* ------------------------------------------------------------------ */
.guide-block {
  background: var(--isk-surface);
  border: 1px solid var(--isk-border);
  border-radius: 10px;
  padding: 1.75rem 2rem;
}

.guide-block p {
  font-size: 0.975rem;
  line-height: 1.7;
  color: #374151;
  margin: 0;
}

.guide-block code {
  background: var(--isk-code-bg);
  border: 1px solid var(--isk-code-border);
  border-radius: 4px;
  padding: 0.15em 0.45em;
  font-size: 0.88em;
  color: var(--isk-blue);
}

.guide-block code:hover {
  border-color: var(--isk-blue);
}

/* ------------------------------------------------------------------ */
/* Realtime Log (Terminal Style)                                       */
/* ------------------------------------------------------------------ */
.log-terminal {
  background: var(--isk-terminal-bg);
  border: 1px solid var(--isk-terminal-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.log-terminal .log-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #252830;
  border-bottom: 1px solid var(--isk-terminal-border);
}

.log-terminal .log-header .log-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.log-terminal .log-header .log-dot--red {
  background: #ef4444;
}
.log-terminal .log-header .log-dot--yellow {
  background: #eab308;
}
.log-terminal .log-header .log-dot--green {
  background: #22c55e;
}

.log-terminal .log-header .log-title {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
  font-family: var(--pico-font-family-monospace);
  margin-left: 0.35rem;
  letter-spacing: 0.02em;
}

.log-terminal #log {
  padding: 0.75rem 1rem;
  max-height: 480px;
  overflow-y: auto;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--isk-terminal-text);
}

.log-terminal #log::-webkit-scrollbar {
  width: 6px;
}

.log-terminal #log::-webkit-scrollbar-track {
  background: transparent;
}

.log-terminal #log::-webkit-scrollbar-thumb {
  background: var(--isk-terminal-border);
  border-radius: 3px;
}

.log-terminal #log pre {
  background: transparent;
  border: none;
  margin: 0;
  padding: 0.15rem 0;
  color: var(--isk-terminal-accent);
  white-space: pre-wrap;
  word-break: break-all;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  animation: logFadeIn 0.25s ease-out;
}

@keyframes logFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-terminal #log pre:last-child {
  border-bottom: none;
}

/* Empty log state */
.log-terminal .log-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--pico-font-family-monospace);
  font-size: 0.85rem;
}

/* Hidden state — toggled by realtime.js when first SSE event arrives */
.log-terminal .log-empty--hidden {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Realtime Page Layout                                                */
/* ------------------------------------------------------------------ */
.realtime-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.realtime-header-row h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.realtime-header-row .thing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--isk-code-bg);
  border: 1px solid var(--isk-code-border);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.825rem;
  color: var(--isk-blue);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--isk-terminal-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.live-indicator .live-pulse {
  width: 8px;
  height: 8px;
  background: var(--isk-terminal-accent);
  border-radius: 50%;
  animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

/* -- .live-indicator--error: modifier for SSE reconnect error state -- */

.live-indicator--error {
  color: #ef4444;
}

.live-indicator--error .live-pulse {
  background: #ef4444;
  animation: none;
}

/* ------------------------------------------------------------------ */
/* Sparkline Charts                                                    */
/* ------------------------------------------------------------------ */
#charts {
  margin-bottom: 1.5rem;
}

.charts-card {
  background: var(--isk-surface);
  border: 1px solid var(--isk-border);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.chart-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 120px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--isk-border);
}

.chart-row:last-child {
  border-bottom: none;
}

.chart-row:nth-child(even) {
  background: var(--isk-surface-raised);
}

.chart-row__key {
  position: relative;
  z-index: 1;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.825rem;
  color: var(--isk-muted);
  white-space: nowrap;
  padding-right: 1rem;
}

.chart-row__value {
  position: relative;
  z-index: 1;
  font-weight: 700;
  font-size: 0.925rem;
  color: #0f172a;
  white-space: nowrap;
  padding-left: 1rem;
  background: linear-gradient(to left, var(--isk-surface) 60%, transparent);
}

.chart-row:nth-child(even) .chart-row__value {
  background: linear-gradient(
    to left,
    var(--isk-surface-raised) 60%,
    transparent
  );
}

.chart-row__canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.charts-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--isk-muted);
  font-family: var(--pico-font-family-monospace);
  font-size: 0.85rem;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .step-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .hero h1 {
    font-size: 1.7rem;
  }

  .hero {
    padding: 2rem 0 1.5rem;
    margin-bottom: 2rem;
  }

  main.container {
    padding: 2rem 1rem 3rem;
  }

  header nav {
    padding: 0.5rem 1rem;
  }

  header nav ul:last-child {
    gap: 0.25rem;
  }

  header a {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
  }

  .chart-row {
    height: 100px;
  }
}
