/* =================================================================
 *  CircuitBoard_Blueprint — Engineering Blueprint Theme
 *  CSS prefix: cb-
 *  Palette: Blueprint blue (#0a1628) → Cyan (#4dc9f6) → Warning yellow (#f59e0b)
 * ================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&display=swap');

:root {
  --cb-bg: #0a1628; --cb-surface: #102240; --cb-surface2: #162d56;
  --cb-line: #1f4480; --cb-line2: #29529b;
  --cb-cyan: #4dc9f6; --cb-cyan2: #7dd8fa; --cb-text: #c8dff5;
  --cb-text-dim: #e0ecf8; --cb-muted: #5078a0; --cb-yellow: #f59e0b;
  --cb-red: #ef4444; --cb-green: #22c55e;
  --cb-font: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  --cb-radius: 0; --cb-gap: 2px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--cb-font); background: var(--cb-bg); color: var(--cb-text);
  line-height: 1.7; font-size: 14px; -webkit-font-smoothing: antialiased;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(77,201,246,.02) 19px, rgba(77,201,246,.02) 20px),
                    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(77,201,246,.02) 19px, rgba(77,201,246,.02) 20px);
}

a { color: var(--cb-cyan); text-decoration: none; }
a:hover { color: var(--cb-cyan2); text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1,h2,h3,h4 { color: var(--cb-text-dim); font-weight: 600; }
blockquote { margin: 16px 0; padding: 12px 18px; border-left: 3px solid var(--cb-cyan); background: var(--cb-surface); color: var(--cb-muted); }
code { background: var(--cb-surface2); padding: 2px 6px; }
pre { background: var(--cb-surface); padding: 14px; border: 1px solid var(--cb-line); overflow-x: auto; font-size: 12px; }

/* =================================================================
 *  LAYOUT
 * ================================================================= */
.cb-wrap { width: min(100% - 32px, 1120px); margin: 0 auto; }
.cb-main { min-height: 70vh; padding-top: 16px; padding-bottom: 40px; }

/* =================================================================
 *  HEADER — Terminal tab bar
 * ================================================================= */
.cb-header { border-bottom: 2px solid var(--cb-line); background: var(--cb-surface); position: sticky; top: 0; z-index: 100; }
.cb-header-bar { display: flex; align-items: center; gap: 6px; padding: 8px 0 0; }
.cb-header-dot { width: 10px; height: 10px; border-radius: 50%; }
.cb-header-dot--red { background: #ef4444; } .cb-header-dot--yellow { background: #f59e0b; } .cb-header-dot--green { background: #22c55e; }
.cb-header-label { font-size: 9px; color: var(--cb-muted); margin-left: 8px; text-transform: uppercase; letter-spacing: .1em; }
.cb-header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; }
.cb-brand { display: flex; align-items: center; gap: 8px; }
.cb-brand-name { font-size: 16px; font-weight: 700; color: var(--cb-cyan); }
.cb-brand-name::before { content: '> '; color: var(--cb-cyan); }
.cb-header-actions { display: flex; align-items: center; gap: 6px; }
.cb-header-search { display: flex; gap: 0; }
.cb-header-search input { height: 30px; border: 1px solid var(--cb-line); border-right: none; background: var(--cb-bg); padding: 0 10px; color: var(--cb-text); font-size: 12px; font-family: var(--cb-font); outline: none; }
.cb-header-search input:focus { border-color: var(--cb-cyan); }
.cb-header-search button { height: 30px; border: 1px solid var(--cb-line); background: var(--cb-surface2); color: var(--cb-cyan); padding: 0 10px; cursor: pointer; font-size: 12px; font-family: var(--cb-font); }
.cb-menu-toggle { display: none; width: 30px; height: 30px; border: 1px solid var(--cb-line); background: var(--cb-bg); color: var(--cb-cyan); font-size: 14px; cursor: pointer; align-items: center; justify-content: center; font-family: var(--cb-font); }
.cb-nav { display: flex; gap: 0; padding: 6px 0; }
.cb-nav a { display: inline-flex; align-items: center; padding: 5px 12px; font-size: 12px; color: var(--cb-muted); border-bottom: 2px solid transparent; }
.cb-nav a:hover { color: var(--cb-cyan); border-bottom-color: var(--cb-line); text-decoration: none; }
.cb-nav a.active { color: var(--cb-cyan); border-bottom-color: var(--cb-cyan); }

/* =================================================================
 *  HERO — Terminal output style carousel
 * ================================================================= */
.cb-hero { position: relative; margin-bottom: 28px; border: 1px solid var(--cb-line); background: var(--cb-surface); }
.cb-hero-track { display: flex; transition: transform .5s ease; }
.cb-hero-slide { min-width: 100%; flex-shrink: 0; position: relative; height: 380px; display: grid; grid-template-columns: 1.2fr 1fr; }
.cb-hero-img { overflow: hidden; background: var(--cb-surface2); }
.cb-hero-img img { width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.cb-hero-text { padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.cb-hero-label { font-size: 10px; color: var(--cb-yellow); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.cb-hero-text h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; line-height: 1.25; }
.cb-hero-text h1 a { color: var(--cb-text-dim); }
.cb-hero-text h1 a:hover { color: var(--cb-cyan); text-decoration: none; }
.cb-hero-text p { color: var(--cb-muted); font-size: 13px; margin: 0 0 16px; display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden; }
.cb-hero-actions { display: flex; align-items: center; gap: 12px; }
.cb-hero-meta { font-size: 10px; color: var(--cb-muted); text-transform: uppercase; letter-spacing: .06em; }
.cb-hero-prev,.cb-hero-next { position: absolute; top: 50%; width: 32px; height: 60px; border: 1px solid var(--cb-line); background: var(--cb-surface); color: var(--cb-cyan); font-size: 16px; cursor: pointer; z-index: 5; display: flex; align-items: center; justify-content: center; opacity: 0; transition: .2s; font-family: var(--cb-font); }
.cb-hero:hover .cb-hero-prev,.cb-hero:hover .cb-hero-next { opacity: 1; }
.cb-hero-prev { left: -1px; } .cb-hero-next { right: -1px; }
.cb-hero-dots { position: absolute; bottom: 12px; right: 32px; display: flex; gap: 4px; z-index: 5; }
.cb-hero-dots span { width: 24px; height: 4px; background: var(--cb-line); cursor: pointer; transition: .2s; }
.cb-hero-dots span.active,.cb-hero-dots span:hover { background: var(--cb-cyan); }

/* =================================================================
 *  BUTTONS & BADGES
 * ================================================================= */
.cb-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border: 1px solid var(--cb-line); font-size: 11px; font-weight: 500; color: var(--cb-cyan); background: transparent; cursor: pointer; text-transform: uppercase; letter-spacing: .06em; transition: .2s; }
.cb-btn:hover { background: var(--cb-cyan); color: var(--cb-bg); border-color: var(--cb-cyan); text-decoration: none; }
.cb-btn-accent { background: var(--cb-cyan); color: var(--cb-bg); border-color: var(--cb-cyan); }
.cb-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 10px; color: var(--cb-cyan); border: 1px solid var(--cb-line); text-transform: uppercase; letter-spacing: .06em; }
.cb-badge--yellow { color: var(--cb-yellow); border-color: rgba(245,158,11,.3); }

/* =================================================================
 *  SECTION HEAD
 * ================================================================= */
.cb-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--cb-line); }
.cb-section-head h2 { font-size: 13px; font-weight: 600; color: var(--cb-cyan); text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.cb-section-head h2::before { content: '## '; color: var(--cb-muted); }

/* =================================================================
 *  CARD GRID — Blueprint cards
 * ================================================================= */
.cb-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-bottom: 28px; }
.cb-card { background: var(--cb-surface); border: 1px solid var(--cb-line); transition: .15s; }
.cb-card:hover { border-color: var(--cb-cyan); }
.cb-card-thumb { display: block; aspect-ratio: 16/10; overflow: hidden; background: var(--cb-surface2); }
.cb-card-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .75; transition: .3s; }
.cb-card:hover .cb-card-thumb img { opacity: 1; }
.cb-card-body { padding: 14px 16px 16px; }
.cb-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cb-card h3 { font-size: 15px; margin: 0 0 6px; line-height: 1.35; font-weight: 600; }
.cb-card h3 a { color: var(--cb-text-dim); }
.cb-card h3 a:hover { color: var(--cb-cyan); text-decoration: none; }
.cb-card p { color: var(--cb-muted); font-size: 12px; margin: 0; display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden; }

/* =================================================================
 *  STREAM
 * ================================================================= */
.cb-stream { display: grid; gap: 2px; margin-bottom: 28px; }
.cb-stream-item { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 16px; padding: 16px; background: var(--cb-surface); border: 1px solid var(--cb-line); transition: .15s; }
.cb-stream-item:hover { border-color: var(--cb-cyan); }
.cb-stream-thumb { display: block; overflow: hidden; background: var(--cb-surface2); aspect-ratio: 16/11; }
.cb-stream-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .75; transition: .3s; }
.cb-stream-item:hover .cb-stream-thumb img { opacity: 1; }
.cb-stream-body { display: flex; flex-direction: column; justify-content: center; }
.cb-stream-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cb-stream-body h4 { font-size: 16px; margin: 0 0 6px; font-weight: 600; line-height: 1.3; }
.cb-stream-body h4 a { color: var(--cb-text-dim); }
.cb-stream-body h4 a:hover { color: var(--cb-cyan); text-decoration: none; }
.cb-stream-excerpt { color: var(--cb-muted); font-size: 12px; margin: 0; display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden; }

/* =================================================================
 *  TWO-COLUMN + SIDEBAR
 * ================================================================= */
.cb-content-grid { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 2px; }
.cb-sidebar { display: grid; gap: 2px; align-content: start; }
.cb-side-panel { padding: 16px; background: var(--cb-surface); border: 1px solid var(--cb-line); }
.cb-side-title { font-size: 11px; font-weight: 700; color: var(--cb-cyan); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--cb-line); }
.cb-side-title::before { content: '// '; }
.cb-side-list { list-style: none; padding: 0; margin: 0; }
.cb-side-list li { padding: 7px 0; border-bottom: 1px solid var(--cb-line); font-size: 12px; }
.cb-side-list li:last-child { border-bottom: none; }
.cb-side-list a { color: var(--cb-text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-side-list a:hover { color: var(--cb-cyan); text-decoration: none; }
.cb-tag-cloud { display: flex; flex-wrap: wrap; gap: 4px; }
.cb-tag-cloud a { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid var(--cb-line); font-size: 10px; color: var(--cb-muted); text-transform: uppercase; letter-spacing: .04em; }
.cb-tag-cloud a:hover { border-color: var(--cb-cyan); color: var(--cb-cyan); text-decoration: none; }

/* =================================================================
 *  LIST & BREADCRUMB
 * ================================================================= */
.cb-breadcrumb { margin-bottom: 14px; font-size: 11px; color: var(--cb-muted); }
.cb-breadcrumb a { color: var(--cb-muted); }
.cb-list-head { padding: 20px 28px; background: var(--cb-surface); border: 1px solid var(--cb-line); margin-bottom: 2px; }
.cb-list-head h1 { font-size: 24px; font-weight: 700; margin: 0; color: var(--cb-cyan); }
.cb-list-head p { font-size: 12px; color: var(--cb-muted); margin: 4px 0 0; }
.cb-list-count { font-size: 10px; color: var(--cb-green); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }

/* =================================================================
 *  PAGINATION
 * ================================================================= */
.cb-pagination,.pagination { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.pagination a,.pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--cb-line); font-size: 11px; color: var(--cb-cyan); background: var(--cb-surface); transition: .15s; }
.pagination a:hover { background: var(--cb-cyan); color: var(--cb-bg); text-decoration: none; }
.pagination .current,.pagination .active { background: var(--cb-cyan); color: var(--cb-bg); border-color: var(--cb-cyan); font-weight: 600; }

/* =================================================================
 *  ARTICLE DETAIL
 * ================================================================= */
.cb-detail { padding: 28px; background: var(--cb-surface); border: 1px solid var(--cb-line); margin-bottom: 2px; }
.cb-detail-header { margin-bottom: 16px; }
.cb-detail-header h1 { font-size: 28px; line-height: 1.25; font-weight: 700; margin: 0 0 8px; }
.cb-detail-meta { font-size: 10px; color: var(--cb-muted); display: flex; flex-wrap: wrap; gap: 12px; text-transform: uppercase; letter-spacing: .06em; }
.cb-detail-meta span::before { content: '['; color: var(--cb-line); } .cb-detail-meta span::after { content: ']'; color: var(--cb-line); }
.cb-detail-cover { margin-bottom: 20px; border: 1px solid var(--cb-line); overflow: hidden; aspect-ratio: 16/8; }
.cb-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.cb-detail-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0; }
.cb-detail-tags a { padding: 2px 8px; border: 1px solid var(--cb-line); font-size: 10px; color: var(--cb-muted); text-transform: uppercase; }
.cb-detail-tags a:hover { border-color: var(--cb-cyan); color: var(--cb-cyan); text-decoration: none; }
.cb-article-content { color: var(--cb-text); font-size: 14px; line-height: 1.8; }
.cb-article-content p { margin: .8em 0; }
.cb-article-content h1,.cb-article-content h2,.cb-article-content h3 { margin: 1.4em 0 .5em; font-weight: 700; color: var(--cb-cyan); }
.cb-article-content h1 { font-size: 22px; } .cb-article-content h2 { font-size: 18px; } .cb-article-content h3 { font-size: 15px; }
.cb-article-content img { border: 1px solid var(--cb-line); margin: 12px 0; }
.cb-article-content a { color: var(--cb-cyan); border-bottom: 1px dashed var(--cb-cyan); }
.cb-article-content a:hover { border-bottom-style: solid; }

/* =================================================================
 *  TAGS
 * ================================================================= */
.cb-tag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.cb-tag-card { padding: 20px; background: var(--cb-surface); border: 1px solid var(--cb-line); text-align: center; transition: .15s; }
.cb-tag-card:hover { border-color: var(--cb-cyan); text-decoration: none; }
.cb-tag-card h3 { font-size: 14px; margin: 0 0 4px; font-weight: 600; color: var(--cb-cyan); text-transform: uppercase; letter-spacing: .04em; }
.cb-tag-card p { font-size: 10px; color: var(--cb-muted); margin: 0; }

/* =================================================================
 *  SO / SEARCH / EMPTY / DIY / FOOTER
 * ================================================================= */
.cb-so-wrap { width: min(100% - 32px, 600px); margin: 0 auto; padding: 80px 0; text-align: center; }
.cb-so-prompt { color: var(--cb-cyan); font-size: 20px; margin: 0 0 6px; }
.cb-so-title { font-size: 24px; font-weight: 700; color: var(--cb-text-dim); margin: 0 0 8px; }
.cb-so-subtitle { font-size: 12px; color: var(--cb-muted); margin-bottom: 24px; text-transform: uppercase; letter-spacing: .06em; }
.cb-so-form { display: flex; max-width: 480px; margin: 0 auto; border: 1px solid var(--cb-line); }
.cb-so-form input { flex: 1; height: 42px; border: none; background: var(--cb-surface); padding: 0 14px; color: var(--cb-text); font-size: 13px; font-family: var(--cb-font); outline: none; }
.cb-so-form button { height: 42px; padding: 0 20px; border: none; border-left: 1px solid var(--cb-line); background: var(--cb-cyan); color: var(--cb-bg); font-size: 12px; font-weight: 600; font-family: var(--cb-font); cursor: pointer; text-transform: uppercase; letter-spacing: .06em; }
.cb-so-form button:hover { background: var(--cb-cyan2); }
.cb-so-hot { margin-top: 28px; }
.cb-so-hot h3 { font-size: 10px; color: var(--cb-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.cb-search-panel { padding: 20px 28px; background: var(--cb-surface); border: 1px solid var(--cb-line); margin-bottom: 2px; }
.cb-search-panel h1 { font-size: 20px; margin: 0; color: var(--cb-cyan); }
.cb-search-panel p { font-size: 10px; color: var(--cb-muted); margin: 4px 0 0; text-transform: uppercase; }
.cb-search-item { padding: 14px; border-bottom: 1px solid var(--cb-line); }
.cb-search-item:last-child { border-bottom: none; }
.cb-search-item h3 { font-size: 16px; margin: 0 0 4px; }
.cb-search-item h3 a { color: var(--cb-text-dim); }
.cb-search-item p { font-size: 12px; color: var(--cb-muted); }
.cb-diy-panel { padding: 28px; background: var(--cb-surface); border: 1px solid var(--cb-line); }
.cb-empty { text-align: center; padding: 80px 20px; }
.cb-empty-code { font-size: 48px; color: var(--cb-cyan); margin-bottom: 8px; }
.cb-empty h1 { font-size: 18px; color: var(--cb-cyan); margin-bottom: 8px; }
.cb-empty p { font-size: 12px; color: var(--cb-muted); margin-bottom: 16px; }
.cb-footer { margin-top: 40px; border-top: 2px solid var(--cb-line); padding: 16px 0; background: var(--cb-surface); }
.cb-footer-inner { display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: var(--cb-muted); text-transform: uppercase; letter-spacing: .06em; }
.cb-footer-links { display: flex; gap: 14px; }
.cb-footer-links a { color: var(--cb-muted); }

/* =================================================================
 *  RESPONSIVE
 * ================================================================= */
@media (max-width: 1100px) {
  .cb-hero-slide { grid-template-columns: 1fr 1fr; }
  .cb-hero-text h1 { font-size: 20px; }
  .cb-card-grid { grid-template-columns: repeat(2, 1fr); }
  .cb-tag-grid { grid-template-columns: repeat(3, 1fr); }
  .cb-content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 991px) { .cb-menu-toggle { display: inline-flex; } .cb-nav { display: none; } .cb-nav.open { display: flex; flex-direction: column; } }
@media (max-width: 768px) {
  .cb-wrap { width: min(100% - 16px, 1120px); }
  .cb-hero-slide { height: auto; grid-template-columns: 1fr; }
  .cb-hero-text { padding: 20px; } .cb-hero-text h1 { font-size: 18px; }
  .cb-card-grid { grid-template-columns: 1fr; }
  .cb-tag-grid { grid-template-columns: repeat(2, 1fr); }
  .cb-stream-item { grid-template-columns: 1fr; }
  .cb-stream-thumb { aspect-ratio: 16/9; }
  .cb-footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .cb-list-head,.cb-detail,.cb-search-panel,.cb-diy-panel { padding: 16px; }
  .cb-detail-header h1 { font-size: 20px; }
  .cb-article-content { font-size: 13px; }
}
