/* Reset + box model coerente */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f8f8f8;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 10px 70px 10px;
}

.main-title {
  text-align: center;
  font-family: Arial, Times, serif;
  font-size: 25pt;
  font-weight: bold;
  margin: 100px 0 30px 0;
}

.th-title {
  text-align: center;
  font-family: Arial, Times, serif;
  font-size: 60px;
  font-weight: bold;
  
}


.subtitle {
  text-align: center;
  font-family: "Times New Roman", Times, serif;
  font-size: 18pt;
  color: blue;
  margin: 25px 0 50px 0;
}

.cards-count{
  text-align: center;
  margin: 12px 0 35px 0;
  font-family: Tahoma, Times, serif;
  font-size: 18pt;
  font-weight: bold;
  color: #111;
}

.main-image {
  display: block;
  margin: 3rem auto 30px auto;
  width: 80%;
  max-width: 600px;
  height: auto;
}

/* GRIGLIA: 3 colonne desktop */
.cards {
  display: grid;
  gap: 32px;
  justify-content: center;
  grid-template-columns: repeat(3, 340px);
}

.nissanred {
  font-family: Arial black;
  color: red;
  font-size: 60px;
 
}

.searchbar{
  margin: 10px 0 26px 0;
  padding: 14px 14px;
  border: 2px solid #111;
  border-radius: 14px;
  background: #fff;
}

.search-label{
  display: block;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 8px;
}

.search-input{
  width: 100%;
  padding: 12px 12px;
  font-size: 16px;
  border: 2px solid #c4c4c4;
  border-radius: 10px;
  outline: none;
}

.search-input:focus{
  border-color: #111;
}

.search-hint{
  margin-top: 8px;
  font-size: 13px;
  color: #444;
}

/* CARD */
.card {
  background: #fff;
  border: 4px solid #111;
  border-radius: 16px;
  padding: 24px 20px 16px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);

  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Immagine “singola” (card senza galleria) */
.card > img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: 8px;
  background: #eee;
  margin-bottom: 16px;
  border: 2px solid #c4c4c4;
}

/* Testi */
.card .label {
  font-size: 20px;
  font-weight: bold;
  text-align: left;
  width: 100%;
  margin-bottom: 0;
  color: #222;
}

.card .code,
.card .desc {
  font-size: 18px;
  text-align: left;
  width: 100%;
  margin-bottom: 10px;
  color: #2c2c2c;
}

.card .fontsize {
  font-size: 14px;
  text-align: left;
  width: 100%;
  margin-bottom: 10px;
  color: #2c2c2c;
}

.card hr {
  width: 100%;
  border: 0;
  border-top: 2px solid #bbb;
  margin: 10px 0;
}

/* BACKLINKS */
.backlinks {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  margin-bottom: 0;
}

.backlinks a {
  font-family: "Times New Roman", Times, serif;
  color: #111;
  font-size: 27px;
  font-weight: bold;
  text-decoration: none;
  margin: 0 22px;
  transition: color 0.15s;
}

.backlinks a:hover {
  color: #4682B4;
  text-decoration: underline;
}

/* HOVER/ZOOM hint */
img.zoomable {
  cursor: zoom-in;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

img.zoomable:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* OVERLAY */
.image-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.image-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.image-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
  cursor: zoom-out;
}

/* Frecce overlay */
.image-overlay .overlay-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: rgba(0,0,0,0.35);
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.image-overlay .overlay-nav.prev { left: 18px; }
.image-overlay .overlay-nav.next { right: 18px; }

.image-overlay .overlay-nav:hover {
  background: rgba(0,0,0,0.55);
}

/* PREZZI */
.price {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.old-price {
  color: #c00000;
  text-decoration: line-through;
  font-size: 20px;
  font-weight: 700;
  opacity: 0.85;
}

.new-price {
  color: #0a8a0a;
  font-size: 22px;
  font-weight: 800;
}

/* =========================
   GALLERIA (desktop/tablet)
   ========================= */
.gallery {
  width: 100%;
  position: relative;
}

/* Immagine principale in galleria (miniatura) */
.gallery .main-photo {
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: 8px;
  background: #eee;
  border: 2px solid #c4c4c4;
  margin-bottom: 16px;
  cursor: zoom-in;
  display: block;
}

/* NASCONDI SEMPRE le altre immagini */
.thumbs {
  display: none !important;
}

/* Contatore sopra la miniatura (non deve andare nel testo) */
.gallery .counter {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  z-index: 2;
  pointer-events: none;
  display: inline-block;
}


/* TABLET: 2 colonne */
@media (max-width: 1024px) {
  .container { padding: 20px 2vw 60px 2vw; }
  .main-title { font-size: 28pt; }
  .cards {
    gap: 16px;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

/* MOBILE: 1 colonna + layout compatto */
@media (max-width: 600px) {
  .main-image { width: 99%; max-width: 99vw; height: auto; }
  .main-title { font-size: 17pt; }
  .nissanred { font-size: 30pt; font-family: Arial black; }
  .subtitle { font-size: 13pt; }

  /* Mobile: un po’ più compatto */
  .searchbar { padding: 12px; }
  .search-label { font-size: 14px; }
  .search-hint { font-size: 12px; }

  .cards { gap: 8px; grid-template-columns: 1fr; }
  .card { padding: 7px 2vw 10px 2vw; }

  .card .fontsize {
    font-size: 14px;
    text-align: left;
    width: 100%;
    margin-bottom: 10px;
    color: #2c2c2c;
  }

  .cards-count {
    text-align: center;
    margin: 12px 0 35px 0;
    font-family: Tahoma, Times, serif;
    font-size: 14pt;
    font-weight: bold;
    color: #111;
  }

  .backlinks { flex-direction: column; gap: 10px; align-items: center; }
  .backlinks a { font-size: 19px; }

  .thumbs { display: none !important; }
}