/* ==========================================================================
   Base: token dei temi, reset e tipografia
   ========================================================================== */

:root {
  /* Caratteri */
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Arrotondamenti */
  --radius-s: 12px;
  --radius-m: 18px;
  --radius-l: 26px;
  --radius-pill: 999px;

  /* Tema scuro (predefinito) */
  --bg: #0e0e0e;
  --surface: #171615;
  --surface-raised: #1f1e1c;
  --line: #2c2a27;
  --text: #f3eee4;
  --muted: #a39d92;
  --on-accent: #0e0e0e;

  /* Colore della materia: lo imposta il JS sul singolo elemento */
  --accent: var(--muted);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eeede8;
  --surface: #f8f7f3;
  --surface-raised: #ffffff;
  --line: #d5d2c9;
  --text: #151412;
  --muted: #625e56;

  color-scheme: light;
}

/* Reset ------------------------------------------------------------------ */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1,
h2,
h3,
p,
ul,
pre {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

code,
kbd,
pre {
  font-family: var(--font-mono);
}

/* Accessibilità ---------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

main:focus {
  outline: none;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
