/* ============================================================
   Michele Mattioni — Modern Portfolio Site
   Design: Glassmorphism + Depth + Rich Gradients
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  /* Light theme palette */
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-border-hover: rgba(0, 0, 0, 0.12);
  
  /* Text */
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8a8aa0;
  --text-accent: #f59e0b;
  
  /* Accent gradients */
  --accent-blue: #4a9eff;
  --accent-purple: #8b5cf6;
  --accent-cyan: #ec4899;
  --accent-pink: #ec4899;
  --accent-green: #34d399;
  
  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #f8f9fc 0%, #e8ecf4 50%, #f0f2f8 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
  --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
  --gradient-accent-hover: linear-gradient(135deg, #fbbf24 0%, #f472b6 100%);
  --gradient-text: linear-gradient(135deg, #f59e0b 0%, #ec4899 50%, #a21caf 100%);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.10);
  --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.08);
  --shadow-glow-hover: 0 0 40px rgba(245, 158, 11, 0.12);
  
  /* Spacing */
  --section-padding: 100px 0;
  --container-max: 1200px;
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --border-radius-lg: 24px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(245, 158, 11, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(236, 72, 153, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 50% 90%, rgba(162, 28, 175, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: all 0.3s ease;
}
a:hover {
  color: var(--accent-cyan);
}

img {
  max-width: 100%;
  height: auto;
}

/* ── Container ──────────────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ── Glass Card ─────────────────────────────────────────────── */
.glass-card {
  background: var(--gradient-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 28px;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--glass-border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* ── Navigation ─────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 0;
  transition: all 0.4s ease;
  background: transparent;
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 0;
}

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

.navbar-brand {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 8px;
  align-items: center;
}

.navbar-nav a {
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 100px;
  padding-bottom: 60px;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

.hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  animation: heroGlow 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.05) 0%, transparent 70%);
  border-radius: 50%;
  animation: heroGlow 10s ease-in-out infinite alternate-reverse;
  pointer-events: none;
  z-index: 0;
}

@keyframes heroGlow {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.1) translate(20px, -15px); }
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 60px;
  align-items: center;
}

.hero-text h1 {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 8px;
  letter-spacing: -2px;
}

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

.hero-text .tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-weight: 400;
}

.hero-text .bio {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 32px;
}

.hero-text .bio a {
  color: var(--text-accent);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}
.hero-text .bio a:hover {
  border-bottom-color: var(--accent-cyan);
}

/* Photo */
.hero-photo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.photo-frame {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  padding: 6px;
  background: var(--gradient-accent);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(245, 158, 11, 0.15);
  position: relative;
}

.photo-frame::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.15);
  animation: photoRing 4s ease-in-out infinite;
}

@keyframes photoRing {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 1; }
}

.photo-frame img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-primary);
  filter: grayscale(20%) contrast(1.1);
}

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

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  text-decoration: none;
}

.social-link:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.social-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.social-link.twitter:hover { border-color: rgba(29, 161, 242, 0.4); box-shadow: 0 4px 20px rgba(29, 161, 242, 0.15); }
.social-link.github:hover { border-color: rgba(255, 255, 255, 0.3); box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1); }
.social-link.linkedin:hover { border-color: rgba(10, 102, 194, 0.4); box-shadow: 0 4px 20px rgba(10, 102, 194, 0.15); }
.social-link.blog:hover { border-color: rgba(245, 133, 44, 0.4); box-shadow: 0 4px 20px rgba(245, 133, 44, 0.15); }
.social-link.slideshare:hover { border-color: rgba(168, 47, 44, 0.4); box-shadow: 0 4px 20px rgba(168, 47, 44, 0.15); }
.social-link.email:hover { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15); }

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-indicator .arrow {
  width: 24px;
  height: 24px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
}

@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}

/* ── Section Styling ────────────────────────────────────────── */
.section {
  padding: var(--section-padding);
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

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

.section-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.section-divider {
  width: 60px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
  margin: 16px auto 0;
}

/* ── Projects Grid ──────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.project-card {
  position: relative;
}

.project-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.project-card .card-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.project-card .card-category.sustainability {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-green);
}

.project-card .card-category.bitcoins {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.project-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
  letter-spacing: -0.3px;
}

.project-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.project-card .card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}

.project-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-card .tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.project-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-weight: 600;
}

.project-card .card-link:hover {
  color: var(--accent-cyan);
}

/* ── Blog Section ───────────────────────────────────────────── */
.blog-feed {
  max-width: 700px;
  margin: 0 auto;
}

.blog-item {
  padding: 24px 28px;
  margin-bottom: 16px;
}

.blog-item .blog-date {
  font-size: 0.8rem;
  color: var(--accent-blue);
  font-weight: 600;
  margin-bottom: 6px;
}

.blog-item h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.blog-item h3 a {
  color: var(--text-primary);
}
.blog-item h3 a:hover {
  color: var(--accent-cyan);
}

.blog-item .blog-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-item .blog-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--accent-blue);
  margin-top: 10px;
  font-weight: 600;
}

.blog-item .blog-more:hover {
  color: var(--accent-cyan);
}

.blog-loading, .blog-error {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.blog-error {
  color: var(--accent-pink);
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--text-secondary);
}
.footer a:hover {
  color: var(--accent-blue);
}

/* ── Animations ─────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 968px) {
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }
  
  .hero-text h1 {
    font-size: 2.8rem;
  }
  
  .social-links {
    justify-content: center;
  }
  
  .hero-photo {
    order: -1;
  }
  
  .photo-frame {
    width: 240px;
    height: 240px;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header h2 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .navbar-nav {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 40px 24px;
    gap: 4px;
  }
  
  .navbar-nav.open {
    display: flex;
  }
  
  .navbar-nav a {
    font-size: 1.1rem;
    padding: 14px 20px;
    width: 100%;
  }
  
  .nav-toggle {
    display: block;
  }
  
  .hero-text h1 {
    font-size: 2.2rem;
  }
  
  .hero-text .tagline {
    font-size: 1.1rem;
  }
  
  .glass-card {
    padding: 20px;
  }
  
  .section {
    padding: 60px 0;
  }
  
  .scroll-indicator {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-text h1 {
    font-size: 1.8rem;
  }
  
  .social-links {
    flex-direction: column;
    align-items: center;
  }
  
  .social-link {
    width: 100%;
    justify-content: center;
  }
  
  .photo-frame {
    width: 180px;
    height: 180px;
  }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}
