/* ===== Claw Code Design System ===== */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #a1a1aa;
  --accent: #2563eb;
  --accent-subtle: #dbeafe;
  --border: #e4e4e7;
  --border-light: #f4f4f5;
  --code-bg: #f4f4f5;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Helvetica, Arial, sans-serif;
  --max-w: 800px;
  --max-w-wide: 1080px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--sans); background: var(--bg); color: var(--text-primary); line-height: 1.7; font-size: 16px; }
a { color: var(--accent); text-decoration: none; transition: opacity 0.15s; }
a:hover { opacity: 0.8; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--code-bg); padding: 2px 6px; border-radius: 4px; }
pre code { background: none; padding: 0; }

/* NAV */
nav { position: sticky; top: 0; z-index: 100; background: rgba(250,250,250,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-inner { max-width: var(--max-w-wide); margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--text-primary); letter-spacing: -0.5px; }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 24px; font-size: 14px; }
.nav-links a { color: var(--text-secondary); font-weight: 500; }
.nav-links a:hover { color: var(--text-primary); opacity: 1; }

/* LANG SWITCHER */
.lang-switch { position: relative; margin-left: 8px; }
.lang-switch > a { color: var(--text-tertiary); font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 3px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; }
.lang-switch > a::after { content: ''; display: inline-block; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 3.5px solid currentColor; margin-top: 1px; }
.lang-switch:hover > a { color: var(--text-primary); border-color: var(--accent); }
.lang-switch-menu { display: none; position: absolute; top: 100%; right: 0; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px 0; min-width: 150px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); z-index: 200; }
.lang-switch:hover .lang-switch-menu { display: block; }
.lang-switch-menu a { display: block; padding: 7px 14px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.lang-switch-menu a:hover { background: var(--border-light); color: var(--text-primary); opacity: 1; }
.lang-switch-menu a.active { color: var(--accent); font-weight: 600; }

/* COMING SOON BANNER */
.coming-soon { display: inline-flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #1e3a5f 0%, #18181b 100%); color: #fff; padding: 10px 24px; border-radius: 100px; font-size: 14px; font-weight: 600; letter-spacing: 0.3px; margin-bottom: 24px; animation: pulse-glow 2.5s ease-in-out infinite; border: 1px solid rgba(37,99,235,0.3); }
.coming-soon .cs-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: blink 1.5s ease-in-out infinite; flex-shrink: 0; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); } 50% { box-shadow: 0 0 20px 4px rgba(37,99,235,0.15); } }

/* COPY PAGE BUTTON (inside toc) */
.copy-page { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 12px; margin-bottom: 16px; background: var(--border-light); color: var(--text-secondary); font-size: 12px; font-weight: 600; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.15s; font-family: var(--sans); }
.copy-page:hover { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent); }
.copy-page.copied { background: #dcfce7; color: #16a34a; border-color: #86efac; }
.copy-page svg { flex-shrink: 0; }

/* BREADCRUMB */
.breadcrumb { max-width: var(--max-w); margin: 0 auto; padding: 16px 24px 0; font-size: 13px; color: var(--text-tertiary); }
.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; }

/* PAGE HEADER */
.page-header { max-width: var(--max-w); margin: 0 auto; padding: 40px 24px 48px; }
.page-header .badge { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-subtle); padding: 3px 12px; border-radius: 100px; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 16px; }
.page-header h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; line-height: 1.15; letter-spacing: -1px; margin-bottom: 16px; }
.page-header .subtitle { font-size: 17px; color: var(--text-secondary); max-width: 640px; line-height: 1.7; }

/* CONTENT */
.content { max-width: var(--max-w); margin: 0 auto; padding: 0 24px 80px; }
.content h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; margin: 48px 0 16px; padding-top: 24px; border-top: 1px solid var(--border); }
.content h2:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.content h3 { font-size: 18px; font-weight: 600; margin: 32px 0 10px; }
.content h4 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
.content p { color: var(--text-secondary); margin-bottom: 16px; }
.content ul, .content ol { color: var(--text-secondary); margin-bottom: 16px; padding-left: 24px; }
.content li { margin-bottom: 6px; }
.content strong { color: var(--text-primary); }

/* CODE BLOCK */
.code-block { background: var(--text-primary); color: #e4e4e7; border-radius: 12px; padding: 24px 28px; font-family: var(--mono); font-size: 13px; line-height: 1.7; overflow-x: auto; margin: 20px 0 24px; }
.code-block .comment { color: #71717a; }
.code-block .kw { color: #c084fc; }
.code-block .str { color: #86efac; }
.code-block .fn { color: #93c5fd; }
.code-block .type { color: #fbbf24; }

/* TABLE */
.table-wrapper { overflow-x: auto; margin: 20px 0 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--border-light); }
th { text-align: left; padding: 12px 18px; font-weight: 600; color: var(--text-primary); font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 1px solid var(--border); }
td { padding: 12px 18px; color: var(--text-secondary); border-bottom: 1px solid var(--border-light); vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* CARDS */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 24px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; transition: border-color 0.2s; }
.card:hover { border-color: var(--accent); }
.card h3 { margin-top: 0; font-size: 16px; }
.card p { font-size: 14px; margin-bottom: 0; }
.card .tag { display: inline-block; font-family: var(--mono); font-size: 11px; background: var(--code-bg); color: var(--text-tertiary); padding: 2px 8px; border-radius: 4px; margin-bottom: 10px; }

/* NOTICE */
.notice { background: #fef3c7; border: 1px solid #fde68a; border-radius: 10px; padding: 20px 24px; margin: 24px 0; }
.notice h4 { font-size: 14px; font-weight: 700; color: #92400e; margin-bottom: 8px; }
.notice p { font-size: 14px; color: #78350f; margin-bottom: 0; }
.notice-info { background: var(--accent-subtle); border-color: #93c5fd; }
.notice-info h4 { color: #1e40af; }
.notice-info p { color: #1e3a5f; }

/* ARCH BLOCK */
.arch-block { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 20px 0 24px; }
.arch-block pre { padding: 24px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--text-secondary); background: var(--surface); }

/* RELATED TOPICS */
.related-topics { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border); }
.related-topics h2 { border-top: none; margin-top: 0; padding-top: 0; font-size: 20px; margin-bottom: 20px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.related-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; transition: border-color 0.2s; color: var(--text-primary); }
.related-card:hover { border-color: var(--accent); opacity: 1; }
.related-card .r-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.related-card .r-desc { font-size: 13px; color: var(--text-tertiary); }

/* TOC SIDEBAR */
.page-layout { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 200px 1fr 200px; gap: 32px; padding: 0 24px; }
.toc { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; padding: 0 0 40px; }
.toc h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-tertiary); margin-bottom: 12px; }
.toc ul { list-style: none; padding: 0; }
.toc li { margin-bottom: 8px; }
.toc a { font-size: 13px; color: var(--text-secondary); display: block; padding: 2px 0; border-left: 2px solid transparent; padding-left: 12px; }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); opacity: 1; }

/* SITE NAV (left sidebar — links between pages) */
.site-nav { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; padding: 0 0 40px; }
.site-nav h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-tertiary); margin-bottom: 10px; font-weight: 700; }
.site-nav ul { list-style: none; padding: 0; margin: 0 0 20px; }
.site-nav li { margin-bottom: 2px; }
.site-nav a { font-size: 13px; color: var(--text-secondary); display: block; padding: 5px 10px; border-radius: 6px; transition: background 0.12s, color 0.12s; line-height: 1.4; }
.site-nav a:hover { background: var(--border-light); color: var(--text-primary); opacity: 1; }
.site-nav a.active { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }

/* FOOTER */
footer { border-top: 1px solid var(--border); background: var(--text-primary); color: #71717a; padding: 0; font-size: 13px; }
footer a { color: #a1a1aa; transition: color 0.15s; }
footer a:hover { color: #fff; opacity: 1; }
.footer-top { max-width: var(--max-w-wide); margin: 0 auto; padding: 56px 24px 40px; display: grid; grid-template-columns: 240px 1fr auto; gap: 48px; align-items: start; }
.footer-brand { }
.footer-brand .fb-logo { font-family: var(--mono); font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.5px; margin-bottom: 12px; }
.footer-brand .fb-logo span { color: var(--accent); }
.footer-brand .fb-desc { font-size: 13px; line-height: 1.6; color: #71717a; margin-bottom: 20px; }
.footer-brand .fb-social { display: flex; gap: 12px; }
.footer-brand .fb-social a { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid #27272a; color: #a1a1aa; transition: all 0.15s; }
.footer-brand .fb-social a:hover { border-color: var(--accent); color: #fff; background: rgba(37,99,235,0.1); }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.footer-col h5 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: #52525b; font-weight: 700; margin-bottom: 14px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { font-size: 13px; }
.footer-lang { }
.footer-lang h5 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: #52525b; font-weight: 700; margin-bottom: 14px; }
.footer-lang ul { list-style: none; padding: 0; margin: 0; }
.footer-lang li { margin-bottom: 6px; }
.footer-lang a { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.footer-lang a.active { color: #fff; font-weight: 600; }
.footer-bottom { border-top: 1px solid #27272a; max-width: var(--max-w-wide); margin: 0 auto; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-bottom p { margin: 0; font-size: 12px; color: #52525b; }
.footer-bottom-links { display: flex; gap: 20px; }
.footer-bottom-links a { font-size: 12px; color: #52525b; }
.footer-bottom-links a:hover { color: #a1a1aa; }
@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
}
.footer-mega { padding: 32px 24px 48px; text-align: center; overflow: hidden; }
.footer-mega-text { font-family: var(--mono); font-size: clamp(48px, 12vw, 140px); font-weight: 900; letter-spacing: -4px; color: #27272a; line-height: 1; white-space: nowrap; user-select: none; }
@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .footer-cols { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-mega-text { letter-spacing: -2px; }
}

/* RESPONSIVE */
@media (max-width: 1080px) {
  .page-layout { grid-template-columns: 1fr 200px; }
  .site-nav { display: none; }
}
@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}
@media (max-width: 640px) {
  .page-header { padding: 24px 20px 32px; }
  .content { padding: 0 20px 56px; }
  .nav-links { gap: 14px; font-size: 13px; }
  .card-grid { grid-template-columns: 1fr; }
}
