@font-face { font-family: 'LunchCond'; src: url('/fonts/Lunchtype25-Medium-Condensed.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'LunchReg'; src: url('/fonts/Lunchtype22-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Queering'; src: url('/fonts/Queering-Heavy.otf') format('opentype'); font-display: block; }
@font-face { font-family: 'Mono'; src: url('/fonts/RobotoMono-Regular.ttf') format('truetype'); font-display: block; }

:root {
  --eu-blue: #3271ff;
  --eu-purple: #ad8ed6;
  --eu-grey: #dbdbdb;
  --bulma-link-h: 222deg;
  --bulma-link-s: 100%;
  --bulma-link-l: 60%;
  --bulma-family-primary: 'LunchReg', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bulma-radius: .6rem;
  --bulma-box-radius: 1rem;
  --studio-gap: 1.5rem;
}

body { font-family: var(--bulma-family-primary); font-size: 1.05rem; min-height: 100vh; }
.title, .label, .brand-name, .button, .tag { font-family: 'LunchCond', var(--bulma-family-primary); letter-spacing: .01em; }
code, kbd { font-family: 'Mono', ui-monospace, monospace; font-size: .85em; }

/* barra in alto */
.studio-nav { display: flex; padding: .25rem 1.25rem; border-bottom: 1px solid var(--bulma-border-weak); align-items: center; min-height: 3.5rem; }
.nav-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.brand { display: inline-flex; align-items: baseline; gap: .7rem; font-size: 1.35rem; color: var(--bulma-text-strong); }
.brand-mark { font-family: 'Queering'; display: inline-block; transform: scaleX(1.5); transform-origin: left center;
  margin-right: .55em; color: var(--eu-blue); line-height: 1; }
.brand-name { font-size: 1.15rem; }

.studio { padding-top: 1.5rem; padding-bottom: 5rem; }
.studio .column { min-width: 0; }  /* le colonne non si allargano per il contenuto (es. le schede che scorrono) */
@media screen and (min-width: 1024px) { .studio > .columns { --bulma-column-gap: 1.6rem; } }

/* anteprima */
.preview-col { position: sticky; top: 1rem; }
.preview {
  position: relative; width: min(100%, calc((100vh - 13.5rem) * .8)); min-width: 260px; aspect-ratio: 4 / 5;
  margin-inline: auto; border-radius: .9rem; overflow: hidden; background: var(--bulma-scheme-main-ter);
  box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 12px 40px -12px rgb(0 0 0 / .35); user-select: none; -webkit-user-select: none;
}
.preview > svg { display: block; width: 100%; height: 100%; }
.preview.can-pan > svg #photo-group, .preview.can-pan > svg #photo { cursor: grab; touch-action: none; }
.preview.is-panning, .preview.is-panning * { cursor: grabbing !important; }
.preview.is-dropping::after { content: 'Rilascia per usare questa foto'; position: absolute; inset: 0; display: grid;
  place-items: center; background: rgb(50 113 255 / .82); color: #fff; font: 1.4rem 'LunchCond', sans-serif; }
.preview-loading { position: absolute; inset: 0; display: grid; place-items: center; }
.preview-hint { margin-top: .6rem; }
#stats { justify-content: center; }
.export-buttons { justify-content: center; margin-top: .25rem; }
#warnings .notification { padding: .7rem 1rem; margin-bottom: .5rem; font-size: .95rem; }

/* pannelli */
.panel-box { padding: 1.4rem 1.5rem; }
.panel-box:not(:last-child) { margin-bottom: var(--studio-gap); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.box-head .title { margin-bottom: 0 !important; }
.step { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; margin-right: .4em; border-radius: 50%;
  background: var(--eu-blue); color: #fff; font-size: .8em; vertical-align: .08em; }

/* modelli */
.family-tabs { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .35rem; scrollbar-width: thin; }
.family-tabs .button { flex: 0 0 auto; border-radius: 999px; }
.family-tabs .button .new { font-size: .65em; margin-left: .35em; padding: .1em .45em; border-radius: 999px;
  background: var(--eu-purple); color: #000; }
.family-desc { margin: .5rem 0 1rem; min-height: 1.3em; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .8rem; }
.variant { position: relative; padding: 0; border: 0; background: none; cursor: pointer; text-align: center;
  border-radius: .7rem; color: inherit; font: inherit; }
.variant img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: .7rem;
  outline: 2px solid var(--bulma-border-weak); outline-offset: 0; transition: transform .15s ease, outline-color .15s ease; }
.variant:hover img { transform: translateY(-2px); }
.variant span { display: block; margin-top: .35rem; font-family: 'LunchCond'; font-size: .95rem; }
.variant .check { position: absolute; top: .4rem; right: .4rem; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--eu-blue); color: #fff; display: none; place-items: center; box-shadow: 0 2px 6px rgb(0 0 0 / .3); }
.variant .check svg { width: 1rem; height: 1rem; }
.variant.is-active img { outline: 3px solid var(--eu-blue); outline-offset: 2px; }
.variant.is-active .check { display: grid; }
.variant:focus-visible { outline: 3px solid var(--eu-blue); outline-offset: 3px; }

/* testi */
#fields .field:not(:last-child) { margin-bottom: 1.1rem; }
#fields .textarea { min-height: 0; resize: vertical; font-family: 'LunchReg', sans-serif; font-size: 1.1rem; line-height: 1.35; }
#fields .input { font-family: 'LunchReg', sans-serif; font-size: 1.05rem; }
.label-row { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.label-row .label { margin-bottom: 0 !important; }
.markup-bar { display: flex; gap: .3rem; }
.markup-bar .button { height: 1.8rem; padding: 0 .55rem; font-size: .8rem; }
.markup-bar .b-acc { color: var(--eu-blue); font-weight: 700; }
.markup-bar .b-ul { text-decoration: underline wavy; text-underline-offset: 3px; }
.markup-help { margin-top: 1rem; }

/* foto */
.dropzone { position: relative; border: 2px dashed var(--bulma-border); border-radius: .9rem; padding: 1.25rem;
  text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--eu-blue); outline: none; }
.dropzone.is-over { border-color: var(--eu-blue); background: rgb(50 113 255 / .07); }
.dropzone .icon.is-large svg { width: 2.4rem; height: 2.4rem; color: var(--eu-blue); }
.dz-photo { display: flex; gap: 1rem; align-items: center; text-align: left; }
.dz-photo img { width: 88px; height: 88px; object-fit: cover; border-radius: .6rem; flex: 0 0 auto; }
#upload-progress { margin: .8rem 0 0; }
.photo-controls { margin-top: 1rem; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; }
.photo-controls .field { margin-bottom: 0; }
.photo-controls .buttons { margin-bottom: 0; }
.photo-controls .buttons .button { margin-bottom: 0; }

input.slider { width: 100%; accent-color: var(--eu-blue); }

/* rifiniture */
.doodle-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.doodle-options .button { border-radius: 999px; }
.size-row { display: flex; align-items: center; gap: 1rem; }
.size-row .checkbox { white-space: nowrap; }
.size-row .tag { min-width: 4.2rem; justify-content: center; }

/* notifiche */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 50; width: max-content;
  max-width: min(92vw, 36rem); box-shadow: 0 10px 30px rgb(0 0 0 / .25); padding: .9rem 1.4rem; }
.mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  background: var(--bulma-scheme-main); border-top: 1px solid var(--bulma-border-weak); }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; background: var(--eu-blue); }
.login-card { width: min(92vw, 380px); padding: 2rem; }
.login-brand { margin-bottom: 1.5rem; }

@media screen and (max-width: 1023px) {
  .preview-col { position: static; }
  .preview { width: min(100%, 520px); }
  .studio { padding: 1rem .75rem 6rem; }
}
@media screen and (max-width: 520px) {
  .photo-controls { grid-template-columns: 1fr; }
  .variant-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .6rem; }
  .panel-box { padding: 1.1rem; }
}

[hidden] { display: none !important; }
