/* ── Custom properties ─────────────────────────── */
:root {
  --bg:            #0d0d0d;
  --bg-card:       #141414;
  --border:        #1f1f1f;
  --text-primary:  #e8e4d9;
  --text-secondary:#9a9a9a;
  --accent:        #b0b8c1;
  --brain:         #c8cdd2;
  --max-w:         900px;
  --section-y:     7.5rem;
  --circuit-line:  %231f1f1f;
  --circuit-dot:   %231a1a1a;
}

/* ── Light theme overrides ─────────────────────── */
[data-theme="light"] {
  --bg:            #f4efe6;
  --bg-card:       #ede7db;
  --border:        #cdc8be;
  --text-primary:  #1a1a1a;
  --text-secondary:#5c5c5c;
  --accent:        #6a7a84;
  --brain:         #5a6a74;
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Crect width='80' height='80' fill='none'/%3E%3Cpath d='M0 40h20M60 40h20M40 0v20M40 60v20' stroke='%231f1f1f' stroke-width='0.8'/%3E%3Ccircle cx='40' cy='40' r='2' fill='%231f1f1f'/%3E%3Ccircle cx='0' cy='40' r='1.2' fill='%231a1a1a'/%3E%3Ccircle cx='80' cy='40' r='1.2' fill='%231a1a1a'/%3E%3Ccircle cx='40' cy='0' r='1.2' fill='%231a1a1a'/%3E%3Ccircle cx='40' cy='80' r='1.2' fill='%231a1a1a'/%3E%3Cpath d='M10 0v10h10M60 0v10h10M10 70v10h10M60 70v10h10' stroke='%231a1a1a' stroke-width='0.6' fill='none'/%3E%3C/svg%3E");
  background-size: 80px 80px;
  color: var(--text-secondary);
  font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

[data-theme="light"] body {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Crect width='80' height='80' fill='none'/%3E%3Cpath d='M0 40h20M60 40h20M40 0v20M40 60v20' stroke='%23cdc8be' stroke-width='0.8'/%3E%3Ccircle cx='40' cy='40' r='2' fill='%23cdc8be'/%3E%3Ccircle cx='0' cy='40' r='1.2' fill='%23d4cfc6'/%3E%3Ccircle cx='80' cy='40' r='1.2' fill='%23d4cfc6'/%3E%3Ccircle cx='40' cy='0' r='1.2' fill='%23d4cfc6'/%3E%3Ccircle cx='40' cy='80' r='1.2' fill='%23d4cfc6'/%3E%3Cpath d='M10 0v10h10M60 0v10h10M10 70v10h10M60 70v10h10' stroke='%23d4cfc6' stroke-width='0.6' fill='none'/%3E%3C/svg%3E");
}

/* ── Logo SVG theming ──────────────────────────── */
/* Node dots — CSS overrides SVG presentation attributes */
.logo-node { fill: #8aaee8; }
.logo-border { stroke: #e8e4d9; }
/* Light mode: remap all logo internals so the brain silhouette is visible */
[data-theme="light"] .logo-left-bg   { fill: #c8d8ee; }
[data-theme="light"] .logo-right-bg  { fill: #adc2dc; }
[data-theme="light"] .logo-tri       { fill: #b2c8e2; stroke: #7a9ec4; }
[data-theme="light"] .logo-right-fill { fill: #8db0d0; }
[data-theme="light"] .logo-gyrus     { stroke: #4a78a8; }
[data-theme="light"] .logo-node      { fill: #1a3a78; }
[data-theme="light"] .logo-divider   { stroke: #2a4878; opacity: 0.65; }
[data-theme="light"] .logo-border    { stroke: #1a2d6b; }

h1, h2, h3 { color: var(--text-primary); font-weight: 300; line-height: 1.2; }
a { color: inherit; }

/* ── Layout helpers ────────────────────────────── */
main { position: relative; z-index: 2; }
.container { max-width: var(--max-w); margin: 0 auto; text-align: center; }
section { padding: var(--section-y) 2rem; }
.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
}

/* ── Scroll fade-in ────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.fade-in.visible { opacity: 1; transform: none; }
.projects-grid.visible .project-card:nth-child(1) { transition-delay: 0s; }
.projects-grid.visible .project-card:nth-child(2) { transition-delay: 0.08s; }
.projects-grid.visible .project-card:nth-child(3) { transition-delay: 0.16s; }
.projects-grid.visible .project-card:nth-child(4) { transition-delay: 0.24s; }
.services-grid.visible .service-card:nth-child(1) { transition-delay: 0s; }
.services-grid.visible .service-card:nth-child(2) { transition-delay: 0.06s; }
.services-grid.visible .service-card:nth-child(3) { transition-delay: 0.12s; }
.services-grid.visible .service-card:nth-child(4) { transition-delay: 0.18s; }
.services-grid.visible .service-card:nth-child(5) { transition-delay: 0.24s; }
.services-grid.visible .service-card:nth-child(6) { transition-delay: 0.30s; }
.services-grid.visible .service-card:nth-child(7) { transition-delay: 0.36s; }
.services-grid.visible .service-card:nth-child(8) { transition-delay: 0.42s; }
.packages-grid.visible .package-card:nth-child(1) { transition-delay: 0s; }
.packages-grid.visible .package-card:nth-child(2) { transition-delay: 0.10s; }
.packages-grid.visible .package-card:nth-child(3) { transition-delay: 0.20s; }

/* ── Nav ───────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(13,13,13,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.3s, border-color 0.3s;
}
[data-theme="light"] nav { background: rgba(244,239,230,0.88); }
nav.scrolled { border-bottom: 1px solid var(--border); }
.nav-logo {
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-icons { display: flex; align-items: center; gap: 0.6rem; }
.nav-icon {
  display: flex; align-items: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-icon:hover { color: var(--accent); }
.nav-icon svg { width: 18px; height: 18px; fill: currentColor; }
.nav-divider { width: 1px; height: 14px; background: var(--border); }
.lang-toggle { display: flex; align-items: center; gap: 0.4rem; }
.lang-toggle button {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.7rem; font-family: inherit;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0; transition: color 0.15s;
}
.lang-toggle button.active { color: var(--text-primary); }
.lang-toggle button:hover  { color: var(--accent); }
.lang-toggle .sep { color: var(--border); font-size: 0.8rem; }

/* ── Theme toggle button ───────────────────────── */
.theme-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 0;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.theme-btn:hover { color: var(--accent); }
.theme-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .icon-sun  { display: none; }
.theme-btn .icon-moon { display: block; }
[data-theme="light"] .theme-btn .icon-sun  { display: block; }
[data-theme="light"] .theme-btn .icon-moon { display: none; }

/* ── Hero ──────────────────────────────────────── */
#hero {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  position: relative;
  padding: 7.5rem 2rem;
  overflow: hidden;
}
.hero-inner { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; position: relative; z-index: 1; }
.hero-logo svg {
  width: 140px; height: 140px;
  animation: brain-pulse 3s ease-in-out infinite;
}
@keyframes brain-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(40,96,184,0.25)); }
  50%       { filter: drop-shadow(0 0 22px rgba(74,128,216,0.65)); }
}
@keyframes brain-pulse-light {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(0,0,0,0.22)) drop-shadow(0 2px 12px rgba(0,0,0,0.14)); }
  50%       { filter: drop-shadow(0 0 20px rgba(0,0,0,0.42)) drop-shadow(0 4px 22px rgba(0,0,0,0.22)); }
}
[data-theme="light"] .hero-logo svg { animation-name: brain-pulse-light; }
.hero-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-weight: 300;
}
.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--text-primary);
  font-weight: 300;
}
.hero-sub { font-size: 0.9rem; color: var(--text-secondary); max-width: 460px; }
.hero-arrow {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  color: var(--accent); font-size: 1rem;
  animation: bob 2.2s ease-in-out infinite;
  z-index: 1;
}
@keyframes bob {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(7px); }
}

/* ── Full-page particles — aligned to circuit vertical traces ── */
/* Circuit tile: 80px. Vertical stubs at x=40 per tile.          */
/* Spans 1-12: float UP. Spans 13-24: float DOWN.                */
.page-particles {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  overflow: hidden;
}
.page-particles span {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
}
/* Up-moving particles (bottom → top) */
.page-particles span:nth-child(1)  { left: 40px;  bottom: 0; animation: float-up  9s  linear 0s    infinite; }
.page-particles span:nth-child(2)  { left: 120px; bottom: 0; animation: float-up  11s linear 1.8s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(3)  { left: 200px; bottom: 0; animation: float-up  8s  linear 0.6s  infinite; width: 4px; height: 4px; }
.page-particles span:nth-child(4)  { left: 280px; bottom: 0; animation: float-up  13s linear 3.2s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(5)  { left: 360px; bottom: 0; animation: float-up  10s linear 0.3s  infinite; }
.page-particles span:nth-child(6)  { left: 440px; bottom: 0; animation: float-up  7s  linear 2.1s  infinite; width: 4px; height: 4px; }
.page-particles span:nth-child(7)  { left: 520px; bottom: 0; animation: float-up  12s linear 1.0s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(8)  { left: 600px; bottom: 0; animation: float-up  9s  linear 4.0s  infinite; }
.page-particles span:nth-child(9)  { left: 680px; bottom: 0; animation: float-up  11s linear 0.5s  infinite; width: 4px; height: 4px; }
.page-particles span:nth-child(10) { left: 760px; bottom: 0; animation: float-up  8s  linear 2.5s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(11) { left: 840px; bottom: 0; animation: float-up  14s linear 1.3s  infinite; }
.page-particles span:nth-child(12) { left: 920px; bottom: 0; animation: float-up  10s linear 3.6s  infinite; width: 2px; height: 2px; }
/* Down-moving particles (top → bottom) */
.page-particles span:nth-child(13) { left: 40px;  top: 0; animation: float-down 10s linear 5.0s  infinite; }
.page-particles span:nth-child(14) { left: 120px; top: 0; animation: float-down 8s  linear 0.9s  infinite; width: 4px; height: 4px; }
.page-particles span:nth-child(15) { left: 200px; top: 0; animation: float-down 13s linear 2.4s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(16) { left: 280px; top: 0; animation: float-down 9s  linear 4.5s  infinite; }
.page-particles span:nth-child(17) { left: 360px; top: 0; animation: float-down 11s linear 1.5s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(18) { left: 440px; top: 0; animation: float-down 7s  linear 3.0s  infinite; width: 4px; height: 4px; }
.page-particles span:nth-child(19) { left: 520px; top: 0; animation: float-down 12s linear 0.2s  infinite; }
.page-particles span:nth-child(20) { left: 600px; top: 0; animation: float-down 9s  linear 5.5s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(21) { left: 680px; top: 0; animation: float-down 10s linear 1.8s  infinite; width: 4px; height: 4px; }
.page-particles span:nth-child(22) { left: 760px; top: 0; animation: float-down 14s linear 0.7s  infinite; }
.page-particles span:nth-child(23) { left: 840px; top: 0; animation: float-down 8s  linear 3.8s  infinite; width: 2px; height: 2px; }
.page-particles span:nth-child(24) { left: 920px; top: 0; animation: float-down 11s linear 2.2s  infinite; }
@keyframes float-up {
  0%   { transform: translateY(0)      scale(1);   opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.2; }
  100% { transform: translateY(-100vh) scale(0.4); opacity: 0; }
}
@keyframes float-down {
  0%   { transform: translateY(0)      scale(1);   opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.2; }
  100% { transform: translateY(100vh)  scale(0.4); opacity: 0; }
}
[data-theme="light"] .page-particles span { background: #006b68; }

/* ── About ─────────────────────────────────────── */
#about .about-text { max-width: 600px; margin: 0 auto; }
#about h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); margin-bottom: 1.5rem; }
#about p  { margin-bottom: 1rem; }

/* ── Projects ──────────────────────────────────── */
#projects .section-label { margin-bottom: 2rem; }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  transition: border-color 0.2s, opacity 0.65s ease, transform 0.65s ease;
  text-align: left;
}
.project-card:hover { border-color: var(--accent); }
.project-icon { font-size: 1.4rem; margin-bottom: 0.75rem; }
.project-card h3 { font-size: 1rem; font-weight: 400; margin-bottom: 0.5rem; }
.project-card p  { font-size: 0.875rem; margin-bottom: 1rem; }
.project-link {
  font-size: 0.75rem; color: var(--accent);
  text-decoration: none; letter-spacing: 0.05em;
  transition: color 0.15s;
}
.project-link:hover { color: var(--text-primary); }

/* ── Services ──────────────────────────────────── */
#services .section-label { margin-bottom: 2rem; }
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  transition: opacity 0.65s ease, transform 0.65s ease;
  text-align: left;
}
.service-card h3 { font-size: 0.9rem; font-weight: 400; margin-bottom: 0.5rem; }
.service-card p  { font-size: 0.8rem; margin-bottom: 0.75rem; }
.service-scope {
  font-size: 0.65rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}

/* ── Packages ──────────────────────────────────── */
#packages .section-label { margin-bottom: 2rem; }
.packages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.package-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.75rem 1.5rem;
  display: flex; flex-direction: column;
  text-align: left;
  transition: border-color 0.2s, opacity 0.65s ease, transform 0.65s ease;
}
.package-card.featured { border-color: var(--accent); }
.package-card:hover { border-color: var(--accent); }
.package-tier {
  font-size: 0.65rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 0.75rem; display: block;
}
.package-card h3 { font-size: 1rem; font-weight: 300; margin-bottom: 0.5rem; }
.package-desc { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 1.25rem; }
.package-features {
  list-style: none; margin-bottom: 1.5rem; flex: 1;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.package-features li {
  font-size: 0.8rem; color: var(--text-secondary);
  padding-left: 1rem; position: relative;
}
.package-features li::before { content: '·'; position: absolute; left: 0; color: var(--accent); }
.package-scope {
  font-size: 0.65rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
  margin-top: auto; display: block;
}

/* ── Contact ───────────────────────────────────── */
#contact h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); margin-bottom: 0.5rem; }
.contact-intro { margin-bottom: 2rem; }
.contact-form { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label {
  font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  text-align: left;
}
.form-field input,
.form-field textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font: inherit; font-size: 0.9rem;
  outline: none; transition: border-color 0.15s, background 0.3s;
}
.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); }
.form-field textarea { min-height: 120px; resize: vertical; }
.submit-btn {
  align-self: center;
  background: none; border: 1px solid var(--accent);
  color: var(--accent); padding: 0.75rem 2rem;
  font: inherit; font-size: 0.75rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer; border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.submit-btn:hover:not(:disabled) { background: var(--accent); color: var(--bg); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.form-status { font-size: 0.875rem; color: var(--accent); display: none; }
.form-status.visible { display: block; }
.contact-social {
  margin-top: 2rem; display: flex;
  align-items: center; justify-content: center; gap: 1.5rem;
}
.contact-social a {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-secondary); text-decoration: none; transition: color 0.15s;
}
.contact-social a:hover { color: var(--accent); }
.contact-social svg { width: 15px; height: 15px; fill: currentColor; }

/* ── Footer ────────────────────────────────────── */
footer {
  position: relative; z-index: 2;
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
footer a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
footer a:hover { color: var(--text-primary); }

/* ── Go to top ─────────────────────────────────── */
.go-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 99;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--accent); width: 40px; height: 40px;
  border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, border-color 0.15s, color 0.15s, background 0.3s;
}
.go-top.visible { opacity: 1; pointer-events: auto; }
.go-top:hover { border-color: var(--accent); color: var(--text-primary); }
.go-top svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 640px) {
  :root { --section-y: 3.75rem; }
  nav { padding: 1rem 1.25rem; }
  .nav-right { gap: 0.65rem; }
  .projects-grid,
  .services-grid,
  .packages-grid { grid-template-columns: 1fr; }
}
