/* ===== PORTFOLIO STYLES - PRODUCTION READY ===== */

/* --- CSS Variables & Theme --- */
:root {
  /* Dark Theme (default) */
  --bg: #0a0d12;
  --bg-gradient: linear-gradient(135deg, #0a0d12 0%, #0f1419 50%, #0d1117 100%);
  --panel: rgba(22, 30, 44, 0.8);
  --panel-solid: #161e2c;
  --text: #e6eaf0;
  --muted: #8b95a5;
  --brand: #4f8cff;
  --accent: #2dd4bf;
  --accent-pink: #f471b5;
  --gradient: linear-gradient(135deg, var(--brand) 0%, var(--accent) 50%, var(--accent-pink) 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --space: 20px;
  --maxw: 1100px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(79, 140, 255, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

:root.light {
  --bg: #f4f6fa;
  --bg-gradient: linear-gradient(135deg, #f4f6fa 0%, #e8ecf4 50%, #f0f4fa 100%);
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(79, 140, 255, 0.1);
  color-scheme: light;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.7 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

/* --- Scroll Progress Indicator --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient);
  width: 0%;
  z-index: 100;
  transition: width 0.1s ease-out;
}

/* --- Utility Classes --- */
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.hidden { display: none !important; }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gradient);
  color: #001023;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font: 600 0.9rem/1 'Inter', sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 140, 255, 0.4);
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  backdrop-filter: blur(4px);
}

.btn-ghost:hover {
  background: var(--panel);
  border-color: var(--brand);
  box-shadow: 0 4px 16px rgba(79, 140, 255, 0.2);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.8rem;
}

/* --- Header & Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--space);
  background: var(--panel);
  backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.nav-toggle {
  display: none;
}

.nav ul {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--panel);
}

/* --- Main Content --- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space);
}

.section {
  padding: 60px 0;
}

.section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 32px;
  position: relative;
}

.section h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--gradient);
  border-radius: 2px;
  margin-top: 12px;
}

/* --- Hero Section --- */
.hero {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 0;
  position: relative;
}

.hero-content {
  max-width: 640px;
}

.hero-intro {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.hero-name {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--brand);
  margin: 0 0 8px;
  min-height: 1.5em;
}

.hero-subtitle {
  font-size: 1.2rem;
  margin: 0 0 20px;
  color: var(--muted);
}

.hero-description {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--muted);
  margin: 0 0 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

/* --- Social Links --- */
.social-links {
  display: flex;
  gap: 16px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.2s ease;
}

.social-link:hover {
  color: var(--brand);
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(79, 140, 255, 0.2);
}

/* --- Settings Panel --- */
.settings-panel {
  margin-top: 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-toggle {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  list-style: none;
  transition: color 0.2s ease;
}

.settings-toggle:hover {
  color: var(--text);
}

.settings-toggle::-webkit-details-marker {
  display: none;
}

.settings-content {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.state-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--muted);
}

.inline-field input {
  width: 180px;
  padding: 8px 12px;
  font-size: 0.875rem;
}

/* --- About Section --- */
.about-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 140px 1fr;
  align-items: start;
}

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-glow);
}

.about-grid p {
  font-size: 1.1rem;
  line-height: 1.8;
  margin: 0;
}

/* --- Cards --- */
.cards {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, 1fr);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow), var(--shadow-glow);
}

.card h3 {
  margin: 12px 0 8px;
  font-size: 1.1rem;
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* --- Project Cards --- */
.project-card {
  display: flex;
  flex-direction: column;
}

.project-card .description {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.5em;
  margin-bottom: 12px;
  color: var(--muted);
}

.lock {
  margin-top: auto;
  color: var(--muted);
  font-style: italic;
  font-size: 0.875rem;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
}

/* --- Filter & Sort Controls --- */
.project-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chips .chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  font: 500 0.85rem 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chips .chip:hover {
  color: var(--text);
  border-color: var(--brand);
}

.filter-chips .chip.active {
  background: var(--gradient);
  color: #001023;
  border-color: transparent;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--muted);
}

.sort-control select {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: 500 0.85rem 'Inter', sans-serif;
  cursor: pointer;
}

/* --- Skills Section --- */
.skills-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, 1fr);
}

.skill-category {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.skill-category-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 20px;
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.skill-item:last-child {
  margin-bottom: 0;
}

.skill-name {
  flex: 0 0 120px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}

.skill-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.skill-progress {
  height: 100%;
  width: var(--progress, 0%);
  background: var(--gradient);
  border-radius: 4px;
  animation: skillLoad 1.2s ease-out forwards;
  transform-origin: left;
}

@keyframes skillLoad {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* --- Quote Card --- */
.quote-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  gap: 16px;
  max-width: 640px;
}

.quote-text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.6;
  margin: 0;
}

.quote-author {
  margin: 0;
  font-style: italic;
}

.quote-actions {
  display: flex;
  gap: 12px;
}

#quoteRefresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Certifications --- */
.certs {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}

.cert h3 {
  font-size: 1rem;
  margin: 0 0 4px;
}

.issuer {
  font-size: 0.875rem;
  color: var(--brand);
  margin: 0;
}

.cert .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 12px 0 8px;
}

/* --- Contact Form --- */
.form {
  display: grid;
  gap: 20px;
  max-width: 520px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 500;
  font-size: 0.9rem;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: 400 1rem 'Inter', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.15);
}

input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
  border-color: #f43f5e;
}

.error-message {
  font-size: 0.8rem;
  color: #f43f5e;
  font-weight: 400;
  display: none;
}

.note {
  margin-top: 8px;
  padding: 12px 16px;
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 0.9rem;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 32px var(--space);
  text-align: center;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

/* Scroll-triggered reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* --- Responsive Design --- */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .avatar {
    margin: 0 auto;
  }
  
  .cards {
    grid-template-columns: 1fr;
  }
  
  .skills-grid {
    grid-template-columns: 1fr;
  }
  
  .certs {
    grid-template-columns: 1fr 1fr;
  }
  
  .project-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  :root {
    --space: 16px;
  }
  
  .hero {
    min-height: auto;
    padding: 60px 0;
  }
  
  .hero-name {
    font-size: 2rem;
  }
  
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: var(--radius-sm);
    font: 500 0.9rem 'Inter', sans-serif;
    cursor: pointer;
  }
  
  .nav ul {
    display: none;
  }
  
  .nav.open ul {
    position: absolute;
    top: 64px;
    right: var(--space);
    left: var(--space);
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--panel-solid);
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  
  .certs {
    grid-template-columns: 1fr;
  }
  
  .section {
    padding: 40px 0;
  }
  
  .section h2 {
    font-size: 1.5rem;
  }
  
  .skill-name {
    flex: 0 0 90px;
    font-size: 0.8rem;
  }
}

/* --- Print Styles --- */
@media print {
  .site-header,
  .scroll-progress,
  .settings-panel,
  .hero-actions,
  .filter-chips,
  .sort-control,
  .quote-actions,
  #themeToggle {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    break-inside: avoid;
  }
}
