/* My Last Right · Post Studio — Bulma con i colori e i caratteri del brand.
   Le creatività hanno il loro stile (renderer.js + library/): qui c'è solo la piattaforma. */

:root, [data-theme=light] {
  --ink: #12181C; --ink-2: #2A323A; --paper: #EAF3F7; --kraft: #DCEAF1;
  --azzurro: #4FB0D6; --azzurro-d: #1E6F94; --deep: #135A78; --teal: #157E97; --yellow: #F2C53D;
  --muted: #5B6B75; --line: #D6E3EA;

  --display: 'Display', 'DisplayX', 'Arial Narrow', sans-serif;
  --mono: 'Mono', 'MonoX', ui-monospace, monospace;

  /* tema Bulma: azzurro del sito come primario, inchiostro come scuro */
  --bulma-primary-h: 197deg; --bulma-primary-s: 62%; --bulma-primary-l: 57%;
  --bulma-primary-on-scheme-l: 34%;
  --bulma-link-h: 199deg; --bulma-link-s: 66%; --bulma-link-l: 35%;
  --bulma-link-on-scheme-l: 35%;
  --bulma-dark-h: 203deg; --bulma-dark-s: 22%; --bulma-dark-l: 9%;
  --bulma-warning-h: 45deg; --bulma-warning-s: 87%; --bulma-warning-l: 59%;
  --bulma-scheme-h: 200; --bulma-scheme-s: 25%;
  --bulma-family-primary: 'Sans', 'SansX', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bulma-family-code: var(--mono);
  --bulma-body-color: var(--ink);
  --bulma-text-strong: var(--ink);
  --bulma-radius: .6rem;
  --bulma-radius-large: 1rem;
  --bulma-box-radius: 1.1rem;
  --bulma-box-padding: 1.6rem;
  --bulma-box-shadow: 0 1px 2px rgba(18, 24, 28, .05), 0 12px 32px -18px rgba(18, 24, 28, .28);
  --bulma-input-radius: .65rem;
  --bulma-column-gap: .75rem;

  --soft-shadow: 0 1px 2px rgba(18, 24, 28, .05), 0 12px 32px -18px rgba(18, 24, 28, .28);
  --lift-shadow: 0 2px 4px rgba(18, 24, 28, .06), 0 18px 40px -20px rgba(18, 24, 28, .38);
}

html { background: #EDF4F8; scroll-padding-top: 5rem; }
body {
  min-height: 100vh; font-size: 1rem; color: var(--ink); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 420px at 12% -120px, rgba(79, 176, 214, .22), transparent 70%),
    radial-gradient(900px 380px at 100% 0, rgba(21, 126, 151, .10), transparent 70%),
    #EDF4F8;
  background-repeat: no-repeat;
}
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon svg { width: 1.15em; height: 1.15em; }
.icon.is-small svg { width: 1em; height: 1em; }
code, kbd { font-family: var(--mono); font-size: .82em; color: var(--deep); background: #E4F1F7; border-radius: .35rem; padding: .1em .4em; }
.title { font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: .005em; line-height: .95; color: var(--ink); }
.label { font-weight: 700; font-size: .92rem; color: var(--ink); }
.help { color: var(--muted); font-size: .84rem; }
.button { font-weight: 700; }
.button.is-primary:not(.is-outlined) { color: var(--ink); }
.button.is-light { background-color: #EAF2F6; color: var(--ink); }
.button.is-light:hover { background-color: #DDEBF2; }
.tag:not(body) { font-weight: 600; }
.tag.is-primary.is-light { background: #E1F2F9; color: var(--deep); }
.eyebrow {
  font-family: var(--mono); font-weight: 700; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before { content: "// "; color: var(--azzurro-d); }

/* ---------- barra in alto ---------- */
.studio-nav {
  --bulma-navbar-background-color: var(--ink);
  background: var(--ink); min-height: 4rem; padding: 0 clamp(.75rem, 2vw, 1.5rem);
  display: flex; align-items: center; position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 10px 30px -18px rgba(0, 0, 0, .6);
}
.studio-nav .navbar-brand { min-height: 4rem; }
.brand { gap: .9rem; padding-left: 0; background: transparent !important; }
.wm {
  display: flex; flex-direction: column; font-family: var(--display); font-weight: 900; text-transform: uppercase;
  font-size: 1.32rem; line-height: .8; color: var(--paper); text-shadow: 2px 2px 0 var(--azzurro); letter-spacing: .01em;
}
.brand-sep { width: 1px; align-self: stretch; margin: .9rem 0; background: rgba(234, 243, 247, .18); }
.brand-app { font-family: var(--mono); font-weight: 700; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: #9FD6EA; }
.brand-app::before { content: "// "; opacity: .7; }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.live-pill {
  display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .85rem .3rem .7rem; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); color: var(--paper);
  transition: background .15s, border-color .15s;
}
.live-pill:hover { background: rgba(79, 176, 214, .16); border-color: rgba(79, 176, 214, .5); color: #fff; }
.live-pill strong { font-family: var(--display); font-weight: 900; font-size: 1.35rem; line-height: 1; color: #fff; letter-spacing: .01em; }
.live-label { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #9FD6EA; }
.pulse { position: relative; width: .55rem; height: .55rem; border-radius: 50%; background: var(--azzurro); }
.pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--azzurro);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.nav-btn.is-outlined { background: transparent; color: var(--azzurro); border-color: rgba(79, 176, 214, .6); }
.nav-btn.is-outlined:hover { background: var(--azzurro); color: var(--ink); border-color: var(--azzurro); }
.nav-exit { color: #B9D3DE; text-decoration: none; }
.nav-exit:hover { color: #fff; text-decoration: none; }

/* ---------- impianto ---------- */
.studio { padding: clamp(1.25rem, 3vw, 2.5rem) clamp(.75rem, 3vw, 2.5rem) 7rem; max-width: 1480px; margin: 0 auto; }
@media screen and (min-width: 1024px) {
  .studio-columns { --bulma-column-gap: 1.5rem; }
  .preview-col { position: sticky; top: 5.5rem; }
  .studio { padding-bottom: 4rem; }
}
.studio .column { min-width: 0; }
.controls { display: flex; flex-direction: column; gap: 1.5rem; }
.controls > .box { margin-bottom: 0; }

/* ---------- anteprima ---------- */
.preview-card {
  max-width: 560px; margin: 0 auto; border-radius: 1.25rem; overflow: hidden; background: #fff;
  box-shadow: 0 2px 6px rgba(18, 24, 28, .06), 0 30px 60px -30px rgba(18, 24, 28, .45);
}
@media screen and (min-width: 1024px) and (max-height: 940px) {
  .preview-card { max-width: min(560px, calc((100vh - 17rem) * .8 + 0px)); }
}
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1rem; }
.preview-head .tags { margin: 0; flex-wrap: nowrap; }
.preview-head .tags .tag { margin-bottom: 0; }
.preview { position: relative; aspect-ratio: 4 / 5; background: var(--kraft); overflow: hidden; touch-action: none; }
.preview > svg { display: block; width: 100%; height: 100%; }
.preview.can-pan { cursor: grab; }
.preview.is-panning { cursor: grabbing; }
.preview.is-dropping::after {
  content: "Drop to use this photo"; position: absolute; inset: .75rem; display: grid; place-items: center;
  border-radius: 1rem; border: 3px dashed var(--ink); background: rgba(79, 176, 214, .82); color: var(--ink); font-weight: 700;
}
.preview-loading { position: absolute; inset: 0; display: grid; place-items: center; }
.preview-loading .loader { width: 2.2rem; height: 2.2rem; border-width: 3px; border-color: var(--azzurro-d); border-right-color: transparent; border-top-color: transparent; }
.preview-foot { display: flex; gap: .75rem; padding: 1rem; background: #fff; }
.preview-foot .button { margin: 0; }
.export-main { flex: 1; }
.pan-hint { text-align: center; margin: .9rem auto 0; max-width: 560px; }
.warnings { max-width: 560px; margin: .9rem auto 0; display: flex; flex-direction: column; gap: .5rem; }
.warnings:empty { display: none; }
.warnings .notification { margin: 0; padding: .7rem 1rem; font-size: .9rem; font-weight: 600; border-radius: .8rem; }
.stats { max-width: 560px; margin: .9rem auto 0 !important; }
.stats .tag { background: rgba(255, 255, 255, .7); color: var(--muted); font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- passi ---------- */
.step { padding: clamp(1.1rem, 2.2vw, 1.75rem); border: 1px solid rgba(18, 24, 28, .05); }
.step-head { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.25rem; }
.step-head .title { font-size: 1.9rem; margin-bottom: .2rem; display: flex; align-items: center; gap: .6rem; }
.step-sub { color: var(--muted); font-size: .92rem; line-height: 1.4; }
.step-num {
  flex: none; width: 2.3rem; height: 2.3rem; border-radius: .7rem; display: grid; place-items: center;
  background: var(--ink); color: var(--azzurro); font-family: var(--display); font-weight: 900; font-size: 1.35rem;
  box-shadow: 3px 3px 0 var(--azzurro);
}
.optional-tag { font-family: var(--bulma-family-primary); text-transform: none; letter-spacing: 0; font-size: .75rem; }

/* famiglie */
.family-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.fam {
  display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; padding: .8rem .85rem .75rem;
  border-radius: .9rem; border: 1.5px solid var(--line); background: #F6FAFC; color: var(--ink); text-align: left;
  font: inherit; font-weight: 700; font-size: .88rem; line-height: 1.15; cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
.fam svg { width: 1.45rem; height: 1.45rem; color: var(--azzurro-d); }
.fam:hover { border-color: var(--azzurro); background: #fff; transform: translateY(-2px); box-shadow: var(--soft-shadow); }
.fam:focus-visible { outline: 3px solid rgba(79, 176, 214, .55); outline-offset: 2px; }
.fam[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 10px 24px -14px rgba(18, 24, 28, .8); transform: none; }
.fam[aria-selected="true"] svg { color: var(--azzurro); }
.family-desc { margin: 1rem 0 1.1rem; color: var(--muted); font-size: .95rem; }

/* varianti */
.variant-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.variant {
  position: relative; padding: 0; border: 0; border-radius: .9rem; overflow: hidden; background: #fff; cursor: pointer; text-align: left;
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px -12px rgba(18, 24, 28, .35);
  transition: transform .14s ease, box-shadow .14s ease;
}
.variant img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.variant-name { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; font-weight: 700; font-size: .88rem; }
.swatch { width: .85rem; height: .85rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(18, 24, 28, .25); flex: none; }
.variant:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--azzurro), var(--lift-shadow); }
.variant:focus-visible { outline: 3px solid rgba(79, 176, 214, .6); outline-offset: 3px; }
.variant[aria-checked="true"] { box-shadow: 0 0 0 3px var(--azzurro), 0 0 0 7px rgba(79, 176, 214, .22), var(--lift-shadow); transform: none; }
.variant .check {
  position: absolute; top: .55rem; right: .55rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: none; place-items: center;
  background: var(--azzurro); color: var(--ink); box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .5);
}
.variant .check svg { width: 1rem; height: 1rem; }
.variant[aria-checked="true"] .check { display: grid; }

/* ---------- testi ---------- */
.text-toolbar { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.lang-field { flex: 1 1 260px; max-width: 380px; margin-bottom: 0 !important; }
.toolbar-buttons { margin-left: auto; margin-bottom: 0 !important; }
.toolbar-buttons .button { margin-bottom: 0; }
.lang-help { margin: .5rem 0 1.25rem; }
.presets {
  margin-bottom: 1.4rem; padding: .9rem 1rem .5rem; border-radius: 1rem;
  background: linear-gradient(135deg, #E2F2F9, #EEF7FB); border: 1px solid #CFE7F2;
}
.presets-title { display: flex; align-items: center; gap: .35rem; font-family: var(--mono); font-weight: 700; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--deep); margin-bottom: .6rem; }
.presets-title .icon { color: var(--azzurro-d); }
.presets .button { border-radius: 999px; background: #fff; border-color: #CFE0E8; }
.presets .button:hover { border-color: var(--azzurro); }
.presets .button.is-selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.fields { display: flex; flex-direction: column; gap: 1.1rem; }
.fields .field { margin-bottom: 0; }
.label-row { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .45rem; }
.label-row .label { margin-bottom: 0; }
.markup-bar { margin-bottom: 0 !important; }
.markup-bar .button { margin-bottom: 0; font-size: .74rem; height: 1.9rem; padding-inline: .7rem; }
.markup-bar .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--azzurro); margin-right: .35rem; }
.input, .textarea, .select select {
  border-color: #CFDDE5; background: #FBFDFE; box-shadow: none; font-size: 1rem;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.input:hover, .textarea:hover, .select select:hover { border-color: #A9C6D4; }
.input:focus, .textarea:focus, .select select:focus,
.input:focus-within, .textarea:focus-within {
  border-color: var(--azzurro); background: #fff; box-shadow: 0 0 0 .2rem rgba(79, 176, 214, .25);
}
.textarea { min-height: 5.2rem; line-height: 1.45; }
.field.is-live .input::placeholder { color: var(--azzurro-d); font-weight: 700; opacity: 1; }
.markup-help { margin-top: 1.1rem; }
.control.has-icons-left .icon.is-left { color: var(--muted); }

/* ---------- foto ---------- */
.dropzone {
  position: relative; border: 2px dashed #B8D0DC; border-radius: 1rem; background: #F6FAFC; padding: 1.5rem; cursor: pointer;
  transition: border-color .14s, background .14s, box-shadow .14s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--azzurro); background: #EFF8FC; box-shadow: 0 0 0 .25rem rgba(79, 176, 214, .15); }
.dropzone:focus-visible { outline: 3px solid rgba(79, 176, 214, .6); outline-offset: 2px; }
.dz-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; }
.dz-icon { width: 3.2rem; height: 3.2rem; border-radius: 1rem; display: grid; place-items: center; background: #DDF0F8; color: var(--azzurro-d); margin-bottom: .35rem; }
.dz-icon svg { width: 1.6rem; height: 1.6rem; }
.dz-title { font-weight: 700; }
.dz-title span { font-weight: 500; color: var(--muted); }
.dz-photo { display: flex; align-items: center; gap: 1rem; }
.dz-photo img { width: 5rem; height: 5rem; object-fit: cover; border-radius: .8rem; flex: none; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .4); }
.dz-meta { min-width: 0; }
.dz-name { font-weight: 700; overflow-wrap: anywhere; }
.dropzone .progress { position: absolute; left: 1rem; right: 1rem; bottom: .6rem; width: auto; margin: 0; }
.tone-field { margin-top: 1.25rem; margin-bottom: 0 !important; }
.tones .button { margin-bottom: 0; }
.tones .button .swatch { width: 1rem; height: 1rem; border-radius: .3rem; margin-right: .45rem; background: linear-gradient(90deg, var(--a), var(--b)); }
.tones .button.is-selected { background: var(--ink); border-color: var(--ink); color: #fff; z-index: 2; }
.photo-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.5rem; margin-top: 1.25rem; }
.zoom-field { flex: 1 1 240px; margin-bottom: 0 !important; }
.zoom-field .label { display: flex; align-items: center; gap: .5rem; }
.photo-controls .buttons { margin-bottom: 0; }
.photo-controls .buttons .button { margin-bottom: 0; }

/* cursori */
.range { width: 100%; accent-color: var(--azzurro-d); cursor: pointer; height: 1.6rem; }
.range:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- rifiniture ---------- */
.size-row { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.size-row .range { flex: 1 1 200px; }
.size-value { min-width: 4.5rem; justify-content: center; font-family: var(--mono); }
.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; font-weight: 700; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 2.75rem; height: 1.55rem; border-radius: 999px; background: #C9D8E0; transition: background .15s; flex: none; }
.switch-track::after {
  content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--azzurro-d); }
.switch input:checked + .switch-track::after { transform: translateX(1.2rem); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(79, 176, 214, .6); outline-offset: 2px; }

/* ---------- mobile ---------- */
.mobile-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; gap: .6rem;
  padding: .75rem clamp(.75rem, 3vw, 2.5rem) calc(.75rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -10px 30px -18px rgba(18, 24, 28, .5);
}
.mobile-bar .button { flex: 1; margin: 0; }
@media screen and (max-width: 768px) {
  .family-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding: .2rem .1rem .6rem; margin-inline: -.1rem; scrollbar-width: none; }
  .family-grid::-webkit-scrollbar { display: none; }
  .nav-btn { padding-inline: .65rem; }
  .nav-btn .icon { margin: 0 !important; }
  .fam { flex: 0 0 8.2rem; scroll-snap-align: start; }
  .variant-grid { gap: .6rem; }
  .variant-name { font-size: .76rem; padding: .45rem .5rem; gap: .35rem; }
  .step-head .title { font-size: 1.6rem; }
  .preview-foot { display: none; }
  .brand-sep, .brand-app, .live-label { display: none; }
  .toolbar-buttons { margin-left: 0; }
}

/* ---------- avvisi ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.75rem; transform: translateX(-50%); z-index: 60; margin: 0 !important;
  max-width: min(520px, calc(100vw - 2rem)); padding: .9rem 1.25rem; border-radius: .9rem; font-weight: 600;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .55); animation: toast-in .2s ease-out;
}
.toast.is-dark { background: var(--ink); color: #fff; }
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }
@media screen and (max-width: 1023px) { .toast { bottom: 5.5rem; } }

/* ---------- guida ---------- */
.modal-card { border-radius: 1.1rem; max-width: 640px; width: calc(100% - 2rem); }
.modal-card-head { background: var(--ink); border-bottom: 0; }
.modal-card-title { font-family: var(--display); font-weight: 900; text-transform: uppercase; color: #fff; font-size: 1.9rem; line-height: 1; text-shadow: 2px 2px 0 var(--azzurro); }
.modal-card-body { padding: 1.5rem 1.75rem 1.75rem; }
.content ol.help-steps:not([type]) { list-style: none; margin: 0 0 1.25rem; padding: 0; counter-reset: s; }
.content .help-steps li { counter-increment: s; position: relative; padding-left: 2.6rem; margin-bottom: .9rem; }
.content .help-steps li::before {
  content: counter(s); position: absolute; left: 0; top: .05rem; width: 1.8rem; height: 1.8rem; border-radius: .55rem;
  display: grid; place-items: center; background: var(--ink); color: var(--azzurro); font-family: var(--display); font-weight: 900; font-size: 1.05rem;
}
.content h4 { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: 1.35rem; letter-spacing: .01em; }

/* ---------- accesso ---------- */
.login-hero {
  background:
    radial-gradient(700px 420px at 15% 10%, rgba(79, 176, 214, .35), transparent 70%),
    radial-gradient(600px 400px at 90% 90%, rgba(21, 126, 151, .35), transparent 70%),
    var(--ink);
}
.login-box { max-width: 400px; margin: 0 auto; padding: 2.25rem 2rem 2rem; border-radius: 1.25rem; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .7); }
.login-wm { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: 3.6rem; line-height: .8; color: var(--ink); text-shadow: 3px 3px 0 var(--azzurro); margin: .6rem 0 1.6rem; }
