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

:root {
  --bg:      #0a0a0a;
  --bg2:     #111111;
  --surface: #1a1a1a;
  --white:   #ffffff;
  --grey1:   #c8c8c8;
  --grey2:   #888888;
  --grey3:   #333333;
  --line:    rgba(255,255,255,0.07);
  --sans:    'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
  cursor: none;
}

/* ── GRAIN ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 1000;
}

/* ── CURSOR ── */
.cursor {
  position: fixed;
  width: 6px; height: 6px;
  background: var(--white);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
  mix-blend-mode: difference;
}
.cursor-ring {
  position: fixed;
  width: 32px; height: 32px;
  border: none;
  border-radius: 0;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
  background-image: url(cursor.webp);
  background-size: contain;
  background-repeat: no-repeat;
  filter: invert(1) sepia(1) saturate(0.6) brightness(0.9);
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 28px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
nav::after {
  content: '';
  position: absolute;
  bottom: 0; left: 48px; right: 48px;
  height: 1px;
  background: var(--line);
}
.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.nav-nombre {
  height: 22px;
  width: auto;
  opacity: 0.75;
  filter: brightness(0) invert(1);
  transition: opacity 0.3s;
}
.nav-logo:hover .nav-nombre {
  opacity: 1;
}
.nav-cta {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey2);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-cta:hover { color: var(--white); }

/* ── HERO ── */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 48px 80px;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 70% at 75% 40%, rgba(255,255,255,0.03) 0%, transparent 65%);
  pointer-events: none;
}

/* 3D scan visual */
.hero-scan {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: 55%;
  pointer-events: none;
  z-index: 0;
}
.hero-scan-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0.15;
  filter: grayscale(100%) contrast(1.3);
  mix-blend-mode: luminosity;
  animation: scanReveal 1.8s 0.3s both;
}
.hero-scan-fade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, var(--bg) 0%, transparent 45%),
    linear-gradient(to top, var(--bg) 0%, transparent 30%);
}

@keyframes scanReveal {
  from { opacity: 0; transform: scale(1.04); }
  to   { opacity: 0.15; transform: scale(1); }
}

.hero-index {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.25em;
  color: var(--grey2);
  text-transform: uppercase;
  margin-bottom: 32px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.9s 0.2s forwards;
  position: relative;
  z-index: 1;
}

h1 {
  font-family: var(--sans);
  font-size: clamp(52px, 9vw, 128px);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(30px);
  animation: fadeUp 1s 0.4s forwards;
  background: none;
  position: relative;
  z-index: 1;
}
h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--grey1);
}

.hero-meta {
  display: flex;
  align-items: flex-end;
  gap: 64px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.9s 0.7s forwards;
  position: relative;
  z-index: 1;
}
.hero-name {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey2);
}
.hero-descriptor {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 300;
  color: var(--grey2);
  max-width: 360px;
  line-height: 1.6;
}

.hero-cta {
  margin-top: 48px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--white);
  padding: 16px 32px;
  text-decoration: none;
  animation: fadeUp 0.9s 1s forwards;
  transition: background 0.3s, gap 0.3s, color 0.3s;
  align-self: flex-start;
  position: relative;
  border-radius: 10px;
  z-index: 1;
}
.hero-cta:hover {
  background: var(--grey1);
  gap: 22px;
  color: var(--bg);
}
.hero-cta svg { width: 14px; height: 14px; }

.scroll-hint {
  position: absolute;
  right: 48px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: fadeIn 1s 1.4s forwards;
  z-index: 1;
}
.scroll-hint span {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--grey2);
  writing-mode: vertical-rl;
}
.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--white), transparent);
  animation: scrollPulse 2s 1.6s infinite;
}

/* ── SECTIONS BASE ── */
section {
  padding: 120px 48px;
  position: relative;
}
section + section::before {
  content: '';
  position: absolute;
  top: 0; left: 48px; right: 48px;
  height: 1px;
  background: var(--line);
}

.section-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--grey2);
  margin-bottom: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
  max-width: 80px;
}

/* ── WHAT I DO ── */
#work { background: var(--bg2); }

.services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-width: 860px;
}
.service-item {
  padding: 40px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 32px;
  align-items: start;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.service-item.visible { opacity: 1; transform: none; }
.service-item:nth-child(2) { transition-delay: 0.1s; }
.service-item:nth-child(3) { transition-delay: 0.2s; }

.service-num {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--grey2);
  padding-top: 6px;
}
.service-text {
  font-family: var(--sans);
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 300;
  line-height: 1.4;
  color: var(--white);
}
.service-text em {
  font-style: italic;
  font-weight: 400;
  color: var(--grey1);
}

/* ── ABOUT ── */
#aboutMe {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.about-left {}
.about-right { padding-top: 80px; }

.about-text {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--grey1);
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.about-text.visible { opacity: 1; transform: none; }
.about-left .about-text:first-of-type { font-size: 20px; color: var(--white); font-weight: 400; }
.about-text:nth-child(3) { transition-delay: 0.1s; }

.about-detail {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey2);
  margin-top: 48px;
  opacity: 0;
  transition: opacity 0.8s ease 0.3s;
}
.about-detail.visible { opacity: 1; }

/* ── WORKS ── */
#works { background: var(--bg2); }

.pieces-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.piece {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--surface);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.piece.visible { opacity: 1; transform: none; }
.piece:nth-child(2) { transition-delay: 0.15s; }
.piece:nth-child(3) { transition-delay: 0.3s; }

.piece-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) brightness(0.75);
  transition: filter 0.6s ease, transform 0.8s ease;
}
.piece:hover .piece-media {
  filter: grayscale(0%) brightness(1);
  transform: scale(1.04);
}
.piece-placeholder {
  width: 100%;
  height: 100%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.piece-placeholder-inner {
  width: 40%; height: 40%;
  border: 1px solid var(--line);
  border-radius: 50%;
  opacity: 0.3;
}
.piece-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  transform: translateY(8px);
  transition: transform 0.4s ease;
}
.piece:hover .piece-info { transform: none; }
.piece-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--white);
  font-style: italic;
  margin: 0;
}
.piece-year {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--grey2);
  margin: 4px 0 0;
}

/* ── CONTACT ── */
#contacto {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.contact-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(255,255,255,0.02) 0%, transparent 70%);
  pointer-events: none;
}
.contact-pre {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--grey2);
  margin-bottom: 32px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s, transform 0.7s;
}
.contact-pre.visible { opacity: 1; transform: none; }

.contact-heading {
  font-family: var(--sans);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--white);
  line-height: 1;
  margin-bottom: 32px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s 0.1s, transform 0.8s 0.1s;
}
.contact-heading.visible { opacity: 1; transform: none; }

.contact-sub {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 300;
  color: var(--grey2);
  max-width: 480px;
  margin: 0 auto 48px;
  line-height: 1.7;
  opacity: 0;
  transition: opacity 0.8s 0.2s;
}
.contact-sub.visible { opacity: 1; }

.contact-email {
  font-family: var(--sans);
  font-size: clamp(14px, 2vw, 20px);
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--white);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 6px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s 0.3s, transform 0.8s 0.3s, border-color 0.3s;
}
.contact-email.visible { opacity: 1; transform: none; }
.contact-email:hover { border-color: var(--white); }

#links {
  margin-top: 48px;
  display: flex;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  transition: opacity 0.8s 0.5s;
}
#links.visible { opacity: 1; }
#links a {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--grey2);
  text-decoration: none;
  transition: color 0.3s;
}
#links a:hover { color: var(--white); }

/* ── FOOTER ── */
footer {
  padding: 32px 48px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
footer span {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey2);
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  to { opacity: 0.5; }
}
@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1); opacity: 0.6; }
  50% { transform: scaleY(1.3); opacity: 1; }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  nav { padding: 24px 28px; }
  nav::after { left: 28px; right: 28px; }
  #hero { padding: 0 28px 64px; }
  section { padding: 80px 28px; }
  section + section::before { left: 28px; right: 28px; }
  #aboutMe { grid-template-columns: 1fr; gap: 0; }
  .about-right { padding-top: 0; }
  .pieces-grid { grid-template-columns: 1fr 1fr; }
  .piece:nth-child(3) { display: none; }
  footer { padding: 28px; flex-direction: column; gap: 12px; text-align: center; }
  .scroll-hint { display: none; }
}

@media (max-width: 600px) {
  h1 { font-size: 44px; }
  .hero-meta { flex-direction: column; gap: 16px; align-items: flex-start; }
  .pieces-grid { grid-template-columns: 1fr; }
  .piece:nth-child(2), .piece:nth-child(3) { display: block; }
  .contact-heading { font-size: 40px; }
  .service-text { font-size: 20px; }
}

/* ── WORK SECTION IMAGE ── */
.work-inner {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 64px;
  align-items: start;
}
.work-image {
  position: sticky;
  top: 120px;
  aspect-ratio: 1/1;
  overflow: hidden;
  background: var(--surface);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}
.work-image.visible {
  opacity: 1;
  transform: none;
}
.work-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) brightness(0.8);
  transition: filter 0.6s ease;
}
.work-image:hover .work-img {
  filter: grayscale(0%) brightness(1);
}
.work-image--empty {
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.work-image--empty::after {
  content: 'Add image';
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey3);
}

@media (max-width: 900px) {
  .work-inner {
    grid-template-columns: 1fr;
  }
  .work-image {
    position: relative;
    top: 0;
    width: 100%;
    max-width: 400px;
  }
}
