/* =========================================================
   LF Design — Portale | Stile liquid glass
   ========================================================= */

:root {
  --blue: #0098dd;
  --navy: #1c4599;
  --cyan: #63c8f2;
  --title: #303133;
  --text: #777;
  --late: #d23a4a;
  --base: #eaf1fb;
  --glass: rgba(255, 255, 255, .46);
  --glass-strong: rgba(255, 255, 255, .68);
  --glass-line: rgba(255, 255, 255, .78);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 -1px 0 rgba(28, 69, 153, .05) inset, 0 24px 60px -18px rgba(28, 69, 153, .28);
  --f-title: 'Poppins', system-ui, sans-serif;
  --f-text: 'Quicksand', system-ui, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  background: var(--base); color: var(--text);
  font: 500 15px/1.55 var(--f-text); -webkit-font-smoothing: antialiased;
}
h1 { font-family: var(--f-title); color: var(--title); margin: 0; line-height: 1.15; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Sfondo aurora ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(120% 80% at 0% 0%, #f6f9ff 0%, transparent 60%),
  linear-gradient(160deg, #eef4fd 0%, #e4edfa 55%, #dfe9f8 100%); }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .7; will-change: transform; }
.o1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: radial-gradient(circle at 35% 35%, var(--cyan), transparent 65%); animation: drift1 22s var(--ease) infinite alternate; }
.o2 { width: 40vmax; height: 40vmax; right: -10vmax; top: 8vmax; background: radial-gradient(circle at 50% 50%, var(--blue), transparent 64%); opacity: .45; animation: drift2 26s var(--ease) infinite alternate; }
.o3 { width: 38vmax; height: 38vmax; left: 18vmax; bottom: -20vmax; background: radial-gradient(circle at 50% 50%, var(--navy), transparent 62%); opacity: .32; animation: drift3 30s var(--ease) infinite alternate; }
.o4 { width: 22vmax; height: 22vmax; right: 18vmax; bottom: 6vmax; background: radial-gradient(circle at 50% 50%, #ffffff, transparent 66%); opacity: .9; animation: drift2 18s var(--ease) infinite alternate-reverse; }
.grain { position: absolute; inset: 0; opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

@keyframes drift1 { to { transform: translate(14vmax, 10vmax) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-12vmax, 12vmax) scale(.92); } }
@keyframes drift3 { to { transform: translate(10vmax, -10vmax) scale(1.12); } }

/* ---------- Vetro ---------- */
.glass {
  position: relative; isolation: isolate;
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(1.7);
  backdrop-filter: blur(26px) saturate(1.7);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow);
}
.glass::before { /* riflesso superiore */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: linear-gradient(160deg, rgba(255,255,255,.75) 0%, rgba(255,255,255,.12) 38%, rgba(255,255,255,0) 60%, rgba(255,255,255,.28) 100%);
}

/* ---------- Login ---------- */
.stage { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; padding: 32px 16px; }
.login { width: 100%; max-width: 400px; border-radius: 30px; padding: 40px 32px 32px; text-align: center;
  animation: rise .9s var(--ease) both; }
.login-logo { width: 78px; height: 78px; margin: 0 auto 22px; border-radius: 24px; display: grid; place-items: center;
  background: var(--glass-strong); border: 1px solid var(--glass-line); box-shadow: 0 10px 30px -10px rgba(28,69,153,.35), inset 0 1px 0 #fff;
  animation: pop .9s .15s var(--ease) both; }
.login-logo img { width: 52px; }
.login h1 { font-size: 26px; font-weight: 600; animation: fadeUp .7s .25s var(--ease) both; }
.lead { margin: 6px 0 26px; animation: fadeUp .7s .32s var(--ease) both; }

.field { position: relative; display: block; margin-bottom: 14px; text-align: left; animation: fadeUp .7s var(--ease) both; }
.field:nth-of-type(1) { animation-delay: .4s; }
.field:nth-of-type(2) { animation-delay: .47s; }
.field input {
  width: 100%; height: 58px; padding: 22px 48px 6px 18px; border-radius: 16px; outline: none;
  background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.9);
  box-shadow: inset 0 1px 2px rgba(28,69,153,.06); color: var(--title); font-weight: 600;
  transition: background .3s, box-shadow .3s, border-color .3s;
}
.field span { position: absolute; left: 19px; top: 18px; font-weight: 600; color: var(--text); pointer-events: none;
  transform-origin: left top; transition: transform .3s var(--ease), color .3s; }
.field input:focus { background: rgba(255,255,255,.85); border-color: rgba(0,152,221,.55); box-shadow: 0 0 0 5px rgba(0,152,221,.12); }
.field input:focus + span, .field input:not(:placeholder-shown) + span { transform: translateY(-11px) scale(.74); color: var(--blue); }
.eye { position: absolute; right: 8px; top: 9px; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; transition: color .2s, background .2s; }
.eye:hover { color: var(--navy); background: rgba(255,255,255,.6); }
.eye.is-on { color: var(--blue); }

.alert { background: rgba(210,58,74,.1); border: 1px solid rgba(210,58,74,.2); color: var(--late); border-radius: 14px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600; font-size: 14px; animation: shake .5s var(--ease); }

.btn-glow {
  position: relative; overflow: hidden; width: 100%; height: 56px; margin-top: 6px; border: 0; border-radius: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px;
  background: linear-gradient(135deg, var(--blue), var(--navy));
  box-shadow: 0 14px 30px -12px rgba(0,152,221,.7), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .25s var(--ease), box-shadow .25s; animation: fadeUp .7s .55s var(--ease) both;
}
.btn-glow::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); }
.btn-glow:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -12px rgba(0,152,221,.8), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-glow:hover::after { transform: translateX(120%); transition: transform .9s var(--ease); }
.btn-glow svg { transition: transform .3s var(--ease); }
.btn-glow:hover svg { transform: translateX(4px); }
.btn-glow.is-loading span::after { content: '…'; }
.foot { margin: 0; font-size: 13px; font-weight: 600; animation: fadeUp .7s .7s var(--ease) both; }

/* ---------- Hub ---------- */
.bar { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 10; width: var(--page); margin: 0 auto; height: 64px; border-radius: 22px;
  display: flex; align-items: center; gap: 12px; padding: 0 20px; animation: dropIn .8s var(--ease) both; }
.bar-brand img { height: 30px; display: block; }
.bar-title { font-family: var(--f-title); font-weight: 600; color: var(--title); font-size: 16px; padding-left: 12px; border-left: 1px solid rgba(28,69,153,.15); }
.bar-out { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 14px; font-weight: 700; color: var(--navy); transition: background .2s; }
.bar-out:hover { background: rgba(255,255,255,.7); }
.bar-out svg { width: 18px; height: 18px; }

.hub { width: var(--page); margin: 0 auto; padding: calc(118px + env(safe-area-inset-top)) 0 40px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; perspective: 1000px; }
.tile {
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 16px; padding: 24px; border-radius: 28px; overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d;
  transition: transform .5s var(--ease), box-shadow .4s, background .4s;
  animation: tileIn .9s calc(.3s + var(--i) * .08s) var(--ease) both;
}
.tile::after { /* luce che segue il cursore */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(320px circle at var(--mx) var(--my), rgba(255,255,255,.6), transparent 45%);
  z-index: 0;
}
.tile:hover { background: rgba(255,255,255,.58); box-shadow: 0 1px 0 #fff inset, 0 34px 70px -22px rgba(28,69,153,.38); }
.tile:hover::after { opacity: 1; }
.tile-icon {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--cyan) -10%, var(--blue) 45%, var(--navy) 110%);
  box-shadow: 0 14px 28px -10px rgba(0,152,221,.75), inset 0 1px 0 rgba(255,255,255,.45);
}
.tile.tone-logo .tile-icon { background: rgba(255,255,255,.85); border: 1px solid #fff; box-shadow: 0 14px 28px -12px rgba(160,40,200,.45), inset 0 1px 0 #fff; }
.tile-icon img { width: 76%; height: 76%; object-fit: contain; display: block; }
.tile-icon svg { width: 30px; height: 30px; stroke-width: 1.7; }
.tile-icon, .tile-text { position: relative; z-index: 1; }
.tile-text b { display: block; font-family: var(--f-title); font-weight: 600; font-size: 22px; color: var(--title); }
.tile-text small { font-size: 14px; font-weight: 600; }
.tile-go { z-index: 1; position: absolute; top: 22px; right: 22px; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; color: var(--navy);
  background: rgba(255,255,255,.6); border: 1px solid #fff; opacity: .7; transition: opacity .3s, background .3s; }
.tile:hover .tile-go { opacity: 1; background: #fff; }

/* Uscita verso uno strumento */
body.is-leaving .hub, body.is-leaving .bar, body.is-leaving .wrap, body.is-leaving .topbar { opacity: 0; transform: scale(.98); filter: blur(6px); transition: all .45s var(--ease); }

/* ---------- Animazioni ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(28px) scale(.97); filter: blur(10px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6) rotate(-10deg); } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-16px); } }
@keyframes tileIn { from { opacity: 0; transform: translateY(26px) scale(.96); filter: blur(8px); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (max-width: 560px) {
  .login { padding: 34px 22px 24px; border-radius: 26px; }
  .bar { top: calc(10px + env(safe-area-inset-top)); height: 58px; border-radius: 20px; padding: 0 16px; }
  .hub { padding-top: calc(96px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
