/* =========================
   BASE
========================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #fff5e4;
  color: #111;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button { font: inherit; color: inherit; }


/* =========================
   FONDO IZQUIERDO (video con trama de puntos)
========================= */

.bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 50vw;
  height: 100%;
  background: #1b1b1b;
  overflow: hidden;
}

.bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0,0,0,.55) 1px, transparent 1.3px);
  background-size: 3px 3px;
  pointer-events: none;
}


/* =========================
   FOOTER
========================= */

.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 1.5rem;
  text-align: center;
  font-size: .9rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
  pointer-events: none;
}
.foot a { color: #fff; pointer-events: auto; }


/* =========================
   ESCRITORIO CREMA
========================= */

.desk {
  position: absolute;
  top: 0;
  left: 50vw;
  width: 50vw;
  height: 100%;
  background: #fff5e4;
}

.desk::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0,0,0,.12);
}


/* =========================
   ÍCONOS CON POSICIÓN LIBRE
========================= */

.ico {
  --w: clamp(70px, 7vw, 130px);   /* tamaño de los íconos */
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--w);
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  cursor: pointer;
}

.ico.static { cursor: default; }

.ico.logo {
  --w: min(44vw, 840px);          /* tamaño del logo */
  cursor: default;
}
.ico.logo img {
  display: block;
  width: 100%;
  height: auto;
}

/* tamaño individual de un ícono:
.ico[data-id="sticker"] { --w: 10vw; } */

.art {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
}
.art svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.28));
  transition: transform .15s ease;
}
.ico:not(.static):hover .art svg { transform: translateY(-3px); }

.cap {
  display: block;
  margin-top: .35rem;
  white-space: nowrap;
  font-size: .8rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}


/* =========================
   MODO MOVER (agregar ?mover a la URL)
========================= */

.desk-edit .ico {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: 1px dashed rgba(0,0,0,.25);
}
.desk-edit .ico:active { cursor: grabbing; }
.desk-edit .ico img,
.desk-edit .ico svg { pointer-events: none; }

.desk-tools {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100000;
  display: flex;
  gap: 6px;
}
.desk-tools button {
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #222;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}


/* =========================
   PHOTO BOOTH
========================= */

.photobooth {
  position: fixed;
  left: 4vw;
  top: 70px;
  width: 270px;
  z-index: 500;
  overflow: hidden;
  border-radius: 12px;
  background: #252525;
  color: #eee;
  font-family: Arial, Helvetica, sans-serif;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}

.pb-titlebar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 31px;
  background: linear-gradient(#ededed, #b9b9b9);
  border-bottom: 1px solid #888;
  color: #333;
  font-size: 11px;
  font-weight: bold;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pb-titlebar:active { cursor: grabbing; }

.pb-traffic {
  position: absolute;
  left: 12px;
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.pb-dot { display: block; width: 10px; height: 10px; border-radius: 50%; }
.pb-red { background: #ff5f57; }
.pb-yellow { background: #febc2e; }
.pb-green { background: #28c840; }

.pb-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #080808;
}
.pb-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  pointer-events: none;
}

.pb-controls {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 49px;
  padding: 0 14px;
  background: linear-gradient(#626262, #303030);
  border-top: 1px solid #888;
}
.pb-mode { display: flex; gap: 8px; color: #ddd; font-size: 13px; }
.pb-shutter {
  width: 35px;
  height: 35px;
  border: 3px solid #ddd;
  border-radius: 50%;
  background: linear-gradient(#ff4141, #b40000);
  box-shadow: 0 2px 7px #151515;
}
.pb-effects {
  padding: 5px 10px;
  color: #eee;
  font-size: 10px;
  border: 1px solid #222;
  border-radius: 5px;
  background: linear-gradient(#777, #444);
}
.pb-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  z-index: 20;
  cursor: nwse-resize;
  touch-action: none;
  background: repeating-linear-gradient(135deg, transparent 0, transparent 4px, #999 4px, #999 5px, transparent 5px, transparent 8px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}


/* =========================
   OVERLAYS (ventanas)
========================= */

.ov {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,.14);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.ov.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .25s ease;
}

.win {
  max-width: 92vw;
  max-height: 90vh;
  overflow: auto;
  padding: 1.1rem 2rem 3rem;
  border-radius: 1.8rem;
  background: #fff;
  box-shadow: .4rem .4rem 2rem rgba(0,0,0,.15);
  transform: translateY(12px) scale(.98);
  transition: transform .3s ease;
}
.ov.open .win { transform: none; }

.win-about { width: min(90vw, 1200px); min-height: 45vh; }
.win-wide  { width: min(1400px, 80vw); }
.win-exp   { width: min(1100px, 60vw); }

.win-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.win-bar:active { cursor: grabbing; }
.win-bar > span { opacity: .55; }

.dots {
  display: flex;
  gap: .35rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.dots i {
  display: block;
  width: .9rem;
  height: .9rem;
  border-radius: 50%;
}
.dots .r { background: rgb(255, 92, 95); }
.dots .y { background: rgb(250, 200, 0); }
.dots .g { background: rgb(52, 199, 89); }

.win h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.25;
}
.win h2 a { color: inherit; }

.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }


/* =========================
   SELECTED WORK + EXPERIMENTS
========================= */

.proj + .proj { margin-top: 6rem; }

.proj-head {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 1rem;
  padding-top: .8rem;
  margin-bottom: 1.6rem;
  border-top: 1px solid #111;
  font-size: .95rem;
  line-height: 1.35;
}
.proj-head p { margin: 0; }

.gal {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
  align-items: end;               /* alineadas abajo, como en Cargo */
}
.gal.gal-4 { grid-template-columns: repeat(4, 1fr); }

.gal figure {
  margin: 0;
  cursor: zoom-in;
}
.gal img {
  display: block;
  width: 100%;
  height: auto;
}
.gal .ph {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: #f1ede4;
  border: 1px dashed #d8d3c8;
}
.gal figure:nth-child(3n) .ph   { aspect-ratio: 1 / 1; }
.gal figure:nth-child(3n+2) .ph { aspect-ratio: 3 / 4; }

.gal figcaption {
  margin-top: .4rem;
  font-size: .75rem;
  opacity: .6;
}

/* ZOOM */
.lb {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(255, 245, 228, .94);
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.lb.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .2s ease;
}
.lb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 .6rem 2rem rgba(0,0,0,.25);
}


/* =========================
   REVISTA
========================= */

.cv-wrap {
  --pw: min(36vw, calc((100vh - 150px) * 0.75), 640px);   /* ancho de UNA página */
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.cv-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.cv-nav {
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f3efe6;
  color: #222;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 .2rem .8rem rgba(0,0,0,.2);
  transition: opacity .2s, background .2s;
}
.cv-nav:hover { background: #e7e1d3; }
.cv-nav[disabled] { opacity: .25; cursor: default; }

.cv-book {
  position: relative;
  flex: none;
  width: calc(var(--pw) * 2);
  height: calc(var(--pw) * 1.3333);
  perspective: 2600px;
  transition: transform .6s cubic-bezier(.4,.1,.2,1);
  cursor: pointer;
}

.cv-sheet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.45,.05,.25,1);
}
.cv-sheet.is-flipped { transform: rotateY(-180deg); }

.cv-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fbfaf7;
  box-shadow: 0 .6rem 1.8rem rgba(0,0,0,.28);
}
.cv-front { border-radius: 0 6px 6px 0; }
.cv-back  { transform: rotateY(180deg); border-radius: 6px 0 0 6px; }

.cv-front::after,
.cv-back::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14%;
  pointer-events: none;
}
.cv-front::after { left: 0;  background: linear-gradient(90deg, rgba(0,0,0,.18), transparent); }
.cv-back::after  { right: 0; background: linear-gradient(270deg, rgba(0,0,0,.18), transparent); }

.cv-page { position: absolute; inset: 0; }
.cv-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.cv-page.inset { padding: 10% 10% 14%; }
.cv-page.inset img { box-shadow: 0 .2rem .8rem rgba(0,0,0,.15); }

.cv-empty {
  position: absolute;
  inset: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: .8rem;
  color: #aaa;
  border: 1px dashed #d8d3c8;
}

.cv-num {
  position: absolute;
  bottom: 3.5%;
  font-size: .7rem;
  color: #555;
}
.cv-front .cv-num { right: 6%; }
.cv-back  .cv-num { left: 6%; }

.cv-foot {
  display: table;
  margin: 1.2rem auto 0;
  padding: .25rem .8rem;
  border-radius: 999px;
  background: #fff;
  color: #333;
  font-size: .75rem;
  box-shadow: 0 .2rem .8rem rgba(0,0,0,.15);
}
.cv-foot:empty { display: none; }


/* =========================
   MOBILE
========================= */

@media (max-width: 700px) {
  .bg   { width: 100%; height: 38vh; }
  .desk { left: 0; top: 38vh; width: 100%; height: 62vh; }

  .ico { --w: 18vw; }
  .ico.logo { --w: 80vw; }

  .photobooth {
    left: 15px;
    top: 15px;
    width: min(200px, calc(100vw - 30px));
  }

  .foot { font-size: .75rem; }

  .win-about, .win-wide, .win-exp { width: 92vw; }
  .proj-head { grid-template-columns: 1fr; }
  .gal, .gal.gal-4 { grid-template-columns: repeat(2, 1fr); gap: 1rem; }

  .cv-wrap { --pw: 40vw; }
  .cv-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ov, .win, .cv-book, .cv-sheet, .art svg, .lb { transition: none; }
  .blink { animation: none; }
}
