/* Plumb 3D — plumb3d.tnhc.dev */
:root {
  --bg: #07091a;
  --bg-elev: #0c1026;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --border: rgba(255, 255, 255, 0.09);
  --fg: #e2ecf8;
  --muted: #7f92b5;
  --dim: #1c2540;
  --accent: #22d3ee;
  --accent-glow: rgba(34, 211, 238, 0.14);
  --accent-line: rgba(34, 211, 238, 0.32);
  --clay: #e2733c;
  --clay-glow: rgba(226, 115, 60, 0.16);
  --gold: #eab308;
  --green: #34d399;
  --nav-bg: rgba(7, 9, 26, 0.78);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef3fa;
  --bg-elev: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-hover: rgba(255, 255, 255, 0.96);
  --border: rgba(12, 22, 40, 0.1);
  --fg: #0c1628;
  --muted: #526382;
  --dim: #d4dcf0;
  --accent: #0284c7;
  --accent-glow: rgba(2, 132, 199, 0.1);
  --accent-line: rgba(2, 132, 199, 0.35);
  --clay: #c2410c;
  --clay-glow: rgba(194, 65, 12, 0.12);
  --nav-bg: rgba(238, 243, 250, 0.85);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

#viewport-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 65% at 50% 35%, transparent 15%, var(--bg) 90%);
}

/* ── Navigation ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.1rem;
}

.brand-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--clay-glow);
  color: var(--clay);
  border: 1px solid rgba(226, 115, 60, 0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.18s;
}

.nav-links a:hover { color: var(--fg); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  transition: background 0.18s, border-color 0.18s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent-line);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #04101f;
  box-shadow: 0 8px 28px rgba(34, 211, 238, 0.25);
}

.btn-clay {
  background: linear-gradient(135deg, var(--clay), #ea580c);
  color: #ffffff;
  box-shadow: 0 8px 28px rgba(226, 115, 60, 0.28);
}

.btn-ghost {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--accent-line);
}

/* ── Main Layout ── */
main {
  position: relative;
  z-index: 2;
}

.section {
  max-width: 1240px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
}

.section-header {
  max-width: 720px;
  margin-bottom: 3rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.85rem;
}

.section-header h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.9rem;
}

.section-header p {
  color: var(--muted);
  font-size: 1.05rem;
}

/* ── Hero ── */
.hero {
  min-height: 100dvh;
  max-width: 1240px;
  margin: 0 auto;
  padding: 7.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 3rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-glow);
  backdrop-filter: blur(10px);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2.2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(2.6rem, 5.2vw, 4.35rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin-bottom: 1.25rem;
}

.gradient-text {
  background: linear-gradient(120deg, var(--accent) 0%, #60a5fa 48%, var(--clay) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 58ch;
  margin-bottom: 2rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fg);
}

.stat-lbl {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Interactive Hero Preview Card ── */
.hero-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

#orbit-preview {
  width: 100%;
  height: 320px;
  display: block;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 45%, rgba(34, 211, 238, 0.08), rgba(7, 9, 26, 0.85));
  cursor: grab;
}

#orbit-preview:active { cursor: grabbing; }

.stage-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.pill-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  cursor: pointer;
  transition: all 0.16s;
}

.pill-btn.active, .pill-btn:hover {
  color: var(--fg);
  border-color: var(--accent-line);
  background: var(--accent-glow);
}

.pill-btn.clay.active {
  color: #fff;
  border-color: rgba(226, 115, 60, 0.6);
  background: var(--clay);
}

/* ── Cards & Grids ── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.45rem;
  backdrop-filter: blur(10px);
  transition: transform 0.18s, border-color 0.2s, background 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  background: var(--surface-hover);
}

.card-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-glow);
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.card-tag.clay {
  background: var(--clay-glow);
  color: var(--clay);
}

.card h3 {
  font-size: 1.12rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
}

.card p {
  font-size: 0.92rem;
  color: var(--muted);
}

/* ── Tabs ── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.tab-btn {
  padding: 0.55rem 1rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.18s;
}

.tab-btn.active {
  background: var(--clay);
  border-color: var(--clay);
  color: #fff;
}

.tab-panel { display: none; }
.tab-panel.active { display: grid; }

/* ── Gallery ── */
.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
}

.gallery-card img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.gallery-meta {
  padding: 1rem 1.2rem;
}

.gallery-meta h4 { font-size: 1rem; margin-bottom: 0.25rem; }
.gallery-meta p { font-size: 0.84rem; color: var(--muted); }

/* ── Code / CLI Blocks ── */
.code-box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.3rem;
  position: relative;
}

.code-box pre {
  font-size: 0.85rem;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--fg);
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.copy-btn:hover { color: var(--fg); border-color: var(--accent-line); }

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

tr:last-child td { border-bottom: none; }

kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--dim);
  border: 1px solid var(--border);
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 6, 16, 0.9);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox.open { display: flex; }

.lightbox-inner {
  max-width: 1080px;
  width: 100%;
  text-align: center;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.lightbox-caption {
  margin-top: 0.9rem;
  color: #e2ecf8;
  font-size: 0.95rem;
}

/* ── Footer ── */
footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

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

/* ── Responsive ── */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding-top: 6.5rem; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-links { display: none; }
}

@media (max-width: 640px) {
  .grid-3, .grid-4, .grid-2, .stats-row { grid-template-columns: 1fr; }
}
