/* ---------- Tokens ---------- */
:root {
  --bg: #07070b;
  --bg-2: #0c0c12;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ececf1;
  --text-dim: #a4a4b0;
  --text-faint: #6b6b78;
  --accent-a: #00e5ff;
  --accent-b: #7c4dff;
  --accent-grad: linear-gradient(135deg, var(--accent-a) 0%, var(--accent-b) 100%);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px rgba(124, 77, 255, 0.25), 0 12px 40px rgba(0, 229, 255, 0.12);
  --radius: 14px;
  --radius-lg: 20px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- Background canvas ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 50% at 80% 0%, rgba(124, 77, 255, 0.18), transparent 60%),
    radial-gradient(50% 40% at 0% 100%, rgba(0, 229, 255, 0.12), transparent 60%),
    linear-gradient(180deg, #07070b 0%, #0a0a12 100%);
  z-index: -1;
}

/* ---------- Layout ---------- */
main { position: relative; z-index: 1; }
.section {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 120px 32px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(7, 7, 11, 0.6);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.logo-mark {
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0));
  box-shadow: var(--shadow-1);
  transition: transform 0.5s var(--ease);
}
.logo:hover .logo-mark { transform: rotate(-4deg) scale(1.04); }
.logo-name {
  font-size: 17px;
  letter-spacing: -0.01em;
}

/* Nav */
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav-link {
  position: relative;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  border-radius: 999px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-active {
  color: var(--text);
  background: var(--surface-2);
}
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: var(--accent-grad);
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  padding-top: 80px;
  padding-bottom: 80px;
}
.hero-inner { max-width: 880px; }

.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(40px, 6.4vw, 80px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 28px;
  color: var(--text);
}
h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(32px, 4.6vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}
h3 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

.gradient-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  font-size: 19px;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 680px;
  margin: 0 0 36px;
}
.section-lede {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 720px;
  margin: 0;
}

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 64px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
              border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
              color 0.25s var(--ease);
}
.btn-primary {
  color: #0a0a12;
  background: var(--accent-grad);
  box-shadow: 0 8px 30px rgba(0, 229, 255, 0.18), 0 2px 0 rgba(255,255,255,0.06) inset;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 36px rgba(124, 77, 255, 0.28); }
.btn-ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); border-color: rgba(255,255,255,0.28); }
.btn-block { width: 100%; }

.hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 16px;
  max-width: 760px;
}
.hero-tools-label {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hero-tools ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-tools li {
  font-size: 13px;
  color: var(--text-dim);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease),
              background 0.25s var(--ease);
}
.hero-tools li:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

/* ---------- Capability pillars ---------- */
.pillars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.pillar {
  position: relative;
  padding: 32px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease),
              transform 0.4s var(--ease);
}
.pillar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(0, 229, 255, 0.5), rgba(124, 77, 255, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.pillar:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}
.pillar:hover::before { opacity: 1; }
.pillar-num {
  font-family: 'Fraunces', serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}
.pillar h3 {
  font-size: 22px;
  margin-bottom: 18px;
}
.capabilities {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0;
}
.capabilities li {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.capabilities li:last-child { padding-bottom: 0; }
.capabilities strong {
  display: block;
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.capabilities span {
  display: block;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  display: grid;
  place-items: center;
  opacity: 0.7;
}
.scroll-cue span {
  width: 3px;
  height: 7px;
  border-radius: 2px;
  background: var(--text);
  animation: scrollCue 1.8s var(--ease) infinite;
}
@keyframes scrollCue {
  0% { transform: translateY(-6px); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translateY(6px); opacity: 0; }
}

/* ---------- About / Projects ---------- */
.section-head { max-width: 820px; margin-bottom: 56px; }

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.project {
  position: relative;
  padding: 26px 26px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.012));
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}
.project::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(0,229,255,0.5), rgba(124,77,255,0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.project:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.04);
  box-shadow: var(--shadow-glow);
}
.project:hover::before { opacity: 1; }
.project-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}
.project p {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 18px;
}
.project strong { color: var(--text); font-weight: 600; }
.stack {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stack li {
  font-size: 12px;
  color: var(--text-faint);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}

/* ---------- Blog index ---------- */
.blog-index .section-head { margin-bottom: 48px; }
.blog-index h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(40px, 5.6vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.posts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}
.post-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease),
              transform 0.4s var(--ease);
}
.post-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(0, 229, 255, 0.5), rgba(124, 77, 255, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}
.post-card:hover::before { opacity: 1; }
.post-card-link {
  display: block;
  padding: 28px 30px;
  color: inherit;
}
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.post-dot { opacity: 0.6; }
.post-card h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--text);
  transition: color 0.25s var(--ease);
}
.post-card:hover h2 { color: #fff; }
.post-card p {
  color: var(--text-dim);
  font-size: 15.5px;
  line-height: 1.6;
  margin: 0 0 16px;
  max-width: 720px;
}
.post-tags {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.post-tags li {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}
.post-cta {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Article ---------- */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 96px 32px 120px;
}
.article-header { margin-bottom: 48px; }
.article-header h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.article-content {
  font-size: 17px;
  line-height: 1.72;
  color: var(--text);
}
.article-content > * + * { margin-top: 1.2em; }
.article-content p { color: var(--text-dim); }
.article-content h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-top: 2em;
  margin-bottom: 0.4em;
  color: var(--text);
}
.article-content h3 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: 1.6em;
  margin-bottom: 0.3em;
  color: var(--text);
}
.article-content ul,
.article-content ol {
  padding-left: 1.25em;
  color: var(--text-dim);
}
.article-content li { margin-top: 0.4em; }
.article-content li strong { color: var(--text); font-weight: 600; }
.article-content a {
  color: var(--accent-a);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 229, 255, 0.3);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.article-content a:hover {
  color: #fff;
  border-bottom-color: var(--accent-a);
}
.article-content blockquote {
  margin: 1.6em 0;
  padding: 12px 22px;
  border-left: 2px solid;
  border-image: var(--accent-grad) 1;
  color: var(--text);
  font-style: italic;
}
.article-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.article-content pre {
  margin: 1.6em 0;
  padding: 18px 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
}
.article-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
}
.article-content hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 2.4em 0;
}
.article-content img {
  border-radius: 12px;
  border: 1px solid var(--border);
}

.article-footer {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.article-back {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.25s var(--ease);
}
.article-back:hover { color: var(--text); }

@media (max-width: 820px) {
  .article { padding: 64px 22px 88px; }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}
.contact-copy p { color: var(--text-dim); max-width: 460px; }
.contact-meta {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  gap: 14px;
}
.contact-meta li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.contact-meta span {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.contact-meta a:hover { color: var(--accent-a); }

.contact-form {
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01));
  box-shadow: var(--shadow-1);
}
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.field .optional {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-faint);
  font-weight: 400;
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease),
              box-shadow 0.25s var(--ease);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(124, 77, 255, 0.6);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 4px rgba(124, 77, 255, 0.12);
}
.field.invalid input,
.field.invalid textarea {
  border-color: rgba(255, 99, 132, 0.7);
  box-shadow: 0 0 0 4px rgba(255, 99, 132, 0.12);
}
.hp { position: absolute; left: -9999px; opacity: 0; }

.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(10,10,18,0.4);
  border-top-color: #0a0a12;
  display: none;
  animation: spin 0.7s linear infinite;
}
.is-submitting .btn-label { opacity: 0.6; }
.is-submitting .btn-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-status {
  margin: 14px 0 0;
  font-size: 14px;
  min-height: 1.2em;
  color: var(--text-dim);
}
.form-status.is-success { color: #5be3a7; }
.form-status.is-error { color: #ff6384; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 32px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}
.footer-dot { margin: 0 8px; }

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .section { padding: 88px 22px; }
  .site-header { padding: 14px 22px; }
  .logo-name { display: none; }
  .nav-toggle { display: inline-flex; }
  .site-nav ul {
    position: absolute;
    top: 100%;
    right: 22px;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: rgba(10, 10, 16, 0.96);
    border: 1px solid var(--border);
    border-radius: 14px;
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-1);
    transform-origin: top right;
    transform: scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  }
  .site-nav.is-open ul {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .pillars { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; gap: 36px; }
  .contact-meta li { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
