/* ============================================================
   PIXETIA — Hub & Directory styles
   Pixel squares · Minimal · Colorful · Elegant
   ============================================================ */

:root {
  --orange: #ff8c42;
  --light-green: #8dffb0;
  --purple: #b388ff;
  --pixel-font: "Press Start 2P", monospace;
  --pixel-mono: "VT323", monospace;
}

/* ============================================================
   FLOATING PIXEL SQUARES (universal)
   ============================================================ */
.px {
  display: block;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.px.red { background: var(--red); }
.px.yellow { background: var(--yellow); }
.px.green { background: var(--green); }
.px.blue { background: var(--blue); }
.px.orange { background: var(--orange); }
.px.light-green { background: var(--light-green); }
.px.purple { background: var(--purple); }

/* Hero pixel sprites */
.px-sprite {
  position: absolute;
  z-index: 1;
  border-radius: 2px;
  opacity: 0.5;
  pointer-events: none;
  animation: pxFloat 6s ease-in-out infinite;
}
.px-s1 { width: 14px; height: 14px; background: var(--red); top: 18%; left: 8%; animation-delay: 0s; box-shadow: 0 0 20px rgba(230, 57, 70, 0.5); }
.px-s2 { width: 10px; height: 10px; background: var(--yellow); top: 24%; right: 10%; animation-delay: 1.2s; box-shadow: 0 0 16px rgba(255, 209, 102, 0.5); }
.px-s3 { width: 12px; height: 12px; background: var(--green); bottom: 22%; left: 14%; animation-delay: 2.1s; box-shadow: 0 0 18px rgba(6, 214, 160, 0.5); }
.px-s4 { width: 8px; height: 8px; background: var(--blue); bottom: 18%; right: 16%; animation-delay: 0.6s; box-shadow: 0 0 14px rgba(58, 134, 255, 0.5); }
.px-s5 { width: 11px; height: 11px; background: var(--red); top: 56%; right: 6%; animation-delay: 2.8s; box-shadow: 0 0 16px rgba(230, 57, 70, 0.4); }

@keyframes pxFloat {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-22px) rotate(8deg); }
}
@media (max-width: 768px) {
  .px-sprite { display: none; }
}

/* ---------- Pixel section headers ---------- */
.pixel-title {
  font-family: var(--pixel-font);
  text-transform: uppercase;
  line-height: 1.3;
}

/* ============================================================
   PIXEL GRID BACKGROUND (hub section)
   ============================================================ */
#hub {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  background-position: -1px -1px;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.hub-search {
  position: relative; display: flex; align-items: center;
  max-width: 620px; margin: 0 auto 40px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px 14px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.hub-search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(6, 214, 160, 0.12);
}
.hub-search svg { flex-shrink: 0; color: var(--text-faint); }
.hub-search input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font-body); font-size: 16px; color: var(--text);
  padding: 12px 12px;
}
.hub-search input::placeholder { color: var(--text-faint); }
.hub-clear {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  color: var(--text-dim); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.3s, color 0.3s;
}
.hub-clear:hover { background: var(--red); color: #fff; }
.hub-clear.hidden { display: none; }

.hub-empty {
  text-align: center; padding: 40px 20px; color: var(--text-dim);
}
.hub-empty-pixels {
  display: flex; gap: 10px; justify-content: center; margin-bottom: 16px;
}
.hub-empty-pixels .px {
  width: 14px; height: 14px;
  animation: pxBlink 1.6s steps(1) infinite;
}
.hub-empty-pixels .px:nth-child(2) { animation-delay: 0.3s; }
.hub-empty-pixels .px:nth-child(3) { animation-delay: 0.6s; }
@keyframes pxBlink {
  0%, 60% { opacity: 1; transform: scale(1); }
  61%, 100% { opacity: 0.3; transform: scale(0.85); }
}
.hub-empty p { font-family: var(--font-mono); font-size: 14px; }

.hidden-link { display: none !important; }
.hidden-cat { display: none !important; }

/* ============================================================
   CATEGORY SECTIONS
   ============================================================ */
.hub-category {
  margin-bottom: 64px; scroll-margin-top: calc(var(--nav-h) + 16px);
}
.hub-cat-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 26px;
}
.hub-cat-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.hub-cat-icon .px-cat {
  width: 22px; height: 22px;
  border-radius: 3px;
  box-shadow: 0 0 14px currentColor;
}
.hub-cat-head:hover .hub-cat-icon { transform: translateY(-2px) rotate(-4deg); }
.hub-cat-title {
  font-family: var(--pixel-font); font-size: clamp(12px, 2.4vw, 17px);
  color: var(--text);
}
.hub-cat-desc { color: var(--text-faint); font-size: 14px; margin-top: 6px; }

/* ============================================================
   LINK GRID & CARDS
   ============================================================ */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.hub-link {
  position: relative; display: flex; flex-direction: column;
  padding: 22px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  text-decoration: none; color: var(--text);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.4s var(--ease);
}
.hub-link::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--hover-glow, rgba(255,255,255,0.04)), transparent 45%);
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.hub-link::after {
  content: ""; position: absolute; top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s var(--ease);
  pointer-events: none;
}
.hub-link:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(0,0,0,0.4); }
.hub-link:hover::before { opacity: 1; }
.hub-link:hover::after { left: 130%; }

/* Floating pixel squares inside cards */
.l-pixels {
  position: relative;
  width: 44px; height: 44px;
  margin-bottom: 16px;
}
.l-pixels .px {
  position: absolute;
  border-radius: 2px;
  animation: pxCardFloat 4s ease-in-out infinite;
}
.l-pixels .px-1 {
  width: 12px; height: 12px;
  top: 0; left: 0;
  animation-delay: 0s;
}
.l-pixels .px-2 {
  width: 8px; height: 8px;
  top: 4px; right: 2px;
  animation-delay: 0.6s;
  opacity: 0.7;
}
.l-pixels .px-3 {
  width: 10px; height: 10px;
  bottom: 2px; left: 8px;
  animation-delay: 1.2s;
  opacity: 0.85;
}

/* Color variants for card pixels */
.l-pixels .px.red { background: var(--red); box-shadow: 0 0 12px rgba(230,57,70,0.5); }
.l-pixels .px.yellow { background: var(--yellow); box-shadow: 0 0 12px rgba(255,209,102,0.5); }
.l-pixels .px.green { background: var(--green); box-shadow: 0 0 12px rgba(6,214,160,0.5); }
.l-pixels .px.blue { background: var(--blue); box-shadow: 0 0 12px rgba(58,134,255,0.5); }
.l-pixels .px.orange { background: var(--orange); box-shadow: 0 0 12px rgba(255,140,66,0.5); }
.l-pixels .px.light-green { background: var(--light-green); box-shadow: 0 0 12px rgba(141,255,176,0.5); }
.l-pixels .px.purple { background: var(--purple); box-shadow: 0 0 12px rgba(179,136,255,0.5); }

@keyframes pxCardFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-4px) rotate(3deg); }
  66% { transform: translateY(2px) rotate(-2deg); }
}

.hub-link:hover .l-pixels .px { animation-duration: 2.5s; }

.hub-link .l-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 15px; letter-spacing: -0.01em; line-height: 1.25;
  margin-bottom: 6px;
}
.hub-link .l-desc {
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
  flex: 1; margin-bottom: 14px;
}
.hub-link .l-handle {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hub-link .l-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px;
}
.hub-link .l-go {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 8px 16px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
  transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
}
.hub-link:hover .l-go {
  color: #06130f; background: var(--hover-color, var(--green)); border-color: var(--hover-color, var(--green));
  transform: translateY(-2px); box-shadow: 0 5px 0 var(--hover-color, var(--green));
}
.hub-link .l-go:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--hover-color, var(--green));
}

.hub-link .l-info {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-faint); padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  transition: color 0.25s, border-color 0.25s;
}
.hub-link .l-info:hover { color: var(--hover-color, var(--green)); border-color: var(--hover-color, var(--green)); }

/* ============================================================
   COLORED SPECIAL GROUPS (Gruppi Speciali)
   ============================================================ */
.hub-link[data-color="red"] {
  --hover-color: var(--red); --hover-glow: rgba(230, 57, 70, 0.12);
}
.hub-link[data-color="red"]:hover { border-color: rgba(230, 57, 70, 0.55); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(230, 57, 70, 0.2), 0 10px 30px rgba(230, 57, 70, 0.12); }

.hub-link[data-color="orange"] {
  --hover-color: var(--orange); --hover-glow: rgba(255, 140, 66, 0.12);
}
.hub-link[data-color="orange"]:hover { border-color: rgba(255, 140, 66, 0.55); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(255, 140, 66, 0.2), 0 10px 30px rgba(255, 140, 66, 0.12); }

.hub-link[data-color="yellow"] {
  --hover-color: var(--yellow); --hover-glow: rgba(255, 209, 102, 0.12);
}
.hub-link[data-color="yellow"]:hover { border-color: rgba(255, 209, 102, 0.55); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(255, 209, 102, 0.2), 0 10px 30px rgba(255, 209, 102, 0.12); }

.hub-link[data-color="light-green"] {
  --hover-color: var(--light-green); --hover-glow: rgba(141, 255, 176, 0.12);
}
.hub-link[data-color="light-green"]:hover { border-color: rgba(141, 255, 176, 0.55); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(141, 255, 176, 0.2), 0 10px 30px rgba(141, 255, 176, 0.12); }

.hub-link[data-color="green"] {
  --hover-color: var(--green); --hover-glow: rgba(6, 214, 160, 0.12);
}
.hub-link[data-color="green"]:hover { border-color: rgba(6, 214, 160, 0.55); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(6, 214, 160, 0.2), 0 10px 30px rgba(6, 214, 160, 0.12); }

.hub-link[data-color="blue"] {
  --hover-color: var(--blue); --hover-glow: rgba(58, 134, 255, 0.12);
}
.hub-link[data-color="blue"]:hover { border-color: rgba(58, 134, 255, 0.55); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(58, 134, 255, 0.2), 0 10px 30px rgba(58, 134, 255, 0.12); }

.hub-link[data-color="purple"] {
  --hover-color: var(--purple); --hover-glow: rgba(179, 136, 255, 0.12);
}
.hub-link[data-color="purple"]:hover { border-color: rgba(179, 136, 255, 0.55); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(179, 136, 255, 0.2), 0 10px 30px rgba(179, 136, 255, 0.12); }

.hub-link[data-color="black"] {
  --hover-color: #ffffff; --hover-glow: rgba(255, 255, 255, 0.06);
  background: #0a0a0a;
}
.hub-link[data-color="black"]:hover { border-color: rgba(255, 255, 255, 0.45); box-shadow: 0 14px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.12), 0 10px 30px rgba(255,255,255,0.04); }

/* ============================================================
   FOLDER CARD (Cartelle)
   ============================================================ */
.hub-link.folder {
  border-style: dashed; border-width: 1.5px;
  min-height: 150px;
}
.hub-link.folder:hover { border-style: solid; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .hub-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .hub-link { padding: 16px 14px; }
  .hub-cat-title { font-size: 11px; }
  .hub-cat-icon { width: 40px; height: 40px; }
  .hub-cat-icon .px-cat { width: 18px; height: 18px; }
}

/* ============================================================
   SERVICE PLACEHOLDER PAGE
   ============================================================ */
.service-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.service-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px circle at 20% 20%, rgba(230, 57, 70, 0.08), transparent 50%),
    radial-gradient(600px circle at 80% 30%, rgba(58, 134, 255, 0.08), transparent 50%),
    radial-gradient(600px circle at 50% 90%, rgba(6, 214, 160, 0.06), transparent 50%);
}
.service-shell { position: relative; z-index: 2; width: 100%; max-width: 480px; }
.service-card {
  --svc-color: var(--blue);
  padding: 40px 34px; border-radius: 24px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 2px solid var(--border-strong);
  text-align: center;
  position: relative; overflow: hidden;
  animation: cardIn 0.6s var(--ease) both;
}
.service-card::before {
  content: ""; position: absolute; top: -80px; right: -80px;
  width: 200px; height: 200px; border-radius: 50%;
  background: var(--svc-color); filter: blur(80px); opacity: 0.12;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }

.service-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.service-back { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); transition: color 0.3s; }
.service-back:hover { color: var(--green); }
.service-tag {
  font-family: var(--pixel-font); font-size: 9px;
  color: var(--svc-color); letter-spacing: 0.08em;
  border: 1px solid color-mix(in srgb, var(--svc-color) 40%, transparent);
  background: color-mix(in srgb, var(--svc-color) 10%, transparent);
  padding: 7px 10px; border-radius: 8px;
  text-transform: uppercase;
}
.service-emoji { font-size: 60px; line-height: 1; margin-bottom: 20px; }
.service-title { font-family: var(--pixel-font); font-size: clamp(15px, 4.5vw, 22px); line-height: 1.4; margin-bottom: 16px; text-transform: uppercase; }
.service-desc { color: var(--text-dim); font-size: 15px; margin-bottom: 24px; }
.service-handle {
  display: inline-block; font-family: var(--font-mono); font-size: 13px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 14px; margin-bottom: 26px;
}
.service-cta { width: 100%; }
.service-pixels { display: flex; justify-content: center; gap: 18px; margin-top: 30px; opacity: 0.5; font-size: 18px; letter-spacing: 6px; }
