/* =====================================================
   DAVIDEMASSERINI.COM — Design System
   Dark violet/blue aesthetic — elegant, cool, grounded
   ===================================================== */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  /* Palette */
  --bg-base:        #07070f;
  --bg-surface:     #0e0e1e;
  --bg-elevated:    #141428;
  --bg-card:        #181830;
  --border-subtle:  rgba(124, 58, 237, 0.18);
  --border-glow:    rgba(124, 58, 237, 0.45);

  --violet:         #7c3aed;
  --violet-light:   #a78bfa;
  --violet-dim:     #4c1d95;
  --blue-electric:  #3b82f6;
  --blue-light:     #93c5fd;
  --blue-dim:       #1e3a8a;

  --text-primary:   #f0eeff;
  --text-secondary: #a89cc8;
  --text-muted:     #5e5880;
  --text-link:      #a78bfa;

  /* Gradients */
  --grad-hero:      linear-gradient(135deg, #07070f 0%, #0e0726 50%, #060b1f 100%);
  --grad-accent:    linear-gradient(135deg, var(--violet) 0%, var(--blue-electric) 100%);
  --grad-card-hover: linear-gradient(135deg, rgba(124,58,237,0.12) 0%, rgba(59,130,246,0.08) 100%);

  /* Typography */
  --font-head:  'Space Grotesk', sans-serif;
  --font-body:  'Inter', sans-serif;

  /* Spacing */
  --sp-xs: 0.5rem;
  --sp-sm: 1rem;
  --sp-md: 2rem;
  --sp-lg: 4rem;
  --sp-xl: 8rem;

  /* Layout */
  --max-width: 1100px;
  --radius:    12px;
  --radius-lg: 20px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur:  0.3s;
}

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

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--text-link); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--violet-light); }
ul { list-style: none; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--violet-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--violet); }

/* =====================================================
   NAVIGATION
   ===================================================== */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 var(--sp-md);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 7, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--dur) var(--ease);
}

.site-nav .nav-logo {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.site-nav .nav-logo span { color: var(--violet-light); }

.nav-links {
  display: flex;
  gap: var(--sp-md);
  align-items: center;
}

.nav-links a {
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color var(--dur) var(--ease);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 1px;
  background: var(--grad-accent);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--dur) var(--ease);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =====================================================
   LAYOUT UTILITIES
   ===================================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-md);
}

.page-wrap {
  padding-top: 64px; /* nav height */
}

.section {
  padding: var(--sp-lg) 0;
}

.section-lg {
  padding: var(--sp-xl) 0;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h4 { font-size: 1rem; font-weight: 500; }

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

.label {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet-light);
}

.lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* =====================================================
   HERO — HOMEPAGE
   ===================================================== */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: var(--grad-hero);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 50%, rgba(124,58,237,0.15) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(59,130,246,0.10) 0%, transparent 60%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
  align-items: center;
  width: 100%;
}

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

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}

.hero-eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--grad-accent);
}

.hero h1 {
  margin-bottom: var(--sp-sm);
  font-weight: 700;
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: var(--sp-md);
  max-width: 480px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

/* Hero image */
.hero-image-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-image-wrap::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(ellipse at center, rgba(124,58,237,0.25) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-image-wrap img {
  width: 100%;
  max-width: 440px;
  height: 560px;
  object-fit: cover;
  object-position: center center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glow);
  position: relative;
  z-index: 1;
  box-shadow: 0 0 60px rgba(124,58,237,0.2), 0 40px 80px rgba(0,0,0,0.5);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.75rem;
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 0 24px rgba(124,58,237,0.3);
}
.btn-primary:hover {
  box-shadow: 0 0 40px rgba(124,58,237,0.5);
  transform: translateY(-2px);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
}
.btn-outline:hover {
  background: rgba(124,58,237,0.1);
  border-color: var(--violet);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* =====================================================
   NAV CARDS — Homepage sections grid
   ===================================================== */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--sp-md);
  text-decoration: none;
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.nav-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-card-hover);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.nav-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: 0 8px 40px rgba(124,58,237,0.2);
  color: var(--text-primary);
}
.nav-card:hover::before { opacity: 1; }

.nav-card-icon {
  font-size: 1.75rem;
  margin-bottom: var(--sp-xs);
  position: relative;
  z-index: 1;
}

.nav-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.nav-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* =====================================================
   PAGE HERO — Inner pages
   ===================================================== */
.page-hero {
  padding: calc(64px + var(--sp-lg)) 0 var(--sp-lg);
  background: var(--grad-hero);
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 80% at 80% 50%, rgba(124,58,237,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.page-hero-inner { position: relative; z-index: 1; }
.page-hero .label { margin-bottom: var(--sp-xs); }
.page-hero h1 { margin-bottom: 1rem; }
.page-hero .lead { max-width: 640px; }

/* =====================================================
   DIVIDER
   ===================================================== */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
  margin: var(--sp-lg) 0;
}

/* =====================================================
   ABOUT PAGE
   ===================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--sp-lg);
  align-items: start;
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1.0625rem;
  line-height: 1.85;
}

.about-text p:first-child { font-size: 1.2rem; color: var(--text-primary); }

.about-image-wrap {
  position: sticky;
  top: 80px;
}

.about-image-wrap img {
  width: 100%;
  height: 480px;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 40px rgba(124,58,237,0.15), 0 20px 60px rgba(0,0,0,0.4);
}

/* =====================================================
   WORK PAGE
   ===================================================== */
.work-company {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-md) var(--sp-lg);
  margin-bottom: var(--sp-lg);
  position: relative;
  overflow: hidden;
}

.work-company::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-accent);
}

.work-company-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-sm);
  flex-wrap: wrap;
}

.work-company h2 { margin-bottom: 0.5rem; }

.company-meta {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 20px;
}

.tag-violet {
  background: rgba(124,58,237,0.15);
  color: var(--violet-light);
  border: 1px solid rgba(124,58,237,0.3);
}

.tag-blue {
  background: rgba(59,130,246,0.12);
  color: var(--blue-light);
  border: 1px solid rgba(59,130,246,0.25);
}

.work-company p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
  max-width: 720px;
}

.work-company p:last-of-type { margin-bottom: var(--sp-sm); }

/* Skills grid */
.skills-section h2 { margin-bottom: var(--sp-md); }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--dur) var(--ease);
}

.skill-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 4px 24px rgba(124,58,237,0.15);
  transform: translateY(-2px);
}

.skill-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
}

.skill-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.skill-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

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

.skill-tag {
  padding: 3px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* =====================================================
   BOOKS PAGE
   ===================================================== */
.books-intro {
  max-width: 640px;
  margin-bottom: var(--sp-lg);
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}

.accordion-item.is-open {
  border-color: rgba(124,58,237,0.35);
}

.accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: 1.25rem 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  transition: background var(--dur) var(--ease);
}

.accordion-btn:hover { background: rgba(124,58,237,0.06); }
.accordion-item.is-open .accordion-btn { background: rgba(124,58,237,0.08); }

.accordion-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.accordion-icon svg {
  width: 12px;
  height: 12px;
  stroke: var(--violet-light);
  transition: transform var(--dur) var(--ease);
}

.accordion-item.is-open .accordion-icon {
  background: rgba(124,58,237,0.3);
  transform: rotate(180deg);
}

.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s var(--ease);
}

.accordion-panel-inner {
  padding: 0 1.5rem 1.5rem;
}

.accordion-panel-inner p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(59,130,246,0.06);
  border-left: 2px solid var(--blue-electric);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px;
}

.book-list li {
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background var(--dur) var(--ease);
  cursor: default;
}

.book-list li:hover {
  background: rgba(124,58,237,0.08);
}

.book-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.book-author {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.01em;
}

.book-audio-badge {
  font-size: 0.75rem;
  margin-left: 5px;
  opacity: 0.65;
  vertical-align: middle;
  font-style: normal;
}

.book-is-audio .book-title {
  color: var(--text-primary);
}

/* =====================================================
   MUSIC PAGE
   ===================================================== */
.music-content {
  max-width: 800px;
  margin: 0 auto;
}

.music-intro {
  text-align: center;
  margin-bottom: var(--sp-md);
}

.music-intro p {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.8;
}

.spotify-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 60px rgba(124,58,237,0.15), 0 20px 60px rgba(0,0,0,0.4);
}

.spotify-wrap iframe {
  display: block;
  border-radius: 0;
}

/* =====================================================
   CONTACTS PAGE
   ===================================================== */
.contacts-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.contact-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.contact-item-text h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.contact-item-text a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--violet-light);
  transition: color var(--dur) var(--ease);
}
.contact-item-text a:hover { color: var(--blue-light); }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: var(--sp-md) 0;
  text-align: center;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.footer-logo {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.footer-logo span { color: var(--violet-light); }

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: var(--sp-sm);
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-links a:hover { color: var(--violet-light); }

/* =====================================================
   SECTION INTRO
   ===================================================== */
.section-intro {
  margin-bottom: var(--sp-lg);
}

.section-intro .label { margin-bottom: var(--sp-xs); display: block; }
.section-intro h2 { margin-bottom: 1rem; }

/* =====================================================
   FADE-IN ANIMATION
   ===================================================== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-delay-1 { transition-delay: 0.1s; }
.fade-in-delay-2 { transition-delay: 0.2s; }
.fade-in-delay-3 { transition-delay: 0.3s; }
.fade-in-delay-4 { transition-delay: 0.4s; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-eyebrow { justify-content: center; }
  .hero-tagline { margin: 0 auto var(--sp-md); }
  .hero-cta { justify-content: center; }
  .hero-image-wrap { order: -1; }
  .hero-image-wrap img { max-width: 320px; height: 400px; }
  .hero-image-wrap::before { inset: -10px; }

  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-image-wrap { position: static; }
  .about-image-wrap img { height: 360px; max-width: 360px; margin: 0 auto; }

  .work-company { padding: var(--sp-md); }
  .work-company-header { flex-direction: column; }

  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 600px) {
  :root { --sp-lg: 3rem; --sp-xl: 5rem; }

  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: rgba(7,7,15,0.98); backdrop-filter: blur(16px); padding: var(--sp-md); gap: var(--sp-sm); border-bottom: 1px solid var(--border-subtle); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }

  .hero h1 { font-size: 2.25rem; }
  .hero-image-wrap img { max-width: 260px; height: 320px; }

  .book-list { grid-template-columns: 1fr; }

  .nav-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .nav-cards { grid-template-columns: 1fr; }
}

/* =====================================================
   GALLERY PAGE
   ===================================================== */
.gallery-intro {
  max-width: 680px;
  margin-bottom: var(--sp-lg);
}

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

/* Masonry columns */
.gallery-masonry {
  columns: 3 260px;
  column-gap: 1rem;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  cursor: zoom-in;
  position: relative;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.gallery-item:hover {
  border-color: var(--border-glow);
  box-shadow: 0 4px 32px rgba(124,58,237,0.2);
}

.gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.45s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.04);
}

/* ---- Lightbox ---- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 4, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  padding: var(--sp-md);
  cursor: zoom-out;
}

.lightbox-overlay.is-open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  cursor: default;
}

.lightbox-inner img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 80px rgba(124,58,237,0.25), 0 40px 80px rgba(0,0,0,0.6);
  display: block;
}

.lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  padding: 8px;
  transition: color var(--dur) var(--ease);
}
.lightbox-close:hover { color: var(--text-primary); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.1rem;
  transition: background var(--dur) var(--ease);
}
.lightbox-nav:hover { background: rgba(124,58,237,0.4); }
.lightbox-nav.prev { right: calc(100% + 16px); }
.lightbox-nav.next { left: calc(100% + 16px); }

.lightbox-counter {
  position: absolute;
  bottom: -36px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-head);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .gallery-masonry { columns: 2 180px; }
  .lightbox-nav { display: none; }
}

@media (max-width: 420px) {
  .gallery-masonry { columns: 1; }
}
