/* ============================================================
   THEME.CSS — Brand Poste Italiane, colori, tipografia, radius
   ============================================================ */

/* ── Helvetica Neue LT Std (locale) ─────────────────────── */
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-UltLt.otf') format('opentype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-UltLtIt.otf') format('opentype');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-Th.otf') format('opentype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-ThIt.otf') format('opentype');
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-Lt.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-LtIt.otf') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-Roman.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-It.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-Md.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-MdIt.otf') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-Bd.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-BdIt.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-Hv.otf') format('opentype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-HvIt.otf') format('opentype');
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-Blk.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue LT Std';
  src: url('/assets/fonts/helvetica-neue/HelveticaNeueLTStd-BlkIt.otf') format('opentype');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ── Brand colors ───────────────────────────────────────── */
  --color-primary:      #00205B;   /* Blu Poste */
  --color-primary-dark: #001540;
  --color-primary-light:#003399;
  --color-accent:       #FF6600;   /* Arancio PostePay */
  --color-accent-dark:  #CC5200;
  --color-yellow:       #FFD700;
  --color-green:        #00873C;   /* PCL / logistica */
  --color-green-dark:   #005A28;

  --color-bg:           #F0F2F5;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #E8EBF0;
  --color-text:         #1A1A2E;
  --color-text-light:   #555F7A;
  --color-text-inv:     #FFFFFF;
  --color-border:       rgba(0, 32, 91, 0.12);

  /* ── Categoria colori ───────────────────────────────────── */
  --color-pagamenti:    #00205B;   /* Blu — PostePay */
  --color-logistica:    #00873C;   /* Verde — PCL */
  --color-spedizioni:   #FF6600;   /* Arancio — PosteDelivery */

  /* ── Tipografia ─────────────────────────────────────────── */
  --font-primary: 'Helvetica Neue LT Std', 'Helvetica Neue', 'Nunito Sans', 'Segoe UI', Arial, sans-serif;
  --font-weight-regular: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  /* ── Border radius ──────────────────────────────────────── */
  --radius-sm: calc(var(--stage-h) * 0.008);
  --radius-md: calc(var(--stage-h) * 0.016);
  --radius-lg: calc(var(--stage-h) * 0.028);
  --radius-xl: calc(var(--stage-h) * 0.040);
  --radius-full: 9999px;

  /* ── Shadows ────────────────────────────────────────────── */
  --shadow-sm: 0 2px 8px rgba(0,32,91,0.10);
  --shadow-md: 0 6px 24px rgba(0,32,91,0.15);
  --shadow-lg: 0 16px 48px rgba(0,32,91,0.22);
}

/* ── Tipografia globale ────────────────────────────────── */
body {
  font-size: var(--font-size-sm);
  line-height: 1.5;
  font-weight: var(--font-weight-regular);
}

h1, h2, h3, h4 {
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

/* ── Bottoni primari ────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-accent);
  color: #fff;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-sm);
}

.btn-primary.large {
  font-size: var(--font-size-lg);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  color: var(--color-primary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-full);
  transition: transform 0.12s ease;
}

.btn-secondary:active {
  transform: scale(0.96);
}

/* ── Tile categoria ─────────────────────────────────────── */
.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  text-align: center;
  padding: var(--space-md);
  box-shadow: var(--shadow-md);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  cursor: pointer;
}

.category-tile:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-sm);
}

.category-tile .tile-icon {
  width: calc(var(--stage-h) * 0.10);
  height: calc(var(--stage-h) * 0.10);
}

.category-tile.pagamenti { background: var(--color-pagamenti); }
.category-tile.logistica  { background: var(--color-logistica); }
.category-tile.spedizioni { background: var(--color-spedizioni); }

/* ── Sub-tile contenuto ─────────────────────────────────── */
.content-tile {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-accent);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.content-tile:active {
  transform: scale(0.97);
  box-shadow: none;
}

.content-tile .tile-icon-sm {
  width: calc(var(--stage-h) * 0.06);
  height: calc(var(--stage-h) * 0.06);
  flex-shrink: 0;
}

.content-tile .tile-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  line-height: 1.3;
}

.content-tile .tile-type-badge {
  margin-left: auto;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-light);
  flex-shrink: 0;
}

/* Badge tipo PDF / VIDEO */
.badge-pdf   { color: var(--color-accent); }
.badge-video { color: var(--color-green); }

/* ── Placeholder content ────────────────────────────────── */
.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-md);
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  text-align: center;
  padding: var(--space-xl);
}

.placeholder-content .placeholder-icon {
  width: calc(var(--stage-h) * 0.12);
  opacity: 0.3;
}

/* ── Btn icon (dentro bottoni primari) ──────────────────── */
.btn-icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  /* L'SVG ha stroke=currentColor — eredita il colore del bottone */
  filter: brightness(0) invert(1);
}

/* ── Home landscape: header logos ───────────────────────── */
.home-landscape .home-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.home-landscape .home-logo-main {
  height: calc(var(--stage-h) * 0.075);
  width: auto;
}

.home-landscape .home-sub-logos {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex: 1;
}

.home-landscape .home-sub-logos img {
  height: calc(var(--stage-h) * 0.042);
  width: auto;
}

/* ── Home portrait: logos ───────────────────────────────── */
.home-portrait .home-logo-main {
  width: min(65%, 360px);
  height: auto;
}

.home-portrait .home-sub-logos {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
  justify-content: center;
}

.home-portrait .home-sub-logos img {
  height: calc(var(--stage-h) * 0.04);
  width: auto;
}

/* ── Category tile: icona scalata correttamente ─────────── */
.category-tile .tile-icon {
  width:  calc(var(--stage-h) * 0.10);
  height: calc(var(--stage-h) * 0.10);
  /* Gli SVG di icona hanno colori interni — niente filter */
}

body.portrait .category-tile .tile-icon {
  width:  calc(var(--stage-h) * 0.07);
  height: calc(var(--stage-h) * 0.07);
}

body.portrait .category-tile {
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  font-size: var(--font-size-lg);
}

/* ── Schermata Nickname ─────────────────────────────────── */
.nick-page {
  background: linear-gradient(160deg, #00205B 0%, #001540 60%, #002060 100%);
}

.nick-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.nick-logo {
  width: min(28%, 260px);
  animation: attract-float 3s ease-in-out infinite;
}

.nick-form-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  width: min(90%, 700px);
}

.nick-title {
  font-size: var(--font-size-xl);
  color: #fff;
  font-weight: var(--font-weight-black);
}

.nick-sub {
  font-size: var(--font-size-sm);
  color: rgba(255,255,255,0.65);
}

.nick-input-group {
  position: relative;
  width: 100%;
}

.nick-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  padding-right: calc(var(--space-lg) * 3);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  font-family: var(--font-primary);
  color: var(--color-primary);
  background: #fff;
  border: 3px solid transparent;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s;
  /* Assicura che la tastiera mobile apra correttamente */
  -webkit-appearance: none;
  appearance: none;
}

.nick-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.nick-input::placeholder {
  color: rgba(0,32,91,0.35);
  font-weight: var(--font-weight-regular);
}

.nick-counter {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-size-xs);
  color: rgba(0,32,91,0.45);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.nick-hint {
  font-size: var(--font-size-sm);
  color: rgba(255,255,255,0.6);
  min-height: 1.5em;
  transition: color 0.2s;
}

.nick-hint--warn  { color: #FFD700; font-weight: 600; }
.nick-hint--error { color: #FF6B6B; font-weight: 600; }

.nick-submit {
  width: min(70%, 400px);
  font-size: var(--font-size-md);
}

.nick-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.nick-skip {
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,0.35);
}

.nick-skip-btn {
  color: rgba(255,255,255,0.55);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  font-size: inherit;
  padding: 0.2em 0.5em;
}

/* ── Nick in HUD gioco ──────────────────────────────────── */
.game-nick {
  font-size: var(--font-size-sm);
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  max-width: 30%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Nick in result ─────────────────────────────────────── */
.result-nick {
  font-size: var(--font-size-lg);
  color: rgba(255,255,255,0.9);
}

.result-nick strong {
  color: var(--color-yellow);
}

/* ── Animazioni transizioni ─────────────────────────────── */
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-right {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.anim-slide-up   { animation: slide-up   0.4s ease forwards; }
.anim-slide-right{ animation: slide-right 0.4s ease forwards; }
.anim-fade-in    { animation: fade-in    0.35s ease forwards; }
