:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --border: rgba(26, 18, 8, 0.08);
  --muted: #786558;
  --fg: #1a1208;
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.1);
  --hero-grid-line: rgba(26, 18, 8, 0.04);
  --terminal-glow: rgba(180, 83, 9, 0.06);
}

html.dark {
  --bg: #1c1410;
  --surface: #251c16;
  --border: rgba(255, 246, 241, 0.08);
  --muted: #a89580;
  --fg: #faf6f1;
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --hero-grid-line: rgba(255, 246, 241, 0.04);
  --terminal-glow: rgba(245, 158, 11, 0.08);
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-feature-settings: "ss01", "cv11";
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 1rem;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 0.5rem;
  transition: color 0.2s, background-color 0.2s;
}

.nav-link:hover {
  color: var(--fg);
}

.nav-link.is-active {
  color: var(--accent);
}

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 9999px;
  background: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--accent);
  transform: rotate(15deg);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.hero-grid {
  background-image:
    linear-gradient(to right, var(--hero-grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hero-grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 80%);
}

.terminal {
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.5),
    0 0 0 1px var(--terminal-glow);
}

.terminal pre {
  margin: 0;
}

.typed-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: caret-blink 1s steps(2, start) infinite;
}

@keyframes caret-blink {
  to { visibility: hidden; }
}

.scroll-dot {
  animation: scroll-down 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes scroll-down {
  0% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(8px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  color: var(--muted);
  background: var(--bg);
}

.arrow-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform 0.3s, background-color 0.3s;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .scroll-dot,
  .typed-caret,
  .animate-ping,
  .animate-pulse {
    animation: none !important;
  }
}

@media (max-width: 640px) {
  .terminal pre {
    font-size: 0.75rem;
  }
}
