/* --- Global Styles & Variables --- */
:root {
  --primary-color: #00ff7f; /* Accent green */
  --background-color: #1a1a1a; /* Dark background */
  --surface-color: #2c2c2c; /* Card/background surface */
  --text-color: #e0e0e0; /* Text */
  --muted-text: #cfcfcf;
  --border-color: #333;
  --header-font: "VT323", monospace;
  --body-font: "Roboto Mono", monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --background-color: #ffffff;
  --surface-color: #f5f7f8;
  --text-color: #0e0e0f;
  --muted-text: #2b2b2b;
  --border-color: #e3e7ea;
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--body-font);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* --- Media defaults --- */
img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Utility to reserve space if width/height set on tag */
.media-frame {
  display: block;
  background: #111;
  border: 1px solid #222;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

h1,
h2,
h3,
h4 {
  font-family: var(--header-font);
  color: var(--primary-color);
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 4rem;
}
h2 {
  font-size: 3rem;
  text-align: center;
}
h3 {
  font-size: 2rem;
}
h4 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

section {
  padding: 6rem 0;
}

/* --- Navbar --- */
.navbar {
  background-color: rgba(26, 26, 26, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: fixed;
  width: 100%;
  z-index: 100;
}

[data-theme="light"] .navbar {
  background-color: rgba(255, 255, 255, 0.85);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar .logo span {
  font-family: var(--header-font);
  font-size: 2rem;
  color: var(--primary-color);
}

.navbar nav ul {
  list-style: none;
  display: flex;
}

.navbar nav ul li {
  margin-left: 2rem;
}

.navbar nav a {
  color: var(--text-color);
  font-weight: bold;
  transition: color 0.3s ease;
}

.navbar nav a:hover {
  color: var(--primary-color);
}

.navbar nav a.active,
.navbar nav a[aria-current="true"],
.navbar nav a[aria-current="location"] {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

/* Theme toggle button */
.theme-toggle {
  margin-left: 1rem;
  border: 2px solid var(--primary-color);
  background: transparent;
  color: var(--primary-color);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* --- Hero Section --- */
.hero-section {
  padding-top: 12rem; /* Make space for fixed navbar */
  text-align: center;
}

.hero-section .subtitle {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 2rem auto;
}

.cta-buttons {
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: var(--header-font);
  font-size: 1.2rem;
  text-transform: uppercase;
  border: 2px solid var(--primary-color);
  transition: all 0.3s ease;
  margin: 0 0.5rem;
  cursor: pointer;
}

.btn.btn-primary {
  color: #000;
  background-color: var(--primary-color);
}

.btn.btn-primary:hover,
.btn.btn-primary:focus-visible {
  filter: brightness(0.9);
}

.btn.btn-secondary {
  color: var(--primary-color);
  background: transparent;
}

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

/* --- FAQ Section --- */
.faq-section {
  border-top: 1px solid #333;
}

.faq {
  max-width: 800px;
  margin: 2rem auto 0 auto;
}

.faq-item + .faq-item {
  border-top: 1px solid #333;
}

.faq-title {
  margin: 0;
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 1rem 2.5rem 1rem 0;
  color: var(--text-color);
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  position: relative;
}

.faq-question::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  font-family: var(--header-font);
  font-size: 1.5rem;
}

.faq-question[aria-expanded="true"]::after {
  content: "−";
}

.faq-panel {
  padding: 0 0 1rem 0;
  color: var(--muted-text);
}

.faq-question:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  background: rgba(44, 44, 44, 0.9);
  color: var(--primary-color);
  font-size: 1.25rem;
  line-height: 2.6rem;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 200;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* --- Testimonials Section --- */
.testimonials-section {
  border-top: 1px solid var(--border-color);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}

.testimonial-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: 6px;
}

.testimonial-card blockquote {
  color: var(--muted-text);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.testimonial-card .author {
  color: var(--text-color);
  font-weight: bold;
}

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

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

/* --- Services visual example --- */
.services-visual {
  max-width: 900px;
  margin: 2rem auto 2rem auto;
}

.services-visual picture,
.services-visual img {
  width: 100%;
  border: 1px solid var(--border-color);
  background: #111;
}

.services-visual figcaption {
  font-size: 0.9rem;
  color: var(--muted-text);
  margin-top: 0.5rem;
  text-align: center;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface-color);
  color: var(--text-color);
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--primary-color);
}

/* Generic focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .back-to-top {
    transition: none;
  }
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--background-color);
}

.btn-primary:hover {
  background-color: transparent;
  color: var(--primary-color);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary-color);
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: var(--background-color);
}

/* --- Services & Experience Sections --- */
.services-section,
.experience-section {
  background-color: var(--surface-color);
}
.services-section .subtitle,
.experience-section .subtitle {
  text-align: center;
  max-width: 700px;
  margin: -1rem auto 3rem auto;
}

.services-grid,
.experience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.service-card,
.experience-item {
  background: var(--background-color);
  padding: 2rem;
  border: 1px solid #444;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover,
.experience-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 255, 127, 0.1);
}

.service-card .icon {
  font-size: 2rem;
  margin-right: 1rem;
  color: var(--primary-color);
}

/* --- Contact Section --- */
.contact-section {
  text-align: center;
}

.contact-form {
  max-width: 600px;
  margin: 2rem auto 0 auto;
  text-align: left;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--header-font);
  font-size: 1.2rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--surface-color);
  border: 1px solid #444;
  color: var(--text-color);
  font-family: var(--body-font);
  font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* --- Footer --- */
.footer {
  background-color: var(--surface-color);
  text-align: center;
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 1px solid #444;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
  h1 {
    font-size: 3rem;
  }
  h2 {
    font-size: 2.5rem;
  }

  .navbar .container {
    flex-direction: column;
    position: relative; /* allow absolute-positioned toggle */
    align-items: center;
    padding-right: 3.25rem; /* reserve space for toggle */
  }

  .navbar .logo {
    margin-bottom: 0.5rem;
  }

  .navbar nav {
    width: 100%;
  }
  .navbar nav ul {
    margin-top: 0.5rem;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .navbar nav ul li {
    margin: 0;
  }

  /* Pin theme toggle to top-right on mobile */
  .theme-toggle {
    position: absolute;
    right: 1rem;
    top: 0.75rem;
    margin-left: 0;
    z-index: 150;
  }

  section {
    padding: 4rem 0;
  }

  .hero-section {
    padding-top: 15rem; /* More space for stacked navbar */
  }
}

/* --- Enhanced Contact Form Wizard --- */
.contact-wizard {
  max-width: 800px;
  margin: 0 auto;
}

.form-progress {
  margin-bottom: 3rem;
}

.progress-steps {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  gap: 2rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.step.active {
  opacity: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: all 0.3s ease;
}

.step.active .step-number {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--background-color);
}

.step-label {
  font-size: 0.9rem;
  text-align: center;
}

.progress-bar {
  height: 4px;
  background: var(--surface-color);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: var(--progress-width, 0%);
  transition: width 0.3s ease;
}

.form-step {
  display: none;
  animation: fadeIn 0.3s ease;
}

.form-step.active {
  display: block;
}

.form-step h3 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text-color);
}

.project-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.project-type-card {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.project-type-card input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.card-content {
  padding: 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  text-align: center;
  transition: all 0.3s ease;
}

.project-type-card:hover .card-content {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.project-type-card input[type="radio"]:checked + .card-content {
  border-color: var(--primary-color);
  background: rgba(0, 255, 127, 0.1);
}

.project-type-card .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.project-type-card h4 {
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.project-type-card p {
  font-size: 0.9rem;
  color: var(--muted-text);
  margin: 0;
}

.budget-slider {
  margin: 1rem 0;
}

.budget-slider input[type="range"] {
  width: 100%;
  margin: 1rem 0;
  height: 6px;
  background: var(--surface-color);
  outline: none;
  border-radius: 3px;
  -webkit-appearance: none;
}

.budget-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  cursor: pointer;
  border-radius: 50%;
}

.budget-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  cursor: pointer;
  border-radius: 50%;
  border: none;
}

.budget-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted-text);
}

.budget-display {
  text-align: center;
  font-weight: bold;
  color: var(--primary-color);
  margin-top: 0.5rem;
}

.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
}

.checkbox-group {
  margin-top: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  position: relative;
  transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--background-color);
  font-weight: bold;
}

.form-saved {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  font-size: 0.9rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Portfolio Section --- */
.portfolio-section {
  background: var(--surface-color);
}

.portfolio-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--background-color);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.portfolio-card {
  background: var(--background-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.portfolio-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 255, 127, 0.1);
}

.portfolio-card.hidden {
  display: none;
}

.card-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.portfolio-card:hover .card-overlay {
  opacity: 1;
}

.overlay-content {
  text-align: center;
  color: white;
  padding: 1rem;
}

.overlay-content h4 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.tech-tag {
  background: var(--primary-color);
  color: var(--background-color);
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.card-content {
  padding: 1.5rem;
}

.card-content h4 {
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.project-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--surface-color);
  border-radius: 8px;
}

.metric {
  text-align: center;
}

.metric-value {
  display: block;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary-color);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--muted-text);
}

.project-actions {
  margin-top: 1rem;
}

.btn-outline {
  border: 2px solid var(--primary-color);
  background: transparent;
  color: var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: var(--background-color);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal[hidden] {
  display: none !important;
}

.modal-content {
  background: var(--background-color);
  border-radius: 12px;
  max-width: 80%;
  max-height: 80%;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
}

.modal-body {
  padding: 1.5rem;
}

/* --- Enhanced Testimonials --- */
.testimonial-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.testimonials-carousel {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.testimonial-track {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.testimonial-card {
  display: none;
  background: var(--surface-color);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--border-color);
  animation: slideIn 0.5s ease;
}

.testimonial-card.active {
  display: block;
}

.testimonial-card.hidden {
  display: none;
}

.testimonial-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.author-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
}

.author-info h4 {
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.author-title,
.author-company {
  font-size: 0.9rem;
  color: var(--muted-text);
  margin: 0;
}

.testimonial-rating {
  margin-left: auto;
}

.stars {
  color: #ffd700;
  font-size: 1.2rem;
}

.testimonial-card blockquote {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
  font-style: italic;
  color: var(--text-color);
}

.project-highlight {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--background-color);
  border-radius: 8px;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-type {
  font-weight: bold;
  color: var(--primary-color);
}

.project-outcome {
  font-size: 0.9rem;
  color: var(--muted-text);
}

.carousel-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.nav-btn {
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  color: var(--text-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--background-color);
}

.carousel-dots {
  display: flex;
  gap: 0.5rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: var(--border-color);
  cursor: pointer;
  transition: background 0.3s ease;
}

.dot.active {
  background: var(--primary-color);
}

.social-proof-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  padding: 2rem;
  background: var(--background-color);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-color);
  font-family: var(--header-font);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--muted-text);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Responsive Design Updates --- */
@media (max-width: 768px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
  
  .project-types {
    grid-template-columns: 1fr;
  }
  
  .progress-steps {
    gap: 1rem;
  }
  
  .step-label {
    font-size: 0.8rem;
  }
  
  .form-navigation {
    flex-direction: column;
    gap: 1rem;
  }
  
  .project-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .testimonial-header {
    flex-direction: column;
    text-align: center;
  }
  
  .project-highlight {
    flex-direction: column;
    text-align: center;
  }
  
  .social-proof-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}
