/* ==========================================================================
   Design tokens — SyncSoft
   Colors derived from the SyncSoft logo (blue -> teal gradient)
   ========================================================================== */
:root {
  --blue: #0089ec;
  --blue-strong: #0072c6;
  --teal: #01c49a;
  --teal-strong: #00a683;
  --gradient: linear-gradient(135deg, var(--blue), var(--teal));

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.45);
}

/* ---- Dark theme (default) ---- */
:root,
html[data-theme="dark"] {
  --bg: #0e1116;
  --bg-raised: #151922;
  --surface: #1a1f2b;
  --surface-hover: #212736;
  --border: #262c3a;
  --text: #eef1f6;
  --text-muted: #9aa3b5;
  --text-faint: #626b7d;
  --accent: var(--teal);
  --accent-strong: #35d9b0;
  --accent-blue: var(--blue);
  --flash-success-bg: #0f2620;
  --flash-success-fg: #4fe0b6;
  --flash-success-border: #1c4438;
  --flash-error-bg: #2a1417;
  --flash-error-fg: #f0919e;
  --flash-error-border: #4a2530;
}

/* ---- Light theme ---- */
html[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-raised: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f0f4f9;
  --border: #dfe4ec;
  --text: #12161d;
  --text-muted: #565f70;
  --text-faint: #8991a0;
  --accent: var(--blue);
  --accent-strong: var(--blue-strong);
  --accent-blue: var(--blue);
  --shadow: 0 12px 30px -14px rgba(20, 30, 50, 0.18);
  --flash-success-bg: #e6f9f3;
  --flash-success-fg: #027a5f;
  --flash-success-border: #b7ecdc;
  --flash-error-bg: #fdeced;
  --flash-error-fg: #b4293b;
  --flash-error-border: #f6c6cc;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; color: var(--text-muted); }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

code, .mono { font-family: var(--font-mono); }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.site-nav { display: flex; gap: 24px; align-items: center; }
.site-nav a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.site-nav a:hover { color: var(--text); }

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-accent {
  background: var(--gradient);
  color: #fff;
}
.btn-accent:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); }

.btn-danger {
  background: transparent;
  border-color: #4a2530;
  color: #d98a97;
}
.btn-danger:hover { background: color-mix(in srgb, #d98a97 15%, transparent); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: 96px 0 64px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -120px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, color-mix(in srgb, var(--teal) 30%, transparent), transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -220px;
  left: -140px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, color-mix(in srgb, var(--blue) 25%, transparent), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  display: inline-block;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 58px);
  max-width: 820px;
  color: var(--text);
  position: relative;
}

.hero h1 em {
  font-style: normal;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lead {
  max-width: 560px;
  font-size: 17px;
  margin-top: 18px;
}

.hero-stats {
  display: flex;
  gap: 40px;
  margin-top: 44px;
  flex-wrap: wrap;
}
.hero-stat .num {
  font-family: var(--font-mono);
  font-size: 28px;
  color: var(--text);
  font-weight: 500;
}
.hero-stat .label {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ==========================================================================
   Module grid / cards
   ========================================================================== */
.section { padding: 64px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 24px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.module-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.module-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.module-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}
.module-icon.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  background: var(--gradient);
  color: #fff;
  font-size: 18px;
}

.module-card h3 { font-size: 18px; margin: 0; }
.module-card .tech-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.module-card .desc {
  font-size: 14px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  flex-grow: 1;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.chip.chip-accent {
  border-color: var(--teal);
  color: var(--accent-strong);
}
.chip.chip-gold {
  border-color: var(--blue);
  color: var(--accent-blue);
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 24px;
  text-align: center;
  color: var(--text-faint);
}

/* ==========================================================================
   Version timeline (signature element)
   ========================================================================== */
.version-timeline {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding: 4px 0 12px;
  gap: 0;
}
.version-node {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.version-node .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gradient);
  border: 2px solid var(--accent-strong);
  flex-shrink: 0;
}
.version-node .line {
  width: 34px;
  height: 2px;
  background: var(--border);
}
.version-node .v-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 10px 0 8px;
  white-space: nowrap;
}

/* ==========================================================================
   Module detail page
   ========================================================================== */
.detail-header {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
}
.detail-top {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}
.detail-icon {
  width: 76px;
  height: 76px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  object-fit: cover;
  flex-shrink: 0;
}
.detail-title h1 { font-size: 34px; margin-bottom: 6px; }
.detail-title .authors { color: var(--text-faint); font-size: 14px; }

.detail-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
  padding: 48px 0;
}
@media (max-width: 820px) {
  .detail-body { grid-template-columns: 1fr; }
}

.prose { font-size: 15px; color: var(--text); }
.prose h2, .prose h3 { margin-top: 1.6em; font-size: 19px; }
.prose ul { color: var(--text-muted); }
.prose img { border-radius: var(--radius-sm); margin: 12px 0; border: 1px solid var(--border); }
.prose p { color: var(--text-muted); }

.screenshot-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin: 24px 0 8px;
}
.screenshot-strip img {
  height: 200px;
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.spec-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.spec-card h4 {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: lowercase;
  color: var(--text-faint);
  margin-bottom: 16px;
}
.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.spec-row:last-child { border-bottom: none; }
.spec-row .k { color: var(--text-faint); }
.spec-row .v { color: var(--text); text-align: right; font-family: var(--font-mono); font-size: 12px; }

/* ==========================================================================
   Forms / auth
   ========================================================================== */
.auth-wrap {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}
.auth-card .brand { justify-content: center; margin-bottom: 20px; font-size: 18px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; text-align: center; }
.auth-card p.lead { font-size: 14px; margin-bottom: 28px; text-align: center; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}
.field .hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}
.checkbox-field input { width: auto; }

/* ==========================================================================
   Flash messages
   ========================================================================== */
.flash-wrap { padding-top: 18px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
.flash-success { border-color: var(--flash-success-border); color: var(--flash-success-fg); background: var(--flash-success-bg); }
.flash-error { border-color: var(--flash-error-border); color: var(--flash-error-fg); background: var(--flash-error-bg); }

/* ==========================================================================
   Admin dashboard
   ========================================================================== */
.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 14px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 28px;
}
.admin-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--surface); }
.status-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.status-pill.on { color: var(--accent-strong); border-color: var(--teal); }
.status-pill.off { color: var(--text-faint); }
.row-actions { display: flex; gap: 8px; }

/* ==========================================================================
   Footer / misc
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 40px;
  color: var(--text-faint);
  font-size: 13px;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.site-footer .foot-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-footer img { width: 18px; height: 18px; border-radius: 5px; }

.not-found {
  text-align: center;
  padding: 120px 24px;
}
.not-found .code {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 14px;
}
