/* ============================================================
   SIGNAL DOCS — Documentation Portal
   justsparx Digital Innovation Lab
   Matches signal.justsparx.com portal aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --accent:        #c8922a;
  --accent-dim:    #8a6018;
  --accent-muted:  rgba(200, 146, 42, 0.15);

  /* Dark theme */
  --bg:            #111010;
  --bg-card:       #181614;
  --bg-card-hover: #1e1b18;
  --bg-nav:        #0d0c0b;
  --bg-footer:     #0d0c0b;
  --bg-reader:     #141210;
  --bg-code:       #0f0e0d;

  --border:        #2a2520;
  --border-card:   #222018;
  --border-accent: #3a3020;

  --text:          #c8c0b0;
  --text-dim:      #6a6258;
  --text-muted:    #3a3530;
  --text-heading:  #e8e0d0;
  --text-sub:      #8a8278;

  --status-open:      #6a9e6a;
  --status-protected: #9e8a5a;
  --status-overview:  #6a8a9e;

  --scrollbar:       #1e1c18;
  --scrollbar-thumb: #3a3530;
}

[data-theme="light"] {
  --bg:            #f4f1eb;
  --bg-card:       #faf8f4;
  --bg-card-hover: #f0ece4;
  --bg-nav:        #1a1510;
  --bg-footer:     #1a1510;
  --bg-reader:     #fdfbf8;
  --bg-code:       #eceae4;

  --border:        #ddd8ce;
  --border-card:   #e8e4da;
  --border-accent: #c8a840;

  --text:          #2a2520;
  --text-dim:      #8a8278;
  --text-muted:    #b0a898;
  --text-heading:  #151210;
  --text-sub:      #6a6258;

  --scrollbar:       #e0dbd0;
  --scrollbar-thumb: #c0b8a8;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

em { font-style: italic; }

/* ── NAV ─────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 52px;
  background: var(--bg-nav);
  border-bottom: 1px solid #2a2218;
  position: sticky;
  top: 0;
  z-index: 100;
}

[data-theme="light"] .nav {
  border-bottom-color: #2a2218;
}

.nav-logo {
  font-family: 'EB Garamond', serif;
  font-size: 18px;
  color: #e8d8b8;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav-logo em {
  color: var(--accent);
  font-style: italic;
}

.nav-logo:hover { text-decoration: none; opacity: 0.85; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-label { color: #5a5248; }
.nav-sep   { color: #3a3530; }
.nav-label.accent { color: var(--accent); }

/* ── HERO ────────────────────────────────────────────────── */
.hero {
  padding: 64px 48px 48px;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: 900px;
}

.hero h1 {
  font-family: 'EB Garamond', serif;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 400;
  color: var(--text-heading);
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.hero h1 em {
  color: var(--accent);
  font-style: italic;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 560px;
  line-height: 1.6;
}

/* ── MAIN ────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px 80px;
}

/* ── SECTION ─────────────────────────────────────────────── */
.section {
  padding-top: 48px;
}

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── GRID ────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  padding: 24px 20px 18px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-accent, transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover {
  background: var(--bg-card-hover);
}

.card:hover::before {
  opacity: 1;
}

.card.active {
  background: var(--bg-card-hover);
}

.card.active::before {
  opacity: 1;
}

.card-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.card-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.card-status.open      { color: var(--status-open); }
.card-status.protected { color: var(--status-protected); }
.card-status.overview  { color: var(--status-overview); }

.card-title {
  font-family: 'EB Garamond', serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--text-heading);
  line-height: 1.2;
}

.card-title em {
  color: var(--accent);
  font-style: italic;
}

.card-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-card);
}

.card-path {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
}

.card-action {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--accent-dim);
  letter-spacing: 0.06em;
  transition: color 0.15s;
}

.card:hover .card-action {
  color: var(--accent);
}

.card-overview {
  background: color-mix(in srgb, var(--bg-card) 95%, var(--accent) 5%);
}

/* ── READER ──────────────────────────────────────────────── */
.reader-section {
  padding-top: 40px;
}

.reader-section.hidden { display: none; }

.reader-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.reader-title-bar {
  font-family: 'EB Garamond', serif;
  font-size: 18px;
  color: var(--text-heading);
  flex: 1;
}

.reader-path {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.reader-loading {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  padding: 40px 0;
}

/* ── RENDERED MARKDOWN ───────────────────────────────────── */
.reader-body {
  max-width: 780px;
}

.reader-body h1 {
  font-family: 'EB Garamond', serif;
  font-size: 32px;
  font-weight: 400;
  color: var(--text-heading);
  margin-bottom: 16px;
  line-height: 1.2;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.reader-body h2 {
  font-family: 'EB Garamond', serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--accent);
  margin: 2.2em 0 0.6em;
  line-height: 1.3;
}

.reader-body h3 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin: 1.8em 0 0.5em;
}

.reader-body h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin: 1.4em 0 0.4em;
}

.reader-body p {
  margin-bottom: 1.1em;
  color: var(--text);
}

.reader-body strong {
  color: var(--text-heading);
  font-weight: 600;
}

.reader-body em {
  color: var(--accent);
}

.reader-body ul,
.reader-body ol {
  margin: 0.6em 0 1.2em 1.6em;
}

.reader-body li {
  margin-bottom: 0.4em;
  color: var(--text);
}

.reader-body code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--accent);
}

.reader-body pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: 3px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 1.2em 0;
}

.reader-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

.reader-body blockquote {
  border-left: 2px solid var(--accent-dim);
  padding: 4px 0 4px 18px;
  color: var(--text-dim);
  font-style: italic;
  margin: 1.2em 0;
}

.reader-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

.reader-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 1.2em 0;
  font-family: 'IBM Plex Mono', monospace;
}

.reader-body th {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 8px 14px;
  text-align: left;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-sub);
}

.reader-body td {
  border: 1px solid var(--border);
  padding: 8px 14px;
  vertical-align: top;
  font-size: 12px;
  color: var(--text);
}

.reader-body tr:hover td {
  background: var(--bg-card-hover);
}

.reader-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-dim);
}

/* ── FOOTER ──────────────────────────────────────────────── */
.footer {
  background: var(--bg-footer);
  border-top: 1px solid #2a2218;
  margin-top: 80px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 48px 32px;
}

.footer-philosophy {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid #2a2218;
}

.footer-heading {
  font-family: 'EB Garamond', serif;
  font-size: 15px;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 8px;
}

.footer-text {
  font-size: 13px;
  color: #5a5248;
  line-height: 1.6;
}

[data-theme="light"] .footer-text { color: #8a8278; }
[data-theme="light"] .footer-heading { color: var(--accent); }

.footer-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #3a3530;
  letter-spacing: 0.06em;
}

.footer-bottom a { color: #5a5248; }
.footer-bottom a:hover { color: var(--accent); text-decoration: none; }
.footer-sep { color: #2a2520; }

/* ── UTILITY ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.accent { color: var(--accent); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .footer-philosophy { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .nav, .hero, .main { padding-left: 24px; padding-right: 24px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .footer-philosophy { grid-template-columns: 1fr; }
  .footer-inner { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}
