/* ── Altitud Portfolio v3 – Frontend CSS ── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --ap-bg:      #080810;
  --ap-surface: #10101e;
  --ap-border:  rgba(255,255,255,0.07);
  --ap-blue:    #1a6ef5;
  --ap-glow:    rgba(26,110,245,0.35);
  --ap-soft:    #60a5fa;
  --ap-white:   #ffffff;
  --ap-muted:   #6b7280;
  --ap-muted2:  #9ca3af;
  --ap-display: 'Syne', sans-serif;
  --ap-body:    'DM Sans', sans-serif;
  --ap-radius:  18px;
}

.altitud-portfolio {
  background: var(--ap-bg);
  font-family: var(--ap-body);
  padding: 90px 20px 100px;
  position: relative;
  overflow: hidden;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  box-sizing: border-box;
}
.altitud-portfolio::before {
  content:''; position:absolute; top:-180px; right:-180px;
  width:560px; height:560px;
  background:radial-gradient(circle,rgba(26,110,245,.18) 0%,transparent 70%);
  pointer-events:none;
}
.altitud-portfolio::after {
  content:''; position:absolute; bottom:-100px; left:-100px;
  width:380px; height:380px;
  background:radial-gradient(circle,rgba(26,110,245,.09) 0%,transparent 70%);
  pointer-events:none;
}
.ap-wrap { max-width:1240px; margin:0 auto; position:relative; z-index:1; }

/* HEADER */
.ap-head { text-align:center; margin-bottom:56px; }
.ap-eyebrow {
  display:inline-flex; align-items:center; gap:10px;
  font-size:11px; font-weight:600; letter-spacing:.22em;
  text-transform:uppercase; color:var(--ap-soft); margin-bottom:18px;
}
.ap-eyebrow span { display:block; width:30px; height:1px; background:var(--ap-soft); opacity:.55; }
.ap-h1 {
  font-family:var(--ap-display);
  font-size:clamp(2rem,5vw,3.6rem);
  font-weight:800; color:var(--ap-white); line-height:1.08; margin-bottom:14px;
}
.ap-h1 em {
  font-style:normal;
  background:linear-gradient(120deg,#1a6ef5 0%,#60a5fa 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
}
.ap-sub { font-size:15.5px; color:var(--ap-muted2); max-width:480px; margin:0 auto; line-height:1.65; }

/* FILTROS 2 NIVELES */
.ap-filters-wrap { margin-bottom:16px; }

.ap-filter-label {
  font-size:10px; font-weight:700; letter-spacing:.18em; text-transform:uppercase;
  color:rgba(255,255,255,.28); margin-bottom:10px; text-align:center;
}
.ap-filter-row { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; }

.ap-btn {
  background:transparent; border:1px solid var(--ap-border); color:var(--ap-muted2);
  padding:9px 20px; border-radius:100px;
  font-family:var(--ap-body); font-size:13px; font-weight:500;
  cursor:pointer; transition:all .22s ease; white-space:nowrap;
}
.ap-btn:hover { border-color:rgba(26,110,245,.45); color:var(--ap-white); background:rgba(26,110,245,.08); }
.ap-btn.on { background:var(--ap-blue); border-color:var(--ap-blue); color:var(--ap-white); box-shadow:0 0 22px var(--ap-glow); }

/* Nivel 2 — sectores */
.ap-lvl2-wrap {
  overflow:hidden; max-height:0; opacity:0;
  transition:max-height .35s ease, opacity .28s ease, margin .3s ease;
  margin-top:0;
}
.ap-lvl2-wrap.visible { max-height:150px; opacity:1; margin-top:12px; }

.ap-filter-row.lvl2 .ap-btn {
  font-size:11px; padding:6px 15px;
  border-color:rgba(255,255,255,.06);
  background:rgba(255,255,255,.03);
  color:var(--ap-muted);
}
.ap-filter-row.lvl2 .ap-btn:hover { color:var(--ap-white); background:rgba(26,110,245,.08); border-color:rgba(26,110,245,.35); }
.ap-filter-row.lvl2 .ap-btn.on {
  background:rgba(26,110,245,.15); border-color:rgba(26,110,245,.5);
  color:var(--ap-soft); box-shadow:none;
}

/* CONTADOR */
.ap-count { text-align:center; font-size:12px; color:var(--ap-muted); margin:20px 0 32px; letter-spacing:.04em; }
.ap-count strong { color:var(--ap-soft); }

/* GRID */
.ap-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:20px; }

/* CARD */
.ap-card {
  border-radius:var(--ap-radius); overflow:hidden; cursor:pointer;
  border:1px solid var(--ap-border); background:var(--ap-surface);
  transition:transform .38s cubic-bezier(.34,1.56,.64,1), box-shadow .35s ease, border-color .28s ease;
  animation:apCardIn .45s ease both;
}
.ap-card:hover {
  transform:translateY(-7px);
  box-shadow:0 28px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(26,110,245,.3);
  border-color:rgba(26,110,245,.28);
}
@keyframes apCardIn { from{opacity:0;transform:translateY(22px)} to{opacity:1;transform:translateY(0)} }

/* MEDIA */
.ap-media { position:relative; height:240px; overflow:hidden; background:#0a0a14; }
.ap-media .ap-img {
  position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  transition:transform .5s ease; z-index:1;
}
.ap-card:hover .ap-media .ap-img { transform:scale(1.06); }

/* Canvas thumbnail del video */
.ap-thumb-canvas {
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; z-index:1; display:block;
  transition:transform .5s ease;
}
.ap-card:hover .ap-thumb-canvas { transform:scale(1.06); }
.ap-media .ap-vid {
  position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  opacity:0; transition:opacity .35s ease; z-index:2; pointer-events:none;
}
.ap-card:hover .ap-media .ap-vid { opacity:1; }
.ap-media::after {
  content:''; position:absolute; inset:0;
  background:linear-gradient(to top,rgba(8,8,16,.9) 0%,rgba(8,8,16,.3) 50%,transparent 100%);
  z-index:3; pointer-events:none;
}

.ap-sector-badge {
  position:absolute; top:14px; left:14px; z-index:5;
  background:rgba(10,10,24,.75); backdrop-filter:blur(10px);
  border:1px solid rgba(255,255,255,.1); color:#93c5fd;
  font-size:10px; font-weight:700; letter-spacing:.12em; text-transform:uppercase;
  padding:4px 11px; border-radius:100px;
}
.ap-play-badge {
  position:absolute; top:14px; right:14px; z-index:5;
  width:30px; height:30px; background:rgba(255,255,255,.15);
  backdrop-filter:blur(8px); border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  border:1px solid rgba(255,255,255,.2);
}
.ap-play-badge svg { width:11px; height:11px; fill:white; margin-left:2px; }

/* Logo — padding interno para que respire */
.ap-logo {
  position:absolute; bottom:14px; left:14px; z-index:6;
  width:60px; height:60px;
  background:white; border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  box-shadow:0 4px 20px rgba(0,0,0,.55);
  border:2px solid rgba(255,255,255,.15);
}
.ap-logo img { width:100%; height:100%; object-fit:cover; display:block; }
.ap-logo--initials { padding:8px; }
.ap-logo .ap-initials { font-family:var(--ap-display); font-size:13px; font-weight:800; color:#0a0a14; line-height:1; text-align:center; }

.ap-client-name {
  position:absolute; bottom:20px; right:14px; z-index:6;
  font-family:var(--ap-display); font-size:14px; font-weight:700;
  color:var(--ap-white); text-align:right;
  text-shadow:0 2px 10px rgba(0,0,0,.7); max-width:55%; line-height:1.2;
}

/* BODY CARD */
.ap-body { padding:18px 20px 20px; }
.ap-title { font-family:var(--ap-display); font-size:16px; font-weight:700; color:var(--ap-white); margin-bottom:8px; line-height:1.3; }
.ap-desc  { font-size:13px; color:var(--ap-muted2); line-height:1.6; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-bottom:14px; }
.ap-svcs-row { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:14px; }
.ap-svc {
  background:rgba(26,110,245,.1); border:1px solid rgba(26,110,245,.22); color:#93c5fd;
  font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  padding:3px 10px; border-radius:100px;
}
.ap-foot { display:flex; align-items:center; justify-content:space-between; padding-top:14px; border-top:1px solid rgba(255,255,255,.06); }
.ap-cta { font-size:12px; font-weight:600; color:var(--ap-soft); display:flex; align-items:center; gap:5px; transition:gap .2s ease; }
.ap-card:hover .ap-cta { gap:9px; }
.ap-cta svg { width:13px; height:13px; }
.ap-year { font-size:12px; color:rgba(255,255,255,.18); }

/* ══════════════════════════════════
   MODAL FULLSCREEN SPLIT
══════════════════════════════════ */
.ap-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(4,4,12,.93); backdrop-filter:blur(14px);
  z-index:999999; align-items:center; justify-content:center; padding:20px;
}
.ap-overlay.ap-open { display:flex; animation:apFade .22s ease; }
@keyframes apFade { from{opacity:0} to{opacity:1} }

.ap-modal {
  width:min(1160px, 96vw);
  height:min(700px, 90vh);
  background:#0d0d1c;
  border:1px solid rgba(255,255,255,.08);
  border-radius:24px;
  display:grid;
  grid-template-columns:400px 1fr;
  overflow:hidden;
  animation:apPop .38s cubic-bezier(.34,1.56,.64,1);
  position:relative;
}
@keyframes apPop { from{opacity:0;transform:scale(.93) translateY(24px)} to{opacity:1;transform:scale(1) translateY(0)} }

/* Panel izquierdo — info */
.ap-m-info {
  display:flex; flex-direction:column;
  padding:40px 36px 36px;
  overflow-y:auto;
  border-right:1px solid rgba(255,255,255,.06);
}
.ap-m-info::-webkit-scrollbar { width:3px; }
.ap-m-info::-webkit-scrollbar-thumb { background:rgba(26,110,245,.35); border-radius:3px; }

/* Logo + cliente en info */
.ap-m-top { display:flex; align-items:center; gap:14px; margin-bottom:26px; }
.ap-m-logo {
  width:64px; height:64px; background:white; border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden; flex-shrink:0;
  box-shadow:0 6px 24px rgba(0,0,0,.4);
}
.ap-m-logo img { width:100%; height:100%; object-fit:cover; display:block; }
.ap-m-logo .ap-initials { font-family:var(--ap-display); font-size:16px; font-weight:800; color:#0a0a14; padding:8px; }

.ap-m-client-block {}
.ap-m-client { font-size:11px; font-weight:700; letter-spacing:.2em; text-transform:uppercase; color:var(--ap-soft); margin-bottom:5px; }
.ap-m-sector-tag {
  display:inline-block;
  background:rgba(26,110,245,.12); border:1px solid rgba(26,110,245,.25);
  color:#93c5fd; font-size:10px; font-weight:700;
  letter-spacing:.1em; text-transform:uppercase;
  padding:3px 10px; border-radius:100px;
}

.ap-m-title {
  font-family:var(--ap-display); font-size:clamp(19px,2.2vw,26px); font-weight:800;
  color:var(--ap-white); line-height:1.2; margin-bottom:14px;
}
.ap-m-desc { font-size:14px; color:var(--ap-muted2); line-height:1.72; margin-bottom:24px; flex:1; }

.ap-m-label { font-size:10px; font-weight:700; letter-spacing:.18em; text-transform:uppercase; color:rgba(255,255,255,.28); margin-bottom:9px; }
.ap-m-svcs { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:24px; }
.ap-m-svc {
  background:rgba(26,110,245,.12); border:1px solid rgba(26,110,245,.28);
  color:#93c5fd; font-size:11px; font-weight:600;
  padding:5px 13px; border-radius:100px;
}

.ap-m-results {
  display:grid; grid-template-columns:repeat(auto-fit,minmax(80px,1fr));
  border:1px solid rgba(255,255,255,.06);
  border-radius:14px; overflow:hidden;
  background:rgba(255,255,255,.02); margin-top:auto;
}
.ap-m-stat { padding:14px 10px; text-align:center; border-right:1px solid rgba(255,255,255,.06); }
.ap-m-stat:last-child { border-right:none; }
.ap-m-val {
  font-family:var(--ap-display); font-size:20px; font-weight:800;
  background:linear-gradient(120deg,#1a6ef5,#60a5fa);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  line-height:1; margin-bottom:4px;
}
.ap-m-lbl { font-size:10px; color:var(--ap-muted); font-weight:500; text-transform:uppercase; letter-spacing:.07em; }

/* Panel derecho — media */
.ap-m-media {
  position:relative; overflow:hidden; background:#06060f;
  display:flex; flex-direction:column;
}
.ap-m-main-media,
.ap-m-media > img,
.ap-m-media > video {
  flex:1; width:100%; object-fit:cover; display:block; min-height:0;
}
.ap-m-placeholder {
  flex:1; display:flex; align-items:center; justify-content:center; font-size:100px;
}

/* ════════════════════════════════════
   CARRUSEL — fullwidth sobre el panel
════════════════════════════════════ */

/* El wrap ocupa la franja inferior del panel derecho */
.ap-m-carousel-wrap {
  position:relative;
  flex-shrink:0;
  height:200px;
  border-top:1px solid rgba(255,255,255,.08);
  background:#000;
  overflow:hidden;
}

/* Track deslizante */
.ap-m-carousel {
  width:100%; height:100%; overflow:hidden;
}
.ap-m-carousel-track {
  display:flex; height:100%;
  transition:transform .4s cubic-bezier(.4,0,.2,1);
  will-change:transform;
}
.ap-car-slide {
  flex:0 0 100%; height:100%; position:relative;
}
.ap-car-slide img {
  width:100%; height:100%; object-fit:cover; display:block;
}

/* Degradado lateral sutil para dar profundidad */
.ap-car-slide::before {
  content:'';
  position:absolute; inset:0;
  background:linear-gradient(to right, rgba(0,0,0,.18) 0%, transparent 15%, transparent 85%, rgba(0,0,0,.18) 100%);
  pointer-events:none; z-index:1;
}

/* ── Flechas flotantes — centradas verticalmente en el carrusel ── */
.ap-car-arrow {
  position:absolute; top:50%; z-index:10;
  transform:translateY(-50%);
  width:44px; height:44px;
  background:rgba(13,13,28,.7);
  backdrop-filter:blur(12px);
  border:1px solid rgba(255,255,255,.14);
  border-radius:50%;
  color:white;
  font-size:0; /* ocultamos el texto, usamos SVG */
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .22s, border-color .22s, transform .22s;
  box-shadow:0 4px 20px rgba(0,0,0,.4);
}
.ap-car-arrow:hover {
  background:var(--ap-blue);
  border-color:var(--ap-blue);
  transform:translateY(-50%) scale(1.08);
  box-shadow:0 0 20px var(--ap-glow);
}
.ap-car-arrow--prev { left:16px; }
.ap-car-arrow--next { right:16px; }

/* SVG dentro de las flechas */
.ap-car-arrow svg {
  width:18px; height:18px;
  stroke:currentColor; stroke-width:2.5;
  fill:none; stroke-linecap:round; stroke-linejoin:round;
  flex-shrink:0;
}

/* ── Contador "1 / 4" — arriba derecha ── */
.ap-car-counter {
  position:absolute; top:12px; right:16px; z-index:10;
  font-family:var(--ap-display); font-size:12px; font-weight:700;
  color:rgba(255,255,255,.8);
  background:rgba(0,0,0,.55); backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,.1);
  padding:4px 12px; border-radius:100px;
  letter-spacing:.04em;
}

/* ── Dots — centrados abajo ── */
.ap-m-carousel-dots {
  position:absolute; bottom:14px; left:50%; transform:translateX(-50%);
  display:flex; gap:7px; z-index:10;
  background:rgba(0,0,0,.35); backdrop-filter:blur(6px);
  padding:6px 12px; border-radius:100px;
  border:1px solid rgba(255,255,255,.08);
}
.ap-car-dot {
  width:7px; height:7px; border-radius:50%;
  background:rgba(255,255,255,.35); border:none; cursor:pointer; padding:0;
  transition:all .25s ease;
}
.ap-car-dot.on {
  background:white;
  transform:scale(1.25);
  box-shadow:0 0 6px rgba(255,255,255,.5);
}

/* ── Label "Galería" — arriba izquierda ── */
.ap-car-label {
  position:absolute; top:12px; left:16px; z-index:10;
  font-size:10px; font-weight:700; letter-spacing:.14em; text-transform:uppercase;
  color:rgba(255,255,255,.6);
  background:rgba(0,0,0,.45); backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,.1);
  padding:4px 10px; border-radius:100px;
}

/* Placeholder sin media */
.ap-no-media {
  position:absolute; inset:0;
  background:linear-gradient(135deg,#1a1a2e,#2d1b69);
  display:flex; align-items:center; justify-content:center;
  font-size:52px; z-index:1;
}

/* Botón cerrar */
.ap-m-close {
  position:absolute; top:16px; right:16px; z-index:20;
  width:38px; height:38px; border-radius:50%;
  background:rgba(0,0,0,.65); backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,.15);
  display:flex; align-items:center; justify-content:center;
  font-size:17px; color:white; cursor:pointer;
  transition:background .2s, border-color .2s;
}
.ap-m-close:hover { background:rgba(26,110,245,.55); border-color:#1a6ef5; }

/* RESPONSIVE */
@media(max-width:860px){
  .ap-modal {
    grid-template-columns:1fr;
    grid-template-rows:45vh 1fr;
    width:100vw; height:100dvh;
    border-radius:0;
  }
  .ap-m-media { order:0; }
  .ap-m-info  { order:1; border-right:none; border-top:1px solid rgba(255,255,255,.06); padding:24px 20px 28px; }
}
@media(max-width:640px){
  .ap-grid { grid-template-columns:1fr; }
}

/* ── LOCALIZACIÓN en card ── */
.ap-loc-badge {
  position:absolute; bottom:72px; right:14px; z-index:6;
  font-size:10px; font-weight:600; color:rgba(255,255,255,.75);
  background:rgba(8,8,16,.6); backdrop-filter:blur(6px);
  border:1px solid rgba(255,255,255,.1);
  padding:3px 10px; border-radius:100px;
  text-shadow:none;
}

/* ── LOCALIZACIÓN en modal ── */
.ap-m-location { margin-bottom:18px; }
.ap-m-loc {
  display:inline-flex; align-items:center; gap:6px;
  font-size:13px; font-weight:500; color:var(--ap-muted2);
  background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08);
  padding:6px 14px; border-radius:100px;
}

/* ── PROYECTOS RELACIONADOS en modal ── */
.ap-m-related {
  display:flex; flex-direction:column; gap:10px;
  margin-top:4px;
}

.ap-rel-card {
  display:grid; grid-template-columns:72px 1fr;
  gap:12px; align-items:center;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.07);
  border-radius:12px; padding:10px 14px;
  cursor:pointer; transition:all .22s ease;
}
.ap-rel-card:hover {
  background:rgba(26,110,245,.1);
  border-color:rgba(26,110,245,.3);
  transform:translateX(4px);
}
.ap-rel-thumb {
  width:72px; height:48px; border-radius:8px; overflow:hidden;
  background:#1a1a2e; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.ap-rel-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.ap-rel-vid-icon { font-size:20px; color:rgba(255,255,255,.5); }
.ap-rel-placeholder { font-size:20px; }

.ap-rel-body {}
.ap-rel-svcs {
  display:flex; flex-wrap:wrap; gap:5px; margin-bottom:4px;
}
.ap-rel-svcs span {
  font-size:9px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:#93c5fd; background:rgba(26,110,245,.12);
  border:1px solid rgba(26,110,245,.2);
  padding:2px 8px; border-radius:100px;
}
.ap-rel-title {
  font-family:var(--ap-display); font-size:13px; font-weight:700;
  color:var(--ap-white); line-height:1.3;
}
