@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=JetBrains+Mono:wght@500;700&family=Sedgwick+Ave+Display&display=swap');

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  z-index: 100;
  text-decoration: none;
}

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

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

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

:root {
  --bg: #f5f5f4;
  --fg: #1c1917;
  --muted: #44403c;
  --border: #d6d3d1;
  color-scheme: light;
}

.dark {
  --bg: #000;
  --fg: #fff;
  --muted: #bbb;
  --border: #222;
  color-scheme: dark;
}

html {
  zoom: 1.15;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  transition: background-color 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: clip;
}

::selection {
  background-color: rgba(0, 0, 0, 0.15);
}

.dark ::selection {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s, border-color 0.2s;
}

.dark header {
  background: rgba(0, 0, 0, 0.7);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
}

header nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

header a {
  color: var(--muted);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
}

/* Underline slide-in animation for links */
header a,
.social-links a,
.back-link,
.about a,
.prose a {
  background-image: linear-gradient(var(--fg), var(--fg));
  background-size: 0% 1.5px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.2s ease, color 0.15s;
}

header a:hover,
.social-links a:hover,
.back-link:hover,
.about a:hover,
.prose a:hover {
  color: var(--fg);
  background-size: 100% 1.5px;
}

.site-name {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-name:hover {
  color: var(--fg);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  padding: 0.375rem;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  border-radius: 6px;
}

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

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

.icon-sun,
.icon-moon {
  display: none;
}

.dark .icon-moon {
  display: block;
}

html:not(.dark) .icon-sun {
  display: block;
}

/* Sections */
section {
  padding: 1.75rem 0;
  scroll-margin-top: 4rem;
}

section + section {
  border-top: 1px solid var(--border);
  transition: border-color 0.2s;
}

#writing {
  border-top: none;
}

.hero {
  padding-top: 7rem;
  padding-bottom: 4rem;
  position: relative;
}

.hero + section {
  border-top: none;
  padding-top: 0;
}

.hero::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  top: -2rem;
  bottom: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 10%, black 70%, transparent);
  z-index: -1;
  opacity: 0.35;
  filter: blur(60px) saturate(1.6);
  background:
    radial-gradient(ellipse 50% 60% at 20% 50%, rgba(255, 50, 100, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 75% 30%, rgba(60, 80, 255, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 45% 55% at 50% 70%, rgba(200, 50, 255, 0.45) 0%, transparent 70%),
    radial-gradient(ellipse 35% 45% at 85% 70%, rgba(255, 150, 50, 0.4) 0%, transparent 70%),
    radial-gradient(ellipse 30% 40% at 10% 80%, rgba(50, 200, 255, 0.35) 0%, transparent 70%);
  background-size: 200% 200%;
  background-position: 30% 60%;
  animation: gradient-drift 30s ease-in-out infinite alternate;
  animation-delay: 5s;
}

.dark .hero::before {
  opacity: 0.55;
  filter: blur(60px) saturate(2.4);
}

@keyframes gradient-drift {
  0% {
    background-position: 30% 60%;
  }
  25% {
    background-position: 70% 30%;
  }
  50% {
    background-position: 40% 80%;
  }
  75% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 30% 60%;
  }
}

h1 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 2.75rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

h1.name {
  font-family: 'Sedgwick Ave Display', 'JetBrains Mono', monospace;
  font-weight: 400;
  font-size: clamp(3.75rem, 12vw, 5.5rem);
  text-wrap: balance;
  text-shadow: 3px 2px 0 rgba(255, 30, 70, 0.45), -3px -2px 0 rgba(0, 100, 255, 0.4);
}

.dark h1.name {
  text-shadow: 3px 2px 0 rgba(255, 30, 70, 0.7), -3px -2px 0 rgba(0, 100, 255, 0.6);
}

h2 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.75rem;
  color: var(--fg);
}

.subtitle {
  font-size: 1.0625rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.75rem;
}

.location {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* Social links */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.8125rem;
}

.social-links a {
  color: var(--muted);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

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

/* About */
.about p {
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

.about a {
  color: var(--fg);
  text-decoration: none;
}

.about p:last-child {
  margin-bottom: 0;
}

.section-desc {
  color: var(--muted);
  margin-top: -1rem;
  margin-bottom: 1.75rem;
  font-size: 0.9375rem;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.project-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  transition: border-color 0.15s;
}

.project-card:hover {
  border-color: var(--muted);
}

.project-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  margin-bottom: 0.875rem;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  line-height: 1;
}

.project-card:nth-child(1) .project-icon {
  background: linear-gradient(135deg, #ff9a9a, #c9302c);
}

.project-card:nth-child(2) .project-icon {
  background: linear-gradient(135deg, #c9a0f0, #5a3dba);
}

.project-card:nth-child(3) .project-icon {
  background: linear-gradient(135deg, #7ee8fa, #0891b2);
}

.project-card:nth-child(4) .project-icon {
  background: linear-gradient(135deg, #ffd97a, #d97706);
}

.project-card:nth-child(5) .project-icon {
  background: linear-gradient(135deg, #6ee7a0, #15803d);
}

.project-card:nth-child(6) .project-icon {
  background: linear-gradient(135deg, #ffa0ac, #9b2c4a);
}

.project-card h3 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--fg);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.project-card p {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.75rem;
}

.project-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  transition: border-color 0.15s, background-color 0.15s;
  background: rgba(128, 128, 128, 0.06);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dark .project-tag {
  background: rgba(255, 255, 255, 0.06);
}

/* Hamburger button — hidden on desktop */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
  z-index: 60;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--fg);
  border-radius: 1px;
  transition: transform 0.3s cubic-bezier(.4,.0,.2,1), opacity 0.2s;
  transform-origin: center;
}

.menu-toggle.open span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.menu-toggle.open span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

/* Coming soon */
.coming-soon {
  position: relative;
  padding: 3.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
  mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.coming-soon p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  z-index: 1;
}

.construction-tape {
  position: absolute;
  left: -2rem;
  right: -2rem;
  height: 22px;
  background: repeating-linear-gradient(
    -45deg,
    #ffcc00,
    #ffcc00 9px,
    #2a2a2a 10px,
    #2a2a2a 19px,
    #ffcc00 20px
  );
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  opacity: 0.75;
}

.construction-tape:first-child {
  top: 1.2rem;
  transform: rotate(-3deg) translateZ(0);
}

.construction-tape:last-child {
  bottom: 1.2rem;
  transform: rotate(2.5deg) translateZ(0);
}

.dark .construction-tape {
  background: repeating-linear-gradient(
    -45deg,
    #ffcc00,
    #ffcc00 9px,
    #444 10px,
    #444 19px,
    #ffcc00 20px
  );
  opacity: 0.55;
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.5),
    inset 0 2px 0 rgba(255, 220, 80, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

/* Mobile nav overlay — hidden by default */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  background: rgba(255, 255, 255, 0.8);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(.4,.0,.2,1), visibility 0.3s;
}

.dark .mobile-nav {
  background: rgba(0, 0, 0, 0.8);
}

.mobile-nav nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 2rem;
}

.mobile-nav a,
.mobile-theme-toggle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.mobile-theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 6px;
}

.mobile-theme-toggle .icon-moon {
  width: 22px;
  height: 22px;
}

.mobile-theme-toggle .icon-sun {
  width: 26px;
  height: 26px;
}

.mobile-nav a:hover,
.mobile-theme-toggle:hover {
  color: var(--muted);
}

.mobile-nav.open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav.open a,
.mobile-nav.open .mobile-theme-toggle {
  opacity: 1;
  transform: translateY(0);
}

.mobile-nav.open :nth-child(1) { transition-delay: 0.08s; }
.mobile-nav.open :nth-child(2) { transition-delay: 0.14s; }
.mobile-nav.open :nth-child(3) { transition-delay: 0.2s; }
.mobile-nav.open :nth-child(4) { transition-delay: 0.26s; }

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

  header nav {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .mobile-nav {
    display: block;
  }
}

/* Blog listing */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.post-item {
  text-decoration: none;
  display: block;
}

.post-item time {
  font-size: 0.75rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.375rem;
  font-variant-numeric: tabular-nums;
}

.post-item h3 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--fg);
  margin-bottom: 0.5rem;
  transition: color 0.15s;
  letter-spacing: -0.01em;
}

.post-item:hover h3 {
  color: var(--muted);
}

.post-item p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.875rem;
}

/* Footer */
footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  transition: border-color 0.2s;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Blog post content */
.prose {
  line-height: 1.8;
  color: var(--fg);
}

.prose h1 {
  font-size: 1.75rem;
  margin: 2.5rem 0 1rem;
}

.prose h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fg);
  margin: 2.5rem 0 0.75rem;
  text-transform: none;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--fg);
  margin: 2rem 0 0.75rem;
}

.prose p {
  margin-bottom: 1.25rem;
  color: var(--muted);
}

.prose a {
  color: var(--fg);
  text-decoration: none;
}

.prose ul,
.prose ol {
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.prose li {
  margin-bottom: 0.375rem;
}

.prose strong {
  color: var(--fg);
  font-weight: 600;
}

.prose code {
  background: var(--border);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.85em;
}

.prose pre {
  background: var(--border);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--muted);
}

/* Back link */
.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  margin-bottom: 2.5rem;
}

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

/* Post header */
.post-header {
  margin-bottom: 0;
}

.post-header .subtitle {
  margin-bottom: 0;
}

.post-header time {
  font-size: 0.75rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.post-header h1 {
  font-size: 2rem;
  margin-bottom: 1.3rem;
}

/* Easter eggs */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-6deg) scale(1.02); }
  30% { transform: rotate(5deg) scale(1.04); }
  45% { transform: rotate(-4deg) scale(1.02); }
  60% { transform: rotate(3deg); }
  75% { transform: rotate(-2deg); }
  90% { transform: rotate(1deg); }
}

.wiggle {
  animation: wiggle 0.6s ease-in-out;
}

/* Party mode — transitions for fade in/out */
.hero::before {
  transition: opacity 0.8s ease, filter 0.8s ease, height 0.8s ease;
}

.party-out .hero::before {
  transition: opacity 0.8s ease, filter 0.8s ease, height 0.8s ease;
}

.party-out h1.name {
  transition: text-shadow 0.8s ease;
}

.party-out header {
  transition: background-color 0.8s ease, border-color 0.8s ease;
}

h1.name {
  transition: text-shadow 0.8s ease;
}

header {
  transition: background-color 0.8s ease, border-color 0.8s ease;
}

.party .hero::before {
  opacity: 0.85 !important;
  filter: blur(35px) saturate(3.5) brightness(1.15) !important;
  animation: party-gradient 1.5s ease-in-out infinite alternate !important;
  height: 160% !important;
}

@keyframes party-gradient {
  0% { background-position: 0% 0%; transform: translateX(-50%) scale(1.1); }
  25% { background-position: 100% 50%; transform: translateX(-50%); }
  50% { background-position: 30% 100%; transform: translateX(-50%) scale(1.25); }
  75% { background-position: 80% 20%; transform: translateX(-50%); }
  100% { background-position: 50% 80%; transform: translateX(-50%) scale(1.1); }
}

.party h1.name {
  animation: party-text 0.8s ease-in-out infinite alternate !important;
}

@keyframes party-text {
  0% { text-shadow: 4px 3px 0 rgba(255,30,70,0.7), -4px -3px 0 rgba(0,100,255,0.6), 0 0 15px rgba(200,50,255,0.3); }
  50% { text-shadow: -3px 4px 0 rgba(50,200,255,0.7), 3px -4px 0 rgba(255,150,50,0.6), 0 0 20px rgba(255,30,70,0.3); }
  100% { text-shadow: 5px -2px 0 rgba(34,211,153,0.7), -5px 2px 0 rgba(168,85,247,0.6), 0 0 18px rgba(50,200,255,0.3); }
}

.party header {
  background: linear-gradient(90deg, rgba(255,50,100,0.1), rgba(60,80,255,0.1), rgba(200,50,255,0.1)) !important;
  animation: party-header 1s linear infinite !important;
}

@keyframes party-header {
  0% { border-color: #ff3068; }
  33% { border-color: #47d1ff; }
  66% { border-color: #a855f7; }
  100% { border-color: #ff3068; }
}
