:root {
  --bg: #fff;
  --ink: #000;
  --muted: #707070;
  --line: #e6e6e6;
  --green: #22c55e;
  --red: #ff1f1f;
  --on-ink: #fff;          /* texto sobre fondos de color --ink (botones, servicios, formulario) */
  --on-ink-muted: #a8a8a8;
  --nav-bg: rgba(255,255,255,.9);
  --ph: #eee;               /* fondo mientras cargan las imágenes */
  --ph-2: #f1f1f1;
  --ph-text: #9a9a9a;
  --ok: #9be8b3;
}
/* Modo noche: se activa con el botón de la luna (o solo, si el sistema está en modo oscuro) */
html[data-tema="noche"] {
  color-scheme: dark;
  --bg: #0c0c0c;
  --ink: #f2f2f2;
  --muted: #9a9a9a;
  --line: #262626;
  --on-ink: #0c0c0c;
  --on-ink-muted: #5c5c5c;
  --nav-bg: rgba(12,12,12,.85);
  --ph: #1c1c1c;
  --ph-2: #181818;
  --ph-text: #6a6a6a;
  --ok: #15803d;
}
body { transition: background-color .3s, color .3s; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 600 14px/1.2 Inter, system-ui, sans-serif;
  font-optical-sizing: auto;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* Degradado de fondo: aparece y desaparece lentamente detrás de todo el contenido.
   Colores en --grad-1/2/3; duración en la animación (16s); intensidad máxima en "opacity" del 50% */
:root { --grad-1: rgba(255,31,31,.55); --grad-2: rgba(255,140,0,.45); --grad-3: rgba(90,80,255,.35); }
body::before {
  content: ""; position: fixed; inset: -15%; z-index: -1; pointer-events: none; opacity: 0;
  background:
    radial-gradient(40% 35% at 20% 30%, var(--grad-1), transparent 70%),
    radial-gradient(35% 40% at 80% 70%, var(--grad-2), transparent 70%),
    radial-gradient(45% 40% at 60% 15%, var(--grad-3), transparent 70%);
  animation: degradado 16s ease-in-out infinite;
}
@keyframes degradado {
  0%, 100% { opacity: 0; transform: translate(0, 0) scale(1); }
  50% { opacity: .5; transform: translate(4%, -3%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; opacity: .2; } }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }
.wrap { width: min(960px, 100% - 32px); margin-inline: auto; }
.btn { display: inline-block; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 2px; border: 0; font-family: inherit; cursor: pointer; transition: opacity .2s; }
.btn:hover { opacity: .75; }
.title { font-weight: 900; font-size: clamp(40px, 6vw, 60px); line-height: 1.2; text-transform: uppercase; text-align: center; }
.intro { text-align: center; }
.intro p { color: var(--muted); max-width: 300px; margin: 12px auto 18px; font-size: 14px; line-height: 1.25; }

/* Nav */
nav { position: fixed; inset: 0 0 auto; z-index: 50; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 40px; background: var(--nav-bg); backdrop-filter: blur(10px); }
nav .l, nav .r { display: flex; gap: 28px; }
nav .r { justify-content: flex-end; }
nav a:hover { opacity: .6; }
nav .lang { color: var(--muted); }
nav .lang button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
nav .lang button.on { color: var(--ink); }
nav .tema { background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
nav .tema svg { width: 16px; height: 16px; }
nav .tema:hover { opacity: .6; }
nav .lang button:hover { color: var(--ink); }
.status { display: flex; align-items: center; gap: 8px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* Hero */
.hero { position: relative; padding: 100px 0 120px; text-align: center; overflow: hidden; }
.hero h1 { font-weight: 900; font-size: clamp(64px, 11vw, 100px); line-height: 1; text-transform: uppercase; margin-bottom: 20px; }
.hero .photo { width: 300px; max-width: 78vw; aspect-ratio: 300/402; margin: 0 auto 26px; border-radius: 8px; overflow: hidden; background: var(--ph); }
.hero p { font-size: 20px; line-height: 1.4; max-width: 430px; margin: 0 auto 22px; }
.hero .content { position: relative; z-index: 2; }
.trail { position: absolute; width: 190px; aspect-ratio: 3/2; pointer-events: none; z-index: 1; transform: translate(-50%, -50%) scale(.7); opacity: 0; transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .45s; }
.trail.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.trail.hide { opacity: 0; transform: translate(-50%, -50%) scale(.85); transition-duration: .8s; }

/* Work */
.work { padding: 40px 0 120px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 12px; margin-top: 36px; }
.grow { transform: scale(var(--s, 1)); border-radius: var(--rad, 8px); transform-origin: center; will-change: transform, border-radius; }
.proj .img { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--ph); }
.proj .img video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.proj .img video.on { opacity: 1; }
.proj .img img { transition: transform .7s cubic-bezier(.2,.8,.2,1); }
.proj:hover .img img { transform: scale(1.05); }
.grid.limit:not(.all) .proj:nth-child(n+7) { display: none; }
.more { text-align: center; margin-top: 44px; }
.proj .img.empty { display: grid; place-items: center; background: var(--ph-2); color: var(--ph-text); font-size: 14px; }
.proj .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.proj h3 { font-weight: 700; font-size: 20px; text-transform: uppercase; }
.proj .arrow { flex: none; width: 24px; height: 24px; background: var(--ink); color: var(--on-ink); border-radius: 3px; display: grid; place-items: center; transition: transform .3s; }
.proj:hover .arrow { transform: rotate(45deg); }
.proj small { display: block; color: var(--muted); font-size: 14px; margin-top: 8px; }

/* About */
.about { position: relative; isolation: isolate; text-align: center; padding: 40px 0 100px; }
.about .text { font-weight: 600; font-size: 20px; line-height: 1.4; max-width: 440px; margin: 16px auto 0; }
.about .photo { position: relative; width: 250px; aspect-ratio: 250/335; margin: 28px auto 0; border-radius: 8px; overflow: hidden; background: var(--ph); }
.about .photo .btn { position: absolute; right: 12px; bottom: 12px; }
.block { width: min(512px, 100%); margin: 56px auto 0; text-align: left; }
.block > h3 { color: var(--muted); font-size: 20px; font-weight: 700; margin-bottom: 12px; }
details { background: var(--ink); color: var(--on-ink); border-radius: 4px; margin-bottom: 4px; overflow: hidden; }
summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-size: 14px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 22px; font-weight: 300; line-height: .8; transition: transform .3s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 12px 14px; color: var(--on-ink-muted); font-weight: 500; line-height: 1.4; }
details .tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 14px; }
details .tools span { background: var(--bg); color: var(--ink); font-size: 12px; padding: 4px 8px; border-radius: 2px; }
.clients { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.clients div { background: var(--ink); color: #fff; border-radius: 4px; aspect-ratio: 166/105; display: grid; place-content: center; justify-items: center; gap: 12px; transition: background .25s; }
.clients div:hover { background: #222; }
.clients b { font-weight: 900; font-size: 26px; line-height: 1; letter-spacing: -.04em; }
.clients span { font-size: 13px; }

/* Project page */
.case-head { padding: 130px 0 50px; text-align: center; }
.case-head small { color: var(--muted); font-size: 14px; }
.case-head h1 { font-weight: 900; font-size: clamp(48px, 9vw, 80px); line-height: 1.05; text-transform: uppercase; margin: 12px auto 16px; max-width: 900px; }
.case-head p { font-size: 20px; line-height: 1.4; max-width: 520px; margin: 0 auto 20px; }
.case-media { width: 100%; margin: 0 auto; aspect-ratio: 16/9; overflow: hidden; background: #000; }
.case-media.empty { display: grid; place-items: center; background: var(--ph-2); color: var(--ph-text); }
.case-text { width: min(560px, 100%); margin: 70px auto 0; display: grid; gap: 34px; }
.case-text h2 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.case-text p { color: var(--muted); font-weight: 500; font-size: 15px; line-height: 1.55; white-space: pre-line; }
.case-text p.todo { font-style: italic; color: #b0b0b0; }
.case-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.case-btns { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.trio > * { aspect-ratio: 4/5; border-radius: 8px; overflow: hidden; background: var(--ph); }
.trio.horizontal > * { aspect-ratio: var(--ar, 16/9); }
.trio.vertical-video > * { aspect-ratio: 9/16; }
.trio video { width: 100%; height: 100%; object-fit: cover; display: block; }
.trio button { display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; }
.trio button img { transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.trio button:hover img { transform: scale(1.04); }
.trio.duo { grid-template-columns: repeat(2, 1fr); }
.trio img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria { margin-top: 80px; }
.galeria h2 { font-size: 20px; font-weight: 700; }
.galeria .trio { margin-top: 18px; }
#fotos-v > * { aspect-ratio: 2/3; }
/* BTS: cada foto con su proporción (verticales y horizontales mezcladas) */
.mosaico { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; }
.mosaico .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.mosaico button { display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--ph); }
.mosaico .col > div { border-radius: 8px; overflow: hidden; background: #000; }
.mosaico video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mosaico img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.mosaico button:hover img { transform: scale(1.04); }
@media (max-width: 700px) { .mosaico, .mosaico .col { gap: 6px; } }
.trio .ph, .ph-ba > div { display: grid; place-items: center; background: var(--ph-2); color: var(--ph-text); font-size: 14px; }
.ph-ba > div { position: absolute; inset: 0; }
.ph-ba .before-ph { background: #d9d9d9; color: #7a7a7a; padding-right: 50%; }
.ph-ba .after-ph { padding-left: 50%; }

/* Color: comparador antes / después */
.color-sec { width: 100%; margin: 80px auto 0; }
.color-sec h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.color-sec > p { color: var(--muted); font-weight: 500; font-size: 15px; margin-bottom: 18px; }
.ba-list { display: grid; gap: 28px; }
.ba { --pos: 50%; position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #111; user-select: none; touch-action: pan-y; }
.ba img { position: absolute; inset: 0; }
.ba .before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba .handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: #fff; transform: translateX(-50%); pointer-events: none; box-shadow: 0 0 12px rgba(0,0,0,.35); }
.ba .handle::after { content: "↔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; font-size: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.ba .lbl { position: absolute; top: 12px; padding: 5px 9px; border-radius: 2px; background: #000; color: #fff; font-size: 12px; pointer-events: none; }
.ba .l-before { left: 12px; }
.ba .l-after { right: 12px; background: #fff; color: #000; }
.ba input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.ba-list figcaption { color: var(--muted); font-size: 14px; margin-top: 10px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.94); display: grid; place-items: center; padding: 56px 16px; }
.lightbox img { width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 112px); object-fit: contain; border-radius: 4px; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font: 600 28px/1 Inter, sans-serif; cursor: pointer; padding: 14px; opacity: .8; }
.lightbox button:hover { opacity: 1; }
.lightbox .x { top: 8px; right: 12px; }
.lightbox .prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 8px; top: 50%; transform: translateY(-50%); }
.lightbox .count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.6); font-size: 13px; }
.more-work { padding: 120px 0 40px; }

/* Contact */
.contact { padding: 60px 0 90px; }
.socials { display: flex; justify-content: center; gap: 8px; }
.socials a { width: 28px; height: 28px; background: var(--ink); color: var(--on-ink); border-radius: 3px; display: grid; place-items: center; transition: opacity .2s; }
.socials a:hover { opacity: .7; }
.socials svg { width: 16px; height: 16px; }
form { width: min(420px, 100%); margin: 30px auto 0; background: var(--ink); color: var(--on-ink); border-radius: 8px; padding: 26px 24px 20px; display: grid; gap: 22px; }
label { display: grid; gap: 10px; font-size: 13px; }
input, textarea { background: transparent; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--on-ink) 35%, transparent); color: var(--on-ink); font: 500 14px Inter, sans-serif; padding: 6px 4px 10px; outline: none; transition: border-color .2s; }
input:focus, textarea:focus { border-color: var(--on-ink); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--on-ink) 55%, transparent); }
textarea { min-height: 90px; resize: vertical; }
form .send { background: var(--bg); color: var(--ink); padding: 10px; border-radius: 3px; }
form .ok { display: none; text-align: center; font-size: 13px; color: var(--ok); }

footer { display: flex; justify-content: space-between; align-items: center; padding: 22px 40px 26px; border-top: 1px solid var(--line); font-size: 13px; }

/* Red cursor dot */
.dot { position: fixed; top: 0; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--red); pointer-events: none; z-index: 99; margin: -5px 0 0 -5px; opacity: 0; transition: opacity .2s, transform .2s; }
.dot.big { transform: scale(2.4); }

/* Movimiento fluido (sitio.js): las fotos y clips se agrandan un poco para que al deslizarse
   dentro de su marco nunca se vea el borde */
.proj .img > img, .proj .img > video, .trio > * > img, .trio > * > video, .mosaico img, .mosaico video,
.hero .photo img, .about .photo img { scale: 1.16; will-change: translate; }
@media (prefers-reduced-motion: reduce) {
  .proj .img > img, .proj .img > video, .trio > * > img, .trio > * > video, .mosaico img, .mosaico video,
  .hero .photo img, .about .photo img { scale: none; }
}

/* Reveal */
.rv { opacity: 0; transform: translateY(26px); transition: opacity .8s, transform .8s cubic-bezier(.2,.8,.2,1); }
.rv.in { opacity: 1; transform: none; }

@media (max-width: 760px) {
  nav { padding: 16px; grid-template-columns: 1fr auto auto; }
  nav .l a + a { display: none; }
  nav .r { gap: 18px; }
  .status span { display: none; }
  .status { order: 2; justify-self: end; margin-left: 18px; }
  .grid { grid-template-columns: 1fr; }
  .trio { gap: 6px; }
  .hero p, .about .text, .case-head p { font-size: 18px; }
  .case-head { padding-top: 100px; }
  footer { padding: 20px 16px; }
}
@media (pointer: coarse) { .dot, .trail { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rv { opacity: 1; transform: none; }
}
