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

:root {
  --bg:        #000000;
  --bg1:       #03050c;
  --bg2:       #070a14;
  --bg3:       #0b1020;
  --glass:     rgba(255,255,255,0.03);
  --glass2:    rgba(255,255,255,0.06);
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.13);
  --text:      #e8edf8;
  --text2:     #7b8899;
  --text3:     #424e5e;
  --cyan:      #00d4ff;
  --blue:      #4f6ef7;
  --purple:    #8b5cf6;
  --green:     #10b981;
  --grad:      linear-gradient(135deg, #00d4ff 0%, #4f6ef7 50%, #8b5cf6 100%);
  --radius:    12px;
  --radius-lg: 20px;
  --max-w:     1280px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

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

/* ─── Gradient text ──────────────────────────────────────────────────────────── */
.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Logo mark ──────────────────────────────────────────────────────────────── */
.logo-mark {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: var(--grad);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  flex-shrink: 0;
}

/* ─── Nav ────────────────────────────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: calc(100% - 3rem);
  max-width: 1020px;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.4rem;
  height: 54px;
  background: rgba(7, 10, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border2);
  border-radius: 100px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: background 0.3s;
}
nav.scrolled .nav-inner {
  background: rgba(3, 5, 12, 0.96);
  box-shadow: 0 12px 40px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 500;
}
.logo-dot { color: var(--cyan); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.nav-links a {
  font-size: 0.88rem;
  color: var(--text2);
  transition: color 0.2s;
  cursor: pointer;
}
.nav-links a:hover { color: var(--text); }

.btn-nav {
  padding: 0.42rem 1.1rem;
  border: 1px solid var(--border2);
  border-radius: 100px;
  font-size: 0.84rem !important;
  color: var(--text) !important;
  background: var(--glass2);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s !important;
}
.btn-nav:hover {
  border-color: rgba(0,212,255,0.4) !important;
  color: var(--cyan) !important;
  background: rgba(0,212,255,0.06) !important;
}

/* ─── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  padding-top: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-left: clamp(1.5rem, 4vw, 3rem);
  padding-right: clamp(1.5rem, 4vw, 3rem);
  position: relative;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.glow-1 {
  width: 700px; height: 700px;
  top: -180px; right: -160px;
  background: radial-gradient(circle, rgba(0,212,255,0.1) 0%, transparent 65%);
}
.glow-2 {
  width: 600px; height: 600px;
  bottom: -120px; left: -180px;
  background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 65%);
}
.glow-3 {
  width: 480px; height: 480px;
  top: 50%; left: 42%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(79,110,247,0.07) 0%, transparent 65%);
}

#grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
  width: 100%;
  max-width: var(--max-w);
  padding: 3rem 0 2rem;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  flex: 0 0 auto;
  max-width: 520px;
}

.hero-terminal {
  flex: 1;
  min-width: 0;
  max-width: 620px;
}

.terminal-glow-wrap {
  position: relative;
}
.terminal-glow-wrap::before {
  content: '';
  position: absolute;
  inset: -30px;
  background: radial-gradient(ellipse at center, rgba(79,110,247,0.12) 0%, transparent 65%);
  pointer-events: none;
  z-index: -1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--cyan);
  background: rgba(0,212,255,0.07);
  margin-bottom: 1.75rem;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50%       { opacity: 0.75; box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}

h1 {
  font-size: clamp(2.6rem, 4.2vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.4rem;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text2);
  max-width: 460px;
  margin-bottom: 2.25rem;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.78rem 1.7rem;
  background: var(--grad);
  color: #fff;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 30px rgba(79,110,247,0.35), 0 4px 16px rgba(0,0,0,0.4);
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(79,110,247,0.5), 0 8px 24px rgba(0,0,0,0.5);
}
.btn-primary:hover::after { opacity: 1; }

.btn-ghost {
  font-size: 0.95rem;
  color: var(--text2);
  transition: color 0.2s;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); }

.hero-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.1rem 1.4rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.stat-label { font-size: 0.71rem; color: var(--text3); letter-spacing: 0.02em; }
.stat-div   { width: 1px; height: 28px; background: var(--border2); }

/* ─── Hero scroll indicator ──────────────────────────────────────────────────── */
.hero-scroll {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 2.5rem;
  color: var(--text3);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--border2), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50%       { opacity: 0.9; transform: scaleY(0.7); }
}

/* ─── Reveal animations ──────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
  transition-delay: var(--delay, 0ms);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Terminal ───────────────────────────────────────────────────────────────── */
.terminal {
  background: rgba(7, 10, 20, 0.92);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 32px 80px rgba(0,0,0,0.75),
    0 0 80px rgba(79,110,247,0.08),
    0 0 160px rgba(0,212,255,0.03);
}
.terminal.small { font-size: 0.82rem; }

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 1.1rem;
  background: rgba(11, 16, 32, 0.95);
  border-bottom: 1px solid var(--border);
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot.red    { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green  { background: #28c840; }
.terminal-title {
  margin-left: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text3);
}

.terminal-body {
  padding: 1.5rem 1.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  line-height: 1.9;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
}
.t-dim     { color: var(--text3); }
.t-cmd     { color: #c9d1d9; }
.t-ok      { color: var(--green); }
.t-muted   { color: var(--text2); }
.t-head    { color: var(--text3); }
.t-node    { color: #a5d8ff; }
.t-comment { color: var(--text3); font-style: italic; }
.t-cursor  {
  color: var(--cyan);
  animation: blink 1.1s step-start infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ─── Sections ───────────────────────────────────────────────────────────────── */
.section {
  padding: clamp(5rem, 8vw, 8rem) clamp(1.5rem, 4vw, 3rem);
}
.section-dark {
  background: var(--bg1);
  position: relative;
}
.section-dark::before,
.section-dark::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
}
.section-dark::before { top: 0; background: linear-gradient(90deg, transparent, var(--border2), transparent); }
.section-dark::after  { bottom: 0; background: linear-gradient(90deg, transparent, var(--border2), transparent); }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: clamp(3rem, 5vw, 5rem);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.section-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.8rem;
  padding: 0.28rem 0.75rem;
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 100px;
  background: rgba(0,212,255,0.05);
}
h2 {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.9rem;
}
.section-sub {
  font-size: 1rem;
  color: var(--text2);
  line-height: 1.7;
}

/* ─── Services ───────────────────────────────────────────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.service-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.service-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,212,255,0.04) 0%, rgba(139,92,246,0.03) 50%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.service-card:hover {
  transform: translateY(-5px);
  border-color: var(--border2);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(79,110,247,0.07);
}
.service-card:hover::after { opacity: 1; }

.card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--cyan);
  margin-bottom: 1.25rem;
  transition: border-color 0.3s, color 0.3s;
}
.service-card:hover .card-icon {
  border-color: rgba(0,212,255,0.35);
  color: var(--cyan);
  box-shadow: 0 0 16px rgba(0,212,255,0.12);
}

.service-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.1em;
  margin-bottom: 0.7rem;
}
.service-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  color: var(--text);
}
.service-card p {
  font-size: 0.87rem;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}
.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
}
.service-tags li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.67rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid var(--border2);
  border-radius: 4px;
  color: var(--text3);
  background: rgba(255,255,255,0.02);
  transition: color 0.2s, border-color 0.2s;
}
.service-card:hover .service-tags li {
  color: var(--text2);
  border-color: rgba(79,110,247,0.3);
}

/* ─── Stack ──────────────────────────────────────────────────────────────────── */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2.5rem;
}

.stack-group-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.stack-items {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.stack-item {
  font-size: 0.87rem;
  color: var(--text2);
  transition: color 0.2s, transform 0.2s;
  padding-left: 0.85rem;
  position: relative;
  cursor: default;
}
.stack-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border2);
  transition: background 0.2s;
}
.stack-item:hover { color: var(--text); transform: translateX(3px); }
.stack-item:hover::before { background: var(--cyan); }

/* ─── Principles ─────────────────────────────────────────────────────────────── */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.principle {
  padding-left: 1.5rem;
  border-left: 1px solid var(--border);
  transition: border-color 0.3s;
}
.principle:hover { border-left-color: var(--cyan); }
.principle-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.85rem;
}
.principle h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
  color: var(--text);
}
.principle p {
  font-size: 0.87rem;
  color: var(--text2);
  line-height: 1.7;
}

/* ─── Contact ────────────────────────────────────────────────────────────────── */
.section-contact { background: var(--bg); }

.contact-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: clamp(2.5rem, 5vw, 4rem);
  /* Gradient border trick */
  background:
    linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(135deg, rgba(0,212,255,0.35), rgba(79,110,247,0.2), rgba(139,92,246,0.25)) border-box;
  border: 1px solid transparent;
}
.contact-glow {
  position: absolute;
  width: 450px; height: 450px;
  top: -120px; right: -80px;
  background: radial-gradient(circle, rgba(79,110,247,0.1) 0%, transparent 65%);
  pointer-events: none;
}

.contact-text .section-tag { display: inline-block; margin-bottom: 1rem; text-align: left; }
.contact-text h2 {
  font-size: clamp(1.65rem, 2.3vw, 2.2rem);
  margin-bottom: 1rem;
  text-align: left;
  letter-spacing: -0.03em;
}
.contact-text p {
  color: var(--text2);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 2rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s, color 0.2s;
  cursor: pointer;
  width: fit-content;
}
.contact-link svg { color: var(--cyan); flex-shrink: 0; }
.contact-link:hover {
  background: rgba(0,212,255,0.08);
  border-color: rgba(0,212,255,0.35);
  color: var(--cyan);
  transform: translateX(4px);
}

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
  background: var(--bg1);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: var(--max-w);
  margin: 0 auto;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
}
.footer-copy  { font-size: 0.8rem; color: var(--text3); }
.footer-links a {
  font-size: 0.83rem;
  color: var(--text3);
  transition: color 0.2s;
  cursor: pointer;
}
.footer-links a:hover { color: var(--text2); }

/* ─── Responsive: tablet (≤ 1100px) ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .hero-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 3rem;
  }
  .hero-content { align-items: center; max-width: 640px; }
  .hero-sub { text-align: center; max-width: 540px; }
  .hero-actions { justify-content: center; }
  .hero-terminal { max-width: 700px; width: 100%; }
  .hero-stats { justify-content: center; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .stack-grid { grid-template-columns: repeat(3, 1fr); }
  .principles-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Responsive: mobile landscape (≤ 860px) ────────────────────────────────── */
@media (max-width: 860px) {
  nav { top: 10px; width: calc(100% - 2rem); }
  .hero-inner { padding: 2rem 0 1.5rem; gap: 2.5rem; }
  .contact-box { grid-template-columns: 1fr; gap: 2.5rem; }
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-scroll { display: none; }
}

/* ─── Responsive: mobile portrait (≤ 600px) ─────────────────────────────────── */
@media (max-width: 600px) {
  .nav-links a:not(.btn-nav) { display: none; }
  .services-grid { grid-template-columns: 1fr; }
  .stack-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .principles-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; gap: 1rem; }
  h1 { font-size: 2.5rem; }
}

/* ─── Accessibility ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .badge-dot, .t-cursor, .scroll-line { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
