/* ============================================================
   DNA HUB — BASE
   Reset + tipografia + utility + focus + layout primitives
   ============================================================ */

/* ---------- RESET ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

/* ---------- TIPOGRAFIA DI BASE ---------- */
.t-xs   { font-size: var(--text-xs);   line-height: var(--leading-xs); }
.t-sm   { font-size: var(--text-sm);   line-height: var(--leading-sm); }
.t-base { font-size: var(--text-base); line-height: var(--leading-base); }
.t-md   { font-size: var(--text-md);   line-height: var(--leading-md); }
.t-lg   { font-size: var(--text-lg);   line-height: var(--leading-lg); }
.t-xl   { font-size: var(--text-xl);   line-height: var(--leading-xl); }
.t-2xl  { font-size: var(--text-2xl);  line-height: var(--leading-2xl); }
.t-3xl  { font-size: var(--text-3xl);  line-height: var(--leading-3xl); }

.w-regular  { font-weight: var(--weight-regular); }
.w-medium   { font-weight: var(--weight-medium); }
.w-semibold { font-weight: var(--weight-semibold); }
.w-bold     { font-weight: var(--weight-bold); }

.text-primary   { color: var(--color-text); }
.text-secondary { color: var(--color-text-secondary); }
.text-disabled  { color: var(--color-text-disabled); }
.text-inverse   { color: var(--color-text-inverse); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-danger    { color: var(--color-danger); }

.tabular { font-variant-numeric: tabular-nums; }

/* ---------- FOCUS ---------- */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Focus su sfondo scuro */
.on-dark :focus-visible {
  outline-color: #FFFFFF;
}

/* ---------- UTILITY DI LAYOUT ---------- */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center{ align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* ---------- SCROLLBAR (discreta, enterprise) ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover { background: var(--color-text-secondary); }

/* ---------- UTILITY: SR-ONLY (per screen reader) ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- SKIP LINK (accessibilità) ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-sm);
  z-index: 9999;
  transition: top var(--motion-fast) var(--ease-standard);
}
.skip-link:focus { top: var(--space-4); }