:root { --gcl-default-accent: #512670; }

/* wrapper and CSS vars defaults */
.gcl-skillcard-wrapper {
  --gcl-popup-bg: #ffffff;
  --gcl-popup-text: #222222;
  --gcl-accent: var(--gcl-default-accent);
  --gcl-back-bg: rgba(255,255,255,0.95);
  --gcl-modal-name-color: var(--gcl-popup-text); /* nuevo: color por defecto para el título (name) del modal */
  display:inline-block;
  margin:12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* grid helper */
.gcl-skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}

/* card basic */
.gcl-skill-card { width: 260px; perspective: 1000px; box-sizing: border-box; margin: 0 auto; }
.gcl-card-inner { position: relative; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(.2,.8,.2,1); height: 260px; }
/* permitir flip cuando JS agrega la clase gcl-flip-active */
.gcl-flip-active .gcl-card-inner {
  transform: rotateY(180deg);
}

.gcl-skill-card:hover .gcl-card-inner { transform: rotateY(180deg); }

/* faces */
.gcl-card-face {
  position: absolute; top:0; left:0; right:0; height: 100%;
  backface-visibility: hidden; border-radius: 12px; overflow: hidden;
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 22px rgba(0,0,0,0.12);
}
.gcl-card-front img { width:100%; height:100%; object-fit:cover; display:block; }

/* backface now uses variable (configurable) to avoid transparency issues */
.gcl-card-back {
  transform: rotateY(180deg); padding: 12px; box-sizing: border-box;
  background: var(--gcl-back-bg);
}

/* footer */
.gcl-card-footer { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; background:#fff; border-radius:0 0 12px 12px; margin-top: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.gcl-card-footer .gcl-person-name { font-size:15px; font-weight:600; color:var(--gcl-popup-text); }
.gcl-learn-more-button { background:var(--gcl-accent); color:#fff; border:none; padding:8px 12px; border-radius:8px; cursor:pointer; font-size:13px; }

/* pentagon */
.gcl-pent-svg { width:100%; height:100%; max-height:100%; display:block; }
.gcl-grid-polygon { stroke:#e6e6e6; stroke-width:0.6; fill:none; }
.gcl-filled-polygon { fill: var(--gcl-accent); fill-opacity: 0.12; stroke: var(--gcl-accent); stroke-opacity: 0.9; stroke-width:1.4; transform-origin:50% 50%; transform: scale(0); opacity:0; }
.gcl-pent-label { font-size:5.5px; text-anchor:middle; dominant-baseline:central; fill:var(--gcl-popup-text); }
.gcl-spoke { stroke: var(--gcl-accent); stroke-width:1.25; stroke-linecap:round; stroke-dasharray: 200; stroke-dashoffset: 200; }

/* animations */
@keyframes gcl-fill-expand { from { transform: scale(0); opacity:0 } to { transform: scale(1); opacity:1 } }
@keyframes gcl-draw { from { stroke-dashoffset: 200; opacity: 0.9 } to { stroke-dashoffset: 0; opacity: 1 } }

/* when modal open or showing backface, animate */
.gcl-modal-open .gcl-filled-polygon,
.gcl-flip-active .gcl-filled-polygon {
  animation: gcl-fill-expand 1200ms cubic-bezier(.2,.9,.2,1) forwards;
  animation-delay: 0.12s;
}
.gcl-modal-open .gcl-spoke,
.gcl-flip-active .gcl-spoke {
  animation: gcl-draw 900ms ease-out forwards;
}

.gcl-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms cubic-bezier(.2,.9,.2,1), transform 260ms cubic-bezier(.2,.9,.2,1);
  transform: translateY(-8px) scale(0.98);
  z-index: 9999;
}

/* Cuando está abierto: visible y en posición */
.gcl-modal.gcl-modal-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Animación para el contenedor interior (pop-in) */
.gcl-modal-inner {
  width: min(1000px, 80%);
  max-width: 700px;
  background: var(--gcl-popup-bg);
  color: var(--gcl-popup-text);
  border-radius: 18px;
  padding: 34px 42px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.28);
  position: relative;
  display: block;
  transform: translateY(8px) scale(0.98);
  transition: transform 260ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
  opacity: 0;
}

/* Cuando modal abierto, anima el inner a su estado final */
.gcl-modal.gcl-modal-open .gcl-modal-inner {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Opcional: animación de salida más suave para el SVG (si quieres) */
.gcl-modal.gcl-modal-open .gcl-filled-polygon {
  /* ya tienes animación, esto solo asegura que sea visible al abrir */
  animation-play-state: running;
}

/* Top row: pentagon (left) + photo (right) in the SAME ROW, horizontally aligned */
.gcl-modal-top {
  display: flex;
  flex-direction: row;
  gap: 28px;
  align-items: center; /* vertical centering of both columns */
  justify-content: space-between;
  width: 100%;
}

/* pentagon column: flexible, will take remaining space */
.gcl-modal-pentagon {
  flex: 1 1 auto;
  height: 240px;
  display:flex;
  align-items:center;
  justify-content:flex-start; /* pentagon positioned a bit to the left like in reference */
  padding-left: 6%;
  box-sizing: border-box;
}

/* photo column: fixed width to the right */
.gcl-modal-photo {
  flex: 0 0 260px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
}
.gcl-modal-photo img { width: 240px; height: 320px; object-fit:cover; border-radius:8px; box-shadow: 0 12px 30px rgba(0,0,0,0.12); }

/* below the top columns we want the title and texts to span full width (flow naturally below) */
.gcl-modal-body {
  width: 100%;
  margin-top: 22px;
}

/* title style large like image */
.gcl-modal-title {
  font-size: 64px;
  line-height: 0.95;
  margin: 6px 0 10px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--gcl-modal-name-color); /* usar la variable personalizada */
}

/* subtitle small caps */
.gcl-modal-sub {
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin: 0 0 18px;
  color: var(--gcl-accent);
}

/* paragraph */
.gcl-modal-text {
  font-size: 15px;
  line-height: 1.8;
  max-width: 760px;
  color: var(--gcl-popup-text);
  margin-bottom: 22px;
}

/* link (bold small) */
.gcl-modal-link {
  display:inline-block;
  font-weight:700;
  letter-spacing: 2px;
  color: var(--gcl-popup-text);
  text-decoration: none;
}

/* close button: big X like image */
.gcl-modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
  background: transparent;
  border: none;
  font-size: 40px;
  line-height: 1;
  color: #2b2b2b;
  cursor: pointer;
  padding: 0;
}

/* small pent */
.gcl-pent-svg.small { width: 100%; height: 100%; }

/* editor safety: disable flip & animations to make editing stable */
.gcl-block-editor .gcl-skill-card:hover .gcl-card-inner { transform: none !important; }
.gcl-block-editor .gcl-filled-polygon,
.gcl-block-editor .gcl-spoke { animation: none !important; transform: none !important; opacity: 1 !important; }

/* editor preview constraints */
.gcl-block-editor .gcl-card-preview { margin-bottom:12px; width:260px; max-width:100%; }
.gcl-block-editor .gcl-skill-card { width:260px; max-width:100%; }
.gcl-block-editor .gcl-card-front img { height:100%; object-fit:cover; display:block; }
.gcl-block-editor .gcl-card-back { height:100%; display:flex; align-items:center; justify-content:center; padding:6px; }

/* responsive */
@media (max-width: 920px) {
  .gcl-modal-inner { padding: 22px; }
  /* switch top to column on small screens */
  .gcl-modal-top { flex-direction: column; align-items: center; gap: 18px; }
  .gcl-modal-pentagon { padding-left: 0; height: 160px; justify-content: center; }
  .gcl-modal-photo { flex: 0 0 auto; }
  .gcl-modal-photo img { width: 160px; height: 220px; }
  .gcl-modal-title { font-size: 40px; }
}

/* Forzar layout horizontal en pantallas pequeñas: pentágono a la izquierda, foto a la derecha */
@media (max-width: 720px) {
  /* Mantén modal-inner con padding reducido pero deja top en fila */
  .gcl-modal-inner {
    padding: 18px;
  }

  /* Top row: fuerza fila horizontal y evita que los items se apilen */
  .gcl-modal-top {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px;
    align-items: center;    /* centra verticalmente pentágono y foto */
    justify-content: space-between;
    overflow-x: auto;       /* permite scroll horizontal si no entra */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  /* Pentagon column: ocupa el espacio disponible, pero con un ancho mínimo */
  .gcl-modal-pentagon {
    flex: 1 1 auto;
    min-width: 140px;       /* evita que desaparezca en pantallas angostas */
    height: 140px;          /* reduce altura para móviles */
    padding-left: 6%;
    box-sizing: border-box;
    justify-content: flex-start;
  }
  /* Mantén el svg pequeño para móviles */
  .gcl-pent-svg.small { max-height: 140px; width: auto; height: 100%; }

  /* Photo column: ancho fijo más pequeño */
  .gcl-modal-photo {
    flex: 0 0 120px;
    display:flex;
    align-items:center;
    justify-content:flex-end;
  }
  .gcl-modal-photo img {
    width: 110px;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
  }

  /* Títulos y textos: ajustar tamaños para no robar ancho */
  .gcl-modal-title { font-size: 28px; line-height: 1; margin-top: 8px; }
  .gcl-modal-sub { font-size: 10px; letter-spacing: 3px; }
  .gcl-modal-text { font-size: 14px; line-height: 1.6; }

  /* Opcional: esconder scrollbar visual (si quieres estética limpia) */
  .gcl-modal-top::-webkit-scrollbar { height: 6px; }
  .gcl-modal-top::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 6px; }
}
