/* OpenClaw Guide - Main Stylesheet */

:root {
  --primary: #2c5aa0;
  --primary-dark: #1e3f73;
  --accent: #e74c3c;
  --bg: #f7f9fc;
  --bg-card: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --border: #e2e8f0;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  --radius: 8px;
  --max-width: 1200px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* ===== Header / Navigation ===== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
}

.nav-menu {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-menu a {
  display: block;
  padding: 0.5rem 0.9rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-menu a:hover, .nav-menu a.active {
  background: var(--primary);
  color: white;
}

.mobile-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary);
}

/* ===== Top Leaderboard Ad ===== */
.ad-leaderboard {
  max-width: var(--max-width);
  margin: 1rem auto;
  padding: 0 1.5rem;
}

.ad-unit {
  background: linear-gradient(135deg, #fafbfc 0%, #f1f3f5 100%);
  border: 1px dashed #cbd5e0;
  border-radius: var(--radius);
  padding: 0.9rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.8rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.ad-unit .ad-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a0aec0;
  margin-bottom: 0.3rem;
}

.ad-unit.leaderboard { min-height: 90px; }
.ad-unit.rectangle { min-height: 250px; }
.ad-unit.skyscraper { min-height: 600px; }
.ad-unit.mobile-banner { min-height: 100px; }

/* ===== Main Layout ===== */
.container {
  max-width: var(--max-width);
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}

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

.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 3rem 2rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 700px;
}

.hero .cta-row {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 0;
  cursor: pointer;
  font-size: 0.95rem;
}

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

.btn-primary:hover { background: #c0392b; transform: translateY(-1px); }

.btn-secondary {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover { background: rgba(255,255,255,0.25); }

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

.card h2, .card h3 { color: var(--primary-dark); margin-bottom: 0.8rem; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.article-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.3rem;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.article-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.article-card .tag {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  margin-bottom: 0.7rem;
}

.article-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.article-card p {
  color: var(--text-light);
  font-size: 0.92rem;
  margin-bottom: 0.8rem;
}

.article-card a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.article-card a:hover { text-decoration: underline; }

/* ===== Sidebar Widgets ===== */
.widget {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.widget h3 {
  font-size: 1rem;
  margin-bottom: 0.8rem;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.4rem;
}

.widget ul { list-style: none; }

.widget ul li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.widget ul li:last-child { border-bottom: 0; }

.widget ul li a {
  color: var(--text);
  text-decoration: none;
}

.widget ul li a:hover { color: var(--accent); }

/* ===== Content Typography ===== */
.content h1 {
  font-size: 2rem;
  margin-bottom: 0.6rem;
  color: var(--primary-dark);
}

.content .meta {
  color: var(--text-light);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.content h2 {
  font-size: 1.5rem;
  margin: 1.8rem 0 0.8rem;
  color: var(--primary-dark);
}

.content h3 {
  font-size: 1.2rem;
  margin: 1.3rem 0 0.6rem;
  color: var(--primary-dark);
}

.content p { margin-bottom: 1rem; }

.content ul, .content ol {
  margin: 0.8rem 0 1.2rem 1.5rem;
}

.content li { margin-bottom: 0.4rem; }

.content code {
  background: #edf2f7;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  color: var(--accent);
}

.content pre {
  background: #2d3748;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
}

.content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-light);
  font-style: italic;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

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

.content th {
  background: var(--bg);
  font-weight: 600;
}

/* ===== In-Article Ad ===== */
.in-article-ad {
  margin: 1.5rem 0;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 2.5rem 1.5rem 1.2rem;
  margin-top: 3rem;
}

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

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

.site-footer a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  font-size: 0.9rem;
}

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

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

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .container { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .hero h1 { font-size: 1.8rem; }
}

@media (max-width: 640px) {
  .nav-menu { display: none; flex-direction: column; width: 100%; }
  .nav-menu.open { display: flex; }
  .mobile-toggle { display: block; }
  .nav-container { flex-direction: column; align-items: flex-start; }
  .hero { padding: 2rem 1.2rem; }
  .hero h1 { font-size: 1.5rem; }
}