/* ============================================================
   BASE — Reset, typography defaults, body, layout, utilities
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

/* Canvas-based animated background sits behind everything */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.layout { position: relative; z-index: 1; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: var(--color-bg);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  z-index: 1000;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--space-4); }

/* --- Two-panel layout --- */
.layout {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  gap: 0;
}

.left-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--left-panel-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-24) var(--space-12);
  overflow: hidden;
}

.right-panel {
  flex: 1;
  min-width: 0;
  padding: var(--space-24) var(--space-12);
}

/* --- Section spacing --- */
.section {
  padding-bottom: var(--space-32);
}

/* --- Typography helpers --- */
h1, h2, h3 {
  font-family: var(--font-sans);
  color: var(--color-text);
  line-height: var(--leading-tight);
}

code, .mono {
  font-family: var(--font-mono);
}

/* --- Utilities --- */
.text-accent { color: var(--color-accent); }
.text-muted  { color: var(--color-text-muted); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Focus --- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --- Mobile: stack panels vertically --- */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .left-panel {
    position: relative;
    top: auto;
    height: auto;
    width: 100%;
    padding: var(--space-16) var(--page-padding-x) var(--space-8);
  }

  .right-panel {
    padding: var(--space-8) var(--page-padding-x) var(--space-16);
  }
}
