/**
 * Main Stylesheet - Premium Refined Design
 * 
 * Design Philosophy: Minimal but confident, subtle motion, systems thinking
 * Inspired by Stripe, Linear, Vercel
 */

/* ===== CSS Variables (Premium Theme Support) ===== */
:root {
  /* Light Theme - Refined */
  --bg-primary: #ffffff;
  --bg-secondary: #fafbfc;
  --bg-tertiary: #f1f3f5;
  --text-primary: #0a0a0a;
  --text-secondary: #525252;
  --text-muted: #8e8e8e;
  --accent: #0066ff;
  --accent-hover: #0052cc;
  --accent-light: rgba(0, 102, 255, 0.1);
  --border-color: #e5e7eb;
  --border-subtle: rgba(0, 0, 0, 0.06);
  --shadow: rgba(0, 0, 0, 0.04);
  --shadow-hover: rgba(0, 102, 255, 0.12);
  --shadow-premium: rgba(0, 0, 0, 0.08);
  
  /* Signature Element - Subtle Grid */
  --grid-color: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] {
  /* Dark Theme - Premium Deep */
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1f1f1f;
  --text-primary: #fafafa;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: rgba(59, 130, 246, 0.15);
  --border-color: #262626;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-hover: rgba(59, 130, 246, 0.2);
  --shadow-premium: rgba(0, 0, 0, 0.6);
  
  /* Signature Grid */
  --grid-color: rgba(255, 255, 255, 0.03);
}

/* ===== Reset & Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* Signature: Subtle background grid */
  background-image: 
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: 0 0, 0 0;
}

/* ===== Premium Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(1.375rem, 3vw, 2rem);
  font-weight: 600;
}

h4 {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* Scroll reveal animation */
.section-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Premium Navigation ===== */
.navbar {
  background-color: rgba(var(--bg-primary-rgb, 255, 255, 255), 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
  background-color: rgba(10, 10, 10, 0.8);
}

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

.nav-brand {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  transition: opacity 0.2s ease;
}

.nav-brand:hover {
  opacity: 0.7;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2.5rem;
  align-items: center;
}

.nav-menu a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.2s ease;
  position: relative;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
  width: 100%;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--text-primary);
}

.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow);
}

.theme-toggle:active {
  transform: translateY(0);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all 0.2s ease;
}

.menu-toggle:hover {
  background: var(--bg-tertiary);
}

/* ===== Hero Section - "Moment of Arrival" ===== */
.hero {
  text-align: center;
  padding: 8rem 0 6rem;
  position: relative;
  overflow: hidden;
  
  /* Premium gradient background with depth */
  background: 
    radial-gradient(ellipse at top, rgba(0, 102, 255, 0.05) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

[data-theme="dark"] .hero {
  background: 
    radial-gradient(ellipse at top, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

.hero-subtitle {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

.hero p {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  max-width: 680px;
  margin: 0 auto 2.5rem;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.8s forwards;
}

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Premium Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.875rem 1.75rem;
  border-radius: 0.5rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  font-size: 0.9375rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow-hover);
}

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

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  transform: translateY(-2px);
  border-color: var(--border-color);
  box-shadow: 0 4px 12px var(--shadow);
}

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

/* ===== Premium Project Cards ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.project-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px var(--shadow-premium);
  border-color: var(--accent);
}

.project-card-content {
  padding: 1.75rem;
}

.project-card-image {
  width: 100%;
  height: 220px;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border-radius: 0;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  position: relative;
  overflow: hidden;
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .project-card-image img {
  transform: scale(1.05);
}

.project-card h3 {
  margin-bottom: 0.75rem;
  margin-top: 0;
}

.project-card h3 a {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.project-card h3 a:hover {
  color: var(--accent);
}

.project-card p {
  flex-grow: 1;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tag {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 1.25rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  font-weight: 500;
}

.tag:hover {
  background-color: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.status-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: 0.01em;
}

.status-live {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

[data-theme="dark"] .status-live {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.status-progress {
  background-color: rgba(251, 191, 36, 0.1);
  color: #f59e0b;
}

[data-theme="dark"] .status-progress {
  background-color: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.status-archived {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

[data-theme="dark"] .status-archived {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* ===== Filters & Search ===== */
.filters-section {
  margin-bottom: 3rem;
}

.search-box {
  width: 100%;
  max-width: 420px;
  padding: 0.875rem 1.25rem;
  border: 1.5px solid var(--border-color);
  border-radius: 0.75rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
  transition: all 0.2s ease;
}

.search-box:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
  background-color: var(--bg-primary);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.filter-chip {
  padding: 0.625rem 1.25rem;
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
  font-weight: 500;
}

.filter-chip:hover {
  background-color: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.filter-chip.active {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--shadow-hover);
}

.sort-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.sort-select {
  padding: 0.625rem 1.25rem;
  border: 1.5px solid var(--border-color);
  border-radius: 0.75rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

/* ===== Premium Project Detail Page ===== */
.project-detail {
  max-width: 900px;
  margin: 0 auto;
}

.project-detail-image {
  width: 100%;
  max-height: 560px;
  object-fit: cover;
  border-radius: 0.75rem;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  box-shadow: 0 8px 32px var(--shadow-premium);
}

.project-detail-header {
  margin-bottom: 3rem;
}

.project-detail-header h1 {
  margin-bottom: 1rem;
}

.project-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.project-detail-meta > div {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.project-detail-meta strong {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 0.5rem;
}

/* Project Detail Sections */
.project-section {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border-subtle);
}

.project-section:last-child {
  border-bottom: none;
}

.project-section h2 {
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.75rem;
}

/* Signature: Subtle line under section headers */
.project-section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.project-section p {
  font-size: 1.0625rem;
  line-height: 1.8;
  max-width: 800px;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.tech-item {
  padding: 0.625rem 1.25rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tech-item:hover {
  background-color: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.project-links {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.features-list {
  list-style: none;
  margin: 1.5rem 0;
}

.features-list li {
  padding: 0.75rem 0;
  padding-left: 2rem;
  position: relative;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.7;
  transition: color 0.2s ease;
}

.features-list li:hover {
  color: var(--text-primary);
}

.features-list li:before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
  transition: transform 0.2s ease;
}

.features-list li:hover:before {
  transform: translateX(4px);
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 2rem;
}

.form-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.875rem 1.25rem;
  border: 1.5px solid var(--border-color);
  border-radius: 0.75rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
  background-color: var(--bg-primary);
}

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

/* ===== Footer ===== */
.footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 3rem 0;
  margin-top: 6rem;
  text-align: center;
  color: var(--text-secondary);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 6rem 2rem;
  color: var(--text-secondary);
}

.empty-state h2 {
  margin-bottom: 1rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.25rem;
    display: none;
    box-shadow: 0 8px 24px var(--shadow-premium);
  }

  .nav-menu.active {
    display: flex;
  }

  .hero {
    padding: 5rem 0 4rem;
  }

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

  .btn {
    width: 100%;
  }

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

  .filter-chips {
    justify-content: center;
  }

  .sort-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .sort-select {
    width: 100%;
  }

  .section {
    padding: 4rem 0;
  }
}

/* ===== Premium Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stagger animation for project cards */
.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; }

/* ===== Utility Classes ===== */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
