
    html {
      background: #111316;
    }

    body {
      margin: 0;
      padding: 0;
      width: 100vw;
      height: 100vh;
      overflow: hidden;
      display: flex;
      justify-content: center;
      align-items: center;
      font-family: 'Roboto Flex', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    body::before {
      content: "";
      position: absolute;
      inset: 0;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='4' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
      background-size: 150px;
      opacity: 0.08;
      pointer-events: none;
      z-index: -1;
      mix-blend-mode: screen;
      image-rendering: pixelated;
      filter: grayscale(100%) contrast(300%) brightness(80%);
    }

  :root {
    /* These are baseline fallbacks; they will be overridden responsively via JS */
    --card-height: 520px;
    --card-width-normal: 320px;
    --card-width-selected: 920px;
    --card-gap: 16px;
    --edge-margin: 64px;
  /* Outline/Border gradients */
  --gradient-outline-default: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(138, 180, 248, 0.05) 0%);
  --gradient-outline-hover: linear-gradient(135deg, rgba(255, 255, 255, 0.6) 0%, rgba(147, 197, 253, 0.5) 50%, rgba(96, 165, 250, 0.6) 100%);
  --gradient-outline-selected: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(96, 165, 250, 0.9) 0%, rgba(59, 130, 246, 0.9) 0%);
  /* Readability overlays for project backgrounds (tweak here) */
  --card-overlay-left: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.75) 10%,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0) 100%
  );
  --card-overlay-vertical: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0) 50%
  );
  /* Overlay used ONLY when cards are compressed */
  --card-overlay-compressed: linear-gradient(
    0deg,
    rgba(29, 33, 40, 0.9),
    rgba(29, 33, 40, 0.9)
  );
  }

  /* Lift main content */
  .card-container { position: relative; z-index: 1; }
  .tab-bar { position: fixed; z-index: 10; }
  .card-container {
    display: flex;
    flex-direction: row;
    gap: var(--card-gap);
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    transition: transform 0.5s ease;
    will-change: transform;
  }
  /* During card switching, hide only textual content to avoid visible reflow */
  .card-container.is-switching .profile-heading,    .card-container.is-switching .profile-summary,
    .card-container.is-switching .profile-tools-container,
    .card-container.is-switching .profile-contacts-horizontal,
    .card-container.is-switching .profile-contacts-vertical,  .card-container.is-switching .profile-bio,
  .card-container.is-switching .inner-tabs,
  .card-container.is-switching .panel-copy {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: none !important;
  }
  /* Reduce jank during programmatic resizes */
  .card-container.is-expanding {
    transition: none !important;
  }
  .card {
    position: relative;
    width: var(--card-width-normal);
    height: var(--card-height);
    /* background: #222222; */
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.3s ease, box-shadow 0.3s ease;
  }
  .card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: var(--card-bg, #1d2128);
    z-index: 0;
    transition: background 0.5s ease;
  }
  .card:not(.selected):hover::after {
    background: var(--card-bg-hover, #232731);
  }
  .card:hover {
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 1;
  }
  .card.selected {
    /* outline: 2px solid #2f00ff; */
    width: var(--card-width-selected);
  }
  .tab-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: none;
    padding: 0 0 0 0;
    position: fixed;
    top: 24px;
    left: 0;
    width: 100vw;
    z-index: 10;
    box-shadow: none;
  /* ensure positioned ancestor for indicator */
  pointer-events: auto;
  }
  .tab {
    color: #ccc;
    font-size: clamp(12px, 1.6vw, 18px);
    text-transform: uppercase;
    padding: 10px 24px;
    border-radius: 0;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
  }
  .tab.active {
    color: #ffffff;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.6), 0 0 24px rgba(255, 255, 255, 0.4);
    background: none;
    box-shadow: none;
  }
  /* Single moving indicator (animated) */
  .tab-bar .tab-indicator {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0) 100%);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.4));
    border-radius: 2px;
    transform: translateX(0px);
    transition: transform 240ms cubic-bezier(.2,.8,.2,1), width 240ms cubic-bezier(.2,.8,.2,1);
    pointer-events: none;
  }
  /* --- Card inner content (non-destructive, scoped) --- */
  .card .card-content {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 24px;
    color: #e0e0e0;
  /* lift above bg fade layer */
  z-index: 3;
  }
  /* Profile card */
  .card .card-content.profile-card { padding: 54px; }
  .profile-card { display: flex; flex-direction: column; gap: 0px; height: 100%; position: relative; z-index: 1; overflow: hidden; justify-content: space-between; }
  .profile-info-container { display: flex; justify-content: center; align-items: start; gap: 38px; align-self: stretch; flex-shrink: 0; transition: gap 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
  
  .profile-media { display: flex; flex-direction: column; gap: 24px; position: relative; flex-shrink: 0; width: 160px; /* fixed width keeps it stable */ align-items: center; transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .profile-photo { width: 160px; height: 160px; border-radius: 16px; overflow: hidden; background: #1e1e1e; flex-shrink: 0; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
  
  .profile-main { display: flex; flex-direction: column; gap: 16px; flex-grow: 1; align-self: stretch; max-width: 1000px; justify-content: flex-start; transition: max-width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease, padding 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), margin 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), flex-grow 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); overflow: hidden; }
  .profile-heading { display: flex; flex-direction: column; gap: 4px; }
  .profile-heading h2 { margin: 0; font-size: clamp(24px, 2.5vw, 32px); font-weight: 700; color: #ffffff; }
  .profile-subtitle { margin: 0; color: #ffffff; font-size: 16px; font-weight: 300; }
  
  .profile-contacts { list-style: none; padding: 0; margin: 0; display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 300; color: #ffffff; }
  .profile-contacts-horizontal { flex-wrap: wrap; }
.profile-contacts-vertical { opacity: 0; visibility: hidden; transition: opacity 0.2s ease, max-height 0.4s ease, margin 0.4s ease, gap 0.4s ease; max-height: 0; overflow: hidden; margin: 0; flex-direction: column; gap: 0; width: 300px; align-items: center; }
  .profile-contacts a { color: #ffffff; text-decoration: none; border-bottom: 1px dashed transparent; transition: color .3s, border-color .3s, text-shadow .3s; }
  .profile-contacts a:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.8); text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(147, 197, 253, 0.6); }
  .profile-contacts-horizontal .sep, .profile-contacts-vertical .sep { color: rgba(255, 255, 255, 0.4); margin: 0 4px; }
  
  .profile-summary { display: flex; flex-direction: column; }
  .profile-summary h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: #ffffff; }
  .profile-bio { margin: 0; line-height: 1.5; font-size: 16px; font-weight: 300; color: #ffffff; }

  /* Profile Tools Container */
  .profile-tools-container { display: flex; flex-direction: column; gap: 32px; align-self: stretch; align-items: center; justify-content: center; flex-grow: 1; }
  
  .tools-hint {
    font-style: italic;
    font-weight: 150; /* Font più sottile (varia da 100 a 400 se vuoi aggiustare) */
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.95rem;
    transition: opacity 0.3s ease;
    margin-top: auto; /* spinge il contenuto verso il basso */
  }

  /* Nasconde il testo quando si fa hover su uno dei bottoni */
  .profile-tools-container:has(.tool-icon:hover) .tools-hint {
    opacity: 0;
  }

  /* MODIFICA QUI IL "gap" PER CAMBIARE LA DISTANZA TRA I 3 BOTTONI ↓ */
  .profile-tools { display: flex; gap: 100px; justify-content: center; align-items: center; width: 100%; margin-top: 0; margin-bottom: 0px;}
  
  .tool-icon { position: relative; width: 128px; height: 128px; color: #888; cursor: pointer; transition: transform 0.4s ease; }
  .tool-icon:hover { 
    transform: translateY(-8px);
    color: #ffffff; 
  }
  .tool-icon:hover .icon-pyramid {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.7));
  }
  .tool-icon svg { width: 100%; height: 100%; display: block; }
  
  .icon-pyramid { position: relative; width: 100%; height: 100%; border-radius: 50%; }
  .tool-icon:hover .icon-pyramid { animation: spin-pyramid 5s linear infinite; }
  
  .icon-wrapper {
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    /* translate backwards properly so they form a triangle. translateY(-40px) places them 40px from center */
    transform: rotate(var(--angle)) translateY(-40px);
  }
  
  .icon-wrapper img {
    position: absolute;
    top: -24px; left: -24px;
    width: 48px; height: 48px;
    object-fit: contain;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
    /* counter-rotate the static angle */
    transform: rotate(calc(var(--angle) * -1));
  }
  
  .tool-icon:hover .icon-wrapper img {
    filter: grayscale(0%);
    /* While wrapper spins, img spins backwards to stay upright */
    animation: counter-spin-pyramid 5s linear infinite;
  }
  
  @keyframes spin-pyramid {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  @keyframes counter-spin-pyramid {
    0% { transform: rotate(calc(var(--angle) * -1 - 0deg)); }
    100% { transform: rotate(calc(var(--angle) * -1 - 360deg)); }
  }

  .tool-tooltip { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(4px); opacity: 0; pointer-events: none; background: transparent; color: #ffffff; font-size: 0.85rem; font-weight: 400; letter-spacing: 0.5px; width: max-content; max-width: 350px; text-align: center; line-height: 1.4; transition: opacity 0.3s ease, transform 0.3s ease; }
  .tool-tooltip strong { display: block; font-size: 1rem; font-weight: 600; margin-bottom: 4px; text-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }
  .tool-icon:hover .tool-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Smooth reveal/hide of profile details: simple fade-in/fade-out */
.profile-heading, .profile-summary, .profile-tools-container, .profile-contacts-horizontal {
  opacity: 1;
  visibility: visible;
  max-height: 800px;
  margin-top: 0;
  transition: 
    visibility 0s linear 0s,
    max-height 0.4s ease,
    margin 0.4s ease,
    gap 0.4s ease,
    opacity 0.4s ease 0.2s; /* Delayed fade-in to let layout settle */
  will-change: opacity, max-height;
}

.card:not(.selected) .profile-info-container {
  gap: 0px; /* smoothly merges the space */
}

  .card:not(.selected) .profile-media {
    /* No width changes needed! Just stays centered */
  }

  .card:not(.selected) .profile-main {
    max-width: 0px;
    opacity: 0;
    margin: 0 !important;
    padding: 0 !important;
    flex-grow: 0;
  }

  .card:not(.selected) .profile-heading, .card:not(.selected) .profile-summary, .card:not(.selected) .profile-tools-container, .card:not(.selected) .profile-contacts-horizontal { opacity: 0; visibility: hidden; max-height: 0; margin: 0 !important; padding: 0 !important; gap: 0 !important; overflow: hidden; transition: opacity 0.2s ease, max-height 0.4s ease, margin 0.4s ease, gap 0.4s ease, visibility 0s linear 0.4s; }

  .card:not(.selected) .profile-contacts-vertical { opacity: 1; visibility: visible; max-height: 200px; gap: 8px; transition: opacity 0.4s ease 0.2s, max-height 0.4s ease, margin 0.4s ease, gap 0.4s ease; pointer-events: none; margin-top: 16px; }

  /* Project cards */
  .project-card { display: grid; grid-template-columns: 240px 1fr; gap: 0 24px; height: 100%; position: relative; z-index: 1; }
  .inner-tabs { position: relative; display: flex; flex-direction: column; gap: 0; align-self: stretch; background: transparent; z-index: 10; }
  .inner-tabs::before { content: ""; position: absolute; top: -24px; bottom: -24px; left: -24px; width: 360px; background: linear-gradient(90deg, rgba(17, 19, 22, 0.7) 0%, rgba(17, 19, 22, 0) 100%); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); mask-image: linear-gradient(90deg, black 0%, black 40%, transparent 100%); -webkit-mask-image: linear-gradient(90deg, black 0%, black 40%, transparent 100%); z-index: -1; pointer-events: none; border-radius: 22px 0 0 22px; }
  .inner-tab { position: relative; text-align: left; padding: 16px 6px; min-height: 44px; background: transparent; color: #d0d0d0; border: none; border-radius: 0; cursor: pointer; font: inherit; letter-spacing: .2px; transition: color .3s ease, font-size .3s ease, font-weight .3s ease, text-shadow .3s ease; }       
  .inner-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: rgba(255,255,255,0.12); transition: height 0.3s ease, background 0.3s ease, filter 0.3s ease; }
  .inner-tab:hover { color: #ffffff; text-shadow: 0 0 8px rgba(255, 255, 255, 0.4); }
  .inner-tab.active { color: #ffffff; text-shadow: 0 0 8px rgba(255, 255, 255, 0.6), 0 0 16px rgba(255, 255, 255, 0.4); font-size: 1.15em; font-weight: 700; }
  .inner-tab.active::after { height: 2px; background: linear-gradient(90deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%); filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.4)); }
  .inner-panels { position: relative; overflow: hidden; border-left: none; padding-left: 0; }
  /* Stack panels and fade via opacity */
  .inner-panel { position: absolute; inset: 0; height: 100%; overflow: visible; opacity: 0; transition: opacity .24s ease; pointer-events: none; }
  .inner-panel.active { opacity: 1; pointer-events: auto; }
  .inner-panel h3 { margin: 0 0 8px; font-size: clamp(16px, 2vw, 22px); color: #f5f5f5; }
  .inner-panel p { margin: 0 0 12px; color: #c7c7c7; line-height: 1.5; }
  /* Removed chips/panel-visual for minimal project presentation */

  /* Minimal project presentation rules */
  .project-card { position: relative; padding: 0; }
  .project-card .category-cover {
    position: absolute;
    inset: 0;
    /* Compressed state: show underlaying cover image */
    background: var(--cover, #151515);
    border: none;
    border-radius: 22px;
    pointer-events: none;
    opacity: 1;
    transition: opacity .35s ease;
  }
  .project-card .category-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: var(--card-overlay-compressed);
    transition: opacity 0.5s ease;
    z-index: 1;
  }
  .card:not(.selected):hover .project-card .category-cover::after {
    opacity: 0.35;
  }

  /* Hide inner tabs/panels unless card is selected */
  .card .project-card .inner-tabs,
  .card .project-card .inner-panels { visibility: hidden; opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }
  .card.selected .project-card .inner-tabs,
  .card.selected .project-card .inner-panels { visibility: visible; opacity: 1; transform: translateY(0); }
  /* Prevent accidental interaction when compressed */
  .card:not(.selected) .project-card .inner-tabs,
  .card:not(.selected) .project-card .inner-panels { pointer-events: none; }
  /* When compressed, show only the category cover */
  .card .project-card .category-cover { display: block; }
  /* On expand (bg ready), fade the compressed overlay out instead of snapping */
  .card.selected.bg-ready .project-card .category-cover { opacity: 0; pointer-events: none; }
  /* No layout footprint for hidden UI when compressed; restore padding when expanded */
  .card:not(.selected) .project-card .inner-tabs,
  .card:not(.selected) .project-card .inner-panels { display: none; }
  .card.selected .project-card { padding: 24px; }
  /* Minimal panel background + brief copy */
  .inner-panel { background: transparent; border: none; padding: 0; }
  /* Description text: tighter edges, slightly smaller font, and smooth visibility */
  .panel-copy {
    position: absolute;
    right: 16px; /* reduced from 24px */
    bottom: 16px; /* reduced from 24px */
    max-width: 52%;
    color: #f0f0f0;
    font-size: 0.95rem; /* slightly smaller */
    line-height: 1.35;
    text-align: right;
    text-shadow: 0 2px 4px rgb(0, 0, 0,0.9);
    opacity: 1;
    visibility: visible;
    transition: opacity .18s ease, visibility 0s linear 0s;
    will-change: opacity;
  }
  /* Hide descriptions while the card is compressed to avoid reflow/rewrap during width transition */
  .card:not(.selected) .panel-copy {
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease 0s, visibility 0s linear .12s;
  }
  /* Delay fade-in until card expansion completes (~0.5s) */
  .card.selected .panel-copy {
    opacity: 1;
    visibility: visible;
    transition: opacity .18s ease .3s, visibility 0s linear .3s;
  }

  /* Background video element (when a panel uses video) */
  .bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .24s ease;
    pointer-events: none;
    /* match rounded shape of the card */
    border-radius: 22px;
    z-index: 1;
  }

  /* Transient background fade layer injected by JS */
  .bg-fade-layer {
    position: absolute;
    inset: 0;
  z-index: 2; /* under .card-content (z=3), above video (z=1) and ::after (z=0) */
    opacity: 0;
    transition: opacity .24s ease;
    pointer-events: none;
    /* match rounded shape of the card */
    border-radius: 22px;
  }

  /* Expanded overlays layer shown ONLY when the card is selected and uses video */
  .expanded-overlay {
    position: absolute;
    inset: 0;
    background: var(--card-overlay-left), var(--card-overlay-vertical);
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
    border-radius: 22px;
    z-index: 2; /* above video, below content */
  }
  .card.selected.has-video .expanded-overlay { opacity: 1; }

  /* Small screens: tighten columns */
  @media (max-width: 900px) {
    .profile-info-container { flex-direction: column; align-items: center; }
    .project-card { grid-template-columns: 160px 1fr; }
    .profile-photo { width: 140px; height: 140px; }
  .profile-media { gap: 24px; }
  }
  @media (max-width: 700px) {
  }

.privacy-footer {
  position: fixed;
  bottom: 16px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 0.7rem;
  color: #555;
  z-index: 10;
  pointer-events: none;
  padding: 0 16px;
  box-sizing: border-box;
  font-family: inherit;
}







.lang-switcher {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: inherit;
  font-size: clamp(12px, 1.6vw, 16px);
  color: #ccc;
  padding: 10px 0; /* Match the vertical padding of tabs for precise alignment */
}
.lang-switcher button {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0 8px;
  outline: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.lang-switcher button:hover {
  color: #fff;
}
.lang-switcher button.active {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  font-weight: 700;
}
.lang-switcher .sep {
  color: rgba(255, 255, 255, 0.3);
}
