/* =========================================================
   Polline: laboratorio.css
   Pagine /laboratorio/ (hub, glossario, tassametro, inflazionometro).
   Qui solo ciò che non può stare inline: stati hover/aperto,
   keyframes e componenti ripetuti. Token colore e font da base.css.
   ========================================================= */

:root { --lab-ease: cubic-bezier(0.22, 1, 0.36, 1); --lab-header: 68px; }
@media (max-width: 899px) { :root { --lab-header: 72px; } }

main :focus-visible { outline: 3px solid #3AB3D9; outline-offset: 3px; }
main [hidden] { display: none !important; }
main button { font-family: inherit; }
main input::placeholder { color: rgba(26,43,74,0.6); }

/* ---------- pulsanti ---------- */
.lab-cta {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; background: #FCDE3D; color: #1A2B4A;
  font-weight: 800; cursor: pointer;
  box-shadow: 0 5px 0 #E3BB19;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lab-cta:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 #E3BB19; }
.lab-cta:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #E3BB19; }

.lab-btn-dark {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 20px;
  border: 0; border-radius: 999px; background: #1A2B4A; color: #FFF6EC;
  font-weight: 800; font-size: 0.95rem; cursor: pointer; transition: color 0.2s ease;
}
.lab-btn-dark:hover { color: #FCDE3D; }
.lab-btn-line, .lab-btn-ghost { transition: background 0.2s ease; }
.lab-btn-line:hover { background: #FCDE3D !important; }
.lab-btn-ghost {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 999px;
  box-shadow: inset 0 0 0 2px #1A2B4A; color: #1A2B4A; font-weight: 800;
}
.lab-btn-ghost:hover { background: #FCDE3D; color: #1A2B4A; }
.lab-ulink { font-weight: 800; color: #1A2B4A; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.lab-ulink:hover { color: #298CAB; }
.lab-close-cta {
  display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 16px 30px; border-radius: 999px;
  background: #FCDE3D; color: #1A2B4A; font-weight: 800; font-size: 1.05rem; transition: background 0.25s ease;
}
.lab-close-cta:hover { background: #FFF6EC; color: #1A2B4A; }
.lab-close-a { transition: background 0.25s ease; }
.lab-close-a:hover { background: #FFF6EC !important; color: #1A2B4A; }
.lab-close-b { transition: color 0.25s ease; }
.lab-close-b:hover { color: #FCDE3D !important; }

/* ---------- hub ---------- */
.lab-tool-card {
  position: relative; display: flex; flex-direction: column; border-radius: 32px; overflow: hidden; color: #1A2B4A;
  transition: transform 0.4s var(--lab-ease), box-shadow 0.4s var(--lab-ease);
}
.lab-tool-card:hover, .lab-tool-card:focus-visible {
  transform: translateY(-6px); box-shadow: 0 22px 40px -18px rgba(26,43,74,0.35); color: #1A2B4A;
}
.lab-flip-pill-inner { transition: transform 0.6s cubic-bezier(0.34, 1.4, 0.64, 1); }
.lab-flip-pill:hover .lab-flip-pill-inner { transform: rotateX(180deg); }

.lab-tm-flag { background: rgba(255,246,236,0.14); color: #FFF6EC; transition: background 0.3s ease, color 0.3s ease; }
.lab-tool-card .tm-on { display: none; }
.lab-tool-card:hover .tm-off, .lab-tool-card:focus-visible .tm-off { display: none; }
.lab-tool-card:hover .tm-on, .lab-tool-card:focus-visible .tm-on { display: inline; }
.lab-tool-card:hover .lab-tm-flag, .lab-tool-card:focus-visible .lab-tm-flag { background: #FCDE3D; color: #1A2B4A; }

.lab-soon-card { position: relative; display: flex; flex-direction: column; border-radius: 32px; background: rgba(26,43,74,0.06); overflow: hidden; }
.lab-soon-badge {
  margin: 0; align-self: flex-start; display: inline-flex; gap: 8px; align-items: center; padding: 7px 14px; border-radius: 999px;
  background: #1A2B4A; color: #FFF6EC; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}

/* ---------- glossario ---------- */
.gl-tabs { display: flex; flex-wrap: wrap; justify-content: center; padding: 6px; border-radius: 999px; background: #FFFFFF; gap: 6px; box-shadow: 0 10px 30px -14px rgba(26,43,74,0.3); }
.gl-tab {
  min-height: 56px; padding: 14px 28px; border: 0; border-radius: 999px; cursor: pointer;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 1.12rem;
  background: transparent; color: #1A2B4A; transition: background 0.2s ease, color 0.2s ease;
}
.gl-tab[aria-selected="true"] { background: #1A2B4A; color: #FFF6EC; }
.gl-word {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 100px; padding: 20px 20px 18px;
  border: 0; border-radius: 22px; background: #FFFFFF; color: #1A2B4A; text-align: left; cursor: pointer;
  transition: transform 0.3s var(--lab-ease), background 0.3s ease;
}
.gl-word:hover { transform: translateY(-4px); background: #F9DF5E; }
.gl-word-alt:hover { background: #FFF6EC; }
.gl-prob {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 14px 18px;
  border: 0; border-radius: 18px; text-align: left; cursor: pointer;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 1.08rem; line-height: 1.2;
  background: #FFFFFF; color: #1A2B4A; transition: background 0.2s ease;
}
.gl-prob[aria-pressed="true"] { background: #1A2B4A; color: #FFF6EC; }

.gl-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(26,43,74,0.4); opacity: 0; pointer-events: none; transition: opacity 0.35s ease; }
.gl-overlay[data-open="true"] { opacity: 1; pointer-events: auto; }
.gl-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: min(600px, 100%); overflow-y: auto; background: #FFF6EC;
  box-shadow: -20px 0 60px -20px rgba(26,43,74,0.35);
  transform: translateX(105%); visibility: hidden;
  transition: transform 0.45s var(--lab-ease), visibility 0s linear 0.45s;
}
.gl-drawer[data-open="true"] { transform: translateX(0); visibility: visible; transition-delay: 0s; }
.gl-close { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #FFFFFF; color: #1A2B4A; font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.gl-close:hover { background: #FFE7D2; }
.gl-drawer-link { align-self: flex-start; font-weight: 800; color: #298CAB; }
.gl-drawer-link:hover { color: #1A2B4A; }

/* condivisione di una voce (pannello e pagina della voce) */
.gl-share-main {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 12px 18px; border: 0; border-radius: 999px;
  background: #FCDE3D; color: #1A2B4A; font-weight: 800; font-size: 0.95rem; cursor: pointer; transition: background 0.2s ease;
}
.gl-share-main:hover { background: #FFF6EC; }
.gl-share-line {
  min-height: 48px; padding: 12px 18px; border: 0; border-radius: 999px; background: transparent; color: #FFF6EC;
  font-weight: 800; font-size: 0.95rem; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,246,236,0.6);
  transition: box-shadow 0.2s ease, color 0.2s ease;
}
.gl-share-line:hover { box-shadow: inset 0 0 0 2px #FCDE3D; color: #FCDE3D; }

/* ---------- tassametro ---------- */
.tm-range { width: 100%; height: 44px; margin: 0; cursor: pointer; accent-color: #1A2B4A; }
.tm-opt {
  min-height: 48px; padding: 10px 12px; border: 0; border-radius: 16px; font-weight: 800; font-size: 0.95rem; cursor: pointer;
  background: #FFF6EC; color: #1A2B4A; transition: background 0.2s ease;
}
.tm-opt[aria-checked="true"] { background: #1A2B4A; color: #FFF6EC; }
.tm-yn { min-width: 56px; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 14px; font-weight: 800; cursor: pointer; background: #FFFFFF; color: #1A2B4A; transition: background 0.2s ease; }
.tm-yn[aria-checked="true"] { background: #1A2B4A; color: #FFF6EC; }
.tm-yn.is-waste[aria-checked="true"] { background: #FBA4C7; color: #1A2B4A; }
.tm-text {
  width: 100%; min-height: 52px; padding: 0 16px; border: 0; border-radius: 16px; background: #FFF6EC;
  box-shadow: inset 0 0 0 2px rgba(26,43,74,0.14); color: #1A2B4A; font-size: 1.05rem; font-weight: 600; outline: none;
  transition: box-shadow 0.2s ease;
}
.tm-text:focus { box-shadow: inset 0 0 0 2px #1A2B4A; }
.tm-test-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 0; border: 0; background: none;
  color: #1A2B4A; text-align: left; cursor: pointer;
}
.tm-plus { position: relative; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; background: #1A2B4A; transition: transform 0.5s var(--lab-ease), background 0.3s ease; }
.tm-plus::before, .tm-plus::after { content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 2.5px; border-radius: 2px; background: #FFF6EC; transform: translate(-50%, -50%); }
.tm-plus::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform 0.5s var(--lab-ease); }
.tm-test-btn:hover .tm-plus { background: #3AB3D9; }
.tm-test[data-open="true"] .tm-plus { transform: rotate(180deg); background: #FBA4C7; }
.tm-test[data-open="true"] .tm-plus::before, .tm-test[data-open="true"] .tm-plus::after { background: #1A2B4A; }
.tm-test[data-open="true"] .tm-plus::after { transform: translate(-50%, -50%) rotate(0deg); }
.tm-test-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s var(--lab-ease); }
.tm-test[data-open="true"] .tm-test-panel { grid-template-rows: 1fr; }
.tm-test-inner { overflow: hidden; min-height: 0; }
.tm-linkbtn { align-self: flex-start; padding: 0; border: 0; background: none; color: #FBA4C7; font-weight: 800; font-size: 0.95rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tm-linkbtn:hover { color: #FFF6EC; }
.tm-meter { position: sticky; top: calc(var(--lab-header) + 20px); padding-top: 24px; }

/* ---------- inflazionometro ---------- */
.iv-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px; border: 0; border-radius: 999px;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; line-height: 1.1;
  transition: background 0.2s ease, transform 0.2s ease; transform: rotate(var(--rot, 0deg));
}
.iv-chip:hover:not(:disabled) { transform: rotate(0deg) scale(1.04); }
.iv-x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #FFF6EC; font-size: 1.1rem; cursor: pointer; }
.iv-x:hover { background: rgba(255,246,236,0.15); }
.iv-line { transition: background 0.2s ease; }
.iv-line:hover { background: #FFFFFF !important; }
.iv-plain:hover { background: #FFFFFF !important; }
.iv-dark { transition: color 0.2s ease; }
.iv-dark:hover { color: #FCDE3D !important; }
.iv-alt {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 14px; border: 0; border-radius: 22px; text-align: left;
  color: #1A2B4A; cursor: pointer; transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.iv-alt:hover { transform: translateY(-3px); }
.iv-fade { animation: iv-in 0.45s var(--lab-ease) both; }
@keyframes iv-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .iv-fade { animation: none; }
}
