/* ============================================
   LAYOUT — Page structure, nav, footer, grid
   ============================================ */

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(6, 10, 16, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
}

.nav__brand-icon {
  font-size: var(--text-2xl);
}

.nav__links {
  display: flex;
  list-style: none;
  gap: var(--space-1);
}

.nav__link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav__link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav__link--active {
  color: var(--accent);
  background: var(--accent-light);
}

.nav-beta {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-primary, #6366f1);
  opacity: 0.7;
  letter-spacing: 0.02em;
}

.nav__mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-xl);
  cursor: pointer;
  padding: var(--space-2);
}

/* ---- Main Content ---- */
.main {
  flex: 1;
  margin-top: var(--nav-height);
  padding: var(--space-8) var(--space-6);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

/* ---- Page with Sidebar ---- */
.page-with-sidebar {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--space-8);
  max-width: var(--max-width);
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-4));
  height: fit-content;
  max-height: calc(100vh - var(--nav-height) - var(--space-8));
  overflow-y: auto;
}

/* ---- Grid Systems ---- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--border-color);
  padding: var(--space-8) var(--space-6);
  margin-top: var(--space-16);
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer__text {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.footer__links {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}

.footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.footer__links a:hover {
  color: var(--text-primary);
}

/* ---- Section Headings ---- */
.section-header {
  margin-bottom: var(--space-8);
}

.section-header__title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

.section-header__subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
}

/* ---- Breadcrumbs ---- */
.breadcrumbs {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs__sep::before {
  content: '/';
  margin: 0 var(--space-1);
}

/* ---- Utility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
