:root {
  --bg: #ffffff;
  --text: #222222;
  --muted: #666666;
  --accent: #2563eb;
  --sidebar-bg: #f4f6f8;
  --border: #e5e7eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10;
    --text: #e6e8ea;
    --muted: #a1a7ae;
    --accent: #60a5fa;
    --sidebar-bg: #111418;
    --border: #1f242a;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
}
.skip-link:focus { left: 8px; z-index: 1000; }

/* Layout shells */
.site {
  display: grid;
  grid-template-rows: auto 1fr auto; /* header, main, footer */
  min-height: 100dvh;
}

header.site-header {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: white;
  overflow: hidden;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.brand-logo svg { width: 28px; height: 28px; }
.brand-title {
  font-weight: 700;
  letter-spacing: .2px;
  margin: 0;
  font-size: 1.25rem;
}
.brand-subtitle {
  margin: 0;
  opacity: .9;
  font-size: .875rem;
}

.header-graphic {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .25;
}

/* Main two-column layout */
.main {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}
aside.sidebar {
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  padding: 1rem;
  position: sticky;          /* Sticky sidebar on desktop */
  top: 0;                    /* stick to top of viewport */
  align-self: start;         /* allow sticky within grid item */
  height: calc(100dvh - 0px);/* full viewport height */
  overflow: auto;            /* scroll if content exceeds */
}

nav.site-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-title {
  font-size: .875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 .5rem 0;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem .75rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
}
.nav-link:hover,
.nav-link:focus {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.25);
  outline: none;
}
.nav-link.active {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.35);
}

/* Content card */
main.content {
  padding: 1.25rem 1.5rem;
  min-width: 0;
}
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
h1, h2, h3 { margin-top: .2em; }
p { margin: .25em 0 1em; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  padding: 1rem 1.25rem;
}
.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: .9375rem;
}
.footer-nav a {
  margin-right: .75rem;
  color: var(--text);
  text-decoration: none;
}
.footer-nav a:hover,
.footer-nav a:focus {
  text-decoration: underline;
}

/* Mobile adjustments */
.nav-toggle {
  display: none;
  background: rgba(255,255,255,.2);
  color: white;
  border: 0;
  padding: .5rem .75rem;
  border-radius: 8px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
  }
  /* On mobile the sidebar becomes an off-canvas drawer */
  aside.sidebar {
    position: fixed;
    z-index: 20;
    inset: 64px auto 0 0;
    width: 80%;
    max-width: 320px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    height: calc(100dvh - 64px);
    overflow-y: auto;
  }
  aside.sidebar.open { transform: translateX(0); }
  .nav-toggle { display: inline-flex; }
  main.content { padding: 1rem; }
}
