
    :root {
      --bg: #050816;
      --bg-alt: #0b1020;
      --card-bg: #0f172a;
      --accent: #38bdf8;
      --accent2: #a855f7;
      --accent-soft: rgba(56, 189, 248, 0.18);
      --text-main: #e5e7eb;
      --text-muted: #9ca3af;
      --border-soft: rgba(148, 163, 184, 0.35);
      --header-offset: 180px;
      --lightbox-bottom-padding: 24px;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--text-main);
      display: flex;
      justify-content: center;
      background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
                  radial-gradient(circle at 100% 100%, rgba(129, 140, 248, 0.22), transparent 55%),
                  var(--bg);
      position: relative;
      overflow-x: hidden;
    }

    html {
      scroll-behavior: smooth;
      scroll-padding-top: var(--header-offset);
    }

    /* Fondo animado suave ----------------------------------- */

    body::before {
      content: "";
      position: fixed;
      inset: -40%;
      background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.16), transparent 55%);
      opacity: 0.7;
      mix-blend-mode: screen;
      pointer-events: none;
      animation: float-bg 24s ease-in-out infinite alternate;
      z-index: -1;
    }

    @keyframes float-bg {
      0%   { transform: translate3d(0, 0, 0) scale(1); }
      50%  { transform: translate3d(-3%, 3%, 0) scale(1.05); }
      100% { transform: translate3d(3%, -3%, 0) scale(1.02); }
    }

    .page {
      width: 100%;
      max-width: 100%;
      padding: 20px 32px 48px;
    }

    /* TOP BAR / HEADER -------------------------------------- */

    .top-bar {
      position: sticky;
      top: 0;
      z-index: 50;
      display: grid;
      grid-template-columns: auto minmax(0, 1.3fr) auto;
      align-items: center;
      gap: 20px;
      margin-bottom: 22px;
      padding: 5px 18px;
      border-radius: 20px;
      background:
        radial-gradient(circle at 0% 0%, var(--accent-soft), transparent 60%),
        var(--card-bg);
      border: 1px solid var(--border-soft);
      box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(15, 23, 42, 0.9);
      overflow: hidden;
    }

    .top-bar::before {
      content: "";
      position: absolute;
      inset: -40%;
      background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.14), transparent 55%);
      opacity: 0.55;
      mix-blend-mode: screen;
      pointer-events: none;
    }

    .header-left,
    .header-center,
    .top-right {
      position: relative;
      z-index: 1;
    }

    .header-left {
      position: relative;
      width: 170px;
      min-width: 150px;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .header-left .avatar-frame {
      width: 130px;
      height: 130px;
    }

    /* Logo BIM Visionary en el header: sin caja y más abajo */
    .header-left .logo-frame {
      width: 90px;
      height: 90px;
      position: absolute;
      bottom: -18px;
      right: -8px;
      opacity: 1;
      border-radius: 0;
      overflow: visible;
      border: none;
      box-shadow: none;
      background: transparent;
    }

    .header-center {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .brand-main {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.22em;
      color: var(--text-muted);
    }

    .brand-main span {
      color: var(--accent);
      font-weight: 600;
    }

    .brand-sub {
      font-size: 0.72rem;
      color: var(--text-muted);
    }

    .header-name {
      font-size: 1.8rem;
      line-height: 1.1;
      margin: 4px 0 2px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .header-name span {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    background-clip: text;        /* estándar */
    -webkit-background-clip: text;/* prefijo para mejor soporte */
    color: transparent;
    }

    .header-title {
      font-size: 0.9rem;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--text-muted);
      margin: 0;
    }

    .top-right {
	  display: flex;
	  flex-direction: column;
	  align-items: flex-end;
	  gap: 6px;
	  padding-top: 8px;      /* 🔹 Baja idiomas + insignias + botones un poco */
	}

    /* fila idiomas arriba */
    .lang-switch {
      display: flex;
      gap: 6px;
      justify-content: flex-end;
    }

    /* fila insignias + bloque de botones */
    .cv-row {
	  display: flex;
	  align-items: center;   /* 🔹 centra verticalmente insignias vs botones */
	  gap: 16px;             /* un poco más de aire entre insignias y textos */
	}

    /* stack vertical: idiomas, masters, compacts */
    .cv-stack {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 4px;
    }

    /* filas existentes en horizontal */
    .lang-switch,
    .cv-buttons,
    .contact-buttons {
	  display: flex;
	  flex-wrap: wrap;
	  gap: 6px;
	  justify-content: flex-end;
	}

    .cert-badges {
	  display: flex;
	  gap: 8px;
	}

    /* INSIGNIAS AGRANDADAS SIN INVADIR BOTONES */
    .cert-badge {
	  width: 120px;
	  height: 120px;
	  border-radius: 999px;
	  border: 1px solid rgba(148, 163, 184, 0.7);
	  background: rgba(15, 23, 42, 0.96);
	  display: flex;
	  align-items: center;
	  justify-content: center;
	  overflow: hidden;
	  box-shadow: 0 0 10px rgba(15, 23, 42, 0.85);
    }

    .cert-badge img {
      width: 90%;
      height: 90%;
      object-fit: contain;
    }

    .cert-badge:hover {
      transform: translateY(-2px) scale(1.10);
      box-shadow: 0 12px 26px rgba(0, 0, 0, 0.6);
    }

    /* En pantallas chicas las bajamos un poco */
    @media (max-width: 900px) {
      .cert-badge {
        width: 60px;
        height: 60px;
      }
    }

    .contact-buttons {
      flex-direction: row;
      align-items: center;
      justify-content: flex-end;
      gap: 6px;
    }

    .btn-pill {
      font-size: 0.7rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      padding: 5px 10px 6px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.6);
      background: rgba(15, 23, 42, 0.9);
      color: var(--text-muted);
      text-decoration: none;
      cursor: pointer;
      white-space: nowrap;
    }

    .btn-pill.active {
      border-color: rgba(56, 189, 248, 0.9);
      color: var(--accent);
      background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(168, 85, 247, 0.12));
    }

    .btn-ghost {
      font-size: 0.7rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      padding: 5px 10px 6px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.5);
      background: rgba(15, 23, 42, 0.9);
      color: var(--text-main);
      text-decoration: none;
      cursor: pointer;
      white-space: nowrap;
    }

    .btn-ghost span {
      opacity: 0.7;
    }

    .icon-btn {
      width: 28px;
      height: 28px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.6);
      background: rgba(15, 23, 42, 0.9);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      color: var(--text-main);
      text-decoration: none;
      cursor: pointer;
    }

    .icon-btn:hover,
    .btn-pill:hover,
    .btn-ghost:hover {
      border-color: rgba(56, 189, 248, 0.9);
      color: var(--accent);
    }

    .cv-buttons {
      align-items: center;
    }

    /* Botón YouTube – pequeño guiño rojo sin romper el diseño */
    .icon-btn-yt {
      font-size: 0.95rem;              /* un pelín más grande el ▶ */
    }

    .icon-btn-yt:hover {
      border-color: rgba(248, 113, 113, 0.9);
      color: #f97373;                  /* rojo suave, no neón asesino */
    }

    /* HERO -------------------------------------------------- */

    .hero {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
      gap: 32px;
      align-items: flex-start;
      margin-bottom: 32px;
    }

    .hero-left {
      border-radius: 20px;
      padding: 20px 20px 22px;
      background:
        radial-gradient(circle at 0% 0%, var(--accent-soft), transparent 60%),
        var(--card-bg);
      border: 1px solid var(--border-soft);
      box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(15, 23, 42, 0.9);
      position: relative;
      overflow: hidden;
    }

    .hero-left::before {
      content: "";
      position: absolute;
      inset: -40%;
      background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.2), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.16), transparent 55%);
      opacity: 0.5;
      mix-blend-mode: screen;
      pointer-events: none;
    }

    .hero-main {
      position: relative;
      z-index: 1;
    }

    .hero-main-layout {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .hero-info {
      flex: 1;
      min-width: 0;
    }

    .avatar-frame {
      width: 140px;
      height: 140px;
      border-radius: 999px;
      overflow: hidden;
      border: 2px solid rgba(56, 189, 248, 0.9);
      box-shadow:
        0 0 20px rgba(56, 189, 248, 0.4),
        0 12px 30px rgba(15, 23, 42, 0.9);
      background: radial-gradient(circle at 30% 0%, rgba(56, 189, 248, 0.25), transparent 60%),
                  #020617;
    }

    .avatar-frame img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    /* Logo genérico (se usa junto con el override de header-left) */
    .logo-frame {
      width: 90px;
      height: 90px;
    }

    .logo-frame img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .hero-label {
      font-size: 0.7rem;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    .hero-bio {
      font-size: 0.9rem;
      color: var(--text-main);
      margin: 0 0 18px;
    }

    .hero-bio span {
      color: var(--accent);
      font-weight: 600;
    }

    .hero-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 4px;
    }

    .tag-chip {
      font-size: 0.7rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      padding: 4px 10px 5px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.5);
      color: var(--text-muted);
      background: rgba(15, 23, 42, 0.95);
      white-space: nowrap;
    }

    .hero-right {
      border-radius: 20px;
      padding: 18px 18px 20px;
      background: rgba(15, 23, 42, 0.92);
      border: 1px solid var(--border-soft);
      box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    }

    .section-title {
      font-size: 0.85rem;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--text-muted);
      margin: 0 0 6px;
    }

    .skills-group {
      margin-bottom: 10px;
    }

    .skills-label {
      font-size: 0.78rem;
      text-transform: uppercase;
      letter-spacing: 0.16em;
      color: var(--text-muted);
      margin-bottom: 2px;
    }

    .skills-line {
      font-size: 0.82rem;
      color: var(--text-main);
      margin: 0 0 4px;
    }

    .timeline {
      margin-top: 8px;
      border-top: 1px dashed rgba(148, 163, 184, 0.6);
      padding-top: 8px;
    }

    .timeline-item {
      margin-bottom: 8px;
    }

    .timeline-role {
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text-main);
      margin: 0 0 2px;
    }

    .timeline-period {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin: 0 0 2px;
    }

    .timeline-desc {
      font-size: 0.8rem;
      color: var(--text-muted);
      margin: 0;
    }

    /* PROJECT GRID ------------------------------------------ */

    .divider {
      height: 1px;
      border: 0;
      background: linear-gradient(90deg, transparent, var(--border-soft), transparent);
      margin: 26px 0 22px;
    }

    .projects-header {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 12px;
      margin-bottom: 10px;
    }

    .projects-title {
      font-size: 0.95rem;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--text-muted);
      margin: 0;
    }

    .projects-sub {
      font-size: 0.78rem;
      color: var(--text-muted);
      margin: 0;
      text-align: right;
    }

    .projects-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 14px;
    }

    .project-card {
      border-radius: 14px;
      padding: 10px 10px 12px;
      background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.15), transparent 70%),
        var(--card-bg);
      border: 1px solid rgba(148, 163, 184, 0.4);
      text-decoration: none;
      color: inherit;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    }

    .project-card:hover {
      transform: translateY(-2px);
      box-shadow:
        0 12px 30px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(56, 189, 248, 0.4);
      border-color: rgba(56, 189, 248, 0.7);
    }

    .project-label {
      font-size: 0.68rem;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 2px;
    }

    .project-name {
      font-size: 0.86rem;
      font-weight: 600;
      margin: 0 0 2px;
    }

    .project-meta {
      font-size: 0.78rem;
      color: var(--text-muted);
      margin: 0 0 4px;
    }

    .project-tags {
      font-size: 0.72rem;
      color: var(--accent);
      margin: 0;
    }

    /* CASE STUDIES DETAIL ----------------------------------- */

    .detail-section {
      page-break-before: always;
      margin-top: 32px;
    }

    .detail-header {
      margin-bottom: 10px;
    }

    .detail-label {
      font-size: 0.8rem;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--text-muted);
      margin: 0 0 4px;
    }

    .detail-title {
      font-size: 1.1rem;
      margin: 0 0 10px;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .detail-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
      column-gap: 12px;
      row-gap: 18px;
      font-size: 0.88rem;
    }

    .detail-block h3 {
      font-size: 0.82rem;
      margin: 0 0 4px;
      text-transform: uppercase;
      letter-spacing: 0.14em;
      color: var(--text-muted);
    }

    .detail-block p {
      margin: 0 0 6px;
      color: var(--text-main);
    }

    .detail-block ul {
      margin: 0 0 6px 18px;
      padding: 0;
      color: var(--text-main);
    }

    .detail-block li {
      margin-bottom: 4px;
    }

    /* GALLERY / PLANOS -------------------------------------- */

    .gallery-section {
      page-break-before: always;
      margin-top: 32px;
    }

    .gallery-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 14px;
      font-size: 0.82rem;
    }

    .gallery-item {
      border-radius: 14px;
      border: 1px solid rgba(148, 163, 184, 0.5);
      background: rgba(15, 23, 42, 0.92);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .gallery-thumb {
      position: relative;
      padding-top: 38%;
      background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.18), transparent 70%),
                  #020617;
      overflow: hidden;
    }

    .gallery-thumb img {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 100%;
      height: 100%;
      transform: translate(-50%, -50%);
      object-fit: cover;
      object-position: center;
    }

    .gallery-caption {
      padding: 8px 10px 10px;
    }

    .gallery-caption p {
      margin: 0;
      color: var(--text-main);
    }

    .gallery-caption span {
      display: block;
      margin-top: 2px;
      font-size: 0.72rem;
      color: var(--text-muted);
    }

    .footer-note {
      margin-top: 20px;
      font-size: 0.78rem;
      text-align: center;
      color: var(--text-muted);
    }

    /* Lightbox / visor flotante de imágenes ---------------- */

    .lightbox-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.85);
      display: none;
      align-items: center;
      justify-content: center;
      padding: var(--header-offset) 16px var(--lightbox-bottom-padding);
      box-sizing: border-box;
      z-index: 40;
    }

    .lightbox-backdrop.active {
      display: flex;
    }

    .lightbox-content {
      position: relative;
      max-width: 90vw;
      max-height: calc(100vh - var(--header-offset) - var(--lightbox-bottom-padding));
      border-radius: 16px;
      overflow: hidden;
      background: #020617;
      border: 1px solid rgba(148, 163, 184, 0.8);
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
      display: flex;
      flex-direction: column;
    }

    .lightbox-image {
      position: relative;
      display: block;
      width: 100%;
      height: auto;
      max-height: calc(
        100vh - var(--header-offset) - var(--lightbox-bottom-padding) - 40px
      );
      object-fit: contain;
      background: #000;
      z-index: 1;
    }

    .lightbox-close {
      position: absolute;
      top: 10px;
      right: 12px;
      width: 28px;
      height: 28px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.7);
      background: rgba(15, 23, 42, 0.95);
      color: #e5e7eb;
      font-size: 16px;
      line-height: 26px;
      text-align: center;
      cursor: pointer;
      z-index: 3;
    }

    .lightbox-close:hover {
      border-color: rgba(56, 189, 248, 0.9);
      color: var(--accent);
    }

    .lightbox-watermark {
      position: absolute;
      inset: 10% 18%;
      background: url("img/bv-logo.png") center/contain no-repeat;
      opacity: 0.12;
      pointer-events: none;
      mix-blend-mode: screen;
      z-index: 2;
    }

    .lightbox-caption {
      position: relative;
      z-index: 3;
      padding: 6px 12px 10px;
      font-size: 0.8rem;
      color: var(--text-muted);
      border-top: 1px solid rgba(30, 64, 175, 0.6);
      background: rgba(15, 23, 42, 0.98);
    }

    /* Responsive -------------------------------------------- */

    @media (max-width: 900px) {
      .top-bar {
        grid-template-columns: minmax(0, 1fr);
        align-items: flex-start;
      }
      .header-left {
        justify-content: flex-start;
      }
      .header-center {
        order: -1;
      }
      .top-right {
        align-items: flex-start;
      }
      .hero {
        grid-template-columns: minmax(0, 1fr);
      }
      .projects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .detail-grid {
        grid-template-columns: minmax(0, 1fr);
      }
      .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 640px) {
      .projects-grid,
      .gallery-grid {
        grid-template-columns: minmax(0, 1fr);
      }
    }

    /* Print ------------------------------------------------- */

    @media print {
      body {
        background: #ffffff;
      }
      body::before {
        display: none;
      }
      .page {
        max-width: 100%;
        padding: 16px 24px;
      }
      .top-bar,
      .hero-left,
      .hero-right,
      .project-card,
      .gallery-item {
        box-shadow: none;
        background: #ffffff;
        border-radius: 8px;
      }
      .tag-chip,
      .btn-pill,
      .btn-ghost,
      .icon-btn {
        background: #ffffff;
      }
      .detail-section,
      .gallery-section {
        page-break-before: always;
        margin-top: 32px;
      }
    }
