/* Colori di VS Code: gli stessi della vecchia config Tailwind */
:root {
  --header: #1f1f1f;      /* myVSCodeColor */
  --search: #313131;      /* searchbarColor */
  --editor: #1f1f1f;      /* backgroundTextEditor1 */
  --bar: #181818;         /* emptybarColor, bottomSectionColor, sidePanelColor, footerColor */
  --border: #161616;      /* borderColor */
  --card: #2b2b2b;        /* texteditor2CardsColor */
  --ssh: #0078d4;         /* sshColor */
  --text: #d1d5db;        /* gray-300 */
  --font: "Quicksand", -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, Menlo, Monaco, Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--editor); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--ssh); outline-offset: -1px; }

.scroll { overflow: auto; }
.scroll::-webkit-scrollbar { width: 14px; height: 14px; }
.scroll::-webkit-scrollbar-track, .scroll::-webkit-scrollbar-corner { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: #424242; border: 4px solid transparent; background-clip: padding-box; border-radius: 7px; }
.scroll::-webkit-scrollbar-thumb:hover { background: #525252; border-width: 3px; background-clip: padding-box; }
.mask-x { -webkit-mask: linear-gradient(90deg, transparent, #000 10%, #000 80%, transparent); mask: linear-gradient(90deg, transparent, #000 10%, #000 80%, transparent); }

/* =========================================================
   INTRO
   Tutto scuro, niente bianco: alla fine la finestra del terminale
   si allarga a tutto schermo e sotto c'è già VS Code.
   ========================================================= */
#desktop {
  position: fixed; inset: 0; z-index: 20; overflow: hidden;
  background: var(--editor) url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='1' fill='%23313131'/%3E%3C/svg%3E");
  transition: background-color .5s ease .15s;
}
#desktop > :not(.mac-terminal) { transition: opacity .45s ease; }
.menubar { height: 24px; display: flex; justify-content: space-between; align-items: center; padding: 0 16px; font-size: 14px; background: var(--bar); border-bottom: 1px solid var(--border); }
#desktop-icons { position: relative; display: grid; grid-template-columns: repeat(4, 84px); gap: 20px 16px; padding: 120px 0 0 200px; }
.desk-icon { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 500; animation: pop .3s both; }
.desk-icon:hover { background: #31313180; }
.desk-icon div { width: 64px; height: 64px; border-radius: 12px; background: var(--bar); border: 1px solid var(--border); display: grid; place-items: center; box-shadow: 0 6px 16px #0006; }
.desk-icon img { width: 48px; height: 48px; object-fit: contain; }
.desk-icon span { padding: 1px 4px; background: var(--bar); border: 1px solid var(--border); border-radius: 4px; }
@keyframes pop { from { opacity: 0; transform: scale(.5); } }
.welcome { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%); font-size: 18px; font-weight: 500; padding: 8px 16px; border-radius: 8px; background: var(--editor); border: 1px solid var(--border); white-space: nowrap; animation: fadeIn .5s .5s both; }
@keyframes fadeIn { from { opacity: 0; } }
.dock { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; padding: 8px 16px; border-radius: 16px; background: #1f1f1fcc; backdrop-filter: blur(12px); border: 1px solid var(--border); box-shadow: 0 20px 40px #000a; }
.dock-app { position: relative; width: 48px; height: 48px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--bar); transition: transform .2s; }
.dock-app:hover { transform: scale(1.1); }
.dock-app img { width: 32px; height: 32px; }
.dock-app.blue { background: var(--ssh); }
.dock-app.rainbow { background: linear-gradient(135deg, #f87171, #facc15, #4ade80); }
.dock-app.clicked { animation: press .35s; }
.dock-app.clicked::after { content: ""; position: absolute; bottom: -6px; width: 4px; height: 4px; border-radius: 50%; background: #fff; }
@keyframes press { 40% { transform: scale(.85); background: #0078d480; } }

.mac-terminal {
  position: absolute; top: 50%; left: 50%; width: min(384px, 92vw); height: 200px;
  border-radius: 8px; overflow: hidden; background: var(--editor); border: 1px solid var(--border); box-shadow: 0 25px 50px #000c;
  transform: translate(-50%, -40%) scale(.85); opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.term-open .mac-terminal { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.mac-terminal-bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; background: var(--bar); border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 500; }
.mac-terminal-bar i { width: 12px; height: 12px; border-radius: 50%; }
.mac-terminal-bar .r { background: #ef4444; } .mac-terminal-bar .y { background: #eab308; } .mac-terminal-bar .g { background: #22c55e; }
.mac-terminal-bar span { margin: 0 auto; transform: translateX(-30px); }
.mac-terminal-body { padding: 16px; font-size: 14px; display: grid; gap: 8px; }
.prompt-ssh { color: var(--ssh); }
.cursor-block { display: inline-block; width: 8px; height: 18px; margin-left: 4px; vertical-align: -3px; background: var(--text); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.opening { opacity: 0; transition: opacity .3s; }
#desktop.opening .opening { opacity: 1; }

#fake-mouse { position: absolute; top: 0; left: 0; z-index: 30; pointer-events: none; transform: translate(100px, 100px); transition: transform 1.5s ease-in-out, opacity .3s; filter: drop-shadow(0 2px 3px #000); }
.term-open #fake-mouse { opacity: 0; }
.skip { position: absolute; top: 36px; right: 16px; font-size: 13px; padding: 4px 10px; border: 1px solid var(--search); border-radius: 6px; background: var(--bar); color: #9ca3af; }
.skip:hover { color: #fff; }

/* uscita: il terminale si allarga a tutto schermo e svanisce, sotto c'è VS Code */
#desktop.leaving { background-color: transparent; background-image: none; pointer-events: none; }
#desktop.leaving > :not(.mac-terminal) { opacity: 0; }
#desktop.leaving .mac-terminal { width: 100vw; height: 100vh; border-radius: 0; transform: translate(-50%, -50%); opacity: 0;
  transition: width .55s cubic-bezier(.7,0,.2,1), height .55s cubic-bezier(.7,0,.2,1), border-radius .55s, opacity .25s ease .45s; }
#vscode { transition: opacity .6s ease, transform .6s ease; }
#vscode[inert] { opacity: 0; transform: scale(1.04); }

/* =========================================================
   VS CODE (stesso layout della versione React)
   ========================================================= */
#vscode { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

.header { height: 34px; flex: none; display: flex; align-items: center; background: var(--header); outline: 1px solid var(--border); color: #fff; font-size: 14px; position: relative; z-index: 5; }
.header > div { flex: 1; display: flex; align-items: center; min-width: 0; }
.header-left { gap: 20px; padding-left: 8px; }
.logo img { width: 20px; height: 20px; }
.logo:hover { opacity: .8; }
.menu { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.menu li { position: relative; }
.menu-title { padding: 2px 8px; border-radius: 4px; }
.menu-title:hover, .menu li.open .menu-title { background: var(--search); }
.dropdown { display: none; position: absolute; top: 100%; left: 0; margin-top: 4px; min-width: 180px; z-index: 50; background: var(--editor); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 8px 20px #0008; }
.menu li.open .dropdown { display: block; }
.dropdown div { padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border); cursor: pointer; }
.dropdown div:last-child { border-bottom: 0; }
.dropdown div:hover { background: var(--search); }
.header-center { justify-content: center; gap: 20px; }
.searchbar { width: 400px; max-width: 100%; text-align: center; padding: 2px 8px; background: var(--search); border-radius: 6px; outline: 1px solid #6b7280; box-shadow: 0 4px 6px #0004; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { justify-content: flex-end; gap: 12px; padding-right: 12px; font-size: 13px; }
.header-right .sep { width: 4px; }
.header-right button:hover { color: #60a5fa; }

.main { flex: 1; display: flex; min-height: 0; }
.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--border); }
.editors { flex: 1; display: flex; min-height: 0; border-bottom: 1px solid var(--border); }
.col-left { width: 35%; display: flex; flex-direction: column; min-width: 0; }
.col-right { width: 65%; display: flex; flex-direction: column; min-width: 0; }
.panel { flex: 1 1 50%; min-height: 0; display: flex; flex-direction: column; background: var(--editor); border-bottom: 1px solid var(--border); }
.col-right .panel { border-left: 1px solid var(--border); }
.tabs { height: 31px; flex: none; display: flex; background: var(--bar); box-shadow: 0 4px 6px #0004; overflow: hidden; position: relative; z-index: 1; }
.tab { max-width: 200px; display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 14px; color: var(--text); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); white-space: nowrap; transition: background .15s; }
.tab img { width: 24px; height: 24px; padding: 4px; }
.tab em { font-style: normal; }
.tab.active { background: var(--editor); border-bottom-color: transparent; }
.tab:hover { background: var(--editor); }
.panel-body { flex: 1; min-height: 0; position: relative; }

.presentation { padding: 40px; }
.hello h1 { font-size: 48px; margin: 0; }
.hello h2 { font-size: 20px; margin: 8px 0 0; }
.hello p { margin: 8px 0 0; line-height: 1.5; }
.rise { animation: rise .5s var(--d) both; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }
.hello, .quote { transition: opacity .3s; }
.quote { position: absolute; inset: 0; padding: 0 20px 0 40px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; opacity: 0; pointer-events: none; }
.quote p { margin: 0; }
.presentation:hover .hello { opacity: 0; }
.presentation:hover .quote { opacity: 1; }
.signature { display: flex; align-items: center; gap: 8px; }
.signature img { width: 32px; height: 32px; padding: 4px; border-radius: 50%; outline: 1px solid var(--border); }

.contact { display: flex; flex-direction: column; }
.contact-top { flex: 1; min-height: 0; display: flex; gap: 8px; }
.contact-btn { width: 50%; display: grid; place-items: center; padding-top: 40px; }
.contact-top p { width: 50%; align-self: flex-end; margin: 0; padding: 0 8px; font-size: 14px; color: #fff; }
.reach { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #fff; text-decoration: none; background: linear-gradient(90deg, #000, var(--bar)); transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.reach:hover { transform: scale(1.05) rotate(5deg); }
.reach:active { transform: scale(.95); }
.marquee { height: 160px; flex: none; overflow: hidden; display: flex; align-items: center; }
.marquee-track { display: flex; gap: 20px; align-items: center; width: max-content; animation: slide 50s linear infinite; }
.marquee-track.slow { gap: 40px; animation-duration: 100s; }
@keyframes slide { to { transform: translateX(-50%); } }
.social { width: 110px; height: 110px; flex: none; border-radius: 8px; background: var(--card); display: grid; place-items: center; box-shadow: 0 10px 15px #0006; transition: background .3s, width .3s, height .3s; }
.social-icon { width: 40px; height: 40px; background: #fff; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; transition: background .3s, width .3s, height .3s; }
.social:hover, .social:focus-visible { background: #fff; width: 120px; height: 120px; }
.social:hover .social-icon, .social:focus-visible .social-icon { background: #000; width: 45px; height: 45px; }

.skills { display: flex; align-items: center; overflow: hidden; }
.skill { display: flex; align-items: center; gap: 16px; }
.skill img { width: 80px; height: 80px; object-fit: contain; }
.skill span { font-size: 96px; font-weight: 700; white-space: nowrap; }

.work { display: flex; }
.work-nav { position: sticky; top: 0; align-self: flex-start; width: 140px; flex: none; padding: 64px 0 0 40px; display: grid; gap: 2px; z-index: 2; }
.work-nav button { text-align: left; padding: 4px; font-weight: 700; color: #6b7280; border-radius: 2px; transition: all .3s; }
.work-nav button:hover { color: #e5e7eb; }
.work-nav button.on { color: #fff; text-decoration: underline; background: #6b728033; }
.work-list { flex: 1; min-width: 0; padding: 0 40px 60px; }
.job { padding: 48px 0 8px; border-bottom: 1px solid #ffffff0d; }
.job-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; }
.job-head > img { width: 110px; height: 110px; flex: none; object-fit: contain; padding: 12px; border-radius: 16px; background: #ffffff0d; border: 1px solid #ffffff14; box-shadow: 0 20px 25px #0008; }
.job-text { flex: 1; min-width: 240px; }
.job-meta { display: flex; gap: 8px; white-space: nowrap; }
.job-head h3 { font-size: 48px; margin: 0; line-height: 1.1; }
.job-btn { flex: none; padding: 4px; border-radius: 6px; color: #000; text-decoration: none; font-size: 15px; transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.job-btn:hover { transform: scale(1.05) rotate(5deg); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.tags span { font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 999px; }
.tag-teal { background: #ccfbf1; color: #115e59; } .tag-blue { background: #dbeafe; color: #1e40af; }
.tag-yellow { background: #fef9c3; color: #854d0e; } .tag-purple { background: #f3e8ff; color: #6b21a8; }
.tag-pink { background: #fce7f3; color: #9d174d; } .tag-gray { background: #f3f4f6; color: #1f2937; }
.tag-indigo { background: #e0e7ff; color: #3730a3; } .tag-green { background: #dcfce7; color: #166534; }
.tag-red { background: #fee2e2; color: #991b1b; } .tag-orange { background: #ffedd5; color: #9a3412; }

/* terminali in basso */
.bottom { height: 220px; flex: none; background: var(--bar); display: flex; flex-direction: column; }
.bottom-bar { height: 34px; flex: none; display: flex; justify-content: space-between; font-size: 14px; color: #fff; padding: 0 12px 0 20px; }
.bottom-bar ul { display: flex; align-items: center; gap: 20px; list-style: none; margin: 0; padding: 0; }
.bottom-tools { gap: 10px !important; }
.bottom-bar li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.bottom-bar li.on { text-decoration: underline; text-underline-offset: 6px; }
.bottom-bar img { width: 16px; height: 16px; }
.terminals { flex: 1; min-height: 0; display: flex; }
.term { flex: 1; min-width: 0; padding: 0 12px 8px 20px; font: 14px/1.45 var(--mono); color: #fff; border-right: 1px solid var(--border); cursor: text; }
.term-side { width: 180px; flex: none; padding-left: 8px; display: grid; align-content: start; gap: 8px; font-size: 16px; color: #fff; }
.prompt { display: flex; flex-wrap: wrap; gap: 0 8px; }
.prompt .p1, .prompt .p3, .prompt .p5, .prompt .p7 { color: #fff; }
.prompt.a .p0 { color: #eab308; } .prompt.a .p2 { color: #a855f7; } .prompt.a .p4 { color: #14b8a6; } .prompt.a .p6 { color: #f472b6; }
.prompt.a .p1, .prompt.a .p3, .prompt.a .p5, .prompt.a .p7 { color: var(--text); }
.prompt.b .p0 { color: #ef4444; } .prompt.b .p2 { color: #14b8a6; } .prompt.b .p4 { color: #ec4899; } .prompt.b .p6 { color: #818cf8; }
.term-intro { font-size: 14px; }
.term-intro.a { color: #93c5fd; } .term-intro.b { color: #86efac; }
.term-line { display: flex; gap: 8px; }
.term-input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; caret-color: #fff; padding: 0; }
.echo { margin-top: 6px; }
.block { margin: 4px 0 8px; display: grid; gap: 2px; }
.block .title, .neofetch .title { color: #60a5fa; font-weight: 700; margin-top: 4px; }
.k { color: #4ade80; display: inline-block; min-width: 90px; }
.err { color: #f87171; font-weight: 700; }
.muted { color: #9ca3af; font-style: italic; }
.techs { display: flex; flex-wrap: wrap; gap: 12px; }
.techs span { display: flex; align-items: center; gap: 4px; }
.techs img { width: 16px; height: 16px; }
.term a { color: #60a5fa; }
.neofetch { display: flex; gap: 16px; margin: 6px 0; }
.neofetch pre { margin: 0; color: #60a5fa; font-size: 11px; line-height: 1.15; }
.ls { display: flex; flex-wrap: wrap; gap: 0 16px; }
.ls .dir { color: #60a5fa; font-weight: 700; }

/* explorer a destra */
.explorer { width: 250px; flex: none; background: var(--bar); font-size: 14px; }
.explorer-title { padding: 8px; color: #9ca3af; font-weight: 600; font-size: 14px; }
.tree-node { position: relative; }
.tree-row { width: 100%; display: flex; align-items: center; gap: 4px; padding-top: 2px; padding-bottom: 2px; color: var(--text); text-align: left; white-space: nowrap; }
.tree-row:hover { background: #374151; }
.tree-row.sel { background: #1e40af; }
.tree-row img { width: 16px; height: 16px; }
.chev { font-size: 10px; width: 12px; }
.dot { font-size: 10px; margin-left: 6px; }
.dot.m { color: #eab308; } .dot.n { color: #22c55e; }

.footer { height: 21px; flex: none; display: flex; justify-content: space-between; background: var(--bar); border-top: 1px solid var(--border); color: #fff; font-size: 12px; }
.footer > div { display: flex; align-items: center; gap: 16px; }
.footer span { display: flex; align-items: center; gap: 6px; }
.footer img { width: 15px; height: 15px; }
.footer .ssh { width: 160px; height: 100%; justify-content: center; background: var(--ssh); font-size: 14px; }
.footer-right { padding-right: 8px; gap: 20px !important; }

#toast { position: fixed; top: 16px; right: 16px; z-index: 100; padding: 8px 16px; border-radius: 8px; color: #fff; background: #2563eb; box-shadow: 0 8px 20px #0008; }
#toast.success { background: #16a34a; } #toast.warning { background: #ca8a04; } #toast.error { background: #dc2626; }

/* laptop: un po' più compatto */
@media (max-width: 1485px) {
  .skill span { font-size: 64px; }
  .skill img { width: 56px; height: 56px; }
  .job-head h3 { font-size: 36px; }
  .term-side { display: none; }
  .header-right .sep ~ button, .arrows { display: none; }
}
/* telefono: stesso contenuto in colonna, si scorre la pagina */
@media (max-width: 820px) {
  html, body { overflow: auto; }
  #desktop-icons { padding: 80px 16px 0; grid-template-columns: repeat(4, 1fr); justify-items: center; }
  #vscode { height: auto; min-height: 100vh; }
  .menu, .arrows, .header-right { display: none !important; }
  .header-center { justify-content: flex-end; padding-right: 8px; }
  .searchbar { width: auto; font-size: 12px; }
  .main, .editors { flex-direction: column; }
  .col-left, .col-right { width: 100%; }
  .panel { flex: none; }
  .presentation { min-height: 320px; padding: 24px; }
  .contact { height: 300px; }
  .contact-btn { padding-top: 0; }
  .skills { height: 140px; }
  .skill span { font-size: 40px; }
  .skill img { width: 40px; height: 40px; }
  .work { height: 75vh; }
  .work-nav { display: none; }
  .work-list { padding: 0 16px 40px; }
  .job { padding-top: 40px; }
  .job-head { flex-wrap: wrap; }
  .job-head h3 { font-size: 28px; }
    .bottom { height: auto; }
  .bottom-tools { display: none !important; }
  .bottom-bar ul { gap: 12px; overflow-x: auto; }
  .terminals { flex-direction: column; }
  .term { height: 240px; flex: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .explorer { width: 100%; max-height: 300px; }
  .footer-right { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- coerenza: tutto quello che sembra cliccabile fa qualcosa ---------- */
.dropdown button { display: block; width: 100%; text-align: left; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.dropdown button:last-child { border-bottom: 0; }
.dropdown button:hover, .dropdown button:focus-visible { background: var(--search); }
.tab[data-go] { cursor: pointer; }
/* i nastri si fermano col mouse sopra, così le card si cliccano */
.marquee:hover .marquee-track, .skills:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
/* il pannello dove si arriva lampeggia un attimo */
.flash { animation: flash .9s ease; }
@keyframes flash { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 25% { box-shadow: inset 0 0 0 2px var(--ssh); } }
.ls button.dir { color: #60a5fa; font-weight: 700; }
.ls button.dir:hover { text-decoration: underline; }
@media (max-width: 820px) {
  /* telefono: i lavori hanno la loro barra di bottoni, fissa in cima al pannello */
  .work { flex: none; height: 75vh; flex-direction: column; }
  .work-nav { display: flex !important; width: 100%; gap: 6px; padding: 8px 16px; overflow-x: auto; background: var(--editor); border-bottom: 1px solid var(--border); scrollbar-width: none; }
  .work-nav button { flex: none; padding: 4px 10px; border-radius: 999px; background: #ffffff0d; }
}
