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

:root {
  --dark: #1a1a2e;
  --dark-2: #16213e;
  --blue: #0f3460;
  --blue-light: #1a4a7a;
  --accent: #4fa3d9;
  --text: #333;
  --muted: #666;
  --border: #e5e5e5;
  --bg: #fff;
  --bg-light: #f7f8fa;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ===== Header / Nav ===== */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

header nav {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 46px;
  width: auto;
}

header nav > ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  align-items: center;
}

header nav > ul > li > a {
  text-decoration: none;
  color: var(--dark);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

header nav > ul > li > a:hover,
header nav > ul > li > a.active {
  color: var(--blue);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 190px;
  list-style: none;
  padding: 0.35rem 0;
  z-index: 100;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.dropdown-menu li a {
  display: block;
  padding: 0.55rem 1.1rem;
  text-decoration: none;
  color: var(--dark);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.dropdown-menu li a:hover {
  background: var(--bg-light);
  color: var(--blue);
}

.dropdown:hover .dropdown-menu {
  display: block;
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--dark);
  border-radius: 2px;
}

@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  header nav > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1.5rem 1rem;
    border-top: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  }

  header nav > ul.open {
    display: flex;
  }

  header nav > ul > li {
    width: 100%;
    padding: 0.4rem 0;
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
    background: transparent;
  }

  .dropdown-menu li a {
    padding: 0.4rem 0;
    font-size: 0.9rem;
  }
}

/* ===== Main ===== */
main {
  flex: 1;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background-image: linear-gradient(rgba(26, 26, 46, 0.75), rgba(26, 26, 46, 0.75)), var(--hero-bg, none);
  background-size: cover;
  background-position: center;
  padding: 5rem 1.5rem;
}

.hero-sm {
  min-height: 300px;
  padding: 4rem 1.5rem;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.hero-tagline {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 640px;
  margin: 0 auto 2rem;
}

.hero .hero-tagline {
  max-width: 640px;
}

/* ===== Sections ===== */
.section {
  padding: 4rem 0;
}

.section-tight {
  padding: 2.5rem 0;
}

.section-light {
  background: var(--bg-light);
}

.section h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--dark);
}

.section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
}

.lead {
  font-size: 1.125rem;
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 720px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--dark);
}

.license {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--blue);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.card p {
  color: #444;
  margin-bottom: 1rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.feature-grid .card {
  margin-bottom: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.6rem;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
}

.btn:hover {
  background: var(--blue-light);
}

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
}

.btn-secondary:hover {
  background: var(--blue);
  color: #fff;
}

.btn-white {
  background: #fff;
  color: var(--dark);
}

.btn-white:hover {
  background: #eef2f7;
}

.btn-light {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.btn-light:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
}

/* ===== Home category cards ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.category-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

.category-card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
}

.category-card .product-image {
  height: 200px;
}

.category-body {
  padding: 1.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.category-body h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.category-body p {
  color: var(--muted);
  margin-bottom: 1.25rem;
  flex: 1;
}

.category-body .btn {
  align-self: flex-start;
  margin-right: 0.5rem;
}

/* ===== Product grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.product-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

.product-card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
}

.product-image {
  height: 200px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-block {
  display: block;
  height: 100%;
}

.product-placeholder {
  color: #aaa;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.product-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-body h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.product-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  flex: 1;
}

.product-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 1rem;
}

.product-body .btn {
  align-self: flex-start;
}

/* ===== Product detail page ===== */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.product-gallery {
  position: sticky;
  top: 90px;
}

.product-gallery .product-image {
  height: 380px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-light);
}

.product-buy {
  padding: 1.5rem 0 0;
}

.product-buy h1 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--dark);
  line-height: 1.2;
}

.product-buy .product-price {
  font-size: 1.5rem;
  color: var(--dark);
  margin-bottom: 1.25rem;
}

.product-sku {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-top: -0.75rem;
  margin-bottom: 1.25rem;
}

.product-buy .btn {
  font-size: 1.1rem;
  padding: 0.9rem 2rem;
  width: 100%;
  text-align: center;
}

.spec-list {
  margin-top: 1.5rem;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.spec-list th,
.spec-list td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.spec-list th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 45%;
}

.spec-list tr:last-child td,
.spec-list tr:last-child th {
  border-bottom: none;
}

@media (max-width: 820px) {
  .product-detail {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .product-gallery {
    position: static;
  }

  .product-gallery .product-image {
    height: 260px;
  }
}

/* ===== GitHub link ===== */
.github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.github-link:hover {
  text-decoration: underline;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  text-align: left;
}

.breadcrumb a {
  color: var(--blue);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===== Coming soon ===== */
.coming-soon {
  text-align: center;
  padding: 4rem 1.5rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  margin-top: 2rem;
  color: var(--muted);
}

.coming-soon h3 {
  color: var(--dark);
  margin-bottom: 0.5rem;
}

/* ===== Diagrams / code blocks ===== */
.diagram {
  background: var(--dark);
  color: var(--accent);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
  margin-top: 1rem;
}

/* ===== Muted ===== */
.muted {
  color: #888;
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ===== Protocol table ===== */
.proto-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.proto-table th,
.proto-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.proto-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

/* ===== Comparison table ===== */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.compare-table th,
.compare-table td {
  border: 1px solid var(--border);
  padding: 0.7rem 0.9rem;
  text-align: left;
  vertical-align: top;
  color: #444;
}

.compare-table thead th {
  background: var(--dark);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}



.compare-table tbody th {
  background: var(--bg);
  color: var(--dark);
  font-weight: 600;
  white-space: nowrap;
}

.compare-table td.compare-self {
  background: rgba(0, 133, 201, 0.06);
}

.compare-table thead th.compare-self {
  background: var(--accent);
  color: #fff;
}

/* ===== Table of contents sidebar ===== */
.toc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 3rem;
  align-items: start;
  padding-top: 2rem;
}

.toc-main {
  min-width: 0;
}

.toc-main .container {
  max-width: none;
  margin: 0;
  padding: 0;
}

.toc-about .toc-main .container {
  padding-left: 2.5rem;
}

.toc-layout.toc-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.toc-layout.toc-hidden .toc-side {
  display: none;
}

.toc-main .section {
  padding: 3.5rem 0;
}

.toc-main [id] {
  scroll-margin-top: 110px;
}

.toc-side {
  position: sticky;
  top: 96px;
}

.toc-nav {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
}

.toc-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.toc-nav a {
  display: block;
  padding: 0.35rem 0;
  color: #666;
  font-size: 0.9rem;
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1.25rem;
  padding-left: 1.25rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-nav a:hover {
  color: var(--dark);
}

.toc-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

@media (max-width: 1280px) {
  .toc-layout {
    grid-template-columns: 1fr;
  }
  .toc-side {
    display: none;
  }
}

/* ===== Lists in cards ===== */
.card ul {
  padding-left: 1.25rem;
  color: #444;
}

.card ul li {
  margin-bottom: 0.35rem;
}

/* ===== Location layout ===== */
.location-layout {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.location-info {
  flex: 1;
}

.location-info h2 {
  margin-bottom: 1rem;
}

.location-info p {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.location-info p:last-child {
  margin-bottom: 0;
}

.location-image {
  flex-shrink: 0;
  width: 340px;
  border-radius: 8px;
  overflow: hidden;
}

.location-image img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 700px) {
  .location-layout {
    flex-direction: column;
  }

  .location-image {
    width: 100%;
  }
}

/* ===== Team Members ===== */
.member {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.member:last-child {
  margin-bottom: 0;
}

.member-photo {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  color: var(--dark);
}

.member-role {
  font-size: 0.875rem;
  color: var(--blue);
  font-weight: 600;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.member-info p {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.member-info p:last-child {
  margin-bottom: 0;
}

/* ===== Contact form ===== */
.contact-form {
  max-width: 620px;
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--dark);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.form-status {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.form-status.success {
  color: #16a34a;
}

.form-status.error {
  color: #dc2626;
}

/* ===== Filter bar (tutorials) ===== */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

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

/* ===== Tutorial grid ===== */
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.tutorial-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.tutorial-video {
  aspect-ratio: 16 / 9;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-video iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.tutorial-placeholder {
  text-align: center;
  color: #888;
}

.tutorial-placeholder p {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.tutorial-hint {
  font-size: 0.75rem !important;
  color: #666 !important;
}

.tutorial-hint code {
  background: #333;
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
}

.tutorial-body {
  padding: 1.25rem;
}

.tutorial-body h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: var(--dark);
}

.tutorial-body p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== Footer ===== */
footer {
  background: var(--dark);
  color: #cfd3dc;
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-col h4 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.footer-col p,
.footer-col a {
  color: #b8bcc7;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  text-decoration: none;
}

.footer-col a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  color: #8a8e9a;
}

/* ===== Purchase tabs ===== */
.purchase-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--bg-light);
  color: var(--text);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
}

.tab:hover {
  color: var(--blue);
}

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

.tab-panel {
  display: none;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 8px;
  background: #fff;
}

.tab-panel.active {
  display: block;
}

.tab-panel .config-fields {
  grid-template-columns: 1fr;
}

/* ===== Configure / Upload UI ===== */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.config-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-weight: 600;
  color: var(--dark);
  font-size: 0.95rem;
}

.field .req {
  color: #d23;
}

.field input[type="file"] {
  width: 100%;
  padding: 0.9rem;
  border: 1px dashed var(--blue);
  border-radius: 8px;
  background: var(--bg-light);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.field input[type="file"]:hover {
  border-color: var(--accent);
}

.field input[type="email"],
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.field input[type="email"]:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.field textarea {
  resize: vertical;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.config-cta {
  margin-top: -0.5rem;
  font-size: 0.85rem;
  background: var(--bg-light);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 0.9rem;
  border-radius: 0 6px 6px 0;
}

.config-form .btn[type="submit"] {
  align-self: flex-start;
}

@media (max-width: 720px) {
  .config-fields {
    grid-template-columns: 1fr;
  }
}
