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

:root {
  --black: #0a0a0a;
  --white: #f5f4f0;
  --gray: #888;
  --terracota: #b85c38;
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --sans: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --nav-h: 70px;
}

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

body {
  font-family: var(--sans);
  background: var(--black);
  color: var(--white);
  overflow-x: hidden;
  cursor: default;
}

a { color: inherit; text-decoration: none; cursor: pointer; }
img { display: block; max-width: 100%; }
button { border: none; background: none; font-family: inherit; cursor: pointer; }
/* En campos de texto, mantener caret visible */
input, textarea { caret-color: var(--white); }

/* ─── Nav ──────────────────────────────────────────────────────────────────── */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
  transition: background 0.4s;
}
#nav.solid { background: var(--black); }

.nav-logo {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--white);
}

.nav-links {
  display: flex; gap: 36px; list-style: none;
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
}
.nav-links a {
  color: var(--white); position: relative; padding-bottom: 2px;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 0; height: 1px; background: var(--white);
  transition: width 0.3s ease;
}
.nav-links a:hover::after { width: 100%; }

/* Hamburger */
.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  width: 28px; padding: 4px 0; background: none; border: none;
}
.nav-burger span {
  display: block; height: 1px; background: var(--white);
  transition: transform 0.3s, opacity 0.3s;
}
.nav-burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile menu overlay */
.nav-overlay {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: var(--black); flex-direction: column;
  align-items: center; justify-content: center; gap: 48px;
}
.nav-overlay.open { display: flex; }
.nav-overlay a {
  font-family: var(--serif); font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 300; letter-spacing: 0.1em; color: var(--white);
}

/* ─── Hero ─────────────────────────────────────────────────────────────────── */
#hero {
  position: relative; height: 100svh; min-height: 600px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--black);
}

.hero-bg {
  position: absolute; inset: 0;
}
.hero-bg::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 160px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
  z-index: 2; pointer-events: none;
}
.hero-bg video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.42);
  z-index: 1;
}
#heroImg {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.42);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}
#heroImg.visible { opacity: 1; }
@keyframes heroZoom {
  from { transform: scale(1.05); }
  to   { transform: scale(1.0); }
}

.hero-content {
  position: relative; z-index: 2;
  text-align: center; padding: 0 20px;
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 12vw, 11rem);
  font-weight: 300;
  letter-spacing: 0.15em;
  line-height: 0.9;
  color: var(--white);
  text-transform: uppercase;
  animation: heroFadeUp 1.4s cubic-bezier(0.16,1,0.3,1) both;
}
.hero-name span { display: block; }
.hero-name .line2 {
  font-style: italic; font-weight: 300;
  font-size: clamp(2.5rem, 9vw, 8rem);
  color: transparent;
  -webkit-text-stroke: 1px var(--white);
  letter-spacing: 0.2em;
  animation-delay: 0.2s;
}

.hero-sub {
  margin-top: 32px;
  font-size: 0.7rem; letter-spacing: 0.4em; text-transform: uppercase;
  color: rgba(245,244,240,0.6);
  animation: heroFadeUp 1.4s cubic-bezier(0.16,1,0.3,1) 0.5s both;
}

@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-scroll {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 0.6rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: rgba(245,244,240,0.4);
  animation: fadeIn 2s 1.5s both;
}
.hero-scroll::after {
  content: ''; width: 1px; height: 40px;
  background: linear-gradient(to bottom, rgba(245,244,240,0.4), transparent);
  animation: scrollLine 2s ease-in-out infinite;
}
@keyframes scrollLine {
  0%, 100% { transform: scaleY(1); opacity: 0.4; }
  50% { transform: scaleY(0.5); opacity: 0.1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Secciones base ───────────────────────────────────────────────────────── */
section { position: relative; }

.section-label {
  font-size: 0.62rem; letter-spacing: 0.4em; text-transform: uppercase;
  color: var(--gray); margin-bottom: 16px;
}
.section-title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: 0.05em; line-height: 1.1;
}

/* ─── Portfolio ────────────────────────────────────────────────────────────── */
#portfolio {
  background: var(--black); color: var(--white);
  padding: 120px 40px;
}

.portfolio-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 60px; flex-wrap: wrap; gap: 24px;
}

.portfolio-header .section-label { color: var(--gray); }
.portfolio-header .section-title { color: var(--white); }

.portfolio-filters {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.filter-btn {
  font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 8px 18px; border: 1px solid rgba(245,244,240,0.25);
  color: var(--white); background: transparent;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--white); color: var(--black); border-color: var(--white);
}

.portfolio-grid {
  columns: 3;
  column-gap: 16px;
  padding: 0;
}
.portfolio-item {
  break-inside: avoid;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
  display: block;
  background: #111;
  border-radius: 0;
}
#drone .portfolio-item img { opacity: 1; }

.portfolio-item img {
  width: 100%; height: auto; display: block;
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.8s ease, opacity 0.6s ease;
  filter: brightness(0.9) saturate(0.95);
  opacity: 0;
  will-change: transform;
}
.portfolio-item img.img-loaded {
  opacity: 1;
}
.portfolio-item:hover img {
  transform: scale(1.03);
  filter: brightness(1) saturate(1.08);
}
/* Overlay sutil al hover */
.portfolio-item::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.28) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.portfolio-item:hover::after { opacity: 1; }
.portfolio-item.hidden { display: none; }

/* Animación de entrada escalonada */
@keyframes imgReveal {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: scale(1); }
}

/* ─── Lightbox ─────────────────────────────────────────────────────────────── */
#lightbox {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(10,10,10,0.96);
  align-items: center; justify-content: center;
}
#lightbox.open { display: flex; }
#lightbox img {
  max-width: 90vw; max-height: 90svh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute; top: 24px; right: 32px;
  font-size: 2rem; color: var(--white); line-height: 1;
}
.lightbox-prev, .lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 2rem; color: var(--white); padding: 20px;
  background: none;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

/* ─── Proyectos personales ─────────────────────────────────────────────────── */
#proyectos {
  background: var(--black); color: var(--white);
  padding: 120px 0;
}

.proyectos-intro {
  padding: 0 40px; max-width: 640px; margin-bottom: 80px;
}
.proyectos-intro p {
  font-family: var(--serif); font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.7; color: rgba(245,244,240,0.7);
  margin-top: 24px;
}

/* Project blocks */
.project-block {
  margin-bottom: 100px;
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.project-block.visible { opacity: 1; transform: translateY(0); }

.project-block-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  min-height: 70vh;
}
.project-block:nth-child(even) .project-block-inner {
  direction: rtl;
}
.project-block:nth-child(even) .project-block-inner > * {
  direction: ltr;
}

.project-visual {
  position: relative; overflow: hidden; min-height: 60vmin;
}
.project-visual img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.16,1,0.3,1);
  filter: grayscale(20%);
}
.project-block:hover .project-visual img { transform: scale(1.04); filter: grayscale(0%); }

.project-info {
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(40px, 6vw, 80px);
  background: var(--black);
}

.project-number {
  font-size: 0.6rem; letter-spacing: 0.5em; color: var(--terracota);
  text-transform: uppercase; margin-bottom: 20px;
}
.project-name {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 5rem);
  font-weight: 300; line-height: 1;
  letter-spacing: 0.05em; margin-bottom: 24px;
}
.project-desc {
  font-size: 0.9rem; line-height: 1.8;
  color: rgba(245,244,240,0.65);
  max-width: 380px; margin-bottom: 40px;
}

.project-gallery-strip {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 8px; scrollbar-width: none;
}
.project-gallery-strip::-webkit-scrollbar { display: none; }
.project-gallery-strip img {
  height: 120px; width: auto; flex-shrink: 0;
  filter: grayscale(30%);
  transition: filter 0.3s;
}
.project-gallery-strip img:hover { filter: grayscale(0%); }

.project-video {
  margin-top: 32px;
}
.project-video video {
  width: 100%; max-height: 280px; object-fit: cover;
  background: #000;
}

/* ─── Sobre mí ─────────────────────────────────────────────────────────────── */
#sobre {
  background: #0a0a0a !important;
  color: var(--white);
  padding: 120px 40px;
}

.sobre-grid-photo {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 80px;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
}

.sobre-photo-col img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: center top;
  filter: grayscale(15%);
}

/* ─── Presupuesto ──────────────────────────────────────────────────────────── */
#presupuesto {
  background: var(--black); color: var(--white);
  padding: 120px 40px;
}

.presupuesto-inner {
  max-width: 760px; margin: 0 auto;
}

.presupuesto-tagline {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 300; font-style: italic;
  color: rgba(245,244,240,0.5);
  margin: 16px 0 60px;
}

.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 20px;
}
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.62rem; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--gray);
}

input, select, textarea {
  background: transparent;
  border: none; border-bottom: 1px solid rgba(245,244,240,0.2);
  color: var(--white); font-family: var(--sans); font-size: 0.9rem;
  padding: 12px 0; outline: none; width: 100%;
  transition: border-color 0.3s;
  -webkit-appearance: none; appearance: none;
}
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer;
}
input:focus, select:focus, textarea:focus {
  border-bottom-color: var(--white);
}
select { background-color: transparent; }
select option { background: var(--black); }
textarea { resize: vertical; min-height: 120px; }

.form-submit {
  margin-top: 48px; text-align: center;
}
.btn-submit {
  display: inline-block;
  padding: 18px 56px;
  border: 1px solid var(--white);
  font-size: 0.7rem; letter-spacing: 0.35em; text-transform: uppercase;
  color: var(--white); background: transparent;
  transition: background 0.3s, color 0.3s;
  position: relative; overflow: hidden;
}
.btn-submit::before {
  content: ''; position: absolute; inset: 0;
  background: var(--white); transform: translateX(-101%);
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}
.btn-submit:hover::before { transform: translateX(0); }
.btn-submit:hover { color: var(--black); }
.btn-submit span { position: relative; z-index: 1; }

.form-message {
  margin-top: 20px; text-align: center; font-size: 0.85rem;
  min-height: 24px;
}
.form-message.ok { color: #6dbf8c; }
.form-message.err { color: #d66; }

/* ─── Contacto ─────────────────────────────────────────────────────────────── */
#contacto {
  background: var(--white); color: var(--black);
  padding: 100px 40px;
}

.contacto-inner {
  max-width: 900px; margin: 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 60px; flex-wrap: wrap;
}

.contacto-left { max-width: 420px; }
.contacto-left .section-title { color: var(--black); }
.contacto-tagline {
  margin-top: 20px; font-size: 0.9rem; line-height: 1.8;
  color: rgba(10,10,10,0.6);
}
.contacto-tagline strong { color: var(--black); font-style: italic; }

.contacto-links {
  display: flex; flex-direction: column; gap: 20px;
  justify-content: center;
}
.contacto-link {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.85rem; letter-spacing: 0.05em;
  color: var(--black); transition: color 0.25s;
}
.contacto-link:hover { color: var(--terracota); }
.contacto-link svg { flex-shrink: 0; }

/* ─── Footer ───────────────────────────────────────────────────────────────── */
footer {
  background: var(--black); color: rgba(245,244,240,0.3);
  padding: 40px; font-size: 0.65rem; letter-spacing: 0.2em;
  text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}

/* ─── Utilities ────────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ─── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  #nav { padding: 0 24px; }
  .nav-links { display: none; }
  .nav-burger { display: flex; }

  #portfolio { padding: 80px 24px; }
  .portfolio-grid { columns: 2; }

  .project-block-inner { grid-template-columns: 1fr; }
  .project-block:nth-child(even) .project-block-inner { direction: ltr; }
  .project-visual { min-height: 60vw; }
  .project-info { padding: 40px 24px; }

  .sobre-grid-photo { grid-template-columns: 1fr; gap: 48px; }
  .sobre-photo-col { order: -1; }
  .sobre-photo-col img { aspect-ratio: 4/3; }

  #presupuesto { padding: 80px 24px; }
  .form-row { grid-template-columns: 1fr; }

  #contacto { padding: 80px 24px; }
  .contacto-inner { flex-direction: column; }

  footer { justify-content: center; text-align: center; }

  .proyectos-intro { padding: 0 24px; }
  #proyectos { padding: 80px 0; }
}

@media (max-width: 540px) {
  .portfolio-grid { columns: 1; }
  .hero-name { letter-spacing: 0.08em; }
}
