/*
 * PROTRACKER — Reset & Base Styles
 */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Box sizing ───────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Base HTML ────────────────────────────────────────────────────────────── */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-regular);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ── Tipografia base ──────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
h5, h6 { font-size: var(--text-base); }

p {
    color: var(--color-text-secondary);
    line-height: var(--leading-loose);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--color-accent-hover); }

strong { font-weight: var(--font-semibold); color: var(--color-text-primary); }
em     { font-style: italic; }
small  { font-size: var(--text-sm); }

code, pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
}
code { padding: 0.1em 0.4em; }
pre  { padding: var(--space-4); overflow-x: auto; }

/* ── Liste ────────────────────────────────────────────────────────────────── */
ul, ol { list-style: none; }

/* ── Form elements reset ──────────────────────────────────────────────────── */
input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
    border: none;
    background: none;
}

button { cursor: pointer; }

input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ── Immagini ─────────────────────────────────────────────────────────────── */
img, svg {
    display: block;
    max-width: 100%;
}

/* ── Selezione testo ──────────────────────────────────────────────────────── */
::selection {
    background: var(--color-accent-subtle);
    color: var(--color-text-primary);
}

/* ── Non selezionabile — tutta l'interfaccia ─────────────────────────────── */
/* Input, textarea e select mantengono la selezione nativa (override sotto).  */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
}

/* SVG e figli ereditano il cursore dal genitore invece di prendere default dal * */
svg, svg * {
    cursor: inherit;
}

/* Garantisce manina su qualsiasi bottone, anche con tabindex="-1" */
button:not(:disabled),
[role="button"]:not(:disabled) {
    cursor: pointer !important;
}

/* Ripristina selezione e cursore per gli elementi che ne hanno bisogno */
input,
textarea,
select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

input[type="checkbox"],
input[type="radio"] {
    cursor: pointer;
}

button,
[role="button"],
a,
[onclick],
.btn,
.tab-item,
.nav-item,
.badge,
.node,
select {
    cursor: pointer;
    user-select: none;
}

label{
    user-select: none;
}

/* ── Focus visibile per accessibilità ────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ── Animazioni globali ───────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
