/* ============================================================
   Design tokens + base — Assurance & Audit Architecture Showcase
   ============================================================ */

:root {
  /* Brand accents */
  --accent:        #4f7cff;
  --accent-2:      #7b5cff;
  --accent-soft:   rgba(79,124,255,.14);
  --accent-border: rgba(79,124,255,.35);

  /* Architecture component categories */
  --c-client:   #38bdf8;
  --c-api:      #4f7cff;
  --c-app:      #a78bfa;
  --c-domain:   #f472b6;
  --c-db:       #34d399;
  --c-msg:      #fbbf24;
  --c-ext:      #fb7185;
  --c-sec:      #f87171;
  --c-mon:      #22d3ee;
  --c-func:     #c084fc;

  --ok:    #34d399;
  --warn:  #fbbf24;
  --err:   #fb7185;
  --info:  #38bdf8;

  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --maxw: 1180px;

  --ff-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.18);
  --shadow:    0 10px 30px -12px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 60px -20px rgba(0,0,0,.65);
}

/* ---------- Dark (default) ---------- */
:root[data-theme="dark"] {
  --bg:        #0b1020;
  --bg-2:      #0e1428;
  --panel:     #131a30;
  --panel-2:   #182142;
  --panel-3:   #1e2950;
  --card:      #141c34;
  --line:      rgba(255,255,255,.09);
  --line-2:    rgba(255,255,255,.14);
  --text:      #eef2fb;
  --text-2:    #aab4cf;
  --text-3:    #7683a3;
  --code-bg:   #0a0f1e;
  --grid:      rgba(255,255,255,.04);
  --glow:      radial-gradient(1200px 600px at 15% -10%, rgba(79,124,255,.16), transparent 60%),
               radial-gradient(1000px 500px at 100% 0%, rgba(123,92,255,.12), transparent 55%);
}

/* ---------- Light ---------- */
:root[data-theme="light"] {
  --bg:        #f4f6fc;
  --bg-2:      #eef1f9;
  --panel:     #ffffff;
  --panel-2:   #f6f8fe;
  --panel-3:   #eef2fd;
  --card:      #ffffff;
  --line:      rgba(15,23,42,.10);
  --line-2:    rgba(15,23,42,.16);
  --text:      #101627;
  --text-2:    #46536e;
  --text-3:    #74809b;
  --code-bg:   #0d1424;
  --grid:      rgba(15,23,42,.045);
  --glow:      radial-gradient(1200px 600px at 15% -10%, rgba(79,124,255,.10), transparent 60%),
               radial-gradient(1000px 500px at 100% 0%, rgba(123,92,255,.08), transparent 55%);
  --shadow:    0 10px 30px -14px rgba(31,45,90,.28);
  --shadow-lg: 0 30px 60px -24px rgba(31,45,90,.30);
  --accent-soft: rgba(79,124,255,.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--ff-sans);
  color: var(--text);
  background: var(--bg);
  background-image: var(--glow);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

h1,h2,h3,h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: 60px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 6px 14px rgba(79,124,255,.35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-contact { display: flex; align-items: center; gap: 8px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--line); }
.topbar-contact .contact-name { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.topbar-contact .contact-link { width: 34px; height: 34px; }
.topbar-contact .contact-link:hover { color: var(--accent); border-color: var(--accent-border); }
.contact-phone { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: .16s ease; }
.contact-phone svg { width: 15px; height: 15px; }
.contact-phone:hover { color: var(--accent); border-color: var(--accent-border); transform: translateY(-1px); }
@media (max-width: 780px) { .topbar-contact .contact-name { display: none; } }
@media (max-width: 980px) { .contact-phone .ph-num { display: none; } .contact-phone { padding: 0; width: 34px; justify-content: center; } }
@media (max-width: 560px) { .topbar-contact { border-right: none; padding-right: 0; } }

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  transition: .16s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.nav-toggle { display: none; }

.icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: block; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge-live { background: var(--accent-soft); color: var(--text); border-color: var(--accent-border); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }

/* ============================================================
   Layout
   ============================================================ */
.layout { display: flex; min-height: calc(100vh - 60px); }

.sidebar {
  position: sticky; top: 60px;
  align-self: flex-start;
  width: 292px; flex: 0 0 292px;
  height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}
.sidebar-search { padding: 14px 12px 6px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap > svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
#navSearch {
  width: 100%; padding: 9px 30px 9px 34px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text);
  font-size: 13px; font-family: var(--ff-sans); outline: none;
  transition: .15s ease; -webkit-appearance: none;
}
#navSearch::placeholder { color: var(--text-3); }
#navSearch:focus { border-color: var(--accent-border); background: var(--panel-2); box-shadow: 0 0 0 3px var(--accent-soft); }
#navSearch::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-kbd {
  position: absolute; right: 9px; font-family: var(--ff-mono); font-size: 11px;
  color: var(--text-3); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; pointer-events: none;
}
#navSearch:focus ~ .search-kbd, #navSearch:not(:placeholder-shown) ~ .search-kbd { opacity: 0; }
.nav-no-results { padding: 12px 16px; font-size: 12.5px; color: var(--text-3); }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 10px 12px 8px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); padding: 16px 12px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8.5px 11px; margin: 1px 0;
  border-radius: 10px;
  color: var(--text-2);
  cursor: pointer; user-select: none;
  font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: .13s ease;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); border-color: var(--accent-border); font-weight: 600; }
.nav-item.active .nav-num { background: var(--accent); color: #fff; border-color: transparent; }
.nav-num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; font-family: var(--ff-mono);
  color: var(--text-3); background: var(--panel); border: 1px solid var(--line);
}
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-footer { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.progress-wrap { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; width: 4%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }
.sidebar-foot-text { font-size: 11.5px; color: var(--text-3); }

.scrim { display: none; }

.content { flex: 1; min-width: 0; outline: none; }
.content-inner { max-width: var(--maxw); margin: 0 auto; padding: 34px 40px 30px; }

.page-foot {
  max-width: var(--maxw); margin: 0 auto; padding: 20px 40px 50px;
  color: var(--text-3); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--line); margin-top: 20px;
}
.foot-sep { opacity: .5; }
.page-foot a { color: var(--accent); font-weight: 600; text-decoration: none; }
.page-foot a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 980px) {
  .nav-toggle { display: grid; }
  .sidebar {
    position: fixed; left: 0; top: 60px; z-index: 55;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg); background: var(--panel);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { display: block; position: fixed; inset: 60px 0 0 0; z-index: 54; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .content-inner { padding: 24px 20px; }
  .brand-sub { display: none; }
}
@media (max-width: 560px) {
  .badge-live { display: none; }
  .content-inner { padding: 20px 14px; }
}
