/* ============================================================
   NELSIG Node Graph Tools — Documentation Site
   Dark mode, sober, professional
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --bg-body: #1a1a1a;
  --bg-card: #282828;
  --bg-elevated: #2b2b2b;
  --bg-code: #1e1e1e;
  --bg-nav: #151515;
  --border: #3a3a3a;
  --brand-orange: #FF6600;
  --accent: #C26828;
  --accent-hover: #d87a3a;
  --text-heading: #FFFFFF;
  --text-body: #CCCCCC;
  --text-subtle: #888888;
  --text-code: #E0E0E0;
  --table-header: #333333;
  --table-row-alt: #252525;
  --max-width: 960px;
  --nav-height: 56px;
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

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

/* --- Typography --- */
h1, h2, h3, h4 { color: var(--text-heading); font-weight: 600; }
h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-top: 3rem; margin-bottom: 1rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.2rem; margin-top: 2rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.05rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }

a { color: var(--brand-orange); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

strong { color: var(--text-heading); }

ul, ol { margin: 0 0 1rem 1.5rem; }
li { margin-bottom: 0.35rem; }
li::marker { color: var(--text-subtle); }

hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* --- Code --- */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-code);
  color: var(--text-code);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--bg-code);
  border-left: 3px solid var(--brand-orange);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
pre code { background: none; padding: 0; font-size: 0.85rem; line-height: 1.5; }

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}
thead th {
  background: var(--table-header);
  color: var(--text-heading);
  text-align: left;
  padding: 0.6rem 0.8rem;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
tbody td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
tbody tr:nth-child(even) { background: var(--table-row-alt); }
tbody tr:hover { background: #2e2e2e; }

/* --- Top Navigation --- */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-heading);
  text-decoration: none;
  margin-right: 2rem;
  white-space: nowrap;
}
.nav-brand:hover { color: var(--brand-orange); text-decoration: none; }
.nav-brand .brand-accent { color: var(--brand-orange); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.nav-links li { margin: 0; }
.nav-links a {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--text-subtle);
  font-size: 0.88rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-heading);
  background: rgba(255, 102, 0, 0.1);
  text-decoration: none;
}
.nav-links a.active { color: var(--brand-orange); }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown > a::after { content: ' \25BE'; font-size: 0.7em; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1001;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 0.4rem 1rem;
  border-radius: 0;
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-heading);
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: auto;
  padding: 0.25rem;
}

/* --- Page Layout --- */
.page-wrapper {
  margin-top: var(--nav-height);
  display: flex;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.page-content {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* --- Side Navigation (TOC) --- */
.side-nav {
  width: 220px;
  flex-shrink: 0;
  padding: 2rem 0 2rem 1rem;
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
  align-self: flex-start;
  max-height: calc(100vh - var(--nav-height) - 2rem);
  overflow-y: auto;
}
.side-nav-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}
.side-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.side-nav li { margin-bottom: 0.15rem; }
.side-nav a {
  display: block;
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
  color: var(--text-subtle);
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.side-nav a:hover {
  color: var(--text-body);
  border-left-color: var(--accent);
  background: rgba(255,255,255,0.03);
  text-decoration: none;
}
.side-nav a.active {
  color: var(--brand-orange);
  border-left-color: var(--brand-orange);
}
.side-nav .sub { padding-left: 1.2rem; font-size: 0.78rem; }

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-subtle);
  margin-bottom: 1.5rem;
}
.hero .version-badge {
  display: inline-block;
  background: rgba(255, 102, 0, 0.15);
  color: var(--brand-orange);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Feature Cards --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  transition: border-color 0.3s, transform 0.2s;
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.feature-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}
.feature-card h3 a { color: var(--text-heading); }
.feature-card h3 a:hover { color: var(--brand-orange); text-decoration: none; }
.feature-card p {
  color: var(--text-subtle);
  font-size: 0.9rem;
  margin-bottom: 0;
}
.feature-card .tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-orange);
  margin-bottom: 0.5rem;
}

/* --- Media Placeholders --- */
.media-placeholder {
  margin: 1.5rem 0;
}
.placeholder-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: rgba(194, 104, 40, 0.05);
  color: var(--text-subtle);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
  min-height: 120px;
}
.placeholder-box .icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.4rem;
}
.placeholder-box .label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.2rem;
  color: var(--text-body);
}
.placeholder-box .filename {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}
figcaption {
  font-size: 0.82rem;
  color: var(--text-subtle);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Aspect ratio containers */
.aspect-16-9 { aspect-ratio: 16 / 9; }
.aspect-4-3 { aspect-ratio: 4 / 3; }
.aspect-wide { aspect-ratio: 21 / 9; }

/* When images are present, replace placeholders */
.media-placeholder {
  text-align: center;
}
.media-placeholder img,
.media-placeholder video {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* --- Info Boxes --- */
.info-box {
  background: var(--bg-elevated);
  border-left: 3px solid var(--brand-orange);
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}
.info-box.tip { border-left-color: #4AE290; }
.info-box.warning { border-left-color: #E2A74A; }

/* --- Keyboard Key Styling --- */
kbd {
  display: inline-block;
  background: rgba(255, 102, 0, 0.12);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--brand-orange);
  box-shadow: 0 1px 0 rgba(194, 104, 40, 0.4);
  line-height: 1.4;
}

/* --- Highlights Row --- */
.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
  text-align: center;
}
.highlight-item {
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.highlight-item .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand-orange);
  display: block;
  margin-bottom: 0.3rem;
}
.highlight-item .label {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.85rem;
}
.site-footer a { color: var(--accent); }
.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
  list-style: none;
  padding: 0;
}

/* --- Page Header (tool pages) --- */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { margin-bottom: 0.5rem; }
.page-header .subtitle {
  font-size: 1.05rem;
  color: var(--text-subtle);
  margin-bottom: 1rem;
}
.page-header .badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text-subtle);
}
.badge.nuke { border-color: #4AE290; color: #4AE290; }
.badge.qt { border-color: #4A90E2; color: #4A90E2; }
.badge.python { border-color: #E2CF4A; color: #E2CF4A; }

/* --- Responsive --- */
@media (max-width: 1023px) {
  .side-nav { display: none; }
  .page-wrapper { display: block; }
  .feature-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

@media (max-width: 767px) {
  .top-nav { padding: 0 1rem; }
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
  }
  .hero h1 { font-size: 1.8rem; }
  .page-content { padding: 1.5rem 1rem 3rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .highlights { grid-template-columns: 1fr 1fr; }
  h2 { font-size: 1.3rem; }
}
