/* OpenClaw Website - Complete CSS Framework */
:root {
  /* Color Palette */
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary-color: #1e40af;
  --success-color: #059669;
  --warning-color: #d97706;
  --danger-color: #dc2626;
  --info-color: #0ea5e9;
  --dark-color: #1f2937;
  --light-color: #f3f4f6;
  --border-color: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  --font-mono: 'Courier New', Courier, monospace;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.6;
  font-size: 16px;
}

/* Header & Navigation */
header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  position: relative;
  top: -15px;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

nav a:hover {
  color: var(--primary-color);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Container & Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Responsive video embed (16:9) */
.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 1rem 0;
  overflow: hidden;
}
.video-wrapper::before {
  content: "";
  display: block;
  padding-bottom: 56.25%; /* 16:9 */
}
.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Breadcrumbs */
.breadcrumbs {
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.breadcrumbs a {
  color: var(--text-secondary);
}

.breadcrumbs span {
  margin: 0 0.5rem;
}

/* Cards */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h3 {
  margin-top: 0;
  color: var(--primary-color);
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}

.alert-info {
  background: #dbeafe;
  border-color: var(--info-color);
  color: #1e40af;
}

.alert-success {
  background: #d1fae5;
  border-color: var(--success-color);
  color: #065f46;
}

.alert-warning {
  background: #fef3c7;
  border-color: var(--warning-color);
  color: #92400e;
}

.alert-danger {
  background: #fee2e2;
  border-color: var(--danger-color);
  color: #991b1b;
}

.alert strong {
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

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

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

/* Code Blocks */
pre {
  background: var(--dark-color);
  color: #e5e7eb;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--light-color);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--danger-color);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

thead {
  background: var(--bg-secondary);
}

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

th {
  font-weight: 600;
  color: var(--text-primary);
}

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

tbody tr:hover {
  background: var(--bg-secondary);
}

/* Lists */
ul, ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

/* Utility Classes */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }

/* Footer */
footer {
  background: var(--dark-color);
  color: #e5e7eb;
  margin-top: 4rem;
  padding: 3rem 0 1rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-section h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.footer-section ul {
  list-style: none;
  margin: 0;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 2rem 2rem 0;
  border-top: 1px solid #374151;
  text-align: center;
  color: #9ca3af;
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-container {
    flex-wrap: wrap;
    padding: 1rem;
  }

  nav {
    display: none;
    width: 100%;
    margin-top: 1rem;
  }

  nav.active {
    display: block;
  }

  nav ul {
    flex-direction: column;
    gap: 1rem;
  }

  .mobile-menu-toggle {
    display: block;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .container {
    padding: 1rem;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 0.9rem;
  }

  th, td {
    padding: 0.5rem;
  }
}

/* Print Styles */
@media print {
  header, footer, nav {
    display: none;
  }

  .container {
    max-width: 100%;
  }

  a {
    text-decoration: underline;
    color: black;
  }
}

/* ========== Index page: horizontal nav with dropdowns (index.html) ========== */
/* 一级菜单水平，二级菜单竖直 */
nav .nav-list {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
}
nav .nav-list > li {
  position: relative;
}
nav .nav-list > li > a,
nav .nav-list > li > .nav-trigger {
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  display: block;
}
nav .nav-list > li > .nav-trigger {
  background: none;
  border: none;
  font-size: inherit;
  cursor: pointer;
  font-family: inherit;
}
nav .nav-list > li:hover > a,
nav .nav-list > li:hover > .nav-trigger {
  color: var(--primary-color);
}
/* 二级菜单：竖直排列，在一级下方展开 */
nav .nav-dropdown {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 200;
  max-height: 70vh;
  overflow-y: auto;
}
nav .nav-list > li:hover > .nav-dropdown,
nav .nav-list > li > .nav-dropdown:hover {
  opacity: 1;
  visibility: visible;
}
nav .nav-list > li > .nav-dropdown {
  overflow: visible;
  max-height: 85vh;
}
nav .nav-dropdown > li {
  display: block;
  position: relative;
}
nav .nav-dropdown > li > a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.9rem;
  white-space: nowrap;
}
nav .nav-dropdown > li > a:hover {
  background: var(--light-color);
  color: var(--primary-color);
}
/* 三级菜单：二级项右侧展开 */
nav .nav-item-has-submenu > .nav-sub-trigger {
  display: block;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: default;
  white-space: nowrap;
}
nav .nav-item-has-submenu > .nav-sub-trigger::after {
  content: " \203A";
  margin-left: 0.25rem;
}
nav .nav-dropdown-level2 {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: -2px;
  min-width: 200px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 201;
  max-height: 70vh;
  overflow-y: auto;
}
nav .nav-item-has-submenu:hover > .nav-dropdown-level2,
nav .nav-dropdown-level2:hover {
  opacity: 1;
  visibility: visible;
}
nav .nav-dropdown-level2 li {
  display: block;
}
nav .nav-dropdown-level2 a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.9rem;
  white-space: nowrap;
}
nav .nav-dropdown-level2 a:hover {
  background: var(--light-color);
  color: var(--primary-color);
}
@media (max-width: 768px) {
  nav .nav-list {
    flex-direction: column;
    align-items: stretch;
  }
  nav .nav-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    max-height: none;
    display: none;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
  }
  nav .nav-list > li:hover > .nav-dropdown {
    display: block;
  }
  nav .nav-dropdown-level2 {
    position: static;
    opacity: 1;
    visibility: visible;
    display: none;
    box-shadow: none;
    border: none;
    padding-left: 1.5rem;
    max-height: none;
  }
  nav .nav-item-has-submenu:hover > .nav-dropdown-level2 {
    display: block;
  }
}
