:root {
  --cutstom-rust: #9f4726;
  --cutstom-rust-dark: #692b1b;
  --cutstom-ink: #211914;
  --cutstom-muted: #776b63;
  --cutstom-line: #e7ddd6;
  --cutstom-paper: #fffdfb;
  --cutstom-soft: #f7f2ee;
}

/* Nelle schede configurabili l'anteprima generata sostituisce la classica
   fotografia prodotto. La miniatura resta disponibile in catalogo e ricerca. */
body.cutstom-corten-page .page-header {
  display: none !important;
}

body.cutstom-corten-page #content-wrap {
  padding-top: 6px !important;
}

.single-product div.product.cutstom-corten-product .woocommerce-product-gallery {
  display: none !important;
}

.single-product div.product.cutstom-corten-product .summary {
  float: none !important;
  clear: both;
  width: 100% !important;
  margin-left: 0 !important;
  margin-bottom: 0 !important;
}

.single-product div.product.cutstom-corten-product form.cart {
  display: grid !important;
  width: 100%;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: .75rem;
}

.single-product div.product.cutstom-corten-product form.cart > .cutstom-configurator {
  grid-column: 1 / -1;
}

.single-product div.product.cutstom-corten-product form.cart > .quantity {
  float: none !important;
  grid-column: 1;
  height: 58px;
  margin: 0 !important;
}

.single-product div.product.cutstom-corten-product form.cart > .single_add_to_cart_button {
  float: none !important;
  width: 100% !important;
  min-height: 58px;
  grid-column: 2;
  margin: 0 !important;
}

.single-product div.product.cutstom-corten-product .summary > .product_title,
.single-product div.product.cutstom-corten-product .summary > .woocommerce-product-details__short-description {
  display: none !important;
}

.single-product div.product.cutstom-corten-product .summary > .price {
  display: none !important;
}

.single-product div.product.cutstom-corten-product .summary > .product_title {
  margin-top: 0 !important;
  margin-bottom: .55rem !important;
}

.single-product div.product.cutstom-corten-product .summary > .woocommerce-product-details__short-description {
  margin-bottom: .75rem !important;
}

.single-product div.product.cutstom-corten-product .summary > .woocommerce-product-details__short-description p {
  margin-bottom: 0;
}

.cutstom-configurator {
  clear: both;
  container-type: inline-size;
  margin: 0 0 .5rem;
  color: var(--cutstom-ink);
  font-family: inherit;
}

.cutstom-configurator * { box-sizing: border-box; }
.cutstom-configurator__header { margin-bottom: .55rem; }
.cutstom-eyebrow {
  display: none;
  margin-bottom: .35rem;
  color: var(--cutstom-rust);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.cutstom-configurator__header h2 { margin: 0 0 .2rem; font-size: clamp(1.45rem, 2.5vw, 2rem); line-height: 1.08; }
.cutstom-configurator__header p { margin: 0; color: var(--cutstom-muted); font-size: .96rem; }

.cutstom-configurator__grid {
  display: grid;
  grid-template-columns: minmax(360px, .84fr) minmax(500px, 1.16fr);
  gap: 1.1rem;
  align-items: stretch;
}

.cutstom-panel {
  overflow: hidden;
  border: 1px solid var(--cutstom-line);
  border-radius: 18px;
  background: var(--cutstom-paper);
  box-shadow: 0 14px 38px rgba(55, 31, 19, .08);
}

.cutstom-step {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: .65rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--cutstom-line);
}
.cutstom-step > div { min-width: 0; }
.cutstom-step:last-child { border-bottom: 0; }
.cutstom-step__number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--cutstom-ink);
  color: #fff;
  font-size: .86rem;
  font-weight: 800;
}
.cutstom-step h3 { margin: .15rem 0 .5rem; font-size: 1rem; }
.cutstom-step small { display: block; margin-top: .22rem; color: #695d55; line-height: 1.25; }

.cutstom-dimensions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin-bottom: .55rem; }
.cutstom-dimensions label, .cutstom-field { display: grid; gap: .25rem; color: #60554e; font-size: .88rem; font-weight: 750; }
.cutstom-dimensions label > span { display: flex; align-items: center; gap: .4rem; color: var(--cutstom-muted); }
.cutstom-dimensions label > span input { min-width: 0; }
.cutstom-configurator input[type="number"],
.cutstom-configurator textarea,
.cutstom-configurator select {
  width: 100%;
  min-height: 40px;
  margin: 0;
  border: 1px solid #d7cac1;
  border-radius: 10px;
  background: #fff;
  color: var(--cutstom-ink);
  box-shadow: none;
  font: inherit;
}
.cutstom-configurator textarea { min-height: 54px; resize: vertical; }
.cutstom-field + .cutstom-field { margin-top: .45rem; }
.cutstom-font-row { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: .45rem; }
.cutstom-font-row .cutstom-field { min-width: 0; margin-top: 0; }

.cutstom-scale-control { display: grid; gap: .2rem; margin-top: .4rem; color: #60554e; font-size: .78rem; font-weight: 750; }
.cutstom-scale-control > span { display: flex; justify-content: space-between; gap: .75rem; }
.cutstom-scale-control strong { color: var(--cutstom-rust-dark); font-size: .78rem; }
.cutstom-scale-control input[type="range"] { width: 100%; height: 18px; margin: 0; padding: 0; accent-color: var(--cutstom-rust); cursor: pointer; }

.cutstom-logo-only {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .45rem;
  padding: .5rem .6rem;
  border: 1px solid var(--cutstom-line);
  border-radius: 11px;
  background: var(--cutstom-soft);
  cursor: pointer;
}
.cutstom-logo-only input { width: 20px; height: 20px; margin: 0; accent-color: var(--cutstom-rust); }
.cutstom-logo-only span { display: grid; gap: .1rem; }
.cutstom-logo-only strong { color: var(--cutstom-ink); font-size: .9rem; }
.cutstom-logo-only small { margin: 0; font-size: .76rem; }
.cutstom-backlight-option { margin-top: .55rem; margin-bottom: 0; background: linear-gradient(135deg, #fffaf4, #fff1e3); }
.cutstom-backlight-option input:checked + span strong { color: var(--cutstom-rust-dark); }
.cutstom-configurator.is-logo-only .cutstom-text-field,
.cutstom-configurator.is-logo-only .cutstom-font-field,
.cutstom-configurator.is-logo-only .cutstom-text-scale { display: none; }

.cutstom-choice-grid { display: grid; gap: .4rem; }
.cutstom-choice-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cutstom-choice-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cutstom-choice-grid + .cutstom-choice-grid { margin-top: .4rem; }
.cutstom-choice { position: relative; margin: 0; cursor: pointer; }
.cutstom-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cutstom-choice span {
  display: grid;
  min-height: 50px;
  align-content: center;
  padding: .48rem .55rem;
  border: 1px solid var(--cutstom-line);
  border-radius: 11px;
  background: #fff;
  transition: .18s ease;
}
.cutstom-choice strong { font-size: .92rem; }
.cutstom-choice small { margin: .1rem 0 0; font-size: .76rem; }
.cutstom-choice input:checked + span { border-color: var(--cutstom-rust); background: #fff7f2; box-shadow: inset 0 0 0 1px var(--cutstom-rust); }
.cutstom-choice input:focus-visible + span { outline: 3px solid rgba(159, 71, 38, .24); outline-offset: 2px; }

.cutstom-upload { display: flex; align-items: center; gap: .5rem; min-height: 40px; padding: .42rem .5rem; border: 1px dashed #cbb7aa; border-radius: 10px; background: var(--cutstom-soft); cursor: pointer; }
.cutstom-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cutstom-upload__button { flex: 0 0 auto; padding: .42rem .6rem; border-radius: 7px; background: var(--cutstom-ink); color: #fff; font-size: .82rem; font-weight: 800; }
.cutstom-upload__name { overflow: hidden; color: #695d55; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }

.cutstom-controls,
.cutstom-preview-card { height: 100%; }
.cutstom-preview-card { position: relative; top: auto; display: flex; flex-direction: column; padding: .8rem; background: #19130f; color: #fff; }
.cutstom-preview-card__top { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem .2rem .85rem; color: #d6c7bd; font-size: .75rem; font-weight: 700; }
.cutstom-preview-help { color: #a89589; font-size: .68rem; font-weight: 600; text-align: center; }
.cutstom-preview-size { color: #fff; }
.cutstom-preview-wrap { display: flex; overflow: hidden; flex: 1 1 auto; align-items: center; border-radius: 12px; background: radial-gradient(circle at 50% 22%, #453b35 0, #25201d 44%, #15110f 100%); transition: background .25s ease; }
.cutstom-configurator.is-backlit .cutstom-preview-wrap { background: radial-gradient(ellipse at 50% 54%, #704a27 0, #33271f 34%, #12100f 72%); }
.cutstom-configurator.is-backlit .cutstom-plate > rect { filter: brightness(1.08); }
.cutstom-preview { display: block; width: 100%; height: 100%; min-height: 330px; }
.cutstom-preview-artwork { cursor: grab; pointer-events: auto; touch-action: none; }
.cutstom-preview-text { fill: #1b130e; stroke: rgba(240, 179, 126, .28); stroke-width: .6px; font-weight: 800; letter-spacing: .035em; paint-order: stroke; cursor: grab; pointer-events: auto; touch-action: none; }
.cutstom-configurator.is-raw-finish .cutstom-preview-text { fill: #101214; stroke: rgba(208, 214, 218, .48); }
.cutstom-configurator.is-dragging-preview .cutstom-preview-artwork,
.cutstom-configurator.is-dragging-preview .cutstom-preview-text { cursor: grabbing; }
.cutstom-selection { pointer-events: none; }
.cutstom-selection-box { fill: none; stroke: #ffd1ae; stroke-width: 2; stroke-dasharray: 8 6; vector-effect: non-scaling-stroke; }
.cutstom-resize-handle { fill: #fff; stroke: var(--cutstom-rust); stroke-width: 4; cursor: nwse-resize; pointer-events: all; touch-action: none; vector-effect: non-scaling-stroke; }
.cutstom-summary { display: grid; gap: .38rem; padding: .55rem .15rem .45rem; }
.cutstom-summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.cutstom-summary span { color: #bba99d; font-size: .74rem; }
.cutstom-summary strong { font-size: .82rem; text-align: right; }
.cutstom-summary .cutstom-price { color: #f4ad75; font-size: 1.55rem; }
.cutstom-review-note { padding: .65rem .75rem; border-radius: 10px; background: rgba(255,255,255,.07); color: #e8ddd6; font-size: .76rem; line-height: 1.4; text-align: center; }
.cutstom-notice { margin-top: .35rem; color: #a89589; font-size: .7rem; text-align: center; }

.cutstom-shortcode-cart > .single_add_to_cart_button {
  width: 100%;
  min-height: 52px;
  margin-top: 1rem;
  border-radius: 10px;
  background: var(--cutstom-rust);
  color: #fff;
  font-weight: 800;
}

@media (max-width: 900px) {
  .cutstom-configurator__grid { grid-template-columns: 1fr; }
  .cutstom-controls, .cutstom-preview-card { height: auto; }
  .cutstom-preview-card { position: static; }
  .cutstom-preview { height: auto; min-height: 0; }
}

/* WooCommerce mantiene la scheda prodotto in una colonna stretta anche su
   monitor grandi. La container query segue lo spazio reale del configuratore,
   evitando che controlli e anteprima vengano compressi fianco a fianco. */
@container (max-width: 900px) {
  .cutstom-configurator__grid { grid-template-columns: minmax(0, 1fr); }
  .cutstom-controls, .cutstom-preview-card { height: auto; }
  .cutstom-preview-card { position: static; }
  .cutstom-preview { height: auto; min-height: 0; }
}

@container (max-width: 400px) {
  .cutstom-choice-grid--3 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .single-product div.product.cutstom-corten-product form.cart { grid-template-columns: 1fr; }
  .single-product div.product.cutstom-corten-product form.cart > .quantity,
  .single-product div.product.cutstom-corten-product form.cart > .single_add_to_cart_button { grid-column: 1; }
  .cutstom-panel { border-radius: 13px; }
  .cutstom-step { grid-template-columns: 28px 1fr; gap: .65rem; padding: 1rem .8rem; }
  .cutstom-step__number { width: 27px; height: 27px; }
  .cutstom-dimensions, .cutstom-choice-grid--2 { grid-template-columns: 1fr 1fr; }
  .cutstom-choice-grid--3 { grid-template-columns: 1fr; }
  .cutstom-font-row { grid-template-columns: 1fr; }
  .cutstom-choice span { min-height: 54px; }
  .cutstom-upload { align-items: flex-start; flex-direction: column; }
}

.cutstom-view-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; padding: .6rem .2rem; color: #e8dcd3; font-size: .8rem; }
.cutstom-configurator .cutstom-view-controls label { color: #e8dcd3; font-size: 12px; display: flex; align-items: center; gap: .5rem; flex: 1; margin: 0; }
.cutstom-view-controls input { flex: 1; min-width: 70px; accent-color: #cd7846; }
.cutstom-view-controls button { background: #40342c; color: white; border: 1px solid #786253; border-radius: 5px; padding: .4rem .7rem; text-transform: none; letter-spacing: 0; }
.cutstom-view-controls output { color: #e8dcd3; font-size: 12px; min-width: 2.2em; }
.cutstom-depth { pointer-events: none; }
