/* ==============================================
   TABLE OF CONTENTS
   1.  Variables & Reset
   2.  Base Styles
   3.  Utilities
   4.  Header & Nav
   5.  Hamburger Menu
   6.  Hero
   7.  Buttons
   8.  Project Cards
   9.  About Page
   10. Contact Form
   11. Footer
   12. Animations
   13. Dark Mode
   14. Media Queries
============================================== */


/* ── 1. VARIABLES & RESET ── */

:root {
  --color-bg:           #ffffff;
  --color-bg-alt:       #f8f9fa;
  --color-surface:      #ffffff;
  --color-border:       #e9ecef;
  --color-text:         #1a1a2e;
  --color-text-muted:   #6c757d;
  --color-primary:      #6c63ff;
  --color-primary-dark: #574fd6;
  --color-accent:       #ff6584;

  --font:       'Inter', system-ui, sans-serif;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   1.875rem;
  --text-4xl:   2.25rem;
  --text-5xl:   3rem;

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg:  0 20px 60px rgba(0, 0, 0, 0.12);
  --transition: all 0.25s ease;
  --nav-height: 70px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

ul {
  list-style: none;
}

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


/* ── 2. UTILITIES ── */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-24) 0;
}

.section__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
  text-align: center;
}

.section__subtitle {
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: var(--space-12);
}

.section__cta {
  text-align: center;
  margin-top: var(--space-12);
}


/* ── 3. HEADER & NAV ── */

.site-header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
  transition: var(--transition);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav__logo {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: var(--transition);
  position: relative;
  padding-bottom: var(--space-1);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.25s ease;
}

.nav__link:hover,
.nav__link.active {
  color: var(--color-text);
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 100%;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: var(--space-2);
  border-radius: var(--radius);
  transition: var(--transition);
  line-height: 1;
  /* Always interactive — must never be inside a pointer-events:none container */
  pointer-events: auto;
  position: relative;
  z-index: 1002;
}

.theme-toggle:hover {
  background: var(--color-bg-alt);
}


/* ── 4. HAMBURGER MENU ── */

.nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.nav__hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: var(--transition);
}

.nav__hamburger.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav__hamburger.open span:nth-child(2) { opacity: 0; }
.nav__hamburger.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }


/* ── 5. HERO ── */

.hero {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
  padding: var(--space-16) 0;
}

.hero__content {
  max-width: 700px;
}

.hero__eyebrow {
  font-size: var(--text-lg);
  color: var(--color-primary);
  font-weight: 500;
  margin-bottom: var(--space-4);
  animation: fadeUp 0.6s ease both;
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -1.5px;
  margin-bottom: var(--space-6);
  animation: fadeUp 0.6s ease 0.1s both;
}

.hero__subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 540px;
  margin-bottom: var(--space-8);
  animation: fadeUp 0.6s ease 0.2s both;
}

.hero__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  animation: fadeUp 0.6s ease 0.3s both;
}


/* ── 6. BUTTONS ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

.btn--primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.35);
}

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

.btn--outline:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-2px);
}

.btn--full {
  width: 100%;
}

.btn:active {
  transform: translateY(0);
}


/* ── 7. PROJECT CARDS ── */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Start hidden for scroll animation */
  opacity: 0;
  transform: translateY(24px);
  /* Single transition covers both reveal and hover */
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

/* Revealed by IntersectionObserver */
.card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hover lifts — only applies once card is visible to avoid fighting the reveal */
.card.visible:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.card__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.card__body {
  padding: var(--space-6);
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.card__tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-primary);
  background: rgba(108, 99, 255, 0.1);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
}

.card__title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.card__description {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

.card__links {
  display: flex;
  gap: var(--space-3);
}


/* ── 8. ABOUT PAGE ── */

.about-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-16);
  align-items: start;
}

.about__image img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.about__content h1 {
  font-size: var(--text-4xl);
  font-weight: 700;
  margin-bottom: var(--space-6);
}

.about__content h2 {
  font-size: var(--text-2xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.about__content p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.skill-tag {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: var(--transition);
}

.skill-tag:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}


/* ── 9. CONTACT FORM ── */

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-16);
  align-items: start;
}

.contact__info h1 {
  font-size: var(--text-4xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.contact__info p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.contact__details li {
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
}

.form-group {
  margin-bottom: var(--space-6);
}

.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  transition: var(--transition);
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-group input.invalid,
.form-group textarea.invalid {
  border-color: #e63946;
}

.field-error {
  display: block;
  font-size: var(--text-sm);
  color: #e63946;
  margin-top: var(--space-1);
  min-height: 1.2em;
}

.form-feedback {
  padding: var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-6);
  font-weight: 500;
  font-size: var(--text-sm);
}

.form-feedback--error {
  background: #fff0f0;
  color: #e63946;
  border: 1px solid #ffcdd2;
}

.form-feedback--success {
  background: #f0fff4;
  color: #2d6a4f;
  border: 1px solid #b7e4c7;
}


/* ── 10. FOOTER ── */

.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: var(--space-8) 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}


/* ── 11. ANIMATIONS ── */

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


/* ── 12. DARK MODE ── */

[data-theme="dark"] {
  --color-bg:        #0f0f1a;
  --color-bg-alt:    #1a1a2e;
  --color-surface:   #1a1a2e;
  --color-border:    #2d2d44;
  --color-text:      #e8e8f0;
  --color-text-muted:#9898b0;
}

/* Form inputs don't inherit CSS variables reliably — browser UA styles
   override them. These explicit overrides force correct colours in dark mode. */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
  background: #1a1a2e;
  color: #e8e8f0;
  border-color: #2d2d44;
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
  color: #9898b0;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus {
  border-color: var(--color-primary);
  background: #1a1a2e;
}


/* ── 13. MEDIA QUERIES ── */

@media (max-width: 768px) {

  .nav__hamburger {
    display: flex;
  }

  .nav__links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--nav-height));
    background: var(--color-surface);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-8);
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .nav__links.open {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
  }

  .nav__link {
    font-size: var(--text-xl);
  }

  .about-layout,
  .contact-layout {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .hero__title {
    letter-spacing: -0.5px;
  }

  .section {
    padding: var(--space-16) 0;
  }
}
