:root{
  --bg:#fff;
  --fg:#000000; /* Pure black for sharper contrast */
  --muted: rgba(0,0,0,.65);
  --line: rgba(0,0,0,.12);
  --glass: rgba(255,255,255,.95); /* More opaque, almost solid white */

  --topbarH: 66px;
  --pad: 40px; /* Increased padding as per design */
  --gap: 100px; /* Larger gap to separate projects distinctly */

  --cardW: 60vw; /* Reduced width for cards */
  --cardH: 100%; /* Fill the rail height */
  --radius: 40px;

  --shadow: 0 14px 46px rgba(0,0,0,.12);
}

@media (max-width: 768px) {
  :root {
    --pad: 20px;
    --gap: 24px;
  }
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.topbar{
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbarH);
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 var(--pad);
  background: rgba(255, 255, 255, 0.65); /* High transparency for liquid feel */
  backdrop-filter: blur(20px) saturate(180%); /* Strong blur + saturation for glass effect */
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.3); /* Glassy border edge */
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03); /* Subtle depth */
  z-index: 30;
}

.brand{
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav{
  display:flex;
  gap:10px;
  align-items:center;
}

.btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.9);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  color: var(--fg);
  text-decoration: none;
}

.btn--primary{
  background: #000000;
  border-color: #000000;
  color: #fff;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
}

main{ padding-top: var(--topbarH); }

/* Mobile specific adjustment: Fit to viewport but allow scroll if needed */
@media (max-width: 767px) {
  .hero {
    /* Use min-height instead of fixed height to prevent cutting off content on very small screens */
    min-height: calc(100vh - var(--topbarH));
    min-height: calc(100dvh - var(--topbarH));
    height: auto; 
    padding: 24px var(--pad) 40px; /* Top padding for spacing, bottom for scroll */
    align-items: flex-start; /* Align content to top instead of center/stretch */
  }
  .hero__inner {
    height: auto; /* Allow natural height */
    width: 100%;
    flex-direction: column;
    justify-content: flex-start; /* Push content to top */
    gap: 20px; /* Restored comfortable gap */
  }
  .hero__img {
    order: 1;
    margin: 0;
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end; /* Align to right (menu button) */
    align-items: flex-start;
    min-height: 0;
    padding-bottom: 0;
    overflow: visible;
  }
  .hero__photo {
    max-height: 50vh; /* Increased height for better impact */
    max-width: 90%; /* Prevent full width to keep right-bias visible */
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center top;
    margin-right: 8px; /* Align visually with the menu icon */
  }
  .hero__content {
    order: 2;
    flex: 0 0 auto; /* Text takes only what it needs */
    text-align: left;
    padding-bottom: 10px;
  }
  .hero .hero__title {
    font-size: clamp(20px, 5vw, 24px); /* Reduced size to match screenshot */
    max-width: 100%;
    line-height: 1.1;
  }
}

.hero__photo {
  display: block;
  width: 100%;
  max-width: 350px;
  height: auto;
}
.hero{
  min-height: calc(100vh - var(--topbarH));
  display:flex;
  align-items: center;
  padding: 56px var(--pad);
}
.hero__inner{
  max-width: 1200px; /* Increased max-width for desktop layout */
  width: 100%;
  display: flex;
  flex-direction: column; /* Mobile first: stack */
  gap: 40px;
}

/* Desktop layout */
@media (min-width: 768px) {
  .hero__inner {
    flex-direction: row;
    align-items: flex-end; /* Align text to bottom */
    justify-content: space-between;
    max-width: 100%; /* Full width to push image to edge */
  }
  .hero__content {
    flex: 1;
    order: 1; /* Text first (left) */
    padding-bottom: 10px; /* Slight offset from bottom alignment */
    text-align: left; /* Center text in desktop too */
  }
  .hero__title {
    font-size: 20px; /* Restored to "perfetto" size (was 14px) */
    max-width: 100%;
    line-height: 1.05;
    text-transform: none; /* Restored */
    letter-spacing: -0.02em; /* Restored */
  }
  .hero__img {
    flex: 0 0 480px; /* Adjusted width for desktop - balanced size */
    order: 2; /* Image second (right) */
    margin-bottom: 0;
  }
  .hero__photo {
    max-width: 100%; /* Allow image to fill the larger container */
  }
}

.hero__img {
  margin-bottom: 32px;
}
@media (min-width: 768px) {
  .hero__img { margin-bottom: 0; }
}

.hero__title{
  margin: 0;
  font-size: 66px; /* ~50pt */
  line-height: 1.05; /* ~52.5pt */
  letter-spacing: -0.02em;
  font-weight: 400; /* Regular weight as seen in mockup */
}
.hero p{
  margin: 0 0 18px 0;
  color: var(--muted);
  line-height: 1.6;
}
.hero__meta{ display:flex; gap:10px; flex-wrap: wrap; }

.spacer{
  padding: 72px var(--pad);
  border-top: 1px solid var(--line);
}
.spacer__inner{ max-width: 1200px; margin: 0; text-align: left; }
.spacer h2{ margin: 0 0 12px 0; font-weight: 400; letter-spacing: -0.02em; }
.spacer p{ margin: 0; color: var(--muted); line-height: 1.6; }

/* Contact Section */
.contact-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 32px;
}

.contact-form-wrapper {
  background: rgba(15,23,42,.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
}

.contact-info {
  /* Removed box styling for cleaner look */
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.contact-intro {
  text-align: left;
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
}

@media (min-width: 768px) {
  /* Contact grid layout adjustments if needed */
  .contact-grid {
     flex-direction: row;
     align-items: flex-start;
     justify-content: space-between;
     gap: 64px;
  }
  .contact-left-column {
    flex: 1;
    text-align: left;
    max-width: none;
  }
  .contact-form-wrapper {
    flex: 1;
    width: auto !important; /* Override inline style */
  }
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0 0;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Default boxed list items */
.contact-list li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  transition: box-shadow 0.2s;
}
.contact-list li:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Clean variant (no box) */
.contact-list.contact-list--clean li {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4px 0;
  text-align: left;
}
.contact-list.contact-list--clean li:hover {
  box-shadow: none;
  background: transparent;
}
.contact-list.contact-list--clean a, 
.contact-list.contact-list--clean .contact-item-text {
  justify-content: flex-start; /* Left align the icon and text */
}

.contact-list a, .contact-item-text {
  color: var(--fg);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--fg);
}

.social-links {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(15,23,42,.03);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: all 0.2s;
}
.social-links a:hover {
  background: #fff;
  border-color: var(--fg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.icon-social {
  width: 22px;
  height: 22px;
}

/* Form */
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}


/* Pills */
.pill{
  display:inline-flex;
  align-items:center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.88);
  font-size: 12px;
}
.pill--muted{ color: var(--muted); }

/* ===== Sezione pinned orizzontale ===== */
.hscroll{
  /* l'altezza viene calcolata via JS per creare lo “spazio” di scroll */
  position: relative;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hscroll__sticky{
  position: sticky;
  top: var(--topbarH);
  height: calc(100vh - var(--topbarH));
  height: calc(100dvh - var(--topbarH));
  overflow: hidden; /* importante: nascondi overflow mentre trasliamo */
  background: var(--bg);
}

.hscroll__head{
  padding: 72px var(--pad) 10px var(--pad);
  width: 100%;
}
.hscroll__head-inner{
  max-width: 1200px;
  margin: 0;
  text-align: left;
}
.hscroll__head h2{
  margin: 0 0 12px 0;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.hscroll__head p{
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

/* La rail è una riga orizzontale che trasliamo in X */
.hscroll__rail{
  display: flex;
  gap: 0; /* Removing gap to handle spacing via margins manually for robustness */
  padding: 16px 0 40px var(--pad);
  height: calc(100% - 86px);
  align-items: center;

  will-change: transform;
  transform: translate3d(0,0,0);
}

/* Spacer logic via margins - Most robust cross-browser method */
.hscroll__rail > * {
  margin-right: var(--gap);
}

/* The last element has NO margin, the spacer handles the end padding */
.hscroll__rail > :last-child {
  margin-right: 0;
}

/* Explicit spacer to ensure scrollWidth captures the end space cross-browser */
.hscroll__rail::after {
  content: "";
  display: block;
  flex: 0 0 var(--pad);
  width: var(--pad);
  height: 1px;
}

/* Card */
.card{
  flex: 0 0 var(--cardW);
  height: var(--cardH);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(15,23,42,.03);
  padding: 4vw; /* Responsive padding */
  box-shadow: 0 0 0 rgba(0,0,0,0);
  
  /* Center content for single-view impact */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease;
}

/* Base resets for cross-browser consistency */
img {
  max-width: 100%;
  height: auto;
  display: block;
}
input, button, textarea, select {
  font: inherit;
}

.card__meta{
  display:flex;
  gap:10px;
  margin-bottom: 24px; /* More breathing room */
}
.card h3{
  margin: 0 0 16px 0;
  font-size: clamp(32px, 5vw, 64px); /* Larger titles */
  letter-spacing: -0.02em;
}
.card p{
  margin: 0 0 32px 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 50ch; /* Narrower reading line for elegance */
  font-size: clamp(16px, 1.2vw, 20px);
}
.link{
  font-size: 18px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid rgba(15,23,42,.25);
  padding-bottom: 2px;
}

/* Footer */
.footer{
  border-top: 1px solid var(--line);
  padding: 36px var(--pad);
}
.footer__inner{ max-width: 1200px; margin: 0 auto; color: var(--muted); text-align: center; }

/* Overlay */
.overlay[hidden]{
  display: block; /* Override default display:none to allow transitions */
  visibility: hidden;
  pointer-events: none;
}
.overlay{ position: fixed; inset: 0; z-index: 60; }
.overlay__backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(12px);
}
.overlay__panel{
  position:absolute;
  top: 0;
  right: 0;
  width: 100%; /* Full width on mobile/desktop or just large panel */
  max-width: 680px;
  height: 100vh; /* Full height */
  background:#fff;
  border-left: 1px solid rgba(0,0,0,.05); /* Very subtle border only on left */
  box-shadow: none; /* No shadow */
  padding: 40px var(--pad);
  display: flex;
  flex-direction: column;
}
.overlay__head{
  display:flex;
  align-items:center;
  justify-content: flex-end; /* Align close button to right */
  padding-bottom: 40px;
  min-height: var(--topbarH);
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: flex-start; /* Align text left */
  justify-content: center;
  flex: 1; /* Take available space */
}
.menu-link {
  font-size: 32px; /* Smaller font (was 48px) */
  text-decoration: none;
  color: var(--fg);
  font-weight: 400;
  transition: opacity 0.2s;
  letter-spacing: -0.02em;
}
.menu-link:hover {
  opacity: 0.6;
}

/* ===== Language Switcher ===== */
.lang-switch {
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.lang-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.3s ease;
}
.lang-btn:hover,
.lang-btn.active {
  color: var(--fg);
}
.lang-sep {
  opacity: 0.3;
}

/* Mobile adjustments for huge menu */
@media (max-width: 767px) {
  .menu-link {
    font-size: 24px; /* Smaller mobile font (was 32px) */
  }
  .overlay__panel {
    width: calc(100vw - (var(--pad) * 2));
    padding: 24px;
  }
}

/* Reduced motion: niente “smooth” (ma funziona uguale) */
@media (prefers-reduced-motion: reduce){
  .hscroll__rail{ will-change: auto; }
  .reveal { transition: none !important; opacity: 1 !important; transform: none !important; }
}

/* ===== Animazioni Extra ===== */

/* 1. Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  will-change: opacity, transform;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* 2. Card Hover */
.card {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease;
}
.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  border-color: var(--fg);
}

/* 3. Overlay Animation */
.overlay {
  display: block;
  pointer-events: none;
  transition: visibility 0s 0.4s; /* delay visibility toggle */
  visibility: hidden;
}

.overlay:not(.open) .overlay__backdrop {
  opacity: 0;
}
.overlay:not(.open) .overlay__panel {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
}

.overlay.open {
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s 0s;
}

.overlay__backdrop {
  transition: opacity 0.4s ease;
}
.overlay__panel {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Service Section Styles ===== */
.service-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  font-size: clamp(15px, 1.1vw, 18px);
  line-height: 1.5;
  color: var(--muted);
  width: 100%;
}
.service-list li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 4px;
}
.service-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--fg);
}
.service-ideal {
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  width: 100%;
}

/* ===== Servizi Section Overrides ===== */
#servizi {
  /* Cards much smaller to allow multiple items in view */
  --cardW: 360px;
  --cardH: auto; /* Let content dictate height instead of stretching */
}

#servizi .card {
  aspect-ratio: 9/12; /* A nice vertical rectangular shape */
  justify-content: flex-start; /* Align content to top */
  padding: 24px;
  background: #ffffff; /* White background for better contrast */
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

#servizi .card h3 {
  /* Adjust title size for narrower cards */
  font-size: 22px;
  line-height: 1.2;
  margin-bottom: 12px;
}

@media (max-width: 768px) {
  #servizi {
    --cardW: 85vw; /* On mobile, keep them readable */
    --cardH: auto;
  }
  #servizi .card {
    width: var(--cardW);
    min-height: 420px; /* Uniform height for all cards on mobile */
    height: auto; /* Allow expansion */
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  /* Ensure alignment on mobile */
  .hscroll__rail {
    align-items: stretch; /* Stretch all cards to the height of the tallest one */
  }
}

/* ===== Progetti Section Overrides ===== */
#progetti {
  --cardW: 420px; /* Smaller width for projects */
  --cardH: auto;
}

#progetti .card {
  aspect-ratio: 3/4; /* Vertical rectangular shape */
  padding: 32px;
  justify-content: space-between; /* Distribute content */
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

#progetti .card h3 {
  font-size: 32px; /* Adjusted for smaller card */
  margin-bottom: 16px;
}

#progetti .card p {
  font-size: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  #progetti {
    --cardW: 85vw;
    --cardH: auto;
  }
  #progetti .card {
    width: var(--cardW);
    min-height: 420px; /* Uniform height for all cards on mobile */
    height: auto;
    aspect-ratio: auto;
  }
}

/* ===== Toolkit Section ===== */
.toolkit-section {
  padding: 100px var(--pad);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}
.toolkit-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: left;
}
.toolkit-inner h2 {
  font-size: clamp(32px, 4vw, 48px);
  margin: 0 0 16px 0;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.toolkit-desc {
  font-size: 18px;
  color: var(--muted);
  max-width: 600px;
  margin: 0 0 48px 0;
  line-height: 1.6;
}

.logo-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}

.tool-item {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.tool-name {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.tool-name::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid rgba(0, 0, 0, 0.8);
}

.tool-item:hover .tool-name {
  opacity: 1;
  visibility: visible;
  bottom: -45px;
}

.tool-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  border-color: var(--fg);
}

.tool-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: grayscale(0%);
  opacity: 1;
  transition: all 0.3s;
}
.tool-item:hover .tool-logo {
  filter: grayscale(0%);
  opacity: 1;
}

/* Placeholder style when no image is present */
.tool-placeholder {
  color: var(--line);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  text-align: center;
}

/* Toolkit Staggered Animation */
@media (max-width: 768px) {
  .toolkit-section {
    padding: 60px var(--pad);
  }
  .logo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  .tool-item {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    padding: 12px;
    border-radius: 16px;
  }
  
  /* Mobile Tooltips: Hidden by default, visible on click (.active-tooltip) */
  .tool-item .tool-name {
    opacity: 0;
    visibility: hidden;
    font-size: 9px;
    padding: 4px 6px;
    width: max-content;
    max-width: 150%;
    pointer-events: none;
    transition: all 0.2s ease;
  }
  
  .tool-item.active-tooltip .tool-name {
    opacity: 1;
    visibility: visible;
  }
  
  /* Tooltips Position - Unified Below for Mobile */
  /* Ensure active item is on top of others (z-index fix for stacking context) */
  .tool-item.active-tooltip {
    z-index: 100;
  }

  /* All Tooltips Below */
  .tool-item .tool-name {
    top: auto;
    bottom: -32px;
  }
  
  .tool-item.active-tooltip .tool-name {
    bottom: -36px; /* Slight drop animation */
  }

  /* Ensure arrow points up (default behavior, but ensuring no overrides) */
  .tool-item .tool-name::before {
    top: -4px;
    bottom: auto;
    border-bottom: 4px solid rgba(0, 0, 0, 0.8);
    border-top: none;
  }
}

@keyframes fadeUpLogos {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo-grid .tool-item.reveal {
  opacity: 0;
  transform: translateY(30px);
}

.logo-grid .tool-item.reveal.active {
  opacity: 1;
  transform: translateY(0);
  animation: fadeUpLogos 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ensure hover works after animation */
.logo-grid .tool-item.reveal.active:hover {
  transform: translateY(-5px);
}

/* Stagger Delays */
.logo-grid .tool-item:nth-child(1) { animation-delay: 0.1s; }
.logo-grid .tool-item:nth-child(2) { animation-delay: 0.2s; }
.logo-grid .tool-item:nth-child(3) { animation-delay: 0.3s; }
.logo-grid .tool-item:nth-child(4) { animation-delay: 0.4s; }
.logo-grid .tool-item:nth-child(5) { animation-delay: 0.5s; }
.logo-grid .tool-item:nth-child(6) { animation-delay: 0.6s; }

/* ===== MOBILE RESIZING & LAYOUT FIXES ===== */
@media (max-width: 767px) {
  /* 1. Horizontal Scroll Adjustments for Mobile */
  /* We revert to horizontal scroll but adjust sizes for better fit */
  
  .hscroll__head {
    padding-bottom: 10px;
  }

  .hscroll__rail {
    /* Restore horizontal layout padding */
    padding: 0 0 40px var(--pad);
  }

  /* 2. Responsive Card Sizing for Horizontal Scroll */
  #servizi .card,
  #progetti .card {
    /* Make cards responsive but keep them in horizontal rail */
    width: 85vw;
    max-width: 360px;
    flex: 0 0 auto;
    /* Height is controlled by rail/sticky container */
    padding: 24px;
    aspect-ratio: auto;
  }
  
  /* 3. Shop Grid - Ensure single column on small screens */
  .product-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .shop-product-section {
    padding: 24px var(--pad);
  }
  
  .shop-title {
    margin-bottom: 32px;
    font-size: 32px;
  }

  /* 4. General Fluidity Improvements */
  .spacer {
    padding: 40px var(--pad);
  }
  
  /* FIX FOR ABOUT SECTION: Remove forced breaks and ensure full width flow */
  .spacer p br {
    display: none;
  }
  .spacer p {
    width: 100%;
  }
  
  .card h3 {
    font-size: 24px;
  }
  
  .project-title {
    font-size: 32px;
  }
}
.logo-grid .tool-item:nth-child(7) { animation-delay: 0.7s; }

/* ===== CV Download Section ===== */
/* CV Button - Clean Implementation */
.cv-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 60px;
  height: 60px;
  border: 2px solid #000000;
  border-radius: 50px;
  background-color: transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition-duration: 0.4s;
  box-shadow: 0 0 0 0 transparent;
  text-decoration: none;
  padding: 0;
  margin: 0;
}

.cv-btn:hover {
  width: 290px;
  background-color: #000000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.cv-icon-wrapper {
  width: 50px;
  height: 50px;
  background-color: #000000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 3px;
  transition: all 0.4s;
  flex-shrink: 0;
  z-index: 2;
}

.cv-btn:hover .cv-icon-wrapper {
  background-color: #ffffff;
  transform: rotate(360deg);
}

.cv-icon {
  width: 24px;
  height: 24px;
  color: #ffffff;
  transition: all 0.4s;
}

.cv-btn:hover .cv-icon {
  color: #000000;
}

.cv-text {
  position: absolute;
  left: 65px;
  color: #ffffff;
  font-weight: 600;
  font-size: 17px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  transition-delay: 0.1s;
}

.cv-btn:hover .cv-text {
  opacity: 1;
  visibility: visible;
}
/* SHOP STYLES */
.shop-product-section {
  display: block;
  min-height: calc(100vh - var(--topbarH));
  padding: 40px var(--pad);
  background-color: var(--bg);
}

.shop-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.shop-title {
  font-size: 56px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 48px 0;
  color: var(--fg);
  text-align: left;
  line-height: 1.05;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 32px;
  justify-items: center;
}

@media (max-width: 767px) {
  .shop-title {
    font-size: clamp(28px, 6vw, 32px);
  }
}

.product-card {
  width: 100%;
  max-width: 340px;
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15,23,42,.03);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease;
}

.product-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 32px rgba(0,0,0,0.06);
  border-color: var(--fg);
}

.product-status {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.product-image-container {
  width: 100%;
  margin: 16px 0 24px;
  display: flex;
  justify-content: center;
}

.product-image {
  max-width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
}

.product-info h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px 0;
}

.product-info p {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0 0 24px 0;
  color: var(--fg);
}

/* Slider Styles */
.product-slider {
  position: relative;
  width: 100%;
  margin: 16px 0 24px;
  overflow: hidden;
}

.product-slider-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  scroll-behavior: smooth;
}
.product-slider-track::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.product-slider-track .product-image-link {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: center;
  display: block;
}

.product-slider-track .product-image {
  width: 100%;
  height: 100%; /* Ensure it fills the link */
  object-fit: contain;
  display: block;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.product-card:hover .slider-btn {
  opacity: 1;
}

.slider-btn:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.1);
}

.slider-btn.prev { left: 10px; }
.slider-btn.next { right: 10px; }

/* Existing dots styles check */
.product-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  transition: background 0.2s;
}
.dot.active {
  background: var(--fg);
}

.shop-btn,
.dm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: var(--fg);
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
  cursor: pointer;
  border: none;
}

.shop-btn:hover,
.dm-button:hover {
  opacity: 0.9;
}

/* ===== Project Page Styles ===== */
.project-detail {
  padding-top: 120px;
  padding-bottom: 80px;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.project-header {
  margin-bottom: 60px;
}

.project-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.project-title {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.1;
  margin-bottom: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--fg);
}

/* Grid Layout for Content */
.project-content-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.project-description {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 800px;
  white-space: pre-line;
}

.project-gallery-container {
    position: relative;
    width: 100%;
}

.project-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0; /* No gap because items are 100% */
  scrollbar-width: none; /* Firefox */
  border-radius: var(--radius);
}
.project-gallery::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start; /* Align to start/left */
  scroll-snap-stop: always;
  display: flex;
  justify-content: flex-start; /* Align image to left */
}

.gallery-item img {
  width: auto; /* Natural width */
  max-width: 100%; /* Limit to container */
  height: auto;
  max-height: 60vh;
  display: block;
  border-radius: var(--radius);
  /* background-color: rgba(15,23,42,.03); REMOVED */
  object-fit: cover; /* Default for photos */
  cursor: pointer;
  transition: transform 0.3s ease;
}

/* Specific overrides can be handled if needed, but width: auto usually fixes the "grey bar" issue */
.project-gallery img:hover,
  .gallery-item img:hover {
    transform: none;
  }

/* Dots for Project Gallery */
.project-dots {
  display: flex;
  justify-content: flex-start; /* Align dots to left (title) */
  gap: 8px;
  margin-top: 16px;
  padding-bottom: 8px;
}
.project-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  transition: background 0.2s;
  cursor: pointer;
}
.project-dots .dot.active {
  background: var(--fg);
}

@media (min-width: 768px) {
  /* Remove side-by-side grid, stack everything as requested */
  .project-content-grid {
    display: flex;
    flex-direction: column;
    gap: 60px;
  }
  
  .project-gallery {
    margin-bottom: 0;
  }

  .project-gallery .gallery-item img {
     max-height: 70vh;
  }
  /* Product Gallery specific styles */
  .project-gallery.gallery-product .gallery-item img {
      object-fit: contain;
  }
  
  /* Reset sticky behavior since it's now stacked */
  .project-description {
    position: static;
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
  padding: 40px;
}
.lightbox.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: scale(0.95);
  transition: transform 0.3s ease;
  border-radius: var(--radius); /* Rounded corners for lightbox image too */
}
.lightbox.active img {
  transform: scale(1);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  line-height: 1;
  padding: 10px;
  z-index: 1001;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
  text-decoration: none;
  color: var(--fg);
  font-size: 0.9rem;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}
.back-link:hover {
  opacity: 1;
}

/* Removed grid layout overrides since we use flex slider now */
@media (min-width: 768px) {
  /* Keep empty or add specific desktop adjustments if needed */
}
/* Project Card Backgrounds */
.card--project {
  position: relative;
  z-index: 1;
  overflow: hidden;
  color: #fff; /* White text for contrast */
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  background: #000; /* Fallback */
  border: none; /* Remove border if image is there */
}
.card--project p {
  color: rgba(255,255,255,0.9); /* Override muted color */
}
.card--project .link {
  color: #fff;
  border-bottom-color: rgba(255,255,255,0.5);
}
.card--project .pill {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  backdrop-filter: blur(4px);
}
.card--project::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  z-index: -2;
  transition: transform 0.6s ease;
}
.card--project::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4); /* Dark overlay */
  z-index: -1;
  transition: background 0.3s;
}

/* Hover effects */
.card--project:hover::before {
  transform: scale(1.05); /* Zoom in slightly */
}
.card--project:hover::after {
  background: rgba(0,0,0,0.3); /* Lighten slightly on hover */
}

/* Specific Project Overrides */
.card--nicare::before {
  filter: grayscale(100%);
}
.card--nicare::after {
  background: rgba(0,0,0,0.5); /* Slightly darker overlay for better text contrast */
}
