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

/* =====================
   VARIABLES
   ===================== */
:root {
  --bg:           #0a0a0f;
  --sidebar-bg:   #080810;
  --surface:      #111118;
  --surface-glass: rgba(17, 17, 24, 0.6);
  --accent:       #00f0ff;
  --accent-dim:   rgba(0, 240, 255, 0.08);
  --accent-glow:  rgba(0, 240, 255, 0.15);
  --violet:       #9b5dff;
  --magenta:      #ff2d78;
  --text:         #e8e8f0;
  --muted:        #5a5a7a;
  --border:       rgba(255, 255, 255, 0.06);
  --font-mono:    'JetBrains Mono', monospace;
  --font-sans:    'Inter', sans-serif;
  --sidebar-w:    220px;
  --radius-card:  14px;
  --radius-btn:   8px;
}

/* =====================
   BASE
   ===================== */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* =====================
   GRID OVERLAY
   ===================== */
.grid-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* =====================
   APP LAYOUT
   ===================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* =====================
   SIDEBAR
   ===================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 100;
}

.sidebar-top {
  margin-bottom: 2.5rem;
}

.sidebar-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

/* Status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  letter-spacing: 0.08em;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}

/* Nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-btn);
  border-left: 2px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  position: relative;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.nav-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  flex-shrink: 0;
}

.nav-link.active .nav-dot {
  opacity: 1;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* Sidebar bottom */
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.smoke-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.25s ease;
}

.smoke-toggle:hover:not(:disabled) {
  color: #ffb14a;
  border-color: rgba(255, 177, 74, 0.35);
  background: rgba(255, 120, 60, 0.08);
}

.smoke-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.smoke-toggle[aria-pressed='true'] {
  color: #ff9a3c;
  border-color: rgba(255, 154, 60, 0.55);
  background: rgba(255, 90, 50, 0.12);
  box-shadow:
    0 0 12px rgba(255, 140, 60, 0.45),
    0 0 28px rgba(255, 45, 120, 0.2);
}

.smoke-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.smoke-toggle-icon {
  display: block;
}

.smoke-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.sidebar-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar-link:hover {
  color: var(--accent);
}

/* =====================
   MAIN CONTENT
   ===================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}

/* =====================
   SECTIONS
   ===================== */
.section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 4rem;
  animation: fadeUp 0.5s ease both;
}

/* =====================
   HOME SECTION
   ===================== */
#home h1 {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 0 60px rgba(0, 240, 255, 0.15);
  margin-bottom: 1rem;
  line-height: 1.1;
}

.tagline {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.sub {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

.sub-attrib {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

/* =====================
   FOOTER
   ===================== */
.site-footer {
  position: fixed;
  bottom: 1.5rem;
  left: calc(var(--sidebar-w) + 2rem);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  z-index: 1;
}

/* =====================
   TOOLS SECTION
   ===================== */
#tools {
  justify-content: flex-start;
  padding-top: 5rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.section-header h2 {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.section-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

/* =====================
   TOOLS GRID
   ===================== */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 800px;
}

/* =====================
   TOOL CARD
   ===================== */
.tool-card {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: default;
}

.tool-card:hover {
  transform: scale(1.02);
  border-color: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.08), inset 0 0 20px rgba(0, 240, 255, 0.03);
}

.tool-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.tool-card-link:hover .tool-card-cta {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}

.tool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tool-name {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.tool-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

.tool-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tool-card-meta span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.tool-card-cta {
  margin-top: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* =====================
   STATUS BADGES
   ===================== */
.status-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.06em;
  font-weight: 400;
}

.status-badge.active {
  color: var(--accent);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.status-badge.wip {
  color: var(--violet);
  background: rgba(155, 93, 255, 0.08);
  border: 1px solid rgba(155, 93, 255, 0.2);
}

/* =====================
   ANIMATIONS
   ===================== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .smoke-toggle {
    transition: none;
  }
}

/* =====================
   SMOKE PLAYGROUND
   ===================== */
.main-content--smoke-playground {
  justify-content: flex-start;
  padding: 1.75rem 2rem 4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.smoke-playground-page-header {
  flex-shrink: 0;
}

.smoke-playground-title {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.smoke-playground-lede {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 36rem;
}

.smoke-playground-layout {
  display: flex;
  flex: 1;
  gap: 1.25rem;
  min-height: 0;
  align-items: stretch;
}

.smoke-playground-panel {
  width: 288px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem 1.1rem 1.15rem;
  max-height: min(720px, calc(100vh - 11rem));
  overflow: auto;
}

.smoke-playground-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.smoke-playground-panel-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.smoke-playground-reset {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.smoke-playground-reset:hover:not(:disabled) {
  color: var(--accent);
  border-color: rgba(0, 240, 255, 0.25);
  background: var(--accent-dim);
}

.smoke-playground-reset:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.smoke-playground-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.smoke-playground-fieldset:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.smoke-playground-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.smoke-playground-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.smoke-playground-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.smoke-playground-row input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.smoke-playground-viewport-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.smoke-playground-viewport {
  position: relative;
  flex: 1;
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 240, 255, 0.04);
}

.smoke-playground-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.smoke-playground-reduced {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--bg);
}

/* =====================
   MOBILE (< 768px)
   ===================== */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    z-index: 200;
  }

  .sidebar-top {
    margin-bottom: 0;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 0.25rem;
    flex: unset;
  }

  .nav-link {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 0.35rem 0.6rem;
  }

  .nav-link.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .sidebar-bottom {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    border-top: none;
    padding-top: 0;
    margin-left: 0.5rem;
  }

  .main-content {
    margin-left: 0;
    padding-top: 56px;
  }

  .section {
    padding: 2.5rem 1.5rem;
  }

  .site-footer {
    left: 1.25rem;
  }

  .main-content--smoke-playground {
    padding: 1rem 1.25rem 3.5rem;
  }

  .smoke-playground-layout {
    flex-direction: column;
  }

  .smoke-playground-panel {
    width: 100%;
    max-height: none;
  }

  .smoke-playground-viewport-wrap {
    min-height: 45vh;
  }
}
