/* === AgentFlow HK — Clean Coder-Inspired Design === */
/* Balanced, readable, consistent spacing & typography */

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

:root {
  --color-bg: #f4f4f4;
  --color-surface: #ffffff;
  --color-sidebar: #1a1a2e;
  --color-sidebar-hover: #232342;
  --color-sidebar-text: #9999b3;
  --color-sidebar-active: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #555577;
  --color-text-muted: #8888aa;
  --color-accent: #18e299;
  --color-accent-hover: #0fa76e;
  --color-accent-bg: #d4fae8;
  --color-border: #e6e6ec;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 8px;
  --sidebar-width: 220px;
  --content-max: 680px;
}

html { font-size: 15px; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

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

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff !important;
  letter-spacing: -0.02em;
}

.sidebar-desc {
  font-size: 0.7rem;
  color: var(--color-sidebar-text);
  margin-top: 0.2rem;
}

.sidebar-nav { padding: 0.5rem 0; flex: 1; }

.sidebar-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-sidebar-text);
  padding: 1rem 1.25rem 0.35rem;
  opacity: 0.5;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1.25rem;
  font-size: 0.85rem;
  color: var(--color-sidebar-text) !important;
  border-left: 2px solid transparent;
  transition: all 0.12s;
}

.sidebar-item:hover {
  color: var(--color-sidebar-active) !important;
  background: var(--color-sidebar-hover);
}

.sidebar-item.active {
  color: var(--color-sidebar-active) !important;
  background: var(--color-sidebar-hover);
  border-left-color: var(--color-accent);
}

.sidebar-icon { width: 18px; text-align: center; font-size: 0.8rem; }

.sidebar-base {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.75rem;
}

.lang-switch {
  display: flex;
  gap: 0.25rem;
}

.lang-btn {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--color-sidebar-text) !important;
}

.lang-btn:hover { color: var(--color-sidebar-active) !important; }

.lang-btn.on {
  background: var(--color-accent);
  color: #111 !important;
}

/* ===== Main Content ===== */
.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.main-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  color: #fff;
}

.hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 0.9rem;
  opacity: 0.75;
  margin-bottom: 1.25rem;
}

.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.12s;
}

.btn-primary {
  background: var(--color-accent);
  color: #111 !important;
}

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

.btn-second {
  background: rgba(255,255,255,0.08);
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.15);
}

.btn-second:hover { background: rgba(255,255,255,0.15); }

/* ===== Section ===== */
.sec { margin-bottom: 2rem; }

.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sec-title {
  font-size: 1rem;
  font-weight: 600;
}

.sec-link {
  font-size: 0.8rem;
  color: var(--color-text-muted) !important;
}

.sec-link:hover { color: var(--color-accent) !important; }

/* ===== Category Cards ===== */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.cat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: all 0.15s;
}

.cat-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgba(24,226,153,0.08);
}

.cat-card .icon { font-size: 1.2rem; margin-bottom: 0.35rem; }

.cat-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.cat-card p {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ===== Post Cards ===== */
.post-grid { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 2rem; }

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: all 0.12s;
}

.post-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 6px rgba(24,226,153,0.06);
}

.card-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.card-meta span { margin-right: 0.5rem; }

.card-cat {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--color-accent-hover);
  font-size: 0.6rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

.card-title a { color: var(--color-text) !important; }
.card-title a:hover { color: var(--color-accent) !important; }

.card-desc {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.card-tags { margin-top: 0.5rem; display: flex; gap: 0.35rem; flex-wrap: wrap; }

.tag {
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--color-accent-bg);
  color: var(--color-accent-hover);
}

/* ===== Tag Cloud ===== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-cloud a {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 14px;
  background: var(--color-sidebar);
  color: var(--color-sidebar-text) !important;
  transition: all 0.12s;
}

.tag-cloud a:hover {
  background: var(--color-accent);
  color: #111 !important;
}

/* ===== Single Post ===== */
.post-header { margin-bottom: 1.5rem; }

.post-cat {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--color-accent-hover);
  background: var(--color-accent-bg);
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.post-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.post-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.post-meta time { margin-right: 0.75rem; }

.post-content {
  font-size: 0.9rem;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}

.post-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.35rem;
}

.post-content p { margin-bottom: 0.75rem; }

.post-content ul, .post-content ol { margin: 0 0 0.75rem 1.25rem; }
.post-content li { margin-bottom: 0.2rem; }

.post-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.6rem 1rem;
  margin: 0.75rem 0;
  background: var(--color-accent-bg);
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--color-sidebar);
  color: var(--color-accent);
  padding: 1px 5px;
  border-radius: 3px;
}

.post-content pre {
  background: var(--color-sidebar);
  padding: 0.85rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0.75rem 0;
}

.post-content pre code { background: none; color: inherit; padding: 0; }

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.8rem;
}

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

.post-content th {
  background: var(--color-sidebar);
  color: #fff;
  font-weight: 600;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
}

.post-nav a { max-width: 45%; color: var(--color-text-secondary) !important; }
.post-nav a:hover { color: var(--color-accent) !important; }

/* ===== Section List (posts, best) ===== */
.section-list h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.section-list .desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.footer-brand .title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.footer-brand .desc {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.footer-col .label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}

.footer-col a {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-secondary) !important;
  margin-bottom: 0.2rem;
}

.footer-col a:hover { color: var(--color-accent) !important; }

.footer-ft {
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.4rem 1rem;
    z-index: 100;
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    border: none;
    flex: 1;
  }

  .sidebar-desc { display: none; }

  .sidebar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
  }

  .sidebar-label { display: none; }

  .sidebar-item {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-left: none;
    border-radius: 4px;
    white-space: nowrap;
  }

  .sidebar-icon { display: none; }

  .sidebar-base {
    padding: 0;
    border: none;
    width: auto;
    text-align: right;
  }

  .main-wrap { margin-left: 0; }
  .main-content { padding: 1.25rem 1rem; }
  .cat-grid { grid-template-columns: 1fr; }
  .hero { padding: 1.5rem 1.25rem; border-radius: 0; margin: -1.25rem -1rem 1.5rem; }
  .hero h1 { font-size: 1.3rem; }
  .post-title { font-size: 1.3rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .post-nav { flex-direction: column; gap: 0.5rem; }
  .post-nav a { max-width: 100%; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.15rem; }
  .hero { padding: 1.25rem 1rem; }
}
