/* Dark theme (default) */
:root {
  --bg: #0a0b0d;
  --bg-alt: #0f1114;
  --text: #f0f2f5;
  --muted: #94a3b8;
  --card: #141619;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --ring: rgba(59, 130, 246, 0.35);
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(148, 163, 184, 0.1);
  --maxw: 1120px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.2), 0 8px 10px -6px rgba(0,0,0,.2);
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Light theme */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --ring: rgba(59, 130, 246, 0.25);
  --border: rgba(148, 163, 184, 0.15);
  --shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}

/* Respect system preference if no manual toggle */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --card: #ffffff;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --ring: rgba(59, 130, 246, 0.25);
    --border: rgba(148, 163, 184, 0.15);
    --shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(to bottom right, var(--bg), color-mix(in oklab, var(--bg) 95%, var(--accent) 5%)),
              radial-gradient(circle at 20% 80%, color-mix(in oklab, var(--accent) 15%, transparent), transparent 50%),
              radial-gradient(circle at 80% 20%, color-mix(in oklab, var(--accent-light) 10%, transparent), transparent 50%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header { 
  position: sticky; 
  top: 0; 
  backdrop-filter: saturate(180%) blur(20px); 
  background: color-mix(in oklab, var(--bg-alt) 75%, transparent);
  border-bottom: 1px solid var(--border); 
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 32px; height: 32px; color: var(--accent); }
.brand strong { font-weight: 700; font-size: 18px; letter-spacing: -0.5px; background: linear-gradient(135deg, var(--text), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
nav ul { display: flex; list-style: none; margin: 0; padding: 0; gap: 24px; align-items: center; }
nav a { color: var(--muted); font-weight: 500; transition: color 0.2s; position: relative; }
nav a:hover { color: var(--text); text-decoration: none; }
nav a::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 2px; background: var(--accent); transition: width 0.3s; }
nav a:hover::after { width: 100%; }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: 8px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}
.theme-toggle:hover {
  color: var(--text);
  background: var(--card);
}
.theme-toggle svg {
  display: none;
}
[data-theme="light"] .sun-icon,
[data-theme="dark"] .moon-icon,
html:not([data-theme]) .moon-icon {
  display: block;
}
@media (prefers-color-scheme: light) {
  html:not([data-theme]) .sun-icon {
    display: block;
  }
  html:not([data-theme]) .moon-icon {
    display: none;
  }
}

/* Hero */
.hero { padding: 100px 0 60px; display: grid; grid-template-columns: 1.25fr .75fr; gap: 60px; align-items: center; }
.hero h1 { 
  font-size: clamp(32px, 5vw, 56px); 
  line-height: 1.1; 
  margin: 0 0 20px; 
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--text) 60%, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p.lede { font-size: clamp(18px, 2vw, 22px); color: var(--text); margin: 0 0 20px; line-height: 1.6; opacity: 0.95; }
.hero p.lede-secondary { font-size: clamp(16px, 1.8vw, 19px); color: var(--muted); margin: 0 0 32px; line-height: 1.6; }
.hero .ctas { display: flex; gap: 16px; flex-wrap: wrap; }
.btn { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
  padding: 12px 24px; 
  border-radius: 10px; 
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn:not(.alt) {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 4px 14px 0 color-mix(in oklab, var(--accent) 30%, transparent);
}
.btn:not(.alt):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 color-mix(in oklab, var(--accent) 40%, transparent);
}
.btn.alt { 
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.alt:hover {
  background: color-mix(in oklab, var(--card) 90%, var(--accent) 10%);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card { 
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  padding: 28px; 
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

.avatar-wrap { display: grid; place-items: center; }
.avatar { 
  width: 180px; 
  height: 180px; 
  border-radius: 50%; 
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  box-shadow: 0 20px 40px color-mix(in oklab, var(--accent) 25%, transparent);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar img { 
  width: calc(100% - 8px); 
  height: calc(100% - 8px); 
  object-fit: cover; 
  display: block; 
  border-radius: 50%;
}

/* Sections */
section { padding: 40px 0; }
section h2 { 
  font-size: clamp(24px, 3vw, 32px); 
  margin: 0 0 24px; 
  font-weight: 700;
  letter-spacing: -0.5px;
  position: relative;
  display: inline-block;
}
section h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
}
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero .ctas { justify-content: center; }
  .avatar-wrap { margin-top: 20px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .nav { padding: 16px; }
  nav ul { gap: 12px; font-size: 14px; }
  .theme-toggle { padding: 6px; margin-left: 4px; }
}

.service { 
  padding: 24px; 
  border-radius: var(--radius); 
  background: var(--card);
  border: 1px solid var(--border);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.service::before {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background: radial-gradient(circle, var(--accent-light), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.service:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}
.service:hover::before {
  opacity: 0.05;
}
.service h3 { 
  margin: 0 0 12px; 
  font-size: 19px; 
  font-weight: 600;
  color: var(--text);
}
.service p { margin: 0; color: var(--muted); line-height: 1.5; }

.project { 
  display: flex; 
  flex-direction: column; 
  gap: 12px; 
  padding: 24px; 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  background: var(--card);
  transition: all 0.3s;
  height: 100%;
  position: relative;
}
.project:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.project .kicker { 
  font-size: 11px; 
  letter-spacing: 1px; 
  text-transform: uppercase; 
  color: var(--accent);
  font-weight: 600;
}
.project a.title, .project .title { 
  font-weight: 700; 
  font-size: 18px; 
  color: var(--text);
  text-decoration: none;
  display: block;
}
.project a.title:hover {
  color: var(--accent);
}
.project p { 
  margin: 0; 
  color: var(--muted); 
  line-height: 1.5;
  flex-grow: 1;
}

/* Coming Soon Projects */
.project.coming-soon {
  opacity: 0.7;
  background: color-mix(in oklab, var(--card) 50%, transparent);
}
.project.coming-soon .kicker {
  color: var(--warning);
}
.project.coming-soon .title {
  color: var(--muted);
}
.project.coming-soon:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.list { display: grid; gap: 8px; }
.list a { display: inline-flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed color-mix(in oklab, var(--text) 16%, transparent); }
.list a:hover { border-style: solid; text-decoration: none; }

footer { 
  padding: 60px 0 40px; 
  color: var(--muted); 
  font-size: 14px;
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: linear-gradient(to bottom, transparent, color-mix(in oklab, var(--bg-alt) 50%, transparent));
}
.footer-grid { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; }
@media (max-width: 700px) { 
  .footer-grid { grid-template-columns: 1fr; text-align: center; }
  .footer-grid .list { justify-content: center; }
}

/* List styles */
.list { display: flex; gap: 12px; flex-wrap: wrap; }
.list a { 
  padding: 8px 16px; 
  border-radius: 8px; 
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  transition: all 0.2s;
}
.list a:hover { 
  color: var(--text);
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
}

/* Accessibility helpers */
.skip { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip:focus { position: static; width: auto; height: auto; background: var(--accent); color: white; padding: 8px 10px; border-radius: 8px; }

/* Additional polish */
::selection {
  background: color-mix(in oklab, var(--accent) 30%, transparent);
  color: var(--text);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Typography improvements */
p {
  line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
}

/* Animation for page load */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero, section {
  animation: fadeIn 0.6s ease-out;
}

section:nth-child(2) { animation-delay: 0.1s; }
section:nth-child(3) { animation-delay: 0.2s; }
section:nth-child(4) { animation-delay: 0.3s; }
section:nth-child(5) { animation-delay: 0.4s; }