/* =========================================================================
   Stramarconia 2026 — Photo Booth
   Design tokens allineati al brand AutomateWork (regola 90/10: neutri + blu).
   Mobile-first. Font: Satoshi con fallback di sistema (nessuna dipendenza di
   rete: la Satoshi va eventualmente self-hostata in assets/fonts, vedi README).
   ========================================================================= */

:root {
  --deep-black: #0A0A0C;
  --graphite:   #18181B;
  --steel:      #6B6B73;
  --mist:       #E6E6EB;
  --white:      #FFFFFF;
  --blue:       #2563EB;
  --blue-hover: #3B82F6;

  --radius: 12px;
  --radius-lg: 18px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: 'Satoshi', 'Inter', 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* L'attributo [hidden] deve sempre vincere sulle regole display: * sotto. */
[hidden] { display: none !important; }

/* Font caratteristico per data e hashtag (self-hostato per l'offline). */
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/oswald-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/oswald-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Permanent Marker';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/permanent-marker.woff2') format('woff2');
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--deep-black);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }

/* ----------------------------- Screens ----------------------------------- */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: calc(24px + var(--safe-top)) 22px calc(24px + var(--safe-bottom));
}
.screen[hidden] { display: none; }

/* ----------------------------- Buttons ----------------------------------- */

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  padding: 15px 22px;
  cursor: pointer;
  transition: background-color .18s ease, transform .06s ease, border-color .18s ease;
  width: 100%;
}
.btn:active { transform: scale(0.985); }

.btn--primary { background: var(--blue); color: var(--white); }
.btn--primary:hover { background: var(--blue-hover); }

.btn--ghost {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(230, 230, 235, 0.28);
}
.btn--ghost:hover { border-color: rgba(230, 230, 235, 0.5); }

.btn--lg { padding: 18px 24px; font-size: 17px; }
.btn--sm { padding: 11px 16px; font-size: 14px; width: auto; }

.link-reset {
  appearance: none;
  background: none;
  border: 0;
  color: var(--steel);
  font-family: inherit;
  font-size: 13px;
  padding: 8px;
  cursor: pointer;
  align-self: center;
}
.link-reset:hover { color: var(--mist); }

.cta-link {
  display: inline-block;
  color: var(--blue-hover);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.cta-link:hover { text-decoration: underline; }

/* ----------------------------- Intro ------------------------------------- */

.screen--intro { justify-content: space-between; }

.intro__inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  gap: 24px;
}

.intro__badge {
  display: flex;
  align-items: center;
  gap: 12px;
}
.intro__mono { width: 92px; height: auto; opacity: 0.92; }
.intro__sponsor {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel);
}

.intro__hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: auto;
  margin-bottom: auto;
}
.intro__logo {
  width: 100%;
  max-width: 380px;
  height: auto;
  margin-bottom: 4px;
}
.intro__title {
  font-size: clamp(40px, 12vw, 60px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.intro__subtitle {
  margin: 12px 0 0;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mist);
}
.intro__accent {
  display: block;
  width: 56px;
  height: 3px;
  border-radius: 3px;
  background: var(--blue);
  margin: 22px 0;
}
.intro__body {
  margin: 0;
  max-width: 32ch;
  font-size: 16px;
  line-height: 1.55;
  color: var(--steel);
}

/* ----------------------------- Camera / Stage ---------------------------- */

.screen--camera {
  justify-content: center;
  align-items: center;
  padding: 0;
  background: #000;
}

/* Card Polaroid: aspect e riquadro foto coincidono col canvas del compositor. */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1080 / 1480;
  max-height: calc(100dvh - 150px);
  margin: auto;
  overflow: hidden;
  background: #FFFFFF;
  border-radius: 6px;
}
/* La foto occupa il riquadro 1:1 dentro la card (54,292 / 972 su 1080x1480). */
.stage__video {
  position: absolute;
  left: 5%;
  top: 19.73%;
  width: 90%;
  height: 65.68%;
  object-fit: cover;
  background: #D8D8DC;
}
.stage__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(132px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
}
.controls > * { justify-self: center; }
.controls__spacer { width: 52px; height: 52px; }

/* Controlli flottanti agli angoli in alto: X (chiudi) a sinistra, ruota-camera a
   destra. Stanno nella fascia superiore, per non sovrapporsi ai loghi della cornice. */
.switch-float,
.close-float {
  position: absolute;
  top: calc(16px + var(--safe-top));
  z-index: 6;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.6);
  border: 1px solid rgba(230, 230, 235, 0.22);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.switch-float { right: 16px; }
.close-float { left: 16px; }
.switch-float:active,
.close-float:active { transform: scale(0.94); }

.control {
  appearance: none;
  background: rgba(24, 24, 27, 0.6);
  border: 1px solid rgba(230, 230, 235, 0.22);
  color: var(--white);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.control--icon { width: 52px; height: 52px; }
.control--label {
  min-width: 52px;
  height: 52px;
  padding: 0 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.control:active { transform: scale(0.94); }

.shutter {
  appearance: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.shutter__core {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--white);
  transition: transform .08s ease, background-color .12s ease;
}
.shutter:active .shutter__core { transform: scale(0.88); background: var(--mist); }

/* ----------------------------- Preview ----------------------------------- */

.screen--preview {
  overflow-y: auto;
  justify-content: flex-start;
  gap: 18px;
}

.preview__frame {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}
.preview__img {
  max-height: 60dvh;
  width: auto;
  max-width: 100%;
  border-radius: 6px;
  background: #FFFFFF;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.preview__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.preview__row {
  display: flex;
  gap: 12px;
}
.preview__row .btn { flex: 1; }

.hint {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--mist);
  background: var(--graphite);
  border: 1px solid rgba(230, 230, 235, 0.14);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.hint strong { color: var(--white); }

.ios-share {
  background: var(--graphite);
  border: 1px solid rgba(230, 230, 235, 0.14);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ios-share__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--steel);
}
.ios-share__text strong { color: var(--white); }
.ios-share .btn { align-self: flex-start; }

/* ----------------------------- Finale / Branding ------------------------- */

.final {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(230, 230, 235, 0.1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contest {
  background: var(--graphite);
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contest__headline { margin: 0; font-size: 17px; font-weight: 700; }
.contest__body { margin: 0; font-size: 14px; color: var(--steel); line-height: 1.5; }

.final__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.final__mono { width: 78px; height: auto; opacity: 0.85; }
.final__line { margin: 0; font-size: 14px; color: var(--steel); }

/* ----------------------------- Errore ------------------------------------ */

.screen--error { justify-content: center; align-items: center; text-align: center; }
.error__inner { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 34ch; }
.error__mark { color: var(--steel); }
.error__title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.error__body { margin: 0; font-size: 15px; line-height: 1.55; color: var(--steel); }
.error__inner .btn { width: auto; margin-top: 4px; }

/* ----------------------------- Larghezze maggiori ------------------------ */

@media (min-width: 620px) {
  .intro__inner, .preview__actions, .final { max-width: 460px; width: 100%; margin-left: auto; margin-right: auto; }
  .screen--preview { align-items: center; }
}
