/* Signal Tower Design System
   Bold, systematic, high-contrast. Pure neutral palette with signal flag color strips.
   Typography: Space Grotesk (headlines), Inter (body), Geist Mono (code) */

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

:root {
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --border: #E8E8EC;
  --text: #111113;
  --text-muted: #6B6B76;
  --blue: #0066CC;
  --green: #18794E;
  --amber: #E5A000;
  --red: #CD2B31;
  --purple: #6E56CF;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113;
    --bg-card: #1C1C1F;
    --border: #2C2C31;
    --text: #FAFAFA;
    --text-muted: #8B8B96;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}

[data-theme="dark"] {
  --bg: #111113;
  --bg-card: #1C1C1F;
  --border: #2C2C31;
  --text: #FAFAFA;
  --text-muted: #8B8B96;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --border: #E8E8EC;
  --text: #111113;
  --text-muted: #6B6B76;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; }
h1 { font-size: 2.5rem; letter-spacing: -0.03em; }
h2 { font-size: 1.75rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }

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

code, pre { font-family: var(--font-mono); }
code {
  font-size: 0.85em;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

/* ── Cards ───────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}
.card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-strip { height: 3px; width: 100%; }
.strip-blue { background: var(--blue); }
.strip-green { background: var(--green); }
.strip-amber { background: var(--amber); }
.strip-red { background: var(--red); }
.strip-purple { background: var(--purple); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 500; font-size: 0.875rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: #0052a3; color: #fff; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }

/* ── Navigation ──────────────────────────────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,250,250,0.95);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  backdrop-filter: blur(12px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav { background: rgba(17,17,19,0.95); }
}
[data-theme="dark"] .nav { background: rgba(17,17,19,0.95); }
[data-theme="light"] .nav { background: rgba(250,250,250,0.95); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
}
.nav-brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  color: var(--text); text-decoration: none;
  display: flex; align-items: center; gap: 0.5rem;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand svg { width: 24px; height: 24px; stroke: var(--blue); fill: none; stroke-width: 2; }
.nav-links { display: flex; gap: 1.5rem; list-style: none; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 0.875rem; font-weight: 500; text-decoration: none; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--text); font-weight: 600; }

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer; color: var(--text); padding: 0.25rem;
}
.nav-toggle svg { display: block; }
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 1rem 1.5rem 1.5rem; gap: 1rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

/* ── Breadcrumbs ─────────────────────────────────────────────── */

.breadcrumbs {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--blue); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .separator { color: var(--text-muted); opacity: 0.5; }

/* ── Page Hero (inner pages) ─────────────────────────────────── */

.page-hero {
  padding: 6rem 1.5rem 3rem;
  max-width: 1200px; margin: 0 auto;
}
.page-hero-container { max-width: 800px; }
.page-hero h1 {
  font-family: var(--font-display);
  font-size: 2.5rem; font-weight: 700;
  line-height: 1.15; margin-bottom: 1rem;
  letter-spacing: -0.03em;
}
.page-hero p {
  font-size: 1.1rem; color: var(--text-muted);
  line-height: 1.7; max-width: 600px;
}
.page-hero .meta {
  display: flex; align-items: center; gap: 1.5rem;
  margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted);
}
.page-hero .meta-item {
  display: flex; align-items: center; gap: 0.4rem;
}
.page-hero .meta-item svg { width: 16px; height: 16px; opacity: 0.6; }

/* ── Tutorial cards grid ─────────────────────────────────────── */

.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}
.tutorial-card { padding: 1.5rem; }
.tutorial-card h3 { margin-bottom: 0.5rem; }
.tutorial-card p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1rem; line-height: 1.6; }
.tutorial-meta { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--text-muted); }

/* ── Card grid (tutorials index) ─────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}
.card .card-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--text); color: var(--bg);
  border-radius: var(--radius); font-weight: 600; font-size: 0.8rem;
  margin-bottom: 1rem;
}
.card h3 {
  font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem;
}
.card p {
  color: var(--text-muted); font-size: 0.875rem; line-height: 1.6; margin-bottom: 0.75rem;
}
.card .card-meta {
  display: flex; align-items: center; gap: 1rem;
  font-size: 0.8rem; color: var(--text-muted);
}

/* ── Content layout (article + sidebar) ──────────────────────── */

.content-layout {
  max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem;
  display: grid; grid-template-columns: 240px 1fr; gap: 3rem;
}

/* Table of Contents */
.toc {
  position: sticky; top: 5rem; align-self: start;
  max-height: calc(100vh - 7rem); overflow-y: auto; padding-right: 1rem;
}
.toc h4 {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 1rem;
}
.toc ul { list-style: none; border-left: 2px solid var(--border); padding-left: 1rem; }
.toc li { margin-bottom: 0.5rem; }
.toc a {
  color: var(--text-muted); text-decoration: none;
  font-size: 0.8rem; line-height: 1.4; display: block; transition: color 0.15s;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--blue); font-weight: 500; }

/* Article content */
.article { max-width: 780px; min-width: 0; }
.article h2 {
  font-family: var(--font-display);
  font-size: 1.75rem; font-weight: 600;
  margin-top: 3rem; margin-bottom: 1rem; padding-top: 1rem;
  letter-spacing: -0.02em;
}
.article h2:first-child { margin-top: 0; }
.article h3 {
  font-size: 1.2rem; font-weight: 600;
  margin-top: 2rem; margin-bottom: 0.75rem;
}
.article h4 {
  font-size: 1rem; font-weight: 600;
  margin-top: 1.5rem; margin-bottom: 0.5rem;
}
.article p {
  color: var(--text-muted); font-size: 0.95rem;
  line-height: 1.8; margin-bottom: 1.25rem;
}
.article ul, .article ol {
  margin-bottom: 1.25rem; padding-left: 1.5rem;
  color: var(--text-muted); font-size: 0.95rem; line-height: 1.8;
}
.article li { margin-bottom: 0.35rem; }
.article strong { color: var(--text); }
.article a { color: var(--blue); text-decoration: none; }
.article a:hover { text-decoration: underline; }

/* Inline code in articles */
.article code {
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--bg); border: 1px solid var(--border);
  padding: 0.15em 0.4em; border-radius: 4px;
}

/* Code blocks in articles */
.article pre {
  background: #111113; border: 1px solid #2C2C31;
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  overflow-x: auto; margin-bottom: 1.5rem;
}
.article pre code {
  background: none; border: none; padding: 0;
  color: #E8E8EC; font-size: 0.85rem; line-height: 1.7; border-radius: 0;
}
/* Code syntax colors */
.article pre .comment { color: #6B6B76; }
.article pre .keyword { color: #18794E; }
.article pre .string { color: #E5A000; }
.article pre .prompt { color: #0066CC; }
.article pre .output { color: #8B8B96; }

/* Blockquotes */
.article blockquote {
  border-left: 3px solid var(--blue);
  padding: 0.75rem 1.25rem; margin: 1.5rem 0;
  background: rgba(0,102,204,0.04); border-radius: 0 var(--radius) var(--radius) 0;
}
.article blockquote p { color: var(--text-muted); margin-bottom: 0; }

/* Tables in articles */
.article table {
  width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: 0.9rem;
}
.article th {
  background: #111113; color: #FAFAFA;
  padding: 0.75rem 1rem; text-align: left; font-weight: 500;
}
.article th:first-child { border-radius: var(--radius) 0 0 0; }
.article th:last-child { border-radius: 0 var(--radius) 0 0; }
.article td {
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-muted);
}
.article tr:hover td { background: var(--bg); }

/* Horizontal rule */
.article hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

@media (max-width: 900px) {
  .content-layout { grid-template-columns: 1fr; }
  .toc {
    position: static; max-height: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem; margin-bottom: 1rem;
  }
  .page-hero h1 { font-size: 2rem; }
}

/* ── Prev/Next navigation ────────────────────────────────────── */

.prev-next {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border);
}
.prev-next a {
  display: block; padding: 1.25rem 1.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; transition: all 0.2s;
}
.prev-next a:hover {
  border-color: var(--blue); transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.prev-next .label {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.35rem;
}
.prev-next .title { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.prev-next .next { text-align: right; }

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

/* ── Section utilities ───────────────────────────────────────── */

.section { padding: 4rem 1.5rem; }
.section-label {
  display: inline-block; padding: 0.35rem 0.8rem;
  background: rgba(0, 102, 204, 0.08); border: 1px solid rgba(0, 102, 204, 0.2);
  border-radius: 100px; font-size: 0.75rem; font-weight: 600;
  color: var(--blue); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 1rem;
}
.section-title {
  font-family: var(--font-display); font-size: 2.25rem; font-weight: 600;
  margin-bottom: 1rem; letter-spacing: -0.02em;
}
.section-subtitle { color: var(--text-muted); font-size: 1.05rem; }

/* ── Footer ──────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border); padding: 3rem 1.5rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.footer-text { color: var(--text-muted); font-size: 0.875rem; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--text-muted); font-size: 0.875rem; text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* Legacy footer compat */
footer {
  padding: 3rem 1.5rem; border-top: 1px solid var(--border); margin-top: 4rem;
}
.footer-container { max-width: 1200px; margin: 0 auto; }
.footer-grid {
  display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 3rem; margin-bottom: 2rem;
}
.footer-brand p { font-size: 0.875rem; margin-top: 0.75rem; color: var(--text-muted); line-height: 1.7; max-width: 300px; }
.footer-column h4 {
  font-size: 0.8rem; font-weight: 600; margin-bottom: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text);
}
.footer-column ul { list-style: none; }
.footer-column li { margin-bottom: 0.4rem; }
.footer-column a { color: var(--text-muted); text-decoration: none; font-size: 0.875rem; transition: color 0.15s; }
.footer-column a:hover { color: var(--blue); }
.footer-bottom {
  padding-top: 1.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: var(--text-muted);
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { flex-direction: column; text-align: center; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.75rem; text-align: center; }
}

/* ── Tool grid (MCP tools) ───────────────────────────────────── */

.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem;
}
.tool-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; transition: all 0.2s;
}
.tool-card:hover { border-color: var(--blue); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.tool-card .tool-name {
  font-family: var(--font-mono); font-size: 0.85rem;
  font-weight: 500; color: var(--blue); margin-bottom: 0.5rem;
}
.tool-card .tool-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }
.tool-category {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text);
  margin-top: 2rem; margin-bottom: 1rem; padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--text);
}
.tool-category:first-of-type { margin-top: 0; }

/* ── Config block ────────────────────────────────────────────── */

.config-block {
  background: #111113; border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin: 1.5rem 0; overflow-x: auto;
}
.config-block code {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: #E8E8EC; line-height: 1.7; white-space: pre;
  background: none; border: none; padding: 0;
}

/* ── Doc links ───────────────────────────────────────────────── */

.doc-links {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem;
}
.doc-link {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  text-decoration: none; display: flex; gap: 1rem; align-items: flex-start; transition: all 0.2s;
}
.doc-link:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.doc-link-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--blue);
}
.doc-link h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.doc-link p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }
.doc-link .external-badge {
  font-size: 0.7rem; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ── Level badges ────────────────────────────────────────────── */

.level-badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 4px; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.level-beginner { background: rgba(24,121,78,0.1); color: var(--green); }
.level-intermediate { background: rgba(229,160,0,0.1); color: var(--amber); }
.level-advanced { background: rgba(110,86,207,0.1); color: var(--purple); }

/* ── Theme Toggle ── icon button (sun / moon) ── */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.theme-toggle:hover { background: var(--bg); color: var(--text); border-color: var(--text-muted); }
.theme-toggle svg { width: 15px; height: 15px; pointer-events: none; display: block; }
/* Light mode → show moon (click to go dark) */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
/* Dark mode → show sun (click to go light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
