/* Variabili condivise: cambia questi valori per personalizzare entrambe le pagine. */
:root { --ink: #292638; --muted: #747080; --lavender: #e2d5f3; --purple: #59416e; --navy: #243858; --line: #e9e4ee; --background: var(--background); --surface: #ffffff; --on-primary: #ffffff; --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; padding: 48px 28px; background: var(--background); color: var(--ink); font-family: var(--font-body); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--purple); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #9273b3; outline-offset: 4px; }
.page-header { max-width: 1320px; margin: 0 auto 36px; }
.eyebrow { color: var(--purple); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1 { font-size: clamp(32px, 4vw, 48px); letter-spacing: -.045em; margin: 12px 0; line-height: 1.12; }
h1, h2, h3, h4 { font-family: var(--font-heading); }
h2 { font-size: 21px; letter-spacing: -.025em; }
p { line-height: 1.6; }
.subtitle, .hint { color: var(--muted); }
.subtitle { margin: 0; }
/* Flexbox affianca il contenuto principale e il riquadro laterale. */
.gallery-layout { display: flex; align-items: flex-start; gap: 24px; max-width: 1320px; margin: auto; }
.gallery-panel { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 26px; min-height: 360px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.panel-heading h2 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 10px 17px; font-size: 14px; transition: background .2s; }
.filter-btn.active, .filter-btn:hover { background: var(--lavender); border-color: var(--lavender); color: var(--purple); }
.gallery-grid { columns: 3 210px; column-gap: 16px; }
.gallery-item { display: block; width: 100%; padding: 0; border: 0; background: #f4eff8; margin-bottom: 16px; break-inside: avoid; border-radius: 14px; overflow: hidden; }
.gallery-item img { width: 100%; height: auto; display: block; transition: transform .25s; }
@media (prefers-reduced-motion: no-preference) { .gallery-item:hover img { transform: scale(1.025); } }
#loading { color: var(--muted); text-align: center; margin: 36px 0; }
.upload-panel { flex: 0 0 240px; padding: 28px; border: 1px solid #e3d7ee; border-radius: 24px; background: var(--lavender); }
.upload-panel p { font-size: 14px; color: var(--purple); }
.upload-button { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: var(--lavender); color: var(--purple); text-decoration: none; }
.upload-button:hover { background: color-mix(in srgb, var(--lavender) 85%, var(--purple)); }
.upload-button svg { width: 24px; height: 24px; }
.upload-panel small { display: block; color: var(--purple); margin-top: 18px; }
.manage-link { display: inline-block; margin-top: 28px; font-size: 13px; text-underline-offset: 4px; }
/* Gestione: i campi a sinistra, l’anteprima a destra. */
.manage-page { max-width: 1150px; margin: auto; }
.manage-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.manage-heading h2 { margin: 0; }
/* Il login occupa tutta la finestra: due colonne della stessa larghezza. */
.manage-body.is-login { padding: 0; background: var(--surface); }
.is-login .manage-page { max-width: none; }
.login-layout { display: flex; min-height: 100svh; }
.login-form-panel, .login-art-panel { flex: 1 1 50%; min-width: 0; background: var(--surface); }
.login-form-panel { display: flex; flex-direction: column; padding: 40px clamp(28px, 5vw, 90px); }
.login-brand .back-link { display: block; margin-bottom: 28px; }
.login-brand .eyebrow { display: block; }
.login-brand h1 { font-size: clamp(30px, 3.2vw, 48px); overflow-wrap: anywhere; }
.login-form-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 52px 0; }
.login-form-panel form { width: 100%; max-width: 340px; }
.login-form-panel h2 { font-size: 32px; letter-spacing: -.035em; margin: 12px 0; overflow-wrap: anywhere; }
.login-form-panel .hint { margin-bottom: 24px; }
.login-submit { width: 100%; margin-top: 18px; }
.login-art-panel { position: relative; overflow: hidden; }
.login-art-panel img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.management-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.management-header .back-link { margin-bottom: 16px; }
.manage-tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.manage-tab { border: 0; border-radius: 999px; background: transparent; color: var(--muted); padding: 12px 24px; font-size: 15px; }
.manage-tab.active { background: var(--lavender); color: var(--purple); }
.album-tools { display: flex; align-items: end; gap: 16px; margin-top: 24px; }
.album-tools > div:first-child { flex: 1; }
.album-tools > div:last-child { flex: 0 0 200px; }
.album-pills { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; max-height: 230px; overflow-y: auto; padding: 5px; }
.album-pill { border: 1px solid #d9c9ea; background: var(--lavender); color: var(--purple); padding: 12px 20px; border-radius: 999px; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.album-pill:hover { background: var(--lavender); }
.image-editor { border-bottom: 1px solid var(--line); padding-bottom: 24px; }
.login-mini-preview { display: flex; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 24px; min-height: 300px; }
.login-mini-preview > div { width: 60%; min-width: 0; padding: 18px; align-self: center; }
.login-mini-preview img { display: block; width: 40%; object-fit: contain; background: var(--surface); }
.login-mini-preview h3 { font-size: 21px; }
.login-mini-preview .pill { width: 100%; min-height: 36px; padding: 8px; margin-top: 12px; overflow-wrap: anywhere; }
.preview-password { background: #f5f3f7; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.editor-title { margin: 32px 0 0; }
.add-album { border: 0; flex-shrink: 0; font-size: 32px; font-weight: 400; }
.manage-columns { display: flex; gap: 24px; align-items: flex-start; }
.text-editor { flex: 1; min-width: 0; }
.text-editor textarea { display: block; width: 100%; resize: vertical; padding: 12px; font: inherit; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--background); }
.text-editor .field-label { margin-top: 24px; }
.preview-panel { flex: 0 0 40%; position: sticky; top: 20px; }
.preview-panel h3 { font-size: 27px; letter-spacing: -.03em; margin: 12px 0; }
.preview-panel h4 { font-size: 18px; margin-bottom: 12px; }
.preview-panel p, .preview-panel small { overflow-wrap: anywhere; }
.preview-home, .preview-upload { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.preview-share { background: var(--lavender); padding: 16px; border-radius: 16px; margin-top: 20px; }
.preview-share h4 { margin-top: 0; }
.album-row { margin-top: 24px; }
.album-row small { display: block; margin-top: 8px; }
.save-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--background); border-top: 1px solid var(--line); padding: 18px 0; margin-top: 24px; position: sticky; bottom: 0; }
.save-bar span { font-size: 13px; color: var(--muted); }
#manageStatus { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
/* Pagina di caricamento e pulsanti a pillola. */
.upload-page { max-width: 720px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 36px; text-decoration: none; font-size: 14px; }
.upload-card { margin-top: 30px; padding: 32px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 10px; }
select, .password-input { padding: 13px 16px; background: var(--background); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); width: 100%; }
.pill-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 22px; min-height: 48px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14px; text-decoration: none; }
.pill svg { width: 18px; height: 18px; }
.pill-navy { background: var(--navy); color: var(--on-primary); }
.pill-navy:hover { background: color-mix(in srgb, var(--navy) 85%, var(--on-primary)); }
.pill-white { background: var(--surface); border-color: #d9d4e1; color: var(--ink); }
.pill-white:hover { background: #f8f5fc; }
.pill-lavender { background: var(--lavender); color: var(--purple); }
button:disabled { opacity: .5; cursor: default; }
.hint { font-size: 13px; }
.file-summary { padding: 16px; border-radius: 12px; background: var(--background); margin-top: 20px; overflow-wrap: anywhere; }
.submit-row { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 24px; }
#results { padding-left: 20px; }
#results li { margin-top: 12px; overflow-wrap: anywhere; line-height: 1.5; }
/* Le finestre native dialog gestiscono focus ed Esc. */
dialog::backdrop { background: #21182a88; backdrop-filter: blur(5px); }
.password-dialog { width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 24px; padding: 28px; color: var(--ink); }
.password-dialog h2 { margin: 0 0 10px; }
.password-dialog .pill-row { justify-content: flex-end; }
#lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; }
#lightbox::backdrop { background: #000e; }
#lightbox img { display: block; width: 100%; height: 75vh; object-fit: contain; touch-action: pan-y pinch-zoom; }
.lightbox-stage { position: relative; width: 90vw; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 1px solid #ffffff66; border-radius: 50%; background: #0009; color: white; font-size: 32px; }
.lightbox-prev { left: 4px; }
.lightbox-next { right: 4px; }
#lightboxCaption { color: white; text-align: center; margin: 12px 0; overflow-wrap: anywhere; }
.lightbox-close { display: block; margin-left: auto; margin-bottom: 10px; border: 0; border-radius: 999px; padding: 10px 18px; background: var(--surface); }
/* Su schermi piccoli i due riquadri si dispongono in verticale. */
@media (max-width: 760px) {
  body { padding: 28px 16px; }
  .gallery-layout { flex-direction: column; }
  .gallery-panel, .upload-panel { width: 100%; }
  .upload-panel { flex-basis: auto; }
  .gallery-panel, .upload-card { padding: 20px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .manage-columns { flex-direction: column; }
  .text-editor, .preview-panel { width: 100%; flex-basis: auto; position: static; }
  .save-bar { flex-wrap: wrap; }
  .login-layout { flex-direction: column; }
  .login-form-panel { min-height: 100svh; padding: 28px 24px; flex-basis: auto; }
  .login-art-panel { min-height: 350px; flex-basis: auto; }
  .login-art-panel img { height: 100%; }
  .album-tools { flex-direction: column; align-items: stretch; }
  .album-tools > div:last-child { flex-basis: auto; }
  .manage-tab { padding: 12px 18px; }
}

/* La stessa anteprima ospita colori e famiglie di font, senza cambiare i controlli. */
.theme-colors { display: grid; gap: 12px; margin-top: 28px; }
.color-control { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.color-control input { width: 44px; height: 36px; padding: 0; border: 0; background: transparent; cursor: pointer; flex-shrink: 0; }
.color-control span { flex: 1; font-size: 13px; }
.color-control code { font-size: 11px; color: var(--muted); }
.appearance-sample { font-family: var(--font-body); background: var(--background); color: var(--ink); border-radius: 18px; padding: 22px; margin-top: 20px; overflow-wrap: anywhere; }
.appearance-sample .sample-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 20px; }
.appearance-sample h3 { font-size: 30px; font-weight: 600; }
.appearance-sample h4 { margin-top: 0; }
