:root {
  --bg: #050816;
  --bg-alt: #0c1020;
  --accent: #4f46e5;
  --text: #f9fafb;
  --muted: #9ca3af;
  --card: #0f172a;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
  --shadow-light: 0 10px 25px rgba(15, 23, 42, 0.55);
  --transition-fast: 0.2s ease-out;
  --transition-med: 0.3s ease-out;
  --max-width: 1120px;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #111827 0, #050816 40%, #020617 100%);
  color: var(--text);
  line-height: 1.6;
  scroll-behavior: smooth;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shell {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* HEADER */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: linear-gradient(to bottom, rgba(5, 8, 22, 0.96), rgba(5, 8, 22, 0.7));
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-symbol {
  width: 36px;
  height: 36px;
  border-radius: 30%;
  background: radial-gradient(circle at 30% 20%, #e5e7eb 0, #9ca3af 35%, #4b5563 55%, #020617 100%);
  position: relative;
  box-shadow: var(--shadow-light);
  overflow: hidden;
}

.brand-symbol::after {
  content: "</>";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f9fafb;
  text-shadow: 0 0 10px rgba(15, 23, 42, 0.9);
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; letter-spacing: 0.04em; font-size: 0.9rem; text-transform: uppercase; }
.brand-role { font-size: 0.78rem; color: var(--muted); }

nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.85rem;
}

nav a {
  position: relative;
  color: var(--muted);
  padding-bottom: 0.15rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #ec4899);
  transition: width var(--transition-fast);
}

nav a:hover { color: var(--text); }
nav a:hover::after { width: 100%; }

.nav-cta {
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(129, 140, 248, 0.65);
  background: radial-gradient(circle at top left, rgba(129, 140, 248, 0.25), rgba(15, 23, 42, 0.2));
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 1);
}

.nav-toggle {
  display: none;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.85);
  font-size: 0.8rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  nav {
    display: none;
    position: absolute;
    inset-inline: 1.5rem;
    top: 3.35rem;
    padding: 0.75rem 1rem 0.85rem;
    flex-direction: column;
    gap: 0.4rem;
    border-radius: 16px;
    background: radial-gradient(circle at top, #111827 0, #020617 80%);
    border: 1px solid rgba(31, 41, 55, 0.8);
  }
  nav.open { display: flex; }
  .nav-toggle { display: inline-flex; }
}

/* MATRIX HERO */
.matrix-hero {
  position: relative;
  width: 100%;
  height: 260px;
  overflow: hidden;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

@media (min-width: 900px) {
  .matrix-hero { height: 320px; }
}

#matrixCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.matrix-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(15, 23, 42, 0.6), rgba(2, 6, 23, 0.96)),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(2, 6, 23, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.matrix-logo-text {
  text-align: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.matrix-logo-text .brand-main {
  display: block;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: #bbf7d0;
  text-shadow:
    0 0 4px #22c55e,
    0 0 8px #22c55e,
    0 0 16px #16a34a,
    0 0 26px #16a34a;
  animation: neonPulseMain 3.2s ease-in-out infinite alternate;
}

.matrix-logo-text .brand-sub {
  display: block;
  margin-top: 0.4rem;
  font-size: clamp(0.75rem, 1.4vw, 0.95rem);
  color: #a7f3d0;
  text-shadow:
    0 0 3px #22c55e,
    0 0 10px rgba(22, 163, 74, 0.8);
  opacity: 0.92;
  animation: neonPulseSub 3.2s ease-in-out infinite alternate;
  animation-delay: 0.6s;
}

@keyframes neonPulseMain {
  0% {
    text-shadow:
      0 0 2px #22c55e,
      0 0 6px #22c55e,
      0 0 10px #16a34a;
  }
  100% {
    text-shadow:
      0 0 6px #22c55e,
      0 0 14px #22c55e,
      0 0 26px #16a34a,
      0 0 40px #16a34a;
  }
}

@keyframes neonPulseSub {
  0% {
    text-shadow:
      0 0 1px #22c55e,
      0 0 4px #22c55e;
  }
  100% {
    text-shadow:
      0 0 4px #22c55e,
      0 0 10px #22c55e,
      0 0 18px #16a34a;
  }
}

/* HERO */
.hero { padding: 3.5rem 0 3rem; }

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 3.5rem;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
}

.hero-kicker {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  margin-bottom: 0.6rem;
}

.hero-title span {
  background: linear-gradient(120deg, #a855f7, #6366f1, #22c55e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 32rem;
  margin-bottom: 1.4rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

/* SECTIONS */
section { padding: 2.75rem 0; }

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
}

.section-title { font-size: 1.2rem; }
.section-subtitle { font-size: 0.85rem; color: var(--muted); max-width: 28rem; }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 2.25rem;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
}

/* CARDS */
.card, .card-soft {
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.35rem;
  box-shadow: var(--shadow-light);
}

.card {
  background: radial-gradient(circle at top, #020617 0, #020617 100%);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.card-soft {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.7));
  border: 1px solid rgba(55, 65, 81, 0.7);
}

.about-text p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.about-list {
  list-style: none;
  margin-top: 0.3rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.about-list li::before {
  content: "• ";
  color: var(--accent);
}

/* BUTTONS */
.btn {
  border-radius: var(--radius-pill);
  padding: 0.7rem 1.45rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.btn-primary {
  background: radial-gradient(circle at top left, #f97316 0, #6366f1 40%, #0f172a 100%);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--muted);
}

/* PROJECTS GRID */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
  margin-top: 1.5rem;
}

.project-card {
  background: var(--card);
  border: 1px solid rgba(31, 41, 55, 0.9);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-light);
  transition: transform var(--transition-med), box-shadow var(--transition-med);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 65px rgba(0,0,0,0.55);
}

.project-thumb {
  position: relative;
  background: #0a0f1c;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-thumb-inner {
  width: 80%;
  height: 80%;
  border-radius: 12px;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-thumb-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(79, 70, 229, 0.35);
  backdrop-filter: blur(6px);
  color: var(--text);
  border: 1px solid rgba(129, 140, 248, 0.4);
}

.project-body {
  padding: 1.2rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.project-title {
  font-size: 1rem;
  font-weight: 600;
}

.project-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.project-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.project-tags span {
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.75rem;
  margin-right: 0.3rem;
}

.project-link {
  color: #a5b4fc;
  font-size: 0.75rem;
  text-decoration: underline;
}

/* CONTACT */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 2rem;
}

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

form input,
form textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  margin-bottom: 0.9rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: #0c1424;
  color: var(--text);
  font-size: 0.9rem;
}

form textarea { min-height: 140px; resize: vertical; }

.form-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

/* FOOTER */
footer {
  margin-top: auto;
  padding: 2.5rem 0;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(to bottom, rgba(5, 8, 22, 0.95), rgba(2, 6, 23, 1));
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}
