body { font-size: 14px; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; padding: 8px var(--gutter); background: var(--scrim); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: block; line-height: 0; text-decoration: none; }
.brand img { height: 40px; width: auto; }
/* Il logo è la firma bianca del Portfolio: con il tema chiaro diventa nera. */
:root:not([data-theme='dark']) .brand img { filter: invert(1); }
.top-nav { display: flex; align-items: center; gap: 18px; }
.top-nav a { text-decoration: none; text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; color: var(--muted); }
.top-nav a:hover, .top-nav a.on { color: var(--fg); }
@media (max-width: 560px) { .top-nav { gap: 8px; } .top-nav .btn { padding: 0 10px; } }

.page { max-width: 1240px; margin: 0 auto; padding: 32px var(--gutter) 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { margin: 0; font: 300 clamp(32px, 5vw, 46px)/1.05 var(--serif); }
.page-head .sub { margin-top: 6px; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
h2.serif { margin: 0 0 14px; font-size: 28px; line-height: 1.1; }
.hint { color: var(--muted); font-size: 12px; }

/* Login */
.login { min-height: calc(100svh - 60px); display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(340px, 100%); text-align: center; }
.login h1 { margin: 0 0 28px; font: 300 40px/1.1 var(--serif); }

/* Elenco gallery */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 20px; }
.card { display: block; text-decoration: none; }
.card-img { aspect-ratio: 3 / 2; background: var(--soft) center / cover no-repeat; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.card:hover .card-img img { transform: scale(1.03); }
.card h3 { margin: 12px 0 2px; font: 300 24px/1.15 var(--serif); }
.card p { margin: 0; color: var(--muted); font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); vertical-align: 2px; }
.pill.open { border-color: var(--ok); color: var(--ok); }
.pill.closed { border-color: var(--fg); color: var(--fg); }
.pill.sent { border-color: var(--heart); color: var(--heart); }

/* Schede della gallery */
.subtabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 28px; overflow-x: auto; }
.subtabs a { padding: 12px 0; border-bottom: 1px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; color: var(--muted); }
.subtabs a.on { color: var(--fg); border-color: var(--fg); }
.subtabs b { font-weight: 400; margin-left: 4px; }

.link-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.link-row code { padding: 4px 8px; background: var(--soft); font: 12px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; }

/* Caricamento */
.drop {
  display: grid; place-items: center; gap: 8px; padding: 34px 16px; margin-bottom: 22px; text-align: center;
  border: 1px dashed var(--line); color: var(--muted); cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.drop:hover, .drop.over { border-color: var(--fg); background: var(--soft); color: var(--fg); }
.drop strong { font: 300 22px/1.2 var(--serif); color: var(--fg); }
.progress { height: 2px; background: var(--line); margin: -12px 0 22px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--fg); transition: width 0.3s; }

/* Miniature */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; background: var(--soft) center / cover no-repeat; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 10px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .tools { position: absolute; top: 2px; right: 2px; display: flex; opacity: 0; transition: opacity 0.2s; }
.thumb:hover .tools, .thumb .tools .on { opacity: 1; }
.thumb:hover .tools { opacity: 1; }
.thumb .tools .icon-btn { width: 30px; height: 30px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.thumb .tools .icon-btn svg { width: 16px; height: 16px; }
.thumb .star.on { opacity: 1; color: #f2c14e; }
.thumb .badge { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)); }
.thumb .badge svg { width: 100%; height: 100%; display: block; }
.thumb .badge path { fill: var(--heart); stroke: #fff; stroke-width: 1.2; }
.thumb.cover-mark { outline: 2px solid var(--fg); outline-offset: -2px; }
@media (hover: none) { .thumb .tools { opacity: 1; } }

/* Selezioni */
.box { border: 1px solid var(--line); padding: 22px clamp(16px, 3vw, 28px); margin-bottom: 18px; background: var(--card); }
.box-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.box-head h3 { margin: 0; font: 300 26px/1.1 var(--serif); }
.box-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.lr { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.lr textarea {
  flex: 1 1 320px; min-height: 64px; padding: 10px 12px; border: 1px solid var(--line); background: var(--bg);
  font: 12px/1.5 ui-monospace, Menlo, monospace; resize: vertical;
}
.lr .btn { align-self: flex-start; }
.stats { display: flex; gap: 32px; flex-wrap: wrap; margin-bottom: 22px; }
.stat b { display: block; font: 300 36px/1 var(--serif); }
.stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; }
.notes { margin: 14px 0 0; padding: 0; list-style: none; }
.notes li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.notes img { width: 56px; height: 56px; object-fit: cover; flex: none; }
.notes code { font: 12px ui-monospace, Menlo, monospace; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 12px; }
details .thumbs { margin-top: 12px; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.help { font-size: 13px; color: var(--muted); }
.help ol { margin: 8px 0 0; padding-left: 20px; }
.help kbd { padding: 1px 5px; border: 1px solid var(--line); font: 11px ui-monospace, Menlo, monospace; }

table.orders { width: 100%; border-collapse: collapse; font-size: 13px; }
.orders th, .orders td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.orders th { font-weight: 400; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }

/* Moduli */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 0 32px; max-width: 860px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--fg); }
.check small { display: block; color: var(--muted); }
select.input { appearance: none; background: transparent; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
legend { padding: 0; margin-bottom: 16px; font: 300 24px/1.1 var(--serif); }
.danger-zone { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }

.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 42px; }
.danger-text { color: var(--heart); }
.input-row { display: flex; gap: 6px; align-items: flex-end; }

/* Menu ⋮ */
.pop { position: absolute; z-index: 70; min-width: 230px; padding: 6px 0; background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12); }
.pop button { display: block; width: 100%; padding: 10px 18px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 14px; }
.pop button:hover { background: var(--soft); }
.pop button.danger { color: var(--heart); }
.pop hr { margin: 6px 0; border: 0; border-top: 1px solid var(--line); }

/* Liste di preferite, come le schede di wfolio */
.list-cards { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 22px; }
.list-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 240px; padding: 14px 8px 14px 18px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; transition: border-color 0.2s; }
.list-card:hover, .list-card.on { border-color: var(--fg); }
.list-card strong { display: block; font: 300 22px/1.2 var(--serif); }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #e0b84a; vertical-align: 1px; }
.dot.submitted { background: var(--ok); }
.thumbs.named { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 12px; margin-top: 16px; }
.thumbs.named figure { margin: 0; }
.thumbs.named figcaption { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: center; word-break: break-all; }
.thumbs.named .thumb { aspect-ratio: 4 / 3; background-color: transparent; }
.thumbs.named .thumb img { object-fit: contain; }
.thumbs.named .thumb { background-image: none !important; }

/* Filigrana: comandi a sinistra, anteprima dal vivo a destra */
.wm-layout { display: grid; grid-template-columns: 1fr; gap: 28px; }
@media (min-width: 960px) { .wm-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; } .wm-side { position: sticky; top: 80px; } }
.form-grid.two { grid-template-columns: 1fr 1fr; gap: 0 20px; }
.range { width: 100%; accent-color: var(--fg); }
.field output { color: var(--fg); margin-left: 4px; }
.field-title { margin: 18px 0 8px; color: var(--muted); font-size: 12px; }
.wm-logo { height: 52px; padding: 4px; background: repeating-conic-gradient(#999 0 25%, #666 0 50%) 0 0 / 14px 14px; }
.wm-preview { display: grid; place-items: center; background: #111; padding: 8px; min-height: 200px; }
.wm-preview img { max-height: 62vh; }
.wm-row { display: flex; gap: 14px; align-items: center; margin: 12px 0; }
.wm-thumb { margin: 0; flex: 0 0 150px; }
.wm-thumb img { width: 150px; aspect-ratio: 3 / 2; object-fit: cover; }
.advanced { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; }

/* Pulsanti affiancati per scegliere un'opzione (disposizione del logo) */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.seg { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border: 1px solid var(--line);
  font-size: 12px; text-align: center; color: var(--muted); transition: border-color 0.2s, color 0.2s, background 0.2s; }
.seg svg { width: 44px; height: 30px; }
.seg svg rect { fill: none; stroke: currentColor; stroke-width: 1; }
.seg svg .fill, .seg svg .fill rect { fill: currentColor; stroke: none; opacity: 0.55; }
.seg:hover span { border-color: var(--muted); color: var(--fg); }
.seg input:checked + span { border-color: var(--fg); color: var(--fg); background: var(--soft); }
.seg input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: 2px; }
.list-note { margin: 4px 0 14px; padding: 12px 16px; background: var(--soft); }
.list-note p { margin: 4px 0 0; }
.review { padding: 14px 0; border-top: 1px solid var(--line); }
.review p { margin: 0 0 6px; }

/* ---------- telefono ---------- */
.orders-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.orders-wrap table { min-width: 560px; }
.touch-only { display: none; }
@media (hover: none) { .touch-only { display: inline; } .mouse-only { display: none; } }
@media (max-width: 600px) {
  .top { gap: 8px; padding-left: 16px; padding-right: 8px; }
  .brand img { height: 34px; }
  .top-nav { gap: 4px; }
  .top-nav .nav-home { display: none; } /* il nome a sinistra porta già all'elenco delle gallery */
  .top-nav a { padding: 8px 6px; letter-spacing: 0.1em; font-size: 10px; }
  .top-nav .btn { min-height: 36px; padding: 0 8px; }
  .page { padding-top: 22px; }
  .page-head { margin-bottom: 20px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .subtabs { gap: 16px; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .subtabs a { letter-spacing: 0.1em; }
  .link-row code { width: 100%; }
  .drop { padding: 26px 14px; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .thumbs.named { grid-template-columns: repeat(2, 1fr); }
  .section-bar { flex-wrap: wrap; }
  .list-card { flex: 1 1 100%; min-width: 0; }
  .box { padding: 18px 14px; }
  .stats { gap: 18px 26px; }
  .stat b { font-size: 30px; }
  .lr .btn { width: 100%; }
  .card h3 { font-size: 22px; }
  .wm-thumb { flex-basis: 110px; }
  .wm-thumb img { width: 110px; }
  .danger-zone .btn { width: 100%; margin-bottom: 8px; }
}

/* Elenco gallery: menu ⋮ sulla copertina (apri, vedi, copia link, elimina) */
.card-wrap { position: relative; }
.card-menu {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; font-size: 18px; line-height: 1;
  background: rgba(255, 255, 255, 0.88); color: #1c1c1b; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.card-menu:hover { background: #fff; }

/* Prezzo delle foto: quattro modi a pulsanti, e una frase che riassume */
.segmented.four { grid-template-columns: repeat(3, 1fr); }
.segmented.four .seg span { padding: 12px 8px; font-size: 12.5px; line-height: 1.35; }
@media (max-width: 700px) { .segmented.four { grid-template-columns: repeat(2, 1fr); } }
.price-summary { margin: 0 0 6px; padding: 12px 16px; background: var(--soft); font-size: 14px; }
.price-summary b { font-weight: 500; }
.modal-box:has(.price-form) { width: min(560px, 100%); }
.modal .segmented.four { grid-template-columns: repeat(2, 1fr); }
.price-form .advanced { margin-top: 10px; }
.segmented.two { grid-template-columns: 1fr 1fr; }
.segmented.two .seg span { align-items: flex-start; text-align: left; padding: 12px 14px; gap: 4px; line-height: 1.4; }
.segmented .seg span b { font-weight: 500; color: var(--fg); font-size: 13px; }
@media (max-width: 480px) { .segmented.two { grid-template-columns: 1fr; } }

/* Avviso gallery in bozza */
.draft-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  margin: 0 0 22px; padding: 14px 18px; border: 1px solid #e0b84a; background: color-mix(in srgb, #e0b84a 12%, var(--bg)); }
.draft-banner p { margin: 0; font-size: 13.5px; max-width: 640px; }
.draft-banner b { font-weight: 500; }
@media (max-width: 600px) { .draft-banner .btn { width: 100%; } }
.thumb .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -60%); width: 38px; height: 38px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #fff; display: grid; place-items: center; font-size: 14px; padding-left: 3px; pointer-events: none; }
.dl-summary { margin: 4px 0 8px; padding-left: 18px; line-height: 1.8; font-size: 14px; }
.dl-log summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.dl-log table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.dl-log td { padding: 5px 8px 5px 0; border-top: 1px solid var(--line); vertical-align: top; word-break: break-word; }
