/* Stile "Notte" (lo stesso della dashboard di Chang Bot e di Chang Music), in versione minimal. */
:root {
  --bg: #0b0b10; --panel: #14141b; --panel-2: #1c1c25; --panel-hover: #17171f;
  --line: #262631; --line-soft: #1e1e27;
  --text: #f4f3f8; --muted: #a3a2b3; --subtle: #8a899b;
  --accent: #ff4fa3; --accent-2: #ff8cc4; --accent-3: #e0388b; --accent-soft: #3a1a2c; --accent-line: #8c2d5e;
  --radius: 18px;
  /* Contenuto al centro, largo al massimo --content; i margini ai lati crescono con lo schermo. */
  --content: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --font-display: 'Bricolage Grotesque', 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-ui: 'Figtree', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
/* Con la finestra di un progetto aperta, la pagina sotto resta ferma. */
html:has(dialog[open]) { overflow: hidden; }
/* Bagliore rosa in alto, come nella pagina di accesso di Chang Music. */
body {
  margin: 0; color: var(--text); font: 15px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1100px 640px at 50% -180px, rgba(176, 45, 124, .34), rgba(67, 22, 107, .2) 55%, transparent) no-repeat, var(--bg);
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 8px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); min-height: 100vh; margin: 0 auto; padding: 20px var(--gutter) 40px; display: flex; flex-direction: column; gap: 80px; }
main { display: flex; flex-direction: column; gap: 80px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; }
/* Lo stesso logo "chang" della dashboard di Chang Bot. */
.brand { font: 800 30px/1 var(--font-display); letter-spacing: -.05em; color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); transition: color .15s, background-color .15s; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.pill-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s; }
.pill-link:hover { background: var(--panel-2); border-color: #34343f; }

/* Presentazione, al centro. */
/* Il margine negativo accorcia lo spazio fra intestazione e nome (il gap di .wrap è pensato per il resto della pagina). */
.hero { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: -40px; text-align: center; }
.hero h1 { margin: 0; font: 700 clamp(52px, 9vw, 96px)/1 var(--font-display); letter-spacing: -.05em; }
/* "Chang" con il rosa del vinile di Chang Music. */
.hero h1 span { padding-bottom: .06em; background: linear-gradient(135deg, var(--accent-2), var(--accent) 55%, var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; max-width: 520px; font-size: 18px; color: var(--muted); text-wrap: balance; }
.hero .pill-link { align-self: center; }

section { display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 24px; }
h2 { margin: 0; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--subtle); }

.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }

/* Progetti: due per riga (uno per riga sui telefoni).
   Il clic sulla scheda apre il sito del progetto; "Dettagli" apre la sua finestra. */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto;
  grid-template-areas: "icon status" "body body" "foot foot";
  gap: 18px; padding: 22px;
  background: radial-gradient(420px 220px at 0 0, rgba(255, 79, 163, .07), transparent 70%), var(--panel);
  transition: border-color .2s, background-color .2s, box-shadow .25s, transform .25s var(--ease-out);
}
/* Luce rosa che segue il puntatore (la posizione arriva da app.js). */
.project::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 79, 163, .09), transparent 65%);
  opacity: 0; transition: opacity .25s;
}
.project-icon { grid-area: icon; width: 56px; height: 56px; border-radius: 15px; box-shadow: 0 10px 26px -8px rgba(255, 79, 163, .5); transition: transform .35s var(--ease-out); }
.project .status { grid-area: status; align-self: start; margin-top: 2px; }
.project-body { grid-area: body; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.project-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.project h3 { margin: 0; font: 700 24px/1.2 var(--font-display); letter-spacing: -.02em; }
/* Il link del titolo si allarga a tutta la scheda; il bordo del focus va sulla scheda. */
.project-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.project-link:focus-visible { outline: none; }
.project:has(.project-link:focus-visible) { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.project p { margin: 0; max-width: 60ch; color: var(--muted); }
.project-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.url { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font: 500 13px/1.4 var(--font-mono); color: var(--subtle); overflow-wrap: anywhere; transition: color .2s; }
.url svg.i { width: 15px; height: 15px; transition: transform .25s var(--ease-out); }
/* Sopra il link che copre la scheda. */
.details { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-left: auto; padding: 0 14px 0 11px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; transition: border-color .15s, background-color .15s, color .15s; }
.details svg.i { width: 16px; height: 16px; color: var(--accent-2); }
.details:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-2); }
@media (hover: hover) {
  .project:hover { border-color: var(--accent-line); background-color: var(--panel-hover); box-shadow: 0 24px 48px -24px rgba(255, 79, 163, .4); transform: translateY(-3px); }
  .project:hover::before { opacity: 1; }
  .project:hover .project-icon { transform: rotate(-6deg) scale(1.06); }
  .project:hover .url { color: var(--accent-2); }
  .project:hover .url svg.i { transform: translate(2px, -2px); }
  /* Sopra "Dettagli" il clic apre la finestra, non il sito: l'indirizzo resta spento. */
  .project:has(.details:hover) .url { color: var(--subtle); }
  .project:has(.details:hover) .url svg.i { transform: none; }
}
.project:active { transform: translateY(-1px) scale(.99); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.status .eq { height: 12px; }

/* Tre barre che si muovono: il progetto è acceso (ferme con "riduci movimento"). */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; flex: none; }
.eq i { width: 3px; height: 100%; background: var(--accent); border-radius: 2px; transform-origin: bottom; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; }
.eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-2); font-size: 12px; font-weight: 600; }
.tag svg.i { width: 12px; height: 12px; stroke-width: 2.4; }

.soon { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 18px; background: none; border: 1px dashed var(--line); color: var(--subtle); font-size: 14px; }
.soon svg.i { width: 16px; height: 16px; }

.contacts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.contact { display: flex; align-items: center; gap: 14px; padding: 16px 20px 16px 16px; transition: border-color .15s, background .15s; }
.contact:hover { border-color: var(--accent-line); background: var(--panel-hover); }
.ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--panel-2); color: var(--accent-2); flex: none; }
.ico svg.i { width: 20px; height: 20px; }
.contact-text { display: flex; flex-direction: column; min-width: 0; }
.label { font-size: 13px; color: var(--subtle); }
.value { font-weight: 600; overflow-wrap: anywhere; }
.contact .go { margin-left: auto; color: var(--subtle); transition: color .15s, transform .25s var(--ease-out); }
.contact:hover .go { color: var(--accent-2); transform: translate(2px, -2px); }

footer { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--subtle); }
/* Nota discreta: si legge solo se la si cerca. */
.made-with { font-size: 11px; color: #4a4958; }

/* Finestra di un progetto (<dialog>): al centro sul computer, dal basso sul telefono.
   Intestazione e piede restano fermi, scorre solo il contenuto. */
.sheet {
  width: min(780px, 100% - 32px); max-width: none; max-height: 88vh; max-height: min(88dvh, 900px);
  margin: auto; padding: 0; overflow: hidden;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .6);
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .3s var(--ease-out); }
.sheet::backdrop { background: rgba(6, 6, 10, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet[open]::backdrop { animation: fade-in .3s ease; }
.sheet.swap:not(.closing)::backdrop { animation: none; }
.sheet.closing { animation: sheet-out .18s ease-in forwards; }
.sheet.closing::backdrop { animation: fade-out .18s ease-in forwards; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.sheet-head { display: flex; align-items: center; gap: 16px; padding: 24px; border-bottom: 1px solid var(--line-soft); }
.sheet-head img { width: 56px; height: 56px; border-radius: 15px; flex: none; }
.sheet-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sheet h2 { font: 700 28px/1.1 var(--font-display); letter-spacing: -.025em; text-align: left; text-transform: none; color: var(--text); }
.sheet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.sheet-close { align-self: flex-start; display: grid; place-items: center; width: 40px; height: 40px; margin-left: auto; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s; }
.sheet-close:hover { color: var(--text); border-color: var(--accent-line); }

.sheet-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 28px; padding: 24px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.lead { margin: 0; max-width: 65ch; font-size: 17px; line-height: 1.55; }
.lead code { padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-2); font: 500 .88em var(--font-mono); white-space: nowrap; }
.sheet-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 28px 36px; }
.sheet-side { display: flex; flex-direction: column; gap: 28px; }
.sheet-block { display: flex; flex-direction: column; gap: 12px; }
.sheet h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.list li { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); }
.list svg.i { margin-top: 2px; color: var(--accent); }
.list-soon svg.i { color: var(--subtle); }
.chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font: 500 12px/1.5 var(--font-mono); }
.related { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-soft); transition: border-color .15s, background-color .15s; }
.related img { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.related-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.related-name { font-weight: 600; }
.related-desc { font-size: 13px; color: var(--subtle); }
.related > svg.i { color: var(--subtle); transition: color .15s, transform .25s var(--ease-out); }
.related:hover { border-color: var(--accent-line); background-color: #20202a; }
.related:hover > svg.i { color: var(--accent-2); transform: translateX(3px); }

.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 16px 24px; border-top: 1px solid var(--line-soft); }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; background: var(--accent); color: var(--bg); font-weight: 700; box-shadow: 0 10px 26px -10px rgba(255, 79, 163, .6); transition: background-color .15s, transform .15s; }
.btn:hover { background: var(--accent-2); }
.btn:active { transform: scale(.98); }
.btn svg.i { width: 16px; height: 16px; stroke-width: 2.4; }
.note { margin: 0; font-size: 13px; color: var(--subtle); }

@media (max-width: 759px) {
  .projects { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 599px) {
  .contacts { grid-template-columns: minmax(0, 1fr); }
  /* Sul telefono la finestra sale dal basso, a tutta larghezza. */
  .sheet { width: 100%; max-height: 92vh; max-height: 92dvh; margin: auto 0 0; border-width: 1px 0 0; border-radius: 22px 22px 0 0; }
  .sheet[open] { animation-name: sheet-up; }
  .sheet.closing { animation-name: sheet-down; }
  .sheet-head { padding: 20px 16px 16px; }
  .sheet h2 { font-size: 24px; }
  .sheet-content { gap: 24px; padding: 20px 16px; }
  .sheet-cols { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .sheet-side { gap: 24px; }
  .sheet-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  .wrap { padding-top: 14px; gap: 56px; }
  main { gap: 56px; }
  .brand { font-size: 28px; }
  .nav a { padding: 8px 10px; }
  .hero { margin-top: -24px; }
  .hero p { font-size: 17px; }
  .project { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .eq i { animation: none; transform: scaleY(.7); }
  .sheet[open], .sheet[open]::backdrop { animation: none; }
  .project:hover, .project:active, .project:hover .project-icon, .project:hover .url svg.i,
  .contact:hover .go, .related:hover > svg.i { transform: none; }
}
