/* =============================================================================
   SkeePass — assets/css/base.css
   Reset moderno, tipografia di base, focus visibile, scrollbar a tema,
   selezione del testo, utilità e rispetto di prefers-reduced-motion.
   Dipende da tokens.css. Nessuna classe di componente: quelle stanno in
   components.css, la shell in layout.css.
   ============================================================================= */

/* --------------------------------------------------------------------------
   Box model e radice
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------------------
   Reset degli elementi
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6, p, dl, dd, figure, blockquote, pre {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  overflow-wrap: break-word;
}

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

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

svg {
  flex-shrink: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  text-align: inherit;
}

button:disabled {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

/* Il pulsante nativo di cancellazione dei campi di ricerca: lo disegna il componente */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

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

a:hover {
  text-decoration: underline;
}

strong, b {
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--text-xs);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.93em;
}

hr {
  height: 1px;
  margin: var(--space-4) 0;
  border: 0;
  background: var(--color-border);
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

summary {
  cursor: pointer;
}

[inert] {
  pointer-events: none;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Focus: visibile e coerente ovunque, solo da tastiera (focus-visible)
   -------------------------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Selezione del testo
   -------------------------------------------------------------------------- */
::selection {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
}

/* --------------------------------------------------------------------------
   Scrollbar sottile a tema
   -------------------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border: 3px solid transparent;
  border-radius: var(--radius-full);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-text-muted);
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: transparent;
}

/* --------------------------------------------------------------------------
   Utilità
   -------------------------------------------------------------------------- */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-3);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
}

.skip-link:focus {
  top: var(--space-4);
  text-decoration: none;
}

.nowrap {
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
}

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

.text-sm {
  font-size: var(--text-sm);
}

.text-muted {
  color: var(--color-text-muted);
}

.spacer {
  flex: 1 1 auto;
}

/* --------------------------------------------------------------------------
   Riduzione del movimento: transizioni e animazioni azzerate
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
