@layer components {
/* ============================================================
   ARCSAFE COMPONENTS
   Layer 3 — components.css
   Reusable UI blocks. No page-specific styles.
   ============================================================ */

/* ---- NAV ---- */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.nav-logo-mark { width: 34px; height: 34px; flex-shrink: 0; }
.nav-logo-mark svg { width: 100%; height: 100%; }

.nav-logo-text {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}
.nav-logo-text em { font-style: normal; color: var(--sky); }

.nav-links {
  display: none;
  align-items: center;
  gap: var(--s1);
}
@media (min-width: 768px) { .nav-links { display: flex; } }

.nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-on-dark-dim);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  transition: color var(--t-base), background var(--t-base);
}
.nav-link:hover  { color: var(--white); background: rgba(255,255,255,0.08); }
.nav-link.active { color: var(--sky-light); }

.nav-search-btn {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-sm);
  color: var(--text-on-dark-dim);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-sm);
  padding: var(--s2) var(--s3);
  transition: background var(--t-base), color var(--t-base);
  cursor: pointer;
}
.nav-search-btn:hover { background: rgba(255,255,255,0.12); color: var(--white); }
.nav-search-shortcut {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-on-dark-dim);
  opacity: 0.6;
  margin-left: var(--s1);
}
@media (max-width: 767px) { .nav-search-shortcut { display: none; } }

.nav-cta {
  display: none;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  background: var(--sky);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-sm);
  transition: background var(--t-base);
}
.nav-cta:hover { background: var(--sky-light); }
@media (min-width: 768px) { .nav-cta { display: inline-flex; align-items: center; } }

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: var(--s2);
}
@media (min-width: 768px) { .nav-toggle { display: none; } }
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-on-dark);
  border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-base);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav drawer */
.nav-mobile {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--navy-deep);
  border-bottom: 1px solid var(--navy-mid);
  padding: var(--s4) var(--s5) var(--s6);
  z-index: calc(var(--z-nav) - 1);
}
.nav-mobile.open { display: block; }

.nav-mobile-link {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-on-dark);
  padding: var(--s4) 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav-mobile-link:last-of-type { border-bottom: none; }

.nav-mobile-cta {
  display: block;
  margin-top: var(--s4);
  text-align: center;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--navy);
  background: var(--sky);
  padding: var(--s4);
  border-radius: var(--r-md);
}

/* ---- SIDEBAR ---- */
.sidebar-inner {
  padding: var(--s5) var(--s4);
}

.sidebar-section { margin-bottom: var(--s6); }

.sidebar-heading {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--s3) var(--s3);
  border-radius: var(--r-sm);
  transition: color var(--t-base), background var(--t-base);
}
.sidebar-link:hover  { color: var(--navy); background: var(--surface-alt); }
.sidebar-link.active { color: var(--navy); background: var(--sky-pale); font-weight: 600; }

.sidebar-link-dot {
  width: 6px; height: 6px;
  border-radius: var(--r-full);
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.4;
}
.sidebar-link.active .sidebar-link-dot { opacity: 1; background: var(--sky-dim); }

/* ---- TAB BAR ---- */
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--s2);
  color: var(--text-muted);
  transition: color var(--t-base);
  -webkit-tap-highlight-color: transparent;
}
.tab-item.active { color: var(--navy); }
.tab-item svg { width: 22px; height: 22px; }
.tab-item span { font-size: 10px; font-weight: 500; letter-spacing: 0.02em; }

/* ---- SEARCH OVERLAY ---- */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(17,28,54,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: var(--s10) var(--content-px) var(--s4);
  align-items: flex-start;
  justify-content: center;
}
.search-overlay.open { display: flex; }

.search-box {
  width: 100%;
  max-width: 640px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--border-light);
}
.search-input-wrap svg { color: var(--text-muted); flex-shrink: 0; width: 20px; height: 20px; }

.search-input {
  flex: 1;
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  color: var(--text-primary);
  border: none;
  outline: none;
  background: transparent;
}
.search-input::placeholder { color: var(--text-muted); }

.search-close {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--s1) var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
}

.search-results {
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--t-base);
}
.search-result-item:hover { background: var(--off-white); }
.search-result-item:last-child { border-bottom: none; }

.search-result-type {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px var(--s2);
  border-radius: var(--r-xs);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 3px;
}

.search-result-body {}
.search-result-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--navy);
  margin-bottom: var(--s1);
}
.search-result-excerpt {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.search-empty {
  padding: var(--s8) var(--s5);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.search-footer {
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--s4);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- SECTION HEADERS ---- */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--sky-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--s3);
}
.section-label::before {
  content: '';
  display: block;
  width: 14px; height: 1px;
  background: currentColor;
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.3;
}
@media (min-width: 768px) { .section-title { font-size: var(--text-3xl); } }

.section-desc {
  margin-top: var(--s3);
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.6;
}

/* ---- CATEGORY AXIS CHIPS ---- */
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--s1) var(--s3);
  border-radius: var(--r-full);
  letter-spacing: 0.04em;
}

.cat-chip--ex     { color: var(--cat-ex);    background: var(--cat-ex-bg);   }
.cat-chip--semi   { color: var(--cat-semi);  background: var(--cat-semi-bg); }
.cat-chip--msk    { color: var(--cat-msk);   background: var(--cat-msk-bg);  }
.cat-chip--pip    { color: var(--cat-pip);   background: var(--cat-pip-bg);  }
.cat-chip--risk   { color: var(--cat-risk);  background: var(--cat-risk-bg); }
.cat-chip--legal  { color: var(--cat-legal, #7c3aed); background: var(--cat-legal-bg, #f5f3ff); }
.cat-chip--com    { color: var(--cat-com,   #0f766e); background: var(--cat-com-bg,  #f0fdfa);  }
.cat-chip--pur    { color: var(--cat-pur);   background: var(--cat-pur-bg);  }
.cat-chip--safe   { color: var(--cat-safe);  background: var(--cat-safe-bg); }
.cat-chip--common { color: var(--cat-common);background: var(--cat-common-bg);}

/* ---- CONTENT TYPE BADGES ---- */
.type-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px var(--s2);
  border-radius: var(--r-xs);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.type-badge--tool    { color: var(--type-tool);    background: var(--type-tool-bg);    }
.type-badge--code    { color: var(--type-code);    background: var(--type-code-bg);    }
.type-badge--case    { color: var(--type-case);    background: var(--type-case-bg);    }
.type-badge--learn   { color: var(--type-learn);   background: var(--type-learn-bg);   }
.type-badge--product { color: var(--type-product); background: var(--type-product-bg); }
.type-badge--manual  { color: var(--type-manual);  background: var(--type-manual-bg);  }

.status-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px var(--s2);
  border-radius: var(--r-xs);
}
.status-badge--free { color: var(--status-free); background: var(--status-free-bg); }
.status-badge--paid { color: var(--status-paid); background: var(--status-paid-bg); }
.status-badge--new  { color: var(--status-new);  background: var(--status-new-bg);  }

/* ---- TOOL CARDS ---- */
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--s6);
  transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-fast);
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--sky);
  transform: translateY(-2px);
}
.tool-card:active { transform: translateY(0); }

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--s4);
}

.tool-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--sky-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tool-icon svg { width: 22px; height: 22px; color: var(--navy); }

.tool-cat {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: var(--s2);
}
.tool-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: var(--s2);
}
.tool-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
  margin-bottom: var(--s5);
}
.tool-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  margin-top: auto;
}
.tool-arrow svg { width: 14px; height: 14px; transition: transform var(--t-base); }
.tool-card:hover .tool-arrow svg { transform: translateX(3px); }

/* ---- CODE ITEMS (List style) ---- */
.code-item {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: var(--s5);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.code-item:hover { border-color: var(--sky); box-shadow: var(--shadow-sm); }

.code-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--navy);
  background: var(--sky-pale);
  border: 1px solid var(--sky-light);
  padding: var(--s1) var(--s3);
  border-radius: var(--r-xs);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
}

.code-body { flex: 1; min-width: 0; }
.code-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--s1);
}
.code-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--navy);
  margin-bottom: var(--s1);
  line-height: 1.4;
}
.code-summary {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.code-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s3);
}
.code-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- CATEGORY HUB CARDS ---- */
.cat-hub-card {
  display: flex;
  align-items: center;
  gap: var(--s4);
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
  transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-fast);
}
.cat-hub-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.cat-hub-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-2xl);
}

.cat-hub-body { flex: 1; min-width: 0; }
.cat-hub-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--s1);
}
.cat-hub-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  padding: var(--s3) var(--s6);
  border-radius: var(--r-md);
  transition: background var(--t-base), color var(--t-base),
              border-color var(--t-base), transform var(--t-fast);
  cursor: pointer;
  border: 1.5px solid transparent;
  text-align: center;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn--primary  { color: var(--navy);  background: var(--sky); }
.btn--primary:hover  { background: var(--sky-light); }

.btn--ghost    { color: var(--text-on-dark); border-color: rgba(255,255,255,0.2); }
.btn--ghost:hover    { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.06); }

.btn--outline  { color: var(--navy); border-color: var(--navy); }
.btn--outline:hover  { background: var(--navy); color: var(--white); }

.btn--sm { font-size: var(--text-sm); padding: var(--s2) var(--s4); }

/* ---- CREDENTIALS ---- */
.cred-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
}
.cred-dot {
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--sky);
  flex-shrink: 0;
}
.cred-text { font-size: var(--text-sm); font-weight: 500; color: var(--navy); }

/* ---- FOOTER ---- */
.footer { background: var(--navy-deep); padding: var(--s12) 0 var(--s8); }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s8);
  margin-bottom: var(--s10);
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
}
.footer-logo {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--white);
  margin-bottom: var(--s3);
}
.footer-logo em { font-style: normal; color: var(--sky); }
.footer-tagline { font-size: var(--text-sm); color: var(--text-on-dark-dim); line-height: 1.6; max-width: 280px; }

.footer-col-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: rgba(232,237,248,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--s4);
}
.footer-links { display: flex; flex-direction: column; gap: var(--s3); }
.footer-link { font-size: var(--text-sm); color: rgba(232,237,248,0.55); transition: color var(--t-base); }
.footer-link:hover { color: var(--white); }

.footer-bottom {
  padding-top: var(--s6);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: space-between;
  align-items: center;
}
.footer-copy { font-size: var(--text-xs); color: rgba(232,237,248,0.3); }

}
