/* ==========================================================
   Salotto Italiano Saquella – demo front-end
   ========================================================== */

/* ---------- Font (Optima, convertiti da Optima.ttc) ---------- */
@font-face {
  font-family: "Saquella Optima";
  src: url("../fonts/optima-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Saquella Optima";
  src: url("../fonts/optima-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Saquella Optima";
  src: url("../fonts/optima-bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Saquella Optima";
  src: url("../fonts/optima-bolditalic.woff2") format("woff2");
  font-weight: 700; font-style: italic; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --cream: #FFF1D4;
  --red: #E12A1C;
  --brown: #552F1A;
  --red-soft: #F5B9A9;
  --frame: #E9D6A8;
  --font: "Saquella Optima", Optima, Candara, "Segoe UI", sans-serif;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--red);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- App shell (mobile first) ---------- */
.app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--cream);
}

/* Su desktop: colonna centrata a larghezza di telefono */
@media (min-width: 600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--frame);
  }
  .app {
    width: 400px;
    height: 820px;
    max-height: calc(100vh - 48px);
    border: 1.5px solid var(--red);
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(85, 47, 26, .18);
  }
}

/* ---------- Screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: clamp(20px, 5vh, 36px) clamp(18px, 6vw, 28px) 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cream);
}
.screen.is-active {
  display: flex;
  animation: screen-in .35s ease both;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.logo {
  display: block;
  width: 112px;
  height: auto;
  margin: 0 auto 18px;
}

.title {
  margin: 0 0 18px;
  font-size: 19px;
  font-style: italic;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.lead {
  margin: 0 0 26px;
  font-size: 17px;
  line-height: 1.4;
  text-align: center;
  letter-spacing: .01em;
}

.body-text {
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
  color: var(--red);
}
.body-text p { margin: 0 0 10px; }
.body-text .emph {
  display: inline-block;
  margin: 4px 0;
  font-size: 17px;
  font-weight: 700;
}

.hint {
  margin: 4px 0 14px;
  font-size: 11px;
  opacity: .9;
}

/* ---------- Navigazione in fondo allo schermo ---------- */
.nav {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
}
.nav--single { padding-top: 24px; }
.nav--single .btn { flex: 1 1 100%; }

/* ---------- Bottoni ---------- */
.btn {
  display: block;
  text-align: center;
  text-decoration: none;
  flex: 1 1 0;
  min-height: 46px;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 15px;
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .2s, color .2s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible,
.option:focus-visible,
.screen:focus-visible,
.link-reset:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}
.btn--outline {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
}
.btn--outline:hover { background: rgba(225, 42, 28, .08); }
.btn--solid {
  background: var(--red);
  color: var(--cream);
  border: 1.5px solid var(--red);
}
.btn--solid:hover { background: #c92216; }

/* ---------- Opzioni (date, slot) ---------- */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  display: block;
  width: 100%;
  padding: 18px 16px;
  font-family: var(--font);
  font-size: 19px;
  text-transform: uppercase;
  text-align: center;
  color: var(--red);
  background: transparent;
  border: 1.5px solid var(--red);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
/* Date e fasce orarie: stessa altezza, anche quando una è esaurita */
.options .option:not(.option--choice) {
  height: 64px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.option small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: lowercase;
}
.option:hover:not([disabled]) { background: rgba(225, 42, 28, .08); }
/* Anche con il mouse sopra, il pulsante selezionato resta rosso */
.option.is-selected,
.option.is-selected:hover {
  background: var(--red);
  color: var(--cream);
}
.option[disabled] {
  cursor: not-allowed;
  background: var(--red-soft);
  border-color: transparent;
  color: #C9573F;
}
.option[disabled] small {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Scelta con 2 bottoni più grandi */
.options--choice { margin-top: 12px; }
.option--choice { padding: 22px 16px; font-size: 18px; }

/* ---------- Form ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-style: italic;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}
.field input[type="text"],
.field input[type="email"] {
  display: block;
  width: 100%;
  padding: 14px;
  font-family: var(--font);
  font-size: 16px;
  text-align: center;
  color: var(--brown);
  background: transparent;
  border: 1.5px solid var(--red);
  border-radius: var(--radius);
  outline: none;
}
.field input::placeholder {
  color: var(--red-soft);
  font-style: italic;
  text-transform: uppercase;
}
.field input:focus { background: rgba(225, 42, 28, .06); }
.field.has-error input { background: rgba(225, 42, 28, .08); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}
.check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--red);
}
.check a { color: #1f63c9; }

.error {
  min-height: 0;
  margin: 0;
  font-size: 12px;
  font-style: italic;
  color: var(--brown);
}
.error:not(:empty) { margin: 4px 0 10px; }

/* ---------- Splash ---------- */
.screen--splash {
  justify-content: flex-start;
  padding-top: 0;
  cursor: pointer;
  align-items: stretch;
}
.pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='74' height='40'><text x='2' y='28' font-family='Optima,Candara,serif' font-size='22' fill='%23F6E2B4'>170</text></svg>");
  background-size: 74px 40px;
}
.splash__lockup {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 28%;
}
.splash__logo {
  width: 210px;
  margin: 0 0 6px;
}
.splash__anniversary {
  margin: 0;
  text-align: center;
  color: var(--red);
  line-height: .95;
}
.splash__number {
  display: block;
  font-size: 96px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.splash__word {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.splash__cta {
  position: relative;
  z-index: 1;
  margin: 26px 0 0;
  font-size: 15px;
  font-style: italic;
  font-weight: 700;
  text-align: center;
  color: var(--brown);
  text-transform: uppercase;
}
.splash__wave {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 26%;
  pointer-events: none;
}
.splash__wave path { fill: var(--red); }

/* ---------- Thanks ---------- */
.screen--thanks > * { position: relative; }
.screen--thanks .pattern { position: absolute; opacity: .9; }
/* Testo al centro dello spazio disponibile */
.thanks__text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.thanks__text .lead { margin-bottom: 0; }
/* Pulsante in fondo */
.thanks__main { padding-top: 24px; }
.thanks__main .btn { width: 100%; }

/* ---------- Riquadro ticket ---------- */
.ticket-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(85, 47, 26, .72);
}
.ticket-modal[hidden] { display: none; }
.ticket-modal__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  max-height: 100%;
}
.ticket-modal img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 110px);
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
}
.ticket-modal__close {
  flex: 0 0 auto;
  min-width: 160px;
  background: var(--cream);
  color: var(--red);
  border-color: var(--cream);
}
.ticket-modal__close:hover { background: #fff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--cream);
  background: var(--brown);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  text-align: center;
}

/* ---------- Telefoni piccoli ---------- */
@media (max-width: 360px) {
  .logo { width: 96px; margin-bottom: 14px; }
  .lead { font-size: 15px; }
  .option { font-size: 17px; }
  .splash__logo { width: 170px; }
  .splash__number { font-size: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-active { animation: none; }
  * { transition: none !important; }
}
