/* ============================================================================
   Font Face
   ============================================================================ */
@font-face {
  font-family: 'Satoshi';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url(/fonts/satoshi-variable.woff2) format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

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

:root {
  --font-display: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-350: #bcbcbc;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-900: #171717;

  --accent: #3478F6;

  --nav-bg: rgba(255, 255, 255, 0.85);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --noise-opacity: 0.035;
}

/* ============================================================================
   Dark Mode
   ============================================================================ */
html.dark {
  --white: #0a0a0a;
  --gray-50: #141414;
  --gray-100: #1a1a1a;
  --gray-200: #2a2a2a;
  --gray-350: #474747;
  --gray-400: #6b6b6b;
  --gray-500: #8b8b8b;
  --gray-600: #a1a1a1;
  --gray-700: #c4c4c4;
  --gray-900: #ededed;

  --accent: #5A9EFF;

  --nav-bg: rgba(10, 10, 10, 0.85);

  --noise-opacity: 0.03;
}

/* ============================================================================
   Base
   ============================================================================ */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  background: var(--gray-50);
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--gray-900);
  background: transparent;
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 8px 16px;
  background: var(--gray-900);
  color: var(--white);
  font-size: 14px;
  text-decoration: none;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
  outline: none;
}

.skip-link:focus-visible {
  left: 8px;
  top: 8px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a { color: inherit; text-decoration: none; }

a, button, [role="button"], input[type="submit"], input[type="button"] {
  cursor: pointer;
  transition: opacity 0.2s;
}

a:hover, button:hover, [role="button"]:hover, input[type="submit"]:hover, input[type="button"]:hover {
  opacity: 0.7;
}

.page-wrapper {
  background: var(--white);
  position: relative;
  min-height: 100vh;
}

/* ============================================================================
   Theme Toggle
   ============================================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle:hover { color: var(--gray-500); }

.theme-toggle svg { width: 20px; height: 20px; }

.theme-icon-moon { display: none; }
html.dark .theme-icon-sun { display: none; }
html.dark .theme-icon-moon { display: block; }

/* ============================================================================
   Navigation
   ============================================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gray-200);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-size: 14px;
  color: var(--gray-600);
  font-weight: 500;
}

/* ============================================================================
   Footer
   ============================================================================ */
.footer {
  padding: 12px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding-top: 0;
  font-size: 13px;
  color: var(--gray-400);
}

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-bottom-links a {
  font-size: 12px;
  color: var(--gray-400);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================================
   Noise Overlay
   ============================================================================ */
.noise {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url(/images/noise.webp);
  background-size: 180px;
  background-repeat: repeat;
  opacity: var(--noise-opacity);
}

.page-wrapper > *:not(.noise) {
  position: relative;
  z-index: 1;
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 640px) {
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .footer-bottom-links {
    flex-direction: column;
    gap: 8px;
  }
}
