/* =====================================================
   DIEGO FIGUEREDO — Web personal (B2C)
   Mobile-first · Noir Elegante (negro + dorado)
   ===================================================== */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-card: #1a1a1a;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --accent: #d4af37;
  --accent-hover: #f4cf57;
  --border: rgba(212, 175, 55, 0.18);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --nav-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  font-weight: 300;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

section[id] { scroll-margin-top: var(--nav-h); }

/* ---------- Utilidades ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 3.5rem 1.25rem; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 700; text-align: center;
  margin-bottom: 0.5rem; color: var(--accent); line-height: 1.15;
}
.section-subtitle {
  text-align: center; color: var(--text-secondary);
  margin-bottom: 2.25rem; font-size: clamp(0.95rem, 3.5vw, 1.1rem);
}

/* =====================================================
   NAV
   ===================================================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); padding: 0 1.25rem;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
  color: var(--accent); text-decoration: none; white-space: nowrap; letter-spacing: 0.5px;
}
.nav-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 8px;
  background: transparent; border: none; cursor: pointer; z-index: 1001;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.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); }

.nav-menu {
  position: absolute; top: var(--nav-h); left: 0; right: 0;
  list-style: none; background: rgba(10, 10, 10, 0.98);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 0.5rem 0;
  transform: translateY(-120%); opacity: 0; visibility: hidden;
  transition: transform 0.35s ease, opacity 0.3s ease, visibility 0.3s;
}
.nav-menu.open { transform: translateY(0); opacity: 1; visibility: visible; }
.nav-link {
  display: block; padding: 0.9rem 1.5rem; color: var(--text-primary);
  text-decoration: none; font-weight: 400; font-size: 1rem;
  border-left: 2px solid transparent;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.nav-link:hover, .nav-link:focus {
  color: var(--accent); border-left-color: var(--accent); background: rgba(212, 175, 55, 0.06);
}

/* =====================================================
   HERO
   ===================================================== */
.hero {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center; text-align: center;
  position: relative; padding: calc(var(--nav-h) + 2rem) 1.25rem 2.5rem;
  background-image:
    radial-gradient(circle at 25% 15%, rgba(212, 175, 55, 0.10), transparent 45%),
    linear-gradient(160deg, rgba(10,10,10,0.55) 0%, rgba(10,10,10,0.80) 100%),
    url('../img/hero.jpg');
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-repeat: no-repeat;
  background-color: var(--bg-primary);
}
.hero-content { position: relative; z-index: 1; max-width: 760px; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 11vw, 5rem); font-weight: 700;
  line-height: 1.05; letter-spacing: 0.5px; margin-bottom: 0.75rem;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}
.hero-subtitle { font-size: clamp(1.05rem, 4.5vw, 1.6rem); color: var(--accent); font-weight: 400; letter-spacing: 1px; margin-bottom: 0.75rem; }
.hero-tagline { font-size: clamp(0.9rem, 3.8vw, 1.1rem); color: var(--text-secondary); margin-bottom: 2rem; max-width: 34ch; margin-left: auto; margin-right: auto; }
.hero-cta {
  display: inline-block; padding: 0.85rem 2rem; background: var(--accent);
  color: var(--bg-primary); text-decoration: none; font-weight: 600;
  font-size: 0.95rem; letter-spacing: 0.5px; border-radius: 2px;
  transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
}
.hero-cta:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(212, 175, 55, 0.30); }

/* =====================================================
   FILTROS
   ===================================================== */
.portfolio { background: var(--bg-secondary); }

.filter-bar {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.5rem; margin-bottom: 2rem;
}
.filter-btn {
  padding: 0.5rem 1.1rem; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary);
  font-family: var(--font-body); font-size: 0.85rem; font-weight: 500;
  letter-spacing: 0.5px; border-radius: 999px; cursor: pointer;
  transition: all 0.25s;
}
.filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.filter-btn.active { background: var(--accent); color: var(--bg-primary); border-color: var(--accent); font-weight: 600; }

/* =====================================================
   GRID DE PROYECTOS
   ===================================================== */
.portfolio-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }

.portfolio-item {
  position: relative; overflow: hidden; border-radius: 4px; cursor: pointer;
  aspect-ratio: 16 / 9; background: var(--bg-card); border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}
.portfolio-item:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); }
.portfolio-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.portfolio-item:hover img { transform: scale(1.08); }

/* Badge de tipo (▶ video / 📷 foto) arriba a la derecha */
.portfolio-badge {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(10,10,10,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 1rem; border: 1px solid var(--border);
}

.portfolio-item-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: flex-end; padding: 1.1rem;
  background: linear-gradient(to top, rgba(10,10,10,0.92) 0%, rgba(10,10,10,0.2) 60%, transparent 100%);
  opacity: 1;
}
.portfolio-item-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--accent); margin-bottom: 0.2rem; line-height: 1.2; }
.portfolio-item-category { font-size: 0.82rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

.portfolio-empty { grid-column: 1 / -1; text-align: center; color: var(--text-secondary); padding: 2rem 0; }

/* =====================================================
   SOBRE MÍ
   ===================================================== */
.about-content { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: center; }
.about-image img {
  width: 100%; max-width: 280px; margin: 0 auto; border-radius: 4px;
  aspect-ratio: 1 / 1; object-fit: cover;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55); border: 1px solid var(--border);
}
.about-text { text-align: center; }
.about-intro { font-size: clamp(1rem, 4vw, 1.15rem); line-height: 1.8; margin-bottom: 1.75rem; color: var(--text-primary); }
.btn-secondary {
  display: inline-block; padding: 0.75rem 1.8rem; border: 1.5px solid var(--accent);
  color: var(--accent); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  border-radius: 2px; transition: background 0.3s, color 0.3s;
}
.btn-secondary:hover { background: var(--accent); color: var(--bg-primary); }

/* =====================================================
   CONTACTO
   ===================================================== */
.contact { background: var(--bg-secondary); text-align: center; }
.contact-social { display: flex; flex-direction: column; gap: 0.85rem; max-width: 360px; margin: 0 auto; }
.social-link {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 0.95rem 1.5rem; background: var(--bg-card); color: var(--text-primary);
  text-decoration: none; border: 1px solid var(--border); border-radius: 4px;
  font-weight: 500; transition: background 0.3s, color 0.3s, transform 0.2s, border-color 0.3s;
}
.social-link:hover { background: var(--accent); color: var(--bg-primary); border-color: var(--accent); transform: translateY(-2px); }

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
  background: var(--bg-primary); text-align: center; padding: 1.75rem 1.25rem;
  color: var(--text-secondary); font-size: 0.82rem; border-top: 1px solid var(--border);
}

/* =====================================================
   MODAL DE PROYECTO
   ===================================================== */
.modal {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal.open { opacity: 1; visibility: visible; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(4px); }

.modal-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 900px; max-height: 92vh;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; overflow-y: auto;
  padding: 1.5rem 1.25rem 2rem;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s ease;
}
.modal.open .modal-panel { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute; top: 0.5rem; right: 0.75rem; z-index: 2;
  background: transparent; border: none; color: var(--text-secondary);
  font-size: 2rem; line-height: 1; cursor: pointer; transition: color 0.2s;
}
.modal-close:hover { color: var(--accent); }

.modal-title { font-family: var(--font-display); font-size: clamp(1.3rem, 5vw, 1.8rem); color: var(--accent); margin-bottom: 0.2rem; padding-right: 2rem; }
.modal-category { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); margin-bottom: 1.25rem; }

/* Video embebido */
.modal-video { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
.modal-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Grid de fotos dentro del modal */
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.gallery-thumb {
  position: relative; aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden;
  cursor: pointer; border: 1px solid var(--border); background: var(--bg-primary);
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.gallery-thumb:hover img { transform: scale(1.06); }

/* =====================================================
   LIGHTBOX (pantalla completa sobre el modal)
   ===================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.96);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.lightbox.open { opacity: 1; visibility: visible; }

.lb-img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 50px rgba(0,0,0,0.6); }

.lb-close {
  position: absolute; top: 0.75rem; right: 1rem; z-index: 3;
  background: transparent; border: none; color: #fff; font-size: 2.4rem; line-height: 1; cursor: pointer;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 48px; height: 64px; border: none; border-radius: 8px;
  background: rgba(212, 175, 55, 0.15); color: var(--accent);
  font-size: 2rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lb-nav:hover { background: rgba(212, 175, 55, 0.35); }
.lb-prev { left: 0.5rem; }
.lb-next { right: 0.5rem; }

.lb-counter {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 3;
  color: var(--text-secondary); font-size: 0.85rem; letter-spacing: 1px;
  background: rgba(0,0,0,0.5); padding: 0.3rem 0.9rem; border-radius: 999px;
}

/* =====================================================
   MEJORAS TABLET (>= 600px)
   ===================================================== */
@media (min-width: 600px) {
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .contact-social { flex-direction: row; flex-wrap: wrap; max-width: 560px; }
  .social-link { flex: 1 1 calc(50% - 0.85rem); }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================
   MEJORAS DESKTOP (>= 900px)
   ===================================================== */
@media (min-width: 900px) {
  :root { --nav-h: 76px; }
  .container { padding: 5rem 2rem; }

  .nav { padding: 0 2.5rem; }
  .nav-toggle { display: none; }
  .nav-menu {
    position: static; transform: none; opacity: 1; visibility: visible;
    background: transparent; border: none; flex-direction: row; gap: 0.5rem; padding: 0;
  }
  .nav-link { padding: 0.5rem 0.9rem; border-left: none; border-bottom: 2px solid transparent; font-size: 0.95rem; }
  .nav-link:hover, .nav-link:focus { border-left-color: transparent; border-bottom-color: var(--accent); background: transparent; }
  .nav-logo { font-size: 1.4rem; }

  .hero-title { letter-spacing: 2px; }

  .portfolio-grid { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
  .portfolio-item-overlay { opacity: 0; transition: opacity 0.3s; }
  .portfolio-item:hover .portfolio-item-overlay { opacity: 1; }

  .about-content { grid-template-columns: 0.9fr 1.1fr; gap: 3.5rem; }
  .about-text { text-align: left; }
  .about-image img { max-width: 100%; }

  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
  .modal-panel { padding: 2rem 2.5rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}