/* Global Light Theme Styles - shared across index and blog pages */

:root {
  --bg: #ffffff;
  --panel: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --brand: #3b82f6; /* primary */
  --brand-2: #34d399; /* secondary */
  --border: #e2e8f0;
  --card: #ffffff;
  --code: #0b1220;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow: 0 8px 30px rgba(15, 23, 42, .12);
  --radius: 16px;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.7 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(59,130,246,.08), transparent),
    radial-gradient(900px 600px at 100% 0, rgba(52,211,153,.10), transparent),
    var(--bg);
  line-height: 1.6;
}

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

/* Links */
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header & Nav */
header { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px); background: rgba(255,255,255,.95); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 12px; }

/* Brand for index (with badge) */
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: .2px; color: var(--text); }
/* Replace gradient badge with actual image logo */
.brand-badge { width: 36px; height: 36px; border-radius: 10px; background: url('/168.jpeg') center/cover no-repeat; box-shadow: var(--shadow-sm); }

/* Navigation links */
nav ul { display: flex; list-style: none; gap: 20px; margin: 0; padding: 0; }
nav a { color: var(--text); opacity: .9; }
.nav .links { display: flex; gap: 16px; align-items: center; }
.nav a.brand { font-weight: 700; color: var(--text); letter-spacing: .2px; }

/* CTA button */
.cta { display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; padding: 10px 14px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow-sm); }

/* Layout */
main { max-width: 900px; margin: 28px auto; padding: 0 16px; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.grid > .card { grid-column: span 4; }
@media (max-width: 960px) { 
  .grid { grid-template-columns: repeat(6, 1fr); } 
  .grid > .card { grid-column: span 6; }
  nav ul { display: none; }
}
@media (max-width: 640px) { 
  .grid { grid-template-columns: repeat(2, 1fr); } 
  .grid > .card { grid-column: span 2; }
}
@media (max-width: 560px) { .card { grid-column: span 12; } }

/* Cards & Badges */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.card h3 { margin: 4px 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); }
.card ul { margin: 10px 0 0 18px; }
.card.posts { transition: box-shadow .2s ease, transform .1s ease; }
.card.posts:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.badge { display: inline-block; font-size: 12px; padding: 4px 8px; border-radius: 999px; background: rgba(59,130,246,.12); color: #1d4ed8; border: 1px solid rgba(59,130,246,.25); font-weight: 600; }

/* Typography */
h1 { font-size: 28px; margin: 10px 0 6px; }
h2 { font-size: 22px; margin: 20px 0 8px; }
h3 { font-size: 18px; margin: 14px 0 8px; }
p { margin: 8px 0; }
ul, ol { padding-left: 22px; }

.section-title { font-size: 26px; margin: 4px 0 8px; }
.section-desc { color: var(--muted); margin: 0 0 16px; }

/* Hero (index page) */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h2 { font-size: 40px; margin: 0 0 12px; line-height: 1.2; }
.hero p { color: var(--muted); margin: 0 auto 24px; max-width: 720px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Sections */
section { padding: 64px 0; }

/* Container sections with increased spacing */
section.container { padding: 36px 0; }

/* Blog: breadcrumbs, header, meta */
.breadcrumbs, .breadcrumb { font-size: 13px; color: var(--muted); margin: 8px 0 18px; }
.breadcrumbs a, .breadcrumb a { color: var(--muted); opacity: .8; }
.breadcrumb a:hover { opacity: 1; }
.post-header { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.meta { color: var(--muted); font-size: 13px; }
.post-meta { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* Article layouts (blog pages) */
.article-header { padding: 40px 0 20px; text-align: center; }
.article-header h1 { font-size: 32px; margin: 0 0 12px; line-height: 1.2; }
.article-meta { color: var(--muted); margin: 0 0 20px; }
.article-content { max-width: 900px; margin: 0 auto; padding: 0 20px 40px; }
.article-content h2 { font-size: 24px; margin: 32px 0 16px; color: var(--text); border-bottom: 2px solid rgba(59,130,246,.3); padding-bottom: 8px; }
.article-content h3 { font-size: 20px; margin: 24px 0 12px; color: var(--brand); }
.article-content h4 { font-size: 18px; margin: 20px 0 10px; color: var(--text); }
.article-content p { margin: 0 0 16px; line-height: 1.8; }
.article-content ul, .article-content ol { margin: 16px 0; padding-left: 24px; }
.article-content li { margin: 8px 0; line-height: 1.6; }
.article-content strong { color: var(--brand); }
.article-content blockquote { border-left: 4px solid var(--brand); padding-left: 16px; margin: 16px 0; color: var(--muted); font-style: italic; }

/* Buttons */
.btn { display: inline-block; padding: 12px 18px; border-radius: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.btn.primary { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; border: none; }
.btn.secondary { background: rgba(59,130,246,.06); color: var(--text); }

/* Tables */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { text-align: left; color: var(--muted); font-weight: 600; }
tr:hover td { background: rgba(59,130,246,.05); }

/* Idea blocks */
.idea { margin: 14px 0; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; background: #fff; }
.idea strong { color: #1d4ed8; }

/* Special content blocks */
.tip { border-left: 3px solid var(--brand); padding: 8px 12px; background: rgba(59,130,246,.08); border-radius: 8px; }
.note { background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(52,211,153,.05)); border: 1px solid rgba(59,130,246,.2); border-radius: var(--radius); padding: 16px; margin: 16px 0; }

/* Code blocks */
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.article-content code { background: rgba(59,130,246,.1); padding: 2px 6px; border-radius: 4px; font-size: 14px; color: var(--brand); }
.article-content pre { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 16px 0; overflow-x: auto; }
.article-content pre code { background: none; padding: 0; color: var(--text); }
pre { background: #f1f5f9; border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow: auto; }

/* Structured elements for complex articles */
.architecture-box { background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 20px 0; box-shadow: var(--shadow-sm); }
.problem-section { background: linear-gradient(135deg, rgba(239,68,68,.1), rgba(239,68,68,.05)); border: 1px solid rgba(239,68,68,.2); border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.problem-section h3 { color: var(--danger); margin-top: 0; }
.solution-section { background: linear-gradient(135deg, rgba(34,197,94,.1), rgba(34,197,94,.05)); border: 1px solid rgba(34,197,94,.2); border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.solution-section h4 { color: var(--ok); margin-top: 0; }
.step-card { background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 16px 0; box-shadow: var(--shadow-sm); }
.step-number { display: inline-block; width: 32px; height: 32px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 50%; text-align: center; line-height: 32px; font-weight: 700; margin-right: 12px; }
.summary-box { background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(52,211,153,.05)); border: 1px solid rgba(59,130,246,.2); border-radius: var(--radius); padding: 24px; margin: 32px 0; }
.summary-box h2 { margin-top: 0; color: var(--brand); }

/* Navigation links */
.back-link { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.04); border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px; margin: 20px 0; color: var(--text); text-decoration: none; }
.back-link:hover { background: rgba(255,255,255,.08); }

/* FAQ (index page) */
details { background: rgba(59,130,246,.03); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
summary { cursor: pointer; font-weight: 700; }

/* Footer */
footer { border-top: 1px solid var(--border); margin-top: 32px; background: #fff; }
footer .inner, footer .container { max-width: 1100px; margin: 0 auto; padding: 20px 18px; color: var(--muted); }

/* Utilities */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,1,1); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { left: 10px; top: 10px; width: auto; height: auto; padding: 8px 10px; background: var(--brand); color: #fff; border-radius: 8px; }

/* Back to top button (index.html) */
#backToTop { position: fixed; right: 18px; bottom: 18px; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: all .2s ease; box-shadow: var(--shadow-sm); }
#backToTop.show { opacity: 1; pointer-events: auto; transform: translateY(-2px); }

/* Forms (subscribe) */
input[type="text"], input[type="email"], input[type="search"], textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.4);
  background: #ffffff;
  color: var(--text);
}

/* Blog list modifications for index */
.posts .card { grid-column: span 6; }
@media (max-width: 960px) { .posts .card { grid-column: span 12; } }

/* Responsive overrides */
@media (max-width: 768px) {
  .hero h2 { font-size: 32px; }
  .article-header h1 { font-size: 28px; }
  .article-content { padding: 0 16px 40px; }
  /* Slightly reduce section spacing on smaller screens for compact layout */
  section { padding: 48px 0; }
  /* Container sections with moderate spacing on mobile */
  section.container { padding: 32px 0; }
}

/* Dark mode (optional support; default is light) */
@media (prefers-color-scheme: dark) {
  :root { 
    --bg: #0b1220; 
    --panel: rgba(255,255,255,.06); 
    --text: #e5e7eb; 
    --muted: #9aa4b2; 
    --border: rgba(148,163,184,.22); 
    --card: rgba(17,24,39,.6); 
  }
  body { background:
    radial-gradient(1200px 800px at 10% -10%, rgba(96,165,250,.12), transparent),
    radial-gradient(900px 600px at 100% 0, rgba(52,211,153,.10), transparent),
    var(--bg); }
  .idea { background: rgba(255,255,255,.04); }
  input[type="text"], input[type="email"], input[type="search"], textarea {
    background: rgba(255,255,255,.06);
    border-color: rgba(148,163,184,.3);
    color: var(--text);
  }
  header { background: rgba(11,18,32,.85); }
}