:root {
  --bg-color: #050505;
  --bg-card: rgba(15, 23, 42, 0.3);
  --accent-primary: #10b981; /* Emerald */
  --accent-secondary: #0ea5e9; /* Sky Blue */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-border-hover: rgba(16, 185, 129, 0.3);
  --glow: 0 0 30px rgba(16, 185, 129, 0.15);
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex; /* Added for sticky footer */
  flex-direction: column; /* Added for sticky footer */
  min-height: 100vh; /* Added for sticky footer */
}

/* Base Background with improved gradients */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.15) 0%, transparent 40%),
    linear-gradient(135deg, #050505 0%, #0a0a0a 100%);
  z-index: -1;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Header Refinement */
header {
  height: 80px; /* Slim fixed height */
  padding: 0 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  width: 100%;
  top: 0;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.logo {
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
}

.logo img {
  height: 180px; /* Keep large size */
  width: auto;
  display: block;
  padding: 0;
  margin: 0;
  transform-origin: left center;
  transition: transform 0.3s ease;
}

.logo:hover img {
  transform: scale(1.05);
}

nav {
  display: flex;
  gap: 2.5rem;
  align-items: center;
}

nav a {
  color: #1e293b;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.3s, opacity 0.3s;
  opacity: 0.9;
}

nav a:hover {
  color: var(--accent-primary);
  opacity: 1;
}

/* Hero Section Refined */
.hero {
  min-height: 60vh; /* Reduced from 90vh to bring sections closer */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 10% 0; /* Removed bottom padding entirely */
  position: relative;
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 30%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
  max-width: 900px;
  animation: fadeInUp 0.8s ease-out forwards;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 650px;
  margin-bottom: 1.5rem; /* Reduced from 3rem */
  animation: fadeInUp 0.8s ease-out 0.2s forwards;
  opacity: 0;
}

.projects {
  padding: 0 10% 6rem; /* Removed top padding entirely */
}

.projects h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 4rem;
  text-align: center;
  background: linear-gradient(to right, #fff, var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 3rem;
  text-decoration: none;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--glass-border-hover);
  background: rgba(16, 185, 129, 0.03);
  box-shadow: var(--glow);
}

.project-card h3 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: #fff;
  transition: color 0.3s;
}

.project-card:hover h3 {
  color: var(--accent-primary);
}

.project-url {
  font-size: 1.1rem;
  color: var(--accent-primary);
  opacity: 0.9;
  margin-top: -1.5rem;
  margin-bottom: 2rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.project-url a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.3s;
}

.project-url a:hover {
  opacity: 1;
  text-decoration: underline;
}

.project-card .project-url {
  font-size: 0.85rem;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.project-card p {
  color: var(--text-muted);
  font-size: 1rem;
  flex-grow: 1;
  margin-bottom: 2rem;
}

.project-card .btn-more {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-primary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  transition: gap 0.3s;
}

.project-card:hover .btn-more {
  gap: 0.75rem;
}

main {
  flex: 1; /* Pushes the footer to the bottom */
}

/* Footer Improvements */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10% 1.5rem; 
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 5rem;
  background: #f8fafc;
  position: relative;
  margin-bottom: 0;
}

.footer-logo {
  padding: 0;
  margin: -40px 0 0 0; /* Pull logo UP towards the top border */
}

.footer-logo img {
  height: 150px;
  margin: 0;
  padding: 0;
  display: inline-block;
  opacity: 0.8;
}

footer p {
  font-size: 0.85rem;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-top: -45px; /* Pull text даже closer to the logo */
  padding-bottom: 0; /* Removed bottom padding */
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Overrides */
@media (max-width: 768px) {
  header {
    padding: 0.75rem 5%;
  }
  
  nav {
    display: none; /* In a real project we'd use a hamburger menu, for now focus on visual refinment */
  }
  
  .projects {
    padding: 4rem 5%;
  }
  
  .project-card {
    padding: 2rem;
  }
}

/* Project Detail Specific Styles (Injected via stylesheet) */
.project-detail {
    padding: 10rem 10% 6rem;
    max-width: 1000px;
    margin: 0 auto;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 2.5rem;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent-primary);
}

.project-header h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 2rem;
    color: #fff;
    line-height: 1.1;
}

.project-content {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 4rem;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.feature-item {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    transition: border-color 0.3s;
}

.feature-item:hover {
    border-color: var(--glass-border-hover);
}

.feature-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--accent-primary);
}

.feature-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
}
