/* ==========================================================
   NautiFix — garage digitale: schede barca, immagine, scheda
   della barca e registrazione guidata. Mobile first.
   ========================================================== */

/* ---------- Immagine della barca (BoatVisual) ---------- */
.bv {
  position: relative; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(120% 100% at 50% 0%, #fffdf9 0%, #f3ede1 60%, #e8dfcf 100%);
}
.bv::after { /* linea d'acqua stilizzata sotto le sagome */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22%;
  background: linear-gradient(180deg, rgba(12, 26, 43, 0) 0%, rgba(12, 26, 43, .07) 100%); pointer-events: none;
}
.bv-img { display: block; max-width: 100%; position: relative; z-index: 1; }
.bv-img.is-photo { width: 100%; height: 100%; object-fit: cover; }
.bv-img.is-render, .bv-img.is-art { width: 82%; height: 78%; object-fit: contain; filter: drop-shadow(0 12px 14px rgba(12, 26, 43, .16)); }
.bv:has(.is-photo)::after { display: none; }
.bv-card { aspect-ratio: 16 / 9; }
.bv-hero { aspect-ratio: 16 / 9; border-radius: 22px; }
.bv-thumb { aspect-ratio: 16 / 10; }

/* ---------- Testi "da garage" ---------- */
.garage-make { margin: 0; font-size: .7rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--teal-dark); }
.garage-model { margin: 2px 0 6px; font-family: var(--font-display); font-weight: 500; font-size: 1.85rem; line-height: 1.05; color: var(--navy); letter-spacing: -.01em; overflow-wrap: anywhere; }
.garage-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip-tag { display: inline-block; padding: .32em .85em; border-radius: 99px; font-size: .74rem; font-weight: 500; letter-spacing: .02em; background: var(--navy); color: var(--c-on-dark); }
.chip-tag.soft { background: var(--sky-soft); color: var(--blue); }
.garage-facts { margin: 4px 0 0; font-weight: 500; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.garage-port { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.garage-port .ico { color: var(--c-gold-ink); }
.garage-engines { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--c-ivory); border: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.garage-engines strong { color: var(--navy); font-weight: 600; }
.garage-engines span { color: var(--teal-dark); font-weight: 600; font-size: .9rem; }
.garage-nickname-line { margin: 0 0 4px; font-style: italic; color: var(--muted); }
.garage-complete {
  display: block; width: 100%; margin-top: 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed #d9c39b;
  background: var(--c-gold-soft); color: var(--c-warn); font: inherit; font-weight: 500; font-size: .9rem; text-align: left; cursor: pointer;
}

/* ---------- Scheda della barca nel garage ---------- */
.garage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.garage-head h1 { margin: 0; font-size: clamp(2.2rem, 4vw, 3rem); line-height: 1.05; }
.garage-head p { margin: 2px 0 0; }
.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 20px; }
.garage-card { background: var(--c-paper); border-radius: 22px; overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.garage-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.garage-visual { position: relative; display: block; }
.garage-nickname {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; padding: .35em .9em; border-radius: 99px;
  background: rgba(12, 26, 43, .86); color: var(--c-on-dark); font-family: var(--font-display); font-style: italic; font-size: 1rem; backdrop-filter: blur(6px);
}
.garage-body { padding: 16px 18px 18px; display: flex; flex-direction: column; }
.garage-body > .btn-block { margin-top: 14px; min-height: 48px; }
.garage-links { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 10px; }
.garage-links a, .garage-links .btn-link {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px; border-radius: 12px;
  background: var(--c-ivory); border: 1px solid var(--line); color: var(--navy); font-weight: 500; font-size: .88rem; text-decoration: none;
}
/* Versione compatta (dashboard): scorrimento orizzontale su telefono */
.garage-strip { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
.garage-card.compact { flex: 0 0 min(260px, 78vw); scroll-snap-align: start; box-shadow: none; }
.garage-card.compact .garage-body { padding: 12px 14px 14px; }
.garage-card.compact .garage-model { font-size: 1.15rem; }
.garage-card.compact .garage-engines { padding: 8px 10px; font-size: .88rem; }

/* ---------- Pagina della barca ---------- */
.boat-page-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; background: var(--c-paper); border: 1px solid var(--line); border-radius: 26px; padding: 18px; }
.boat-page-txt .garage-model { font-size: clamp(2.2rem, 3.6vw, 3rem); }
.boat-page-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.boat-page-actions .btn { min-height: 48px; }
.panel.soon { text-align: center; padding: 34px 22px; }
.panel.soon h2 { margin-bottom: 6px; }
.danger-zone { text-align: center; margin: 24px 0 8px; }
.danger-zone .btn-link { min-height: 44px; }

/* ---------- Registrazione guidata ---------- */
.wizard {
  padding: 0; border: 0; width: min(640px, 100%); max-width: 100%; max-height: min(92vh, 900px);
  border-radius: 28px; box-shadow: var(--shadow-lg); background: var(--c-paper); overflow: hidden;
}
.wizard::backdrop { background: rgba(8, 17, 29, .6); backdrop-filter: blur(6px); }
.wz-shell { display: flex; flex-direction: column; height: min(92vh, 900px); }
.wz-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.wz-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: var(--c-paper); color: var(--navy); cursor: pointer; }
.wz-icon[hidden] { display: block !important; visibility: hidden; }
.wz-progress { flex: 1; height: 3px; border-radius: 99px; background: var(--line); overflow: hidden; }
.wz-progress span { display: block; height: 100%; width: 0; background: var(--c-gold-ink); border-radius: inherit; transition: width .3s ease; }
.wz-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; -webkit-overflow-scrolling: touch; }
.wz-body h2 { font-size: 2rem; line-height: 1.1; margin: 0 0 16px; }
.wz-step { margin: 0 0 6px; font-size: .7rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--teal-dark); }
.wz-sub { margin: -8px 0 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; }
.wz-foot { border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--c-paper); }
.wz-foot .form-msg { margin: 0 0 6px; font-size: .9rem; }
.wz-foot .form-msg:empty { display: none; }
.wz-actions { display: flex; gap: 10px; }
.wz-actions .btn { min-height: 52px; font-size: 1rem; }
.wz-actions [data-wz="next"] { flex: 1; }
.wz-actions [data-wz="skip"][hidden] { display: none; }

.wz-input {
  width: 100%; min-height: 52px; padding: .8em 1em; border: 1px solid var(--c-line-strong); border-radius: 12px;
  font: inherit; font-size: 16px; /* evita lo zoom automatico su iPhone */ background: var(--c-paper); color: var(--ink);
}
textarea.wz-input { min-height: 96px; }
.wz-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(201, 169, 110, .35); }
.wz-label { display: grid; gap: 8px; font-weight: 500; font-size: .92rem; color: var(--ink); margin-bottom: 14px; }
.opt-tag { font-weight: 600; font-size: .75rem; color: var(--muted); }
.wz-hint { color: var(--muted); font-size: .9rem; margin: 8px 0; }
.wz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.wz-grid .wz-span { grid-column: 1 / -1; }
.wz-label .wz-mini { justify-self: start; margin-top: 2px; font-size: .84rem; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: -3px; margin-right: 6px; }

/* Tipologia */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 14px; min-height: 112px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--c-paper); font: inherit; font-weight: 500; font-size: .9rem; color: var(--ink); cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.cat-tile:hover { border-color: var(--c-line-strong); }
.cat-tile img { width: 100%; max-width: 140px; height: 54px; object-fit: contain; }
.cat-tile.on, .cat-row.on { border-color: var(--navy); background: var(--c-gold-soft); color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.wz-more {
  display: block; width: 100%; min-height: 48px; margin: 14px 0 10px; border: 0; border-radius: 14px;
  background: var(--c-ivory); border: 1px solid var(--line); color: var(--navy); font: inherit; font-weight: 500; cursor: pointer;
}
.cat-all { margin-top: 10px; }
.cat-group { margin: 18px 0 8px; font-size: .7rem; letter-spacing: .2em; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.cat-list { display: grid; gap: 8px; }
.cat-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 56px; padding: 8px 14px; text-align: left; border: 1px solid var(--line); border-radius: 12px;
  background: var(--c-paper); font: inherit; font-weight: 500; color: var(--ink); cursor: pointer;
}
.cat-row img { width: 88px; height: 36px; object-fit: contain; flex: none; }
.wz-chosen { margin: 10px 0 0; }

/* Ricerca cantiere/modello */
.wz-results { display: grid; gap: 8px; margin-top: 10px; }
.wz-result {
  display: grid; gap: 2px; text-align: left; min-height: 56px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--c-paper); font: inherit; color: var(--ink); cursor: pointer;
}
.wz-result strong { font-size: 1.02rem; font-weight: 600; color: var(--navy); }
.wz-result small { color: var(--muted); }
.wz-manual {
  display: block; width: 100%; margin-top: 14px; min-height: 52px; padding: 10px 14px; border: 1px dashed var(--c-line-strong);
  border-radius: 12px; background: transparent; font: inherit; color: var(--muted); text-align: left; cursor: pointer;
}
.wz-manual strong { color: var(--navy); font-weight: 600; }
.wz-manual.subtle { border: 0; padding-left: 0; }
.wz-picked {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-radius: 16px;
  background: var(--c-gold-soft); border: 1px solid #d9c39b;
}
.wz-picked span { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .18em; color: var(--teal-dark); width: 100%; }
.wz-picked strong { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; color: var(--navy); flex: 1; }

/* Dati del modello, scelte, classificazione */
.wz-model-card { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; padding-bottom: 12px; margin-bottom: 14px; }
.wz-model-card .bv { margin-bottom: 12px; }
.wz-model-card > :not(.bv) { margin-left: 16px; margin-right: 16px; }
.wz-alert { padding: 16px; border-radius: 16px; background: var(--c-gold-soft); border: 1px solid #d9c39b; margin-bottom: 14px; }
.wz-alert p { margin: 0 0 10px; }
.wz-choice { display: grid; gap: 8px; }
.wz-choice .opt, .opt-card {
  display: grid; gap: 2px; text-align: left; min-height: 56px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--c-paper); font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
}
.wz-choice .opt small, .opt-card small { font-weight: 500; color: var(--muted); }
.wz-choice .opt.on, .opt-card.on { border-color: var(--navy); background: var(--c-gold-soft); box-shadow: inset 0 0 0 1px var(--navy); }
.wz-options { display: grid; gap: 10px; }
.badge-sug { display: inline-block; margin-left: 6px; padding: .1em .6em; border-radius: 99px; background: var(--sky-soft); color: var(--blue); font-size: .72rem; vertical-align: 2px; }

/* Motori */
.engine-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 14px 16px; border-radius: 16px; background: var(--navy); color: var(--c-on-dark); margin-bottom: 12px; }
.engine-summary strong { font-family: var(--font-display); font-weight: 500; font-size: 1.45rem; }
.engine-summary span { color: var(--c-gold); font-weight: 500; }
.engine-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.engine-row strong { display: block; color: var(--navy); }
.engine-row small { color: var(--muted); }
.engine-pos { display: block; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .18em; color: var(--teal-dark); margin: 0 0 2px; }
.engine-actions { display: flex; gap: 14px; align-items: center; }
.engine-actions .btn-link { min-height: 44px; }
.engine-form { border: 1px solid var(--c-line-strong); border-radius: 18px; padding: 16px; margin: 12px 0; background: var(--c-ivory); }
.engine-form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.engine-form-actions .btn { min-height: 44px; }

/* Foto e riepilogo */
.wz-photo .bv { margin-bottom: 14px; }
.wz-file { min-height: 52px; cursor: pointer; }
.wz-photo .btn-link { display: block; margin: 10px auto 0; min-height: 44px; }
.garage-hero { text-align: center; margin-bottom: 14px; }
.garage-hero .bv { margin: 10px 0 12px; }
.garage-hero .garage-chips { justify-content: center; }
.garage-hero .garage-engines { justify-content: center; }
.wz-summary { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.wz-summary li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label action" "value action"; gap: 0 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wz-summary li > span { grid-area: label; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.wz-summary li > strong { grid-area: value; color: var(--ink); overflow-wrap: anywhere; }
.wz-summary li > .btn-link { grid-area: action; min-height: 44px; }

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .wz-choice { grid-template-columns: 1fr 1fr; }
  .wz-options { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .boat-page-hero { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .boat-page-txt { padding: 0 6px 6px; }
  .boat-page-txt .garage-model { font-size: 2.1rem; }
  .boat-page-actions .btn { flex: 1; }
}
@media (max-width: 600px) {
  /* Registrazione a schermo intero, come un'app */
  .wizard { width: 100%; height: 100%; max-height: none; border-radius: 0; margin: 0; }
  .wz-shell { height: 100dvh; }
  .wz-grid { grid-template-columns: 1fr; }
  .garage-head h1 { font-size: 2.2rem; }
  .garage-head .btn { width: 100%; min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .wz-progress span { transition: none; }
}
