:root {
  --bg: #060c1a;
  --bg-soft: #0d1730;
  --surface: rgba(16, 28, 56, 0.85);
  --surface-2: #111c37;
  --border: rgba(118, 162, 255, 0.2);
  --border-strong: rgba(118, 162, 255, 0.35);
  --text: #f4f7ff;
  --text-muted: #b8c4e3;
  --text-dark: #101828;
  --text-dark-muted: #475467;
  --primary: #2f7bff;
  --primary-2: #59a4ff;
  --primary-glow: rgba(47, 123, 255, 0.35);
  --white: #ffffff;
  --light-section: #f7f9fc;
  --shadow-lg: 0 24px 60px rgba(2, 8, 23, 0.35);
  --shadow-md: 0 16px 35px rgba(15, 23, 42, 0.14);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --nav-height: 76px;
  --container: 1180px;
  --transition: 220ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(47, 123, 255, 0.2), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(89, 164, 255, 0.14), transparent 40%),
    linear-gradient(180deg, #040915 0%, #060c1a 45%, #071022 100%);
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.section {
  position: relative;
  padding: 5.5rem 0;
}

.section-light {
  background: linear-gradient(180deg, rgba(247, 249, 252, 0.97), rgba(242, 245, 250, 0.97));
  color: var(--text-dark);
}

.section-light .eyebrow,
.section-light .section-heading p,
.section-light .card p,
.section-light .about-content p,
.section-light .highlight-item p,
.section-light .contact-copy p {
  color: var(--text-dark-muted);
}

.section-heading {
  max-width: 720px;
  margin-bottom: 2.2rem;
}

.section-heading h2 {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(1.75rem, 2.8vw, 2.5rem);
  line-height: 1.15;
}

.section-heading p {
  margin: 0;
  color: var(--text-muted);
}

.eyebrow {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #a8c8ff;
}

/* Header / Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: transparent;
  transition: background-color var(--transition), box-shadow var(--transition), backdrop-filter var(--transition);
}

.site-header.is-sticky {
  background: rgba(5, 11, 24, 0.78);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(2, 8, 23, 0.28);
}

.navbar {
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.navbar > *,
.hero-grid > *,
.about-grid > *,
.contact-grid > *,
.portfolio-group-grid > *,
.project-modal-grid > * {
  min-width: 0;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-logo-image {
  height: 65px;
  width: auto;
}

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0;
  margin: 0;
}

.nav-menu a {
  color: var(--text-muted);
  font-weight: 600;
  transition: color var(--transition);
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  color: var(--white);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.is-active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Hero */
.hero {
  padding-top: 3rem;
  padding-bottom: 4.75rem;
  overflow: clip;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  align-items: center;
}

.hero-content h1 {
  margin: 0.55rem 0 1rem;
  font-size: clamp(2.1rem, 4vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.hero-text {
  margin: 0 0 1.6rem;
  max-width: 56ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition), background-color var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--white);
  box-shadow: 0 10px 25px var(--primary-glow);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  box-shadow: 0 14px 28px rgba(47, 123, 255, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.02);
  color: var(--white);
  border-color: var(--border-strong);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.hero-panel {
  background: linear-gradient(180deg, rgba(13, 23, 48, 0.8), rgba(10, 18, 36, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}

.code-card {
  border-radius: 16px;
  border: 1px solid rgba(170, 204, 255, 0.14);
  background: rgba(4, 9, 20, 0.8);
  overflow: hidden;
}

.code-header {
  display: flex;
  gap: 0.45rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(170, 204, 255, 0.08);
}

.code-header span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.code-header span:nth-child(1) { background: #ff5f57; }
.code-header span:nth-child(2) { background: #febc2e; }
.code-header span:nth-child(3) { background: #28c840; }

.code-lines {
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  color: #d7e3ff;
  overflow-x: auto;
}

.code-lines p {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-key { color: #78a8ff; }
.code-string { color: #8fe3b3; }
.code-fn { color: #ffd18a; }

.hero-metrics {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.hero-metrics > div {
  border: 1px solid rgba(170, 204, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-metrics strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.1;
}

.hero-metrics span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hero-bg-shape {
  position: absolute;
  border-radius: 999px;
  filter: blur(6px);
  opacity: 0.55;
  pointer-events: none;
}

.shape-1 {
  width: 280px;
  height: 280px;
  top: 8%;
  right: 8%;
  background: radial-gradient(circle at 30% 30%, rgba(47, 123, 255, 0.55), rgba(47, 123, 255, 0));
}

.shape-2 {
  width: 240px;
  height: 240px;
  bottom: 6%;
  left: 3%;
  background: radial-gradient(circle at 60% 40%, rgba(89, 164, 255, 0.36), rgba(89, 164, 255, 0));
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
}

.card {
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.services-grid .card {
  background: var(--white);
  border: 1px solid #e6ebf5;
  box-shadow: var(--shadow-md);
}

.service-card .icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #edf4ff, #e4eeff);
  font-size: 1.25rem;
  margin-bottom: 0.7rem;
}

.service-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.06rem;
}

.service-card p {
  margin: 0;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}

.about-content h2 {
  margin: 0.4rem 0 0.9rem;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.15;
}

.about-content p {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
}

.highlights {
  display: grid;
  gap: 0.95rem;
}

.highlight-item {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13, 23, 48, 0.78), rgba(10, 17, 34, 0.9));
  border-radius: var(--radius-md);
  padding: 1rem;
}

.highlight-item h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.highlight-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Projects */
.projects-grid .project-card {
  background: linear-gradient(180deg, #ffffff, #fbfcff);
  border: 1px solid #e8edf7;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.projects-grid .project-card:hover,
.projects-grid .project-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.16);
  border-color: rgba(47, 123, 255, 0.28);
}

.project-tag {
  display: inline-flex;
  align-self: flex-start;
  background: #eff5ff;
  color: #205bcc;
  border: 1px solid #d9e7ff;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.project-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.project-card p {
  margin: 0;
  color: var(--text-dark-muted);
}

.btn-card {
  margin-top: auto;
  align-self: flex-start;
  background: transparent;
  border-color: #d9e7ff;
  color: #1447a6;
  padding-inline: 0.9rem;
}

.btn-card:hover,
.btn-card:focus-visible {
  background: #f3f7ff;
}

/* Stats */
.stats-section {
  padding-top: 4.8rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13, 23, 48, 0.72), rgba(9, 16, 32, 0.9));
  border-radius: var(--radius-md);
  padding: 1.1rem;
  text-align: center;
}

.stat-card h3 {
  margin: 0;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat-card p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1.3rem;
  align-items: start;
}

.contact-copy h2 {
  margin: 0.45rem 0 0.8rem;
  font-size: clamp(1.65rem, 2.8vw, 2.25rem);
  line-height: 1.15;
}

.contact-copy p {
  color: var(--text-dark-muted);
}

.contact-meta {
  margin-top: 1rem;
  border-top: 1px solid #e8edf7;
  padding-top: 0.9rem;
}

.contact-meta p {
  margin: 0 0 0.35rem;
}

.contact-form {
  background: #ffffff;
  border: 1px solid #e8edf7;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 1.15rem;
}

.form-group {
  margin-bottom: 0.95rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
  color: #1b2437;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid #d8e0ef;
  background: #fbfcff;
  color: #111827;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(47, 123, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(47, 123, 255, 0.12);
  background: #ffffff;
}

.form-group input.input-error,
.form-group select.input-error,
.form-group textarea.input-error {
  border-color: #dc3545;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.08);
}

.field-error {
  display: block;
  min-height: 1.1rem;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: #d12f3f;
}

.btn-submit {
  width: 100%;
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

.form-status {
  min-height: 1.2rem;
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.form-status.success { color: #177a46; }
.form-status.error { color: #b42318; }

/* Footer */
.site-footer {
  background: #040914;
  border-top: 1px solid rgba(170, 204, 255, 0.08);
}

.footer-grid {
  padding: 2.1rem 0 1.25rem;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 1.25rem;
}

.footer-logo {
  display: inline-block;
  margin-bottom: 0.5rem;
}

.footer-brand-logo-image {
  height: 65px;
}

.footer-text {
  margin: 0;
  color: var(--text-muted);
  max-width: 34ch;
}

.site-footer h3 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--white);
}

.footer-bottom {
  border-top: 1px solid rgba(170, 204, 255, 0.06);
  padding: 0.9rem 0 1.1rem;
}

.footer-bottom p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 650ms ease, transform 650ms ease;
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 992px) {
  .hero-grid,
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    max-width: 680px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --nav-height: 70px;
  }

  html {
    scroll-padding-top: 78px;
  }

  .section {
    padding: 4rem 0;
  }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .nav-menu {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 1rem;
    left: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(7, 14, 29, 0.95);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
  }

  .nav-menu.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-menu li + li {
    border-top: 1px solid rgba(170, 204, 255, 0.08);
  }

  .nav-menu a {
    display: block;
    padding: 0.95rem 1rem;
    color: var(--white);
  }

  .hero {
    padding-top: 1.8rem;
  }

  .hero-content h1 {
    max-width: none;
  }

  .code-lines p {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 520px) {
  .container {
    width: min(100% - 1.2rem, var(--container));
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .contact-form {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ==============================
   Premium Glassmorphism Theme Overrides
   ============================== */

html,
body {
  min-height: 100%;
}

body {
  position: relative;
  transition: background-color 260ms ease, color 260ms ease;
}

body[data-theme="dark"] {
  --text: #f5f7ff;
  --text-muted: #c0c9e8;
  --text-dark: #f3f6ff;
  --text-dark-muted: #b8c4e3;
  --primary: #4b8dff;
  --primary-2: #6db4ff;
  --primary-glow: rgba(75, 141, 255, 0.38);
  --border: rgba(173, 210, 255, 0.14);
  --border-strong: rgba(173, 210, 255, 0.26);
  --panel-bg: linear-gradient(180deg, rgba(20, 31, 60, 0.46), rgba(12, 20, 40, 0.34));
  --panel-bg-strong: linear-gradient(180deg, rgba(20, 31, 60, 0.58), rgba(12, 20, 40, 0.4));
  --panel-shadow: 0 14px 40px rgba(2, 8, 23, 0.28);
  --glass-blur: blur(16px);
  background:
    radial-gradient(circle at 12% 15%, rgba(91, 149, 255, 0.23), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(66, 229, 255, 0.14), transparent 34%),
    radial-gradient(circle at 70% 76%, rgba(119, 96, 255, 0.11), transparent 38%),
    linear-gradient(180deg, #040814 0%, #060c1d 48%, #070f21 100%);
}

body[data-theme="light"] {
  --text: #0f172a;
  --text-muted: #475467;
  --text-dark: #0f172a;
  --text-dark-muted: #475467;
  --white: #ffffff;
  --primary: #2f7bff;
  --primary-2: #32b8ff;
  --primary-glow: rgba(47, 123, 255, 0.18);
  --border: rgba(66, 104, 163, 0.14);
  --border-strong: rgba(66, 104, 163, 0.22);
  --panel-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(250, 252, 255, 0.45));
  --panel-bg-strong: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(247, 251, 255, 0.58));
  --panel-shadow: 0 16px 38px rgba(15, 23, 42, 0.1);
  --glass-blur: blur(14px);
  background:
    radial-gradient(circle at 12% 15%, rgba(47, 123, 255, 0.12), transparent 36%),
    radial-gradient(circle at 82% 15%, rgba(50, 184, 255, 0.1), transparent 32%),
    radial-gradient(circle at 70% 78%, rgba(84, 91, 255, 0.07), transparent 38%),
    linear-gradient(180deg, #eef4ff 0%, #f4f8ff 45%, #eef3ff 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  border-radius: 50%;
  pointer-events: none;
  z-index: -2;
  filter: blur(40px);
  opacity: 0.8;
  animation: blobFloat 18s ease-in-out infinite;
}

body::before {
  width: 28rem;
  height: 28rem;
  top: 6rem;
  right: -8rem;
  background: radial-gradient(circle at 35% 35%, rgba(87, 157, 255, 0.42), rgba(87, 157, 255, 0));
}

body::after {
  width: 24rem;
  height: 24rem;
  left: -6rem;
  bottom: 10vh;
  background: radial-gradient(circle at 50% 50%, rgba(68, 235, 255, 0.22), rgba(68, 235, 255, 0));
  animation-delay: -8s;
}

main {
  position: relative;
  isolation: isolate;
}

main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.07) 1px, transparent 1.5px),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.05) 1px, transparent 1.5px),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 180px 180px, 220px 220px, 32px 32px, 32px 32px;
  mask-image: radial-gradient(circle at 50% 20%, black 40%, transparent 90%);
}

@keyframes blobFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -14px, 0) scale(1.04); }
}

@keyframes crystalPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(109, 180, 255, 0.06), var(--panel-shadow); }
  50% { box-shadow: 0 0 0 8px rgba(109, 180, 255, 0.02), var(--panel-shadow); }
}

.site-header {
  background: transparent;
}

.site-header.is-sticky {
  background: rgba(9, 15, 31, 0.28);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(2, 8, 23, 0.15);
}

body[data-theme="light"] .site-header.is-sticky {
  background: rgba(246, 250, 255, 0.6);
}

.navbar {
  gap: 1rem;
}

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

.nav-menu a {
  color: var(--text-muted);
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  color: var(--text);
  text-shadow: 0 0 14px rgba(109, 180, 255, 0.18);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur) saturate(140%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(140%);
  border-radius: 999px;
  padding: 0.5rem 0.8rem 0.5rem 0.65rem;
  min-height: 2.75rem;
  box-shadow: var(--panel-shadow);
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, background-color 220ms ease, box-shadow 220ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: 0 10px 26px rgba(2, 8, 23, 0.16);
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 1.8rem;
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0.95;
}

.theme-toggle-text {
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-toggle {
  border-color: var(--border);
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur) saturate(140%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(140%);
  box-shadow: var(--panel-shadow);
}

.hero {
  padding-top: 3.4rem;
}

.hero-bg-shape {
  opacity: 0.9;
  filter: blur(12px);
  animation: blobFloat 20s ease-in-out infinite;
}

.shape-1 {
  background: radial-gradient(circle at 30% 30%, rgba(76, 141, 255, 0.65), rgba(76, 141, 255, 0));
}

.shape-2 {
  background: radial-gradient(circle at 50% 50%, rgba(65, 230, 255, 0.4), rgba(65, 230, 255, 0));
  animation-delay: -10s;
}

.hero-content h1 {
  text-shadow: 0 12px 30px rgba(3, 8, 18, 0.2);
}

.hero-text {
  color: var(--text-muted);
}

.hero-panel,
.highlight-item,
.stat-card,
.contact-form,
.services-grid .card,
.projects-grid .project-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  backdrop-filter: var(--glass-blur) saturate(135%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(135%);
  box-shadow: var(--panel-shadow);
}

.hero-panel {
  animation: crystalPulse 5.5s ease-in-out infinite;
}

.code-card {
  background: linear-gradient(180deg, rgba(5, 10, 22, 0.72), rgba(7, 13, 26, 0.52));
  border-color: rgba(173, 210, 255, 0.12);
  backdrop-filter: blur(12px);
}

body[data-theme="light"] .code-card {
  background: linear-gradient(180deg, rgba(241, 247, 255, 0.72), rgba(233, 241, 255, 0.58));
}

body[data-theme="light"] .code-lines {
  color: #1c2a43;
}

body[data-theme="light"] .code-key { color: #205bcc; }
body[data-theme="light"] .code-string { color: #0f8b5f; }
body[data-theme="light"] .code-fn { color: #b26a00; }

.hero-metrics > div {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

body[data-theme="light"] .hero-metrics > div {
  background: rgba(255, 255, 255, 0.45);
}

.hero-metrics span {
  color: var(--text-muted);
}

.section,
.section-light {
  background: transparent;
  color: var(--text);
}

.section-light .eyebrow,
.section-light .section-heading p,
.section-light .card p,
.section-light .about-content p,
.section-light .highlight-item p,
.section-light .contact-copy p {
  color: var(--text-muted);
}

.section::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.015));
  z-index: -1;
}

.section-heading p,
.about-content p,
.contact-copy p,
.service-card p,
.project-card p,
.highlight-item p,
.stat-card p {
  color: var(--text-muted);
}

.services-grid .card,
.projects-grid .project-card {
  transition: transform 240ms ease, border-color 240ms ease, box-shadow 240ms ease, background-color 240ms ease;
}

.services-grid .card:hover,
.projects-grid .project-card:hover,
.services-grid .card:focus-within,
.projects-grid .project-card:focus-within {
  transform: translateY(-6px);
  border-color: rgba(115, 186, 255, 0.26);
  box-shadow: 0 20px 44px rgba(2, 8, 23, 0.18);
}

.service-card .icon {
  background: linear-gradient(180deg, rgba(91, 149, 255, 0.14), rgba(91, 149, 255, 0.08));
  border: 1px solid rgba(109, 180, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.project-tag {
  background: rgba(78, 144, 255, 0.12);
  color: var(--text);
  border-color: rgba(109, 180, 255, 0.18);
}

.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.18) 45%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 420ms ease;
}

.btn:hover::after,
.btn:focus-visible::after {
  transform: translateX(120%);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(75, 141, 255, 0.9), rgba(109, 180, 255, 0.88));
  border-color: rgba(132, 196, 255, 0.25);
}

.btn-secondary,
.btn-card {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--border);
  backdrop-filter: blur(10px);
}

body[data-theme="light"] .btn-secondary,
body[data-theme="light"] .btn-card {
  background: rgba(255, 255, 255, 0.5);
}

.stats-grid .stat-card h3 {
  color: var(--text);
  text-shadow: 0 0 18px rgba(109, 180, 255, 0.1);
}

.contact-form {
  background: var(--panel-bg-strong);
}

.form-group label {
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  backdrop-filter: blur(10px);
}

body[data-theme="light"] .form-group input,
body[data-theme="light"] .form-group select,
body[data-theme="light"] .form-group textarea {
  background: rgba(255, 255, 255, 0.62);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: color-mix(in srgb, var(--text-muted) 80%, transparent);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(109, 180, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(75, 141, 255, 0.12);
}

.contact-meta {
  border-top-color: var(--border);
}

.site-footer {
  background: transparent;
  border-top-color: var(--border);
}

.footer-grid {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  backdrop-filter: var(--glass-blur) saturate(130%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(130%);
  border-radius: 20px;
  box-shadow: var(--panel-shadow);
  padding: 1.4rem;
  margin-top: 1.25rem;
}

.footer-bottom {
  border-top-color: transparent;
}

.footer-bottom p,
.footer-text,
.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--text);
}

/* Project modal */
body.modal-open {
  overflow: hidden;
}

.project-modal[hidden] {
  display: none;
}

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.project-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 23, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.project-modal-panel {
  position: relative;
  width: min(1080px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel-bg-strong);
  backdrop-filter: var(--glass-blur) saturate(135%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(135%);
  box-shadow: 0 32px 90px rgba(2, 8, 23, 0.42);
  padding: 1.4rem;
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: opacity 180ms ease, transform 220ms ease;
}

.project-modal.is-open .project-modal-backdrop {
  opacity: 1;
}

.project-modal.is-open .project-modal-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.project-modal-close {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: rgba(7, 14, 28, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
}

.project-modal-close span {
  font-size: 1.6rem;
  line-height: 1;
}

.project-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: 1.25rem;
  align-items: start;
}

.project-modal-gallery {
  display: grid;
  gap: 0.9rem;
}

.project-shot {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(6, 12, 26, 0.42);
}

.project-shot img,
.project-shot video {
  width: 100%;
  display: block;
  background: rgba(4, 8, 18, 0.4);
}

.project-shot figcaption {
  padding: 0.75rem 0.9rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.project-modal-content h3 {
  margin: 0.3rem 0 0.75rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
}

.project-modal-eyebrow,
.project-modal-summary,
.project-modal-overview {
  color: var(--text-muted);
}

.project-modal-summary,
.project-modal-overview {
  margin: 0 0 0.95rem;
}

.project-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.1rem 0;
}

.project-meta-card,
.project-meta-section {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.95rem 1rem;
}

.project-meta-card h4,
.project-meta-section h4 {
  margin: 0 0 0.4rem;
  font-size: 0.96rem;
}

.project-meta-card p {
  margin: 0;
  color: var(--text-muted);
}

.project-tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.project-tech-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(78, 144, 255, 0.12);
}

.project-detail-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-muted);
}

.project-detail-list li + li {
  margin-top: 0.5rem;
}

@media (max-width: 760px) {
  .nav-actions {
    margin-left: auto;
  }

  .container {
    width: calc(100% - 1.4rem);
  }

  .theme-toggle {
    padding: 0.45rem;
    min-width: 2.7rem;
    min-height: 2.7rem;
    gap: 0;
  }

  .theme-toggle-text {
    display: none;
  }

  .nav-menu {
    background: rgba(10, 18, 36, 0.55);
    backdrop-filter: blur(16px) saturate(145%);
    -webkit-backdrop-filter: blur(16px) saturate(145%);
    border-color: var(--border);
  }

  body[data-theme="light"] .nav-menu {
    background: rgba(255, 255, 255, 0.68);
  }

  .hero {
    overflow-x: clip;
  }

  .hero .container,
  .hero-grid,
  .hero-content,
  .hero-panel,
  .code-card,
  .hero-metrics,
  .hero-metrics > div,
  .hero-actions,
  .hero-actions .btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-content,
  .hero-panel,
  .code-lines,
  .code-lines p {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .project-modal {
    padding: 0.75rem;
  }

  .project-modal-panel {
    max-height: min(92vh, 1000px);
    padding: 1rem;
    border-radius: 20px;
  }

  .project-modal-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-meta-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .container,
  .hero .container {
    width: calc(100% - 1rem);
  }

  .project-modal {
    padding: 0.5rem;
  }

  .project-modal-panel {
    max-height: calc(100vh - 1rem);
    padding: 0.9rem;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .hero-bg-shape,
  .hero-panel {
    animation: none !important;
  }
}
@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .hero-content,
  .hero-panel {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
  }

  .hero-panel {
    padding: 0.9rem;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .hero-metrics > div {
    width: 100%;
    text-align: center;
  }

  .code-card {
    width: 100%;
    margin-inline: auto;
  }
}

@media (max-width: 520px) {
  .hero-panel,
  .code-card,
  .hero-metrics,
  .hero-metrics > div {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
  }

  .hero-metrics > div {
    text-align: center;
  }
}
/* Final mobile hero fit fix */
@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .hero {
    overflow-x: hidden;
  }

  .hero .container {
    width: min(100% - 1.4rem, var(--container));
    padding-inline: 0;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.15rem;
    justify-items: stretch;
  }

  .hero-content,
  .hero-panel {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
  }

  .hero-content {
    text-align: center;
  }

  .hero-content h1,
  .hero-text,
  .eyebrow {
    max-width: 100%;
    margin-inline: auto;
  }

  .hero-content h1 {
    font-size: clamp(1.95rem, 8vw, 2.65rem);
    line-height: 1.08;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 100%;
  }

  .hero-panel,
  .code-card,
  .code-lines,
  .hero-metrics,
  .hero-metrics > div {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: auto;
  }

  .hero-panel {
    padding: 0.9rem;
  }

  .code-lines {
    overflow-x: hidden;
  }

  .code-lines p {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-overflow: clip;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .hero-metrics > div {
    padding-inline: 0.9rem;
  }
}

@media (max-width: 520px) {
  .hero .container,
  .container {
    width: min(100% - 1rem, var(--container));
  }

  .hero {
    padding-top: 2.2rem;
    padding-bottom: 3.4rem;
  }

  .hero-content h1 {
    font-size: clamp(1.8rem, 9vw, 2.25rem);
  }

  .hero-text {
    font-size: 0.98rem;
  }

  .hero-panel {
    padding: 0.8rem;
  }

  .code-lines {
    padding: 0.9rem;
    font-size: 0.84rem;
    line-height: 1.6;
  }
}

/* Final contact form visibility fix */
.form-group input,
.form-group select,
.form-group textarea {
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(184, 196, 227, 0.92) !important;
  -webkit-text-fill-color: rgba(184, 196, 227, 0.92) !important;
  opacity: 1 !important;
}

.form-group textarea {
  color-scheme: dark;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23dbe7ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 16px;
  padding-right: 2.5rem;
}

.form-group select:required:invalid {
  color: rgba(184, 196, 227, 0.92) !important;
  -webkit-text-fill-color: rgba(184, 196, 227, 0.92) !important;
}

.form-group select option,
body[data-theme="light"] .form-group select option,
body[data-theme="dark"] .form-group select option {
  color: #0f172a !important;
  background: #ffffff !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.form-group input.input-error,
.form-group select.input-error,
.form-group textarea.input-error {
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="light"] .form-group input,
body[data-theme="light"] .form-group select,
body[data-theme="light"] .form-group textarea {
  color: var(--text-dark) !important;
  -webkit-text-fill-color: var(--text-dark) !important;
  caret-color: var(--text-dark) !important;
  background: rgba(255, 255, 255, 0.72) !important;
}

body[data-theme="light"] .form-group input::placeholder,
body[data-theme="light"] .form-group textarea::placeholder {
  color: rgba(71, 84, 103, 0.9) !important;
  -webkit-text-fill-color: rgba(71, 84, 103, 0.9) !important;
}

body[data-theme="light"] .form-group select:required:invalid {
  color: rgba(71, 84, 103, 0.9) !important;
  -webkit-text-fill-color: rgba(71, 84, 103, 0.9) !important;
}

body[data-theme="light"] .form-group input:focus,
body[data-theme="light"] .form-group select:focus,
body[data-theme="light"] .form-group textarea:focus,
body[data-theme="light"] .form-group input.input-error,
body[data-theme="light"] .form-group select.input-error,
body[data-theme="light"] .form-group textarea.input-error {
  color: var(--text-dark) !important;
  -webkit-text-fill-color: var(--text-dark) !important;
  background: rgba(255, 255, 255, 0.88) !important;
}

/* Final mobile hero + hero-to-services spacing refinement */
@media (max-width: 760px) {
  .hero {
    padding-top: 2.4rem;
    padding-bottom: 2.5rem;
  }

  .hero .container {
    width: min(100% - 1.25rem, var(--container));
  }

  .hero-grid {
    gap: 1rem;
    align-items: start;
  }

  .hero-content {
    display: grid;
    justify-items: center;
    gap: 0;
    text-align: center;
    padding-inline: 0.1rem;
  }

  .hero-content .eyebrow,
  .hero-content h1,
  .hero-content .hero-text {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-content .eyebrow {
    margin-bottom: 0.55rem;
  }

  .hero-content h1 {
    margin-bottom: 0.85rem;
  }

  .hero-text {
    margin-bottom: 1.2rem;
  }

  .hero-actions {
    margin-top: 0;
  }

  .hero-panel {
    justify-self: center;
  }

  .code-card,
  .code-lines,
  .hero-metrics,
  .hero-metrics > div {
    margin-inline: auto;
  }

  .hero-metrics > div {
    align-items: center;
    justify-content: center;
  }

  #services.section {
    padding-top: 3.1rem;
  }

  #services .section-heading {
    margin-bottom: 1.75rem;
  }

  #services .container {
    width: min(100% - 1.25rem, var(--container));
  }
}

@media (max-width: 520px) {
  .hero {
    padding-top: 2rem;
    padding-bottom: 2.15rem;
  }

  .hero .container,
  #services .container,
  .container {
    width: min(100% - 0.9rem, var(--container));
  }

  .hero-grid {
    gap: 0.9rem;
  }

  .hero-content {
    padding-inline: 0;
  }

  .hero-content .eyebrow {
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .hero-content h1 {
    margin-bottom: 0.75rem;
  }

  .hero-text {
    margin-bottom: 1rem;
  }

  .hero-actions {
    gap: 0.7rem;
  }

  .hero-panel {
    padding: 0.75rem;
  }

  .hero-metrics {
    gap: 0.7rem;
  }

  .hero-metrics > div {
    padding: 0.8rem;
  }

  #services.section {
    padding-top: 2.75rem;
  }

  #services .section-heading {
    margin-bottom: 1.5rem;
  }
}
