/* ── AlgoSphere Help Center — Shared Stylesheet ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080c14; --bg2: #0d1220; --bg3: #111827;
  --card: #0f1724; --card-hover: #141e2e;
  --border: rgba(99,178,255,0.1); --border-hover: rgba(56,189,248,0.35);
  --teal: #38bdf8; --teal2: #0ea5e9;
  --teal-dim: rgba(56,189,248,0.12); --teal-glow: rgba(56,189,248,0.06);
  --green: #34d399; --amber: #fbbf24; --coral: #fb7185; --purple: #a78bfa;
  --txt: #e2e8f0; --txt2: #94a3b8; --txt3: #64748b;
  --font-head: 'Syne', sans-serif; --font-body: 'DM Sans', sans-serif;
  --r: 14px; --r-sm: 8px;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--txt); font-family: var(--font-body); font-size: 15px; line-height: 1.6; min-height: 100vh; }

body::before {
  content: ''; position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 128px; pointer-events: none; z-index: 0; opacity: 0.4;
}
body::after {
  content: ''; position: fixed; inset: 0;
  background-image: linear-gradient(rgba(56,189,248,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(56,189,248,0.03) 1px, transparent 1px);
  background-size: 40px 40px; pointer-events: none; z-index: 0;
}
* { position: relative; z-index: 1; }

/* ── NAV ── */
nav { display: flex; align-items: center; justify-content: space-between; padding: 0 40px; height: 64px; background: rgba(8,12,20,0.9); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { width: 34px; height: 34px; background: linear-gradient(135deg, #0ea5e9, #6366f1); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 800; font-size: 14px; color: #fff; }
.logo-name { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: var(--txt); letter-spacing: -0.3px; }
.logo-badge { font-size: 11px; font-weight: 500; color: var(--teal); background: var(--teal-dim); border: 1px solid rgba(56,189,248,0.2); padding: 2px 7px; border-radius: 20px; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links a { text-decoration: none; color: var(--txt2); font-size: 14px; padding: 6px 14px; border-radius: var(--r-sm); transition: all 0.2s; }
.nav-links a:hover { color: var(--txt); background: rgba(255,255,255,0.04); }
.nav-links a.active { color: var(--teal); }
.nav-btn { background: var(--teal2) !important; color: #fff !important; font-weight: 500 !important; }
.nav-btn:hover { opacity: 0.85; }

/* ── BREADCRUMB ── */
.breadcrumb { padding: 16px 40px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--txt3); border-bottom: 1px solid var(--border); }
.breadcrumb a { color: var(--txt3); text-decoration: none; transition: color 0.2s; }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb span { color: var(--txt2); }

/* ── PAGE HERO ── */
.page-hero { padding: 52px 40px 40px; max-width: 860px; margin: 0 auto; text-align: center; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; letter-spacing: 1.2px; text-transform: uppercase; color: var(--teal); margin-bottom: 16px; }
.hero-eyebrow::before, .hero-eyebrow::after { content: ''; width: 24px; height: 1px; background: var(--teal); opacity: 0.5; }
.page-hero h1 { font-family: var(--font-head); font-size: clamp(28px, 4vw, 46px); font-weight: 800; line-height: 1.1; letter-spacing: -1.2px; color: var(--txt); margin-bottom: 12px; }
.page-hero h1 span { background: linear-gradient(90deg, var(--teal), #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.page-hero p { color: var(--txt2); font-size: 16px; font-weight: 300; max-width: 520px; margin: 0 auto; }

/* ── SEARCH ── */
.search-wrap { position: relative; max-width: 560px; margin: 28px auto 0; }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--txt3); pointer-events: none; }
.search-input { width: 100%; height: 50px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; color: var(--txt); font-family: var(--font-body); font-size: 15px; padding: 0 110px 0 48px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.search-input::placeholder { color: var(--txt3); }
.search-input:focus { border-color: rgba(56,189,248,0.4); box-shadow: 0 0 0 3px rgba(56,189,248,0.08); }
.search-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 38px; padding: 0 18px; background: var(--teal2); color: #fff; border: none; border-radius: 8px; font-family: var(--font-body); font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity 0.2s; }
.search-btn:hover { opacity: 0.85; }

/* ── MAIN LAYOUT ── */
.main { max-width: 1160px; margin: 0 auto; padding: 48px 40px 100px; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--txt3); margin-bottom: 20px; }

/* ── CATEGORY GRID ── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 56px; }

/* cat-card works as both <a> (category pages) and <div> (index page) */
.cat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 24px; text-decoration: none; transition: all 0.25s; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.cat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--teal), transparent); opacity: 0; transition: opacity 0.3s; }
.cat-card:hover { background: var(--card-hover); border-color: var(--border-hover); transform: translateY(-2px); }
.cat-card:hover::before { opacity: 1; }

/* ── CAT-HEAD-LINK — clickable header area on index cards ── */
.cat-head-link { display: flex; align-items: flex-start; gap: 14px; text-decoration: none; flex: 1; min-width: 0; }
.cat-head-link:hover .cat-title { color: var(--teal); }
.cat-head-link:hover .cat-icon { opacity: 0.85; }

.cat-head { display: flex; align-items: flex-start; gap: 14px; }
.cat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: opacity 0.2s; }
.cat-info { flex: 1; min-width: 0; }
.cat-title { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--txt); margin-bottom: 4px; letter-spacing: -0.2px; transition: color 0.2s; }
.cat-desc { font-size: 13px; color: var(--txt3); line-height: 1.5; }
.cat-count { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; padding: 3px 9px; border-radius: 20px; flex-shrink: 0; margin-top: 2px; }
.cat-articles { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.art-link { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--txt2); text-decoration: none; padding: 4px 0; transition: color 0.15s; }
.art-link::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--txt3); flex-shrink: 0; transition: background 0.15s; }
.art-link:hover { color: var(--teal); }
.art-link:hover::before { background: var(--teal); }
.art-more { font-size: 12px; color: var(--teal); text-decoration: none; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.art-more:hover { text-decoration: underline; }

/* ── ICON COLORS ── */
.ic-teal   { background: rgba(56,189,248,0.1);  color: var(--teal); }
.ic-green  { background: rgba(52,211,153,0.1);  color: var(--green); }
.ic-amber  { background: rgba(251,191,36,0.1);  color: var(--amber); }
.ic-coral  { background: rgba(251,113,133,0.1); color: var(--coral); }
.ic-purple { background: rgba(167,139,250,0.1); color: var(--purple); }
.ic-blue   { background: rgba(99,102,241,0.1);  color: #818cf8; }
.cnt-teal   { background: rgba(56,189,248,0.1);  color: var(--teal); }
.cnt-green  { background: rgba(52,211,153,0.1);  color: var(--green); }
.cnt-amber  { background: rgba(251,191,36,0.1);  color: var(--amber); }
.cnt-coral  { background: rgba(251,113,133,0.1); color: var(--coral); }
.cnt-purple { background: rgba(167,139,250,0.1); color: var(--purple); }
.cnt-blue   { background: rgba(99,102,241,0.1);  color: #818cf8; }

/* ── ARTICLE LIST (category page) ── */
.article-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 48px; }
.article-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; text-decoration: none; transition: all 0.2s; gap: 16px; }
.article-item:hover { background: var(--card-hover); border-color: var(--border-hover); }
.article-item-left { display: flex; align-items: center; gap: 14px; }
.article-item-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.article-item-title { font-size: 14px; font-weight: 500; color: var(--txt); }
.article-item-meta { font-size: 12px; color: var(--txt3); margin-top: 2px; }
.article-arrow { color: var(--txt3); transition: all 0.2s; flex-shrink: 0; }
.article-item:hover .article-arrow { color: var(--teal); transform: translateX(4px); }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 56px; }
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.faq-item + .faq-item { margin-top: 6px; }
.faq-q { width: 100%; background: none; border: none; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; text-align: left; transition: background 0.2s; }
.faq-q:hover { background: var(--card-hover); }
.faq-q-text { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--txt); }
.faq-chevron { width: 20px; height: 20px; color: var(--txt3); flex-shrink: 0; transition: transform 0.3s; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-a { display: none; padding: 0 24px 20px; color: var(--txt2); font-size: 14px; line-height: 1.75; border-top: 1px solid var(--border); padding-top: 16px; }
.faq-item.open .faq-a { display: block; }
.faq-a code { background: rgba(56,189,248,0.1); color: var(--teal); padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: 'Courier New', monospace; }
.faq-a pre { background: #0a1628; border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px; margin: 12px 0; overflow-x: auto; }
.faq-a pre code { background: none; padding: 0; color: #7dd3fc; font-size: 13px; }
.faq-a ol, .faq-a ul { padding-left: 20px; margin: 8px 0; }
.faq-a li { margin-bottom: 4px; }

/* ── CHANGELOG ── */
.changelog-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 48px; }
.cl-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; text-decoration: none; transition: all 0.2s; gap: 16px; }
.cl-item:hover { background: var(--card-hover); border-color: var(--border-hover); }
.cl-badge { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; flex-shrink: 0; }
.cl-badge.latest { background: var(--amber); color: #0c0a00; }
.cl-badge.normal { background: rgba(251,191,36,0.1); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.cl-badge.old { background: rgba(100,116,139,0.1); color: var(--txt3); border: 1px solid rgba(100,116,139,0.2); }
.cl-title { font-size: 14px; font-weight: 500; color: var(--txt); }
.cl-date { font-size: 12px; color: var(--txt3); margin-top: 2px; }

/* ── SIDEBAR LAYOUT ── */
.with-sidebar { display: grid; grid-template-columns: 1fr 280px; gap: 40px; align-items: start; }
.sidebar { position: sticky; top: 88px; }
.sidebar-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; margin-bottom: 16px; }
.sidebar-title { font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--txt); letter-spacing: 0.5px; margin-bottom: 14px; text-transform: uppercase; }
.sidebar-link { display: block; font-size: 13px; color: var(--txt2); text-decoration: none; padding: 6px 0; border-bottom: 1px solid var(--border); transition: color 0.15s; }
.sidebar-link:last-child { border-bottom: none; }
.sidebar-link:hover { color: var(--teal); }

/* ── QUICK PILLS ── */
.quick-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 48px; }
.quick-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 30px; text-decoration: none; font-size: 13px; color: var(--txt2); transition: all 0.2s; }
.quick-pill:hover { background: var(--teal-dim); border-color: rgba(56,189,248,0.3); color: var(--teal); }

/* ── STATS ── */
.stats-bar { display: flex; justify-content: center; max-width: 680px; margin: 36px auto 0; }
.stat { flex: 1; text-align: center; padding: 18px 0; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-num { font-family: var(--font-head); font-size: 26px; font-weight: 800; color: var(--txt); letter-spacing: -1px; }
.stat-label { font-size: 11px; color: var(--txt3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.8px; }

/* ── CTA ── */
.cta-band { background: linear-gradient(135deg, rgba(14,165,233,0.08), rgba(99,102,241,0.08)); border: 1px solid rgba(56,189,248,0.12); border-radius: var(--r); padding: 44px; text-align: center; margin-bottom: 48px; }
.cta-band h2 { font-family: var(--font-head); font-size: 24px; font-weight: 800; color: var(--txt); margin-bottom: 8px; letter-spacing: -0.5px; }
.cta-band p { color: var(--txt2); font-size: 14px; margin-bottom: 24px; }
.cta-btns { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 11px 26px; background: var(--teal2); color: #fff; border: none; border-radius: 10px; font-family: var(--font-body); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; transition: opacity 0.2s; }
.btn-primary:hover { opacity: 0.85; }
.btn-outline { display: inline-flex; align-items: center; gap: 8px; padding: 11px 26px; background: transparent; color: var(--txt); border: 1px solid var(--border); border-radius: 10px; font-family: var(--font-body); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.btn-outline:hover { border-color: var(--border-hover); background: var(--teal-glow); }

/* ── CHANGELOG STRIP ── */
.changelog-strip { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 28px 32px; margin-bottom: 56px; display: flex; align-items: flex-start; gap: 24px; }
.changelog-icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(251,191,36,0.1); color: var(--amber); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.changelog-content { flex: 1; }
.changelog-content h3 { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--txt); margin-bottom: 6px; }
.changelog-content p { font-size: 13px; color: var(--txt2); margin-bottom: 14px; }
.version-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.v-pill { font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 20px; background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.2); color: var(--amber); text-decoration: none; transition: all 0.2s; }
.v-pill:hover { background: rgba(251,191,36,0.15); }
.v-pill.latest { background: var(--amber); color: #0c0a00; font-weight: 600; border-color: var(--amber); }

/* ── FOOTER ── */
footer { border-top: 1px solid var(--border); padding: 24px 40px; display: flex; align-items: center; justify-content: space-between; color: var(--txt3); font-size: 13px; flex-wrap: wrap; gap: 12px; }
footer a { color: var(--txt3); text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--teal); }
.footer-links { display: flex; gap: 24px; }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.page-hero { animation: fadeUp 0.5s ease both; }
.cat-card { animation: fadeUp 0.5s ease both; }
.cat-card:nth-child(1) { animation-delay: 0.05s; } .cat-card:nth-child(2) { animation-delay: 0.10s; }
.cat-card:nth-child(3) { animation-delay: 0.15s; } .cat-card:nth-child(4) { animation-delay: 0.20s; }
.cat-card:nth-child(5) { animation-delay: 0.25s; } .cat-card:nth-child(6) { animation-delay: 0.30s; }
.cat-card:nth-child(7) { animation-delay: 0.35s; } .cat-card:nth-child(8) { animation-delay: 0.40s; }
.cat-card:nth-child(9) { animation-delay: 0.45s; } .cat-card:nth-child(10) { animation-delay: 0.50s; }
.article-item { animation: fadeUp 0.4s ease both; }
.article-item:nth-child(1) { animation-delay: 0.05s; } .article-item:nth-child(2) { animation-delay: 0.10s; }
.article-item:nth-child(3) { animation-delay: 0.15s; } .article-item:nth-child(4) { animation-delay: 0.20s; }
.article-item:nth-child(5) { animation-delay: 0.25s; } .article-item:nth-child(6) { animation-delay: 0.30s; }
.faq-item { animation: fadeUp 0.4s ease both; }
.faq-item:nth-child(odd) { animation-delay: 0.05s; } .faq-item:nth-child(even) { animation-delay: 0.10s; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) { .with-sidebar { grid-template-columns: 1fr; } .sidebar { position: static; } }
@media (max-width: 768px) {
  nav { padding: 0 20px; } .nav-links { display: none; }
  .page-hero { padding: 36px 20px 28px; } .main { padding: 32px 20px 80px; }
  .cat-grid { grid-template-columns: 1fr; } .breadcrumb { padding: 12px 20px; }
  .changelog-strip { flex-direction: column; } .cta-band { padding: 28px 20px; }
  footer { padding: 20px; flex-direction: column; text-align: center; }
  .stats-bar { flex-wrap: wrap; } .stat { min-width: 50%; }
}
