/* ============================================================
   BASE — shared tokens, reset, layout, nav, footer, typography
   Imported by every page. Page-specific styles live in their
   own files: index.css / post.css / about.css
   ============================================================ */

/* --- Tokens --- */

:root {
  --color-bg:      #0a0a0a;
  --color-surface: #1e1e1e;
  --color-primary: #00ffea;
  --color-accent:  #ff00c8;
  --color-muted:   #b4b4b4;
  --color-success: #00ff7f;
  --color-warning: #ffbf00;
  --color-error:   #ff4b4b;
  --font-body:     'Inter', system-ui, sans-serif;
  --font-code:     'Fira Code', monospace;
  --font-heading:  'Montserrat', sans-serif;
  --fw-regular: 400;
  --fw-medium:  600;
  --fw-bold:    700;
}

/* --- Reset --- */

*, *::before, *::after {
  box-sizing: border-box;
}

figure {
  margin: 0;
  padding: 0;
}

/* --- Page shell --- */

html, body {
  min-height: 100vh;
  scrollbar-gutter: stable;
}

body {
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top left, #101116, #0a0a0a 70%);
  color: #e8e8e8;
  line-height: 1.6;
}

main {
  flex: 1;
  max-width: 950px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

section {
  margin: 1.5rem 0;
}

/* --- Navigation --- */

header, footer {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

header.site-nav {
  width: 100%;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-brand {
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: 1.1rem;
  text-decoration: none;
}

.nav-brand:hover {
  color: var(--color-primary);
}

header.site-nav nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

header.site-nav .menu-toggle {
  background: transparent;
  border: 0;
  color: var(--color-primary);
  font-size: 1.2rem;
  cursor: pointer;
}

/* --- Footer --- */

footer {
  width: 100%;
  flex-shrink: 0;
  padding: 1.25rem 2rem;
  text-align: center;
  box-shadow: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-inner {
  max-width: 950px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.social-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.social-links a {
  color: var(--color-muted);
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--color-primary);
}

.footer-nav {
  display: flex;
  gap: 1rem;
}

.footer-nav a,
.social {
  color: var(--color-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

footer p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* --- Typography --- */

h1, h2, h3 {
  margin: 0 0 0.75rem;
  font-weight: var(--fw-bold);
  line-height: 1.2;
}

h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }

h2 {
  color: #fff;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

h3 { font-size: 1.1rem; }

/* --- Links --- */

a {
  color: var(--color-primary);
}

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

nav a {
  text-decoration: none;
  color: var(--color-primary);
  font-weight: var(--fw-medium);
  transition: color 0.2s ease, transform 0.2s ease;
}

nav a:hover {
  color: var(--color-accent);
  transform: translateY(-1px);
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  padding: 0.75rem 1.3rem;
  border-radius: 8px;
  font-weight: var(--fw-medium);
  text-decoration: none;
  cursor: pointer;
  border: 0;
}

.btn-primary {
  background: var(--color-primary);
  color: #000;
}

/* --- Accessibility / print --- */

@media (prefers-contrast: more) {
  :root {
    --color-bg: #000000;
    --color-surface: #111111;
  }
}

@media print {
  :root {
    --color-bg: #ffffff;
    --color-surface: #f9f9f9;
    --color-primary: #0066cc;
    --color-accent: #0066cc;
  }

  body { color: #000; background: #fff; }

  header, footer { box-shadow: none; border-color: #ddd; }
}

/* --- Back to top --- */

#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--color-primary);
  color: #000;
  border: 0;
  border-radius: 50%;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 255, 234, 0.3);
  transition: transform 0.18s ease;
  z-index: 100;
}

#back-to-top:hover {
  transform: translateY(-3px);
}

/* --- Mobile nav --- */

@media (max-width: 640px) {
  header.site-nav {
    position: sticky; /* already set, ensures containing block for dropdown */
    flex-wrap: wrap;
  }

  header.site-nav nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    z-index: 49;
  }

  header.site-nav nav.nav-open {
    max-height: 300px;
    padding: 0.75rem 1.5rem 1rem;
  }

  header.site-nav nav a {
    padding: 0.5rem 0;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  header.site-nav .menu-toggle {
    display: block;
  }
}

@media (min-width: 641px) {
  header.site-nav .menu-toggle {
    display: none;
  }
}

