/* ==========================================================================
   LAYOUT
   Page chrome, containers, grid scaffolding, background texture.
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

section {
  padding-block: var(--space-9);
  border-bottom: 1px solid var(--color-border);
}

section:last-of-type {
  border-bottom: none;
}

.section-head {
  margin-bottom: var(--space-7);
}

.section-head__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

/* A blinking cursor after the command reinforces "this is a live prompt,
   not a label" — a cheap way to make the eyebrow feel more like a deliberate
   half of the heading pair rather than an afterthought above it. */
.section-head__eyebrow::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 4px;
  background: var(--color-accent);
  vertical-align: -2px;
}

@media (prefers-reduced-motion: no-preference) {
  .section-head__eyebrow::after {
    animation: blink 1s steps(1) infinite;
  }
}

.section-head__title {
  font-size: var(--fs-2xl);
}

/* Subtle scanline + grid texture on the page background.
   Decorative only: fixed, low-opacity, ignored by assistive tech,
   and never sits behind body text at a contrast-relevant layer.

   Two kinds of motion, both very low-amplitude:
   1. A slow ambient drift (bg-drift keyframe) so it never reads as a
      static image, even before anyone scrolls.
   2. A gentle scroll-parallax: main.js writes --parallax-shift as you
      scroll, so the grid glides at a fraction of scroll speed instead of
      being pinned rigidly to the viewport. Both are no-ops under
      prefers-reduced-motion (the drift via the media query below; the
      parallax because main.js skips wiring the scroll listener at all). */
.bg-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(74, 222, 128, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 222, 128, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%);
  transform: translateY(var(--parallax-shift, 0px));
}

/* Animated network-node background (js/background.js). Hidden by default —
   the script only reveals it (and hides .bg-texture above) once it confirms
   motion is allowed and canvas is supported, so there's always a working
   background even if JS fails or reduced-motion is on. */
#bg-canvas {
  display: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .bg-texture {
    animation: bg-drift 50s linear infinite;
  }
}

/* ---------- Header / primary nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-4);
}

.site-header__brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--color-text);
}

.site-header__brand span {
  color: var(--color-accent);
}

.primary-nav__list {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.primary-nav__link {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.primary-nav__link:hover,
.primary-nav__link:focus-visible {
  color: var(--color-accent);
  text-decoration: none;
}

.primary-nav__link.is-active {
  color: var(--color-accent);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-toggle {
  display: none;
}

/* ---------- Two-column grid (Skills clusters) ---------- */

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

/* ---------- Project card grid ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: var(--space-6);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text-faint);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .grid-2,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .primary-nav {
    position: fixed;
    inset: 0 0 0 30%;
    top: var(--header-h, 60px);
    background: var(--color-bg-raised);
    border-left: 1px solid var(--color-border);
    padding: var(--space-6) var(--space-5);
    transform: translateX(100%);
    transition: transform var(--dur-base) var(--ease-out);
  }

  .primary-nav[data-open="true"] {
    transform: translateX(0);
  }

  .primary-nav__list {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
  }

  .nav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 560px) {
  .container {
    padding-inline: var(--space-4);
  }

  section {
    padding-block: var(--space-7);
  }

  .section-head {
    text-align: center;
  }

  .section-head__title {
    font-size: var(--fs-xl);
  }

  .site-footer__inner {
    flex-direction: column;
    text-align: center;
  }
}
