@font-face {
  font-family: 'Brice Black';
  src: url('assets/Brice-Black.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('assets/fonts/poppins-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('assets/fonts/poppins-900.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('assets/fonts/poppins-900italic.woff2') format('woff2');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('assets/fonts/roboto-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('assets/fonts/roboto-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('assets/fonts/instrument-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('assets/fonts/instrument-400italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('assets/fonts/garamond-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('assets/fonts/garamond-500italic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #000;
  --paper: #fff;
  --green: #00c675;
  --pink: #ff9cd2;
  --yellow: #ffda22;
  --red: #ff2524;
  --heading: 'Poppins', sans-serif;
  --body: 'Roboto', sans-serif;
  --serif: 'Times New Roman', Times, serif;
  --shadow: 3px 3px 0 var(--ink);
  --r-btn: .5rem;
  --r-card: 1rem;
}

* { box-sizing: border-box; }

/* l'attributo hidden deve vincere sempre, anche su elementi con display in CSS */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--pink);
  -webkit-font-smoothing: antialiased;
}
body[data-screen="foto"],
body[data-screen="dettagli"],
body[data-screen="frase"] { background: var(--paper); }

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 6px;
}
.back {
  width: 42px; height: 42px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.back:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.dots { display: flex; gap: 7px; }
.dots span {
  width: 11px; height: 11px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}
.dots span.on { background: var(--green); }

/* ---------- screens ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 22px 30px;
  position: relative;
}

/* ---------- typography ---------- */
.display {
  font-family: var(--heading);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: clamp(34px, 9.5vw, 42px);
  line-height: 1.04;
  letter-spacing: .01em;
  color: var(--yellow);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3.5px 3.5px 0 var(--ink);
  margin: 0;
}
.display.small { font-size: clamp(30px, 8vw, 36px); margin-bottom: 18px; }

.step-title {
  font-family: var(--heading);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: 27px;
  margin: 10px 0 6px;
}
.step-sub { margin: 0 0 20px; color: #4a4a4a; font-size: 15px; line-height: 1.45; }

.note { font-size: 12.5px; color: rgba(0,0,0,.65); text-align: center; margin: 14px 0 0; line-height: 1.45; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--heading);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: 15px;
  padding: 16px 22px;
  border: 2px solid var(--ink);
  border-radius: var(--r-btn);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform .07s, box-shadow .07s;
  user-select: none;
  display: block;
  width: 100%;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .35; cursor: default; }
.btn:disabled:active { transform: none; box-shadow: var(--shadow); }
.btn.primary { background: var(--green); color: #fff; }
.btn.secondary { background: var(--paper); color: var(--ink); }

.link-btn {
  background: none;
  border: none;
  padding: 4px 0;
  font: 700 14px var(--body);
  color: var(--ink);
  text-decoration: underline wavy var(--green) 2px;
  text-underline-offset: 5px;
  cursor: pointer;
}
.link-btn.center { margin: 6px auto 0; display: block; }

.cta-bottom { margin-top: auto; padding-top: 24px; display: grid; gap: 12px; }

/* ---------- home ---------- */
.home { text-align: center; align-items: center; justify-content: center; gap: 18px; overflow: hidden; }
.home .logo-img { width: min(80%, 330px); margin-top: 22px; }
.home .sub { font-size: 16px; line-height: 1.5; margin: 0; max-width: 34ch; }
.cta-home { width: 100%; max-width: 330px; }
.event {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  font-family: var(--heading);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12.5px;
  letter-spacing: .06em;
  margin-top: 10px;
  color: var(--ink);
  text-decoration: none;
}
.event span {
  text-decoration: underline wavy var(--green) 2px;
  text-underline-offset: 5px;
}
.event img { width: 30px; height: 30px; }

a.btn { text-decoration: none; }

.event-card {
  margin: 0 0 22px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 22px 18px 20px;
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.event-card img { width: 46px; height: 46px; }
.event-card h3 {
  font-family: var(--heading);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: 20px;
  margin: 0;
}
.event-card p { margin: 0; font-size: 14.5px; line-height: 1.5; color: #333; }
.event-card .btn { margin-top: 8px; }
.privacy-link {
  font-size: 12px;
  color: rgba(0,0,0,.55);
  text-decoration: underline;
  margin-top: 2px;
}
.note a { color: inherit; }
.leaf { position: absolute; width: 84px; pointer-events: none; }
.leaf-a { top: 6%; left: -26px; transform: rotate(-24deg); }
.leaf-b { bottom: 9%; right: -22px; transform: rotate(18deg) scaleX(-1); }

/* ---------- foto ---------- */
.upload-card {
  border: 2px dashed var(--ink);
  border-radius: var(--r-card);
  background: var(--paper);
  padding: 30px 22px;
  display: grid;
  gap: 14px;
  justify-items: center;
}
.upload-card .leaf-ico { width: 64px; margin-bottom: 4px; }
.btn.wide { width: 100%; }

/* ---------- dettagli ---------- */
.photoRow { display: flex; align-items: center; gap: 14px; margin: 2px 0 20px; }
#thumb {
  width: 62px; height: 62px;
  object-fit: cover;
  border: 2px solid var(--ink);
  border-radius: var(--r-btn);
  box-shadow: var(--shadow);
  background: var(--pink);
}
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-family: var(--heading);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .07em;
  margin-bottom: 8px;
}
.field > label small { color: #767676; font-weight: 800; text-transform: none; letter-spacing: 0; font-size: 12px; }
.field input[type=text],
.field input[type=number] {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: var(--r-btn);
  padding: 13px 14px;
  font-size: 16px;
  font-family: var(--body);
  background: var(--paper);
}
.field input:focus { outline: 3px solid var(--green); outline-offset: 1px; }
.field input.invalid { border-color: var(--red); }
.field input.invalid:focus { outline-color: var(--red); }
.note.error { color: var(--red); font-weight: 700; text-align: left; margin: -6px 0 14px; }
.ageRow { display: flex; gap: 12px; align-items: center; }
.ageRow input[type=number] { width: 84px; }

.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { cursor: pointer; position: relative; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-block;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-family: var(--heading);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: var(--paper);
}
.pill input:checked + span { background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }
.pill input:focus-visible + span { outline: 3px solid var(--green); }

/* ---------- frasi ---------- */
.phrase {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: 14px 16px;
  margin: 0 0 12px;
  cursor: pointer;
  font-family: var(--body);
  color: var(--ink);
  position: relative;
}
.phrase .tag {
  font-family: var(--heading);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12.5px;
  letter-spacing: .05em;
  display: block;
  margin-bottom: 6px;
}
.phrase p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.42;
  color: #2c2c2c;
}
.phrase.selected {
  background: var(--yellow);
  box-shadow: var(--shadow);
}
.phrase.selected::after {
  content: '';
  position: absolute;
  top: -10px; right: -8px;
  width: 26px; height: 26px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/14px no-repeat;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: center;
  font-family: var(--heading);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .06em;
  color: #767676;
  margin: 20px 0 16px;
}
.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  border-top: 2px solid rgba(0, 0, 0, .15);
}

/* ---------- frase custom ---------- */
.customBox {
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 16px 16px 4px;
  margin: -4px 0 14px;
}
.customBox .count { float: right; font-weight: 800; color: #999; font-size: 11px; letter-spacing: .04em; }
.customBox textarea {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: var(--r-btn);
  padding: 12px 14px;
  font-size: 16px;
  font-family: var(--body);
  background: var(--paper);
  resize: none;
}
.customBox textarea:focus { outline: 3px solid var(--green); outline-offset: 1px; }

/* ---------- risultato ---------- */
.result { padding-top: 6px; }
#preview {
  display: block;
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: var(--r-btn);
  box-shadow: 4px 4px 0 var(--ink);
  background: var(--paper);
}
.result .note { color: rgba(0,0,0,.6); }
.iosHint { display: none; }
@supports (-webkit-touch-callout: none) { .iosHint { display: block; } }

/* ---------- pagine legali ---------- */
body.legal { background: #fff; }
.legal-wrap { max-width: 640px; margin: 0 auto; padding: 32px 22px 60px; }
.legal-wrap h1 { font-family: var(--heading); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 26px; margin: 18px 0 6px; }
.legal-wrap h2 { font-family: var(--heading); font-weight: 800; text-transform: uppercase; font-size: 15px; letter-spacing: .05em; margin: 28px 0 8px; }
.legal-wrap p, .legal-wrap li { font-size: 15px; line-height: 1.6; color: #222; }
.legal-wrap .updated { color: #777; font-size: 13px; }
.legal-wrap a { color: var(--ink); text-decoration: underline wavy var(--green) 2px; text-underline-offset: 4px; }
.legal-wrap .logo-sm { width: 150px; display: block; }
.legal-wrap .back-link { margin-top: 36px; }

/* ---------- gallery riservata ---------- */
body.gallery { background: #fff; }
.gal-wrap { max-width: 1100px; margin: 0 auto; padding: 22px 20px 60px; }
.gal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.gal-head .logo-sm { width: 140px; display: block; }
.gal-title { font-family: var(--heading); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 20px; margin: 0; }
.login-card { max-width: 360px; margin: 12vh auto 0; display: grid; gap: 14px; border: 2px solid var(--ink); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 26px 22px; background: #fff; }
.login-card h1 { font-family: var(--heading); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 22px; margin: 0; }
.login-card .logo-sm { width: 150px; display: block; }
.login-card input { border: 2px solid var(--ink); border-radius: var(--r-btn); padding: 13px 14px; font-size: 16px; font-family: var(--body); width: 100%; }
.login-card input:focus { outline: 3px solid var(--green); outline-offset: 1px; }
.login-error { color: var(--red); font-size: 13.5px; font-weight: 700; margin: 0; }
.login-sub { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 6px; }
.chip { border: 2px solid var(--ink); border-radius: 999px; padding: 8px 14px; font-family: var(--heading); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: #fff; cursor: pointer; }
.chip.on { background: var(--green); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.gal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; }
.muted { color: #777; font-size: 13.5px; }
.gal-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 700px) {
  .gal-grid { grid-template-columns: repeat(2, 1fr); }
}
.gal-card a.imgLink { display: block; cursor: zoom-in; }
.gal-card { border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 3px 3px 0 var(--ink); display: flex; flex-direction: column; }
.gal-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; border-bottom: 2px solid var(--ink); background: #f3f3f3; }
.gal-meta { padding: 14px 14px 16px; font-size: 14px; line-height: 1.5; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.gal-meta b { font-size: 15px; }
.gal-meta .tagline { font-family: var(--heading); font-weight: 800; text-transform: uppercase; font-size: 10.5px; letter-spacing: .04em; color: #666; }
.gal-meta .custom-txt { font-family: var(--serif); font-style: italic; color: #444; }
.btn.mini { padding: 9px 10px; font-size: 11px; box-shadow: 2px 2px 0 var(--ink); margin-top: auto; }
.fmt-row { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.fmt-row .btn.mini { flex: 1; margin-top: 0; }
.bulk { display: flex; gap: 8px; align-items: center; }
.bulk select {
  border: 2px solid var(--ink);
  border-radius: var(--r-btn);
  padding: 8px 10px;
  font-family: var(--heading);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  background: #fff;
}
.gal-more { margin: 26px auto 0; max-width: 280px; }

/* ---------- desktop ---------- */
@media (min-width: 700px) {
  #app { padding-top: 12px; }
  .home .logo-img { width: 360px; }
  .leaf { width: 110px; }
  .leaf-a { left: -34px; }
  .leaf-b { right: -30px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .back { transition: none; }
}
