/* =========================================================
   HAKI - Components: nav, buttons, cards, badges, theme toggle
   ========================================================= */

/* ---- Navigation ---- */
nav.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 72px;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.nav-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-primary);
}

.nav-brand-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  overflow: hidden;
  flex: none;
}
.nav-brand-mark img { width: 24px; height: 24px; image-rendering: -webkit-optimize-contrast; }

.nav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.nav-brand-text .name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
.nav-brand-text .sub {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

/* Nav-links is hidden by default on every viewport; opened via burger */
.nav-links {
  display: none;
  list-style: none;
}
.nav-links.open {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: calc(72px + var(--space-2));
  right: var(--space-3);
  min-width: 260px;
  max-width: calc(100vw - var(--space-5));
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-modal);
  padding: var(--space-2);
  gap: 2px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  animation: nav-menu-in 180ms ease-out;
}
.nav-links a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-btn);
  transition: background 160ms ease, color 160ms ease;
  letter-spacing: -0.005em;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: rgba(200, 168, 78, 0.10);
}

@keyframes nav-menu-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 540px) {
  .nav-links.open {
    left: var(--space-3);
    right: var(--space-3);
    min-width: 0;
  }
}

.nav-right { display: flex; align-items: center; gap: var(--space-2); }

.nav-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  padding: 0.45rem;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}
.nav-burger:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.nav-burger[aria-expanded="true"] { border-color: var(--accent-primary); color: var(--accent-primary); }

/* ---- Theme toggle ---- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.45rem;
  border-radius: var(--radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.theme-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.theme-toggle .icon-sun  { display: var(--toggle-icon-show); }
.theme-toggle .icon-moon { display: var(--toggle-icon-hide); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.005em;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.18s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gradient-cta);
  color: var(--n-white);
  box-shadow: 0 4px 14px rgba(26, 138, 112, 0.30);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(26, 138, 112, 0.45);
  color: var(--n-white);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}
.btn-ghost:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-link {
  background: transparent;
  color: var(--accent-primary);
  padding: 0.5rem 0;
  font-weight: 600;
  border: none;
  min-height: auto;
}
.btn-link:hover { color: var(--accent-primary-hover); }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-medium);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}
.card:hover::before { opacity: 1; }

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(43, 196, 132, 0.10);
  color: var(--plexaris-teal-light);
  margin-bottom: var(--space-3);
}
[data-theme="light"] .card-icon {
  background: rgba(26, 138, 112, 0.08);
  color: var(--plexaris-teal);
}

.card h3 { margin-bottom: var(--space-2); }
.card p  { color: var(--text-secondary); }

/* ---- Stat tile ---- */
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}
.stat-tile .number {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.stat-tile .label {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-medium);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-primary);
}
.badge.role-admin    .dot { background: #DC2626; }
.badge.role-citizen  .dot { background: #2563EB; }
.badge.role-police   .dot { background: var(--plexaris-teal); }
.badge.role-court    .dot { background: #7C3AED; }
.badge.role-reviewer .dot { background: #F59E0B; }

/* ---- Pipeline step ---- */
.step {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.step:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}
.step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(200, 168, 78, 0.12);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.8125rem;
  border: 1px solid var(--border-medium);
}
.step .agent { font-weight: 600; color: var(--text-primary); font-size: 0.9375rem; }
.step .desc  { font-size: 0.8125rem; color: var(--text-tertiary); line-height: 1.5; }

/* ---- Timeline (roadmap) ---- */
.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 5%;
  right: 5%;
  height: 1px;
  background: var(--border-medium);
  z-index: 0;
}
.timeline-item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.timeline-marker {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-page-tint);
  border: 2px solid var(--border-medium);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  margin-bottom: var(--space-2);
}
.timeline-item.active .timeline-marker {
  border-color: var(--accent-primary);
  background: rgba(200, 168, 78, 0.10);
  box-shadow: 0 0 0 6px rgba(200, 168, 78, 0.10);
}
.timeline-phase {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-primary);
  font-weight: 600;
}
@media (max-width: 720px) {
  .timeline { grid-template-columns: 1fr; gap: var(--space-5); }
  .timeline::before { display: none; }
}

/* ---- KPI grid ---- */
.kpi {
  text-align: center;
  padding: var(--space-4) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-card);
}
.kpi .num {
  display: block;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-primary);
  margin-bottom: 0.25rem;
}
.kpi .label {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Security tier ---- */
.tier {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-card);
}
.tier-icon {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(200, 168, 78, 0.10);
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tier h4 { margin-bottom: 0.25rem; color: var(--text-primary); }
.tier p  { color: var(--text-secondary); font-size: 0.9375rem; }
.tier-tag {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* ---- Stakeholder card ---- */
.stake {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-card);
}
.stake-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(43, 196, 132, 0.10);
  color: var(--plexaris-teal-light);
}
[data-theme="light"] .stake-icon { background: rgba(26, 138, 112, 0.10); color: var(--plexaris-teal); }
.stake h3 { font-size: 1.0625rem; margin-bottom: 0.25rem; }
.stake ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: var(--space-2);
}
.stake ul li {
  position: relative;
  padding-left: 1.125rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.55;
}
.stake ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-secondary);
}

/* ---- Image frame for product mockups ---- */
.product-frame {
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-modal);
  background: var(--bg-card);
  padding: var(--space-3);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.product-frame img {
  border-radius: 8px;
  width: 100%;
  height: auto;
  display: block;
}

/* ---- Footer ---- */
footer.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding-block: var(--space-7) var(--space-5);
  background: var(--bg-page);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}
@media (max-width: 980px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-4); }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-col h5 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
  font-weight: 600;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.footer-col a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.footer-col a:hover { color: var(--accent-primary); }
.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}
.footer-plexaris {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: var(--space-3);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* ---- Icons ---- */
svg.icon { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.icon-sm { width: 18px; height: 18px; }
svg.icon-lg { width: 32px; height: 32px; }

/* ---- Anchors with offset for fixed nav ---- */
[id] { scroll-margin-top: 90px; }
