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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}
:root[data-theme='light'] { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur-slow) var(--ease-in-out), color var(--dur-slow) var(--ease-in-out);
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-4);
  color: var(--text-primary);
}
h1 { font-size: var(--step-6); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-3); }
h4 { font-size: var(--step-2); }

p { margin: 0 0 var(--space-4); color: var(--text-secondary); }
small { font-size: var(--step--1); }

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

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

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

button, input, textarea {
  font-family: inherit;
  color: inherit;
}

::selection {
  background: var(--accent);
  color: #fff;
}

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

code, .mono {
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-normal);
}

.container {
  width: min(100% - 2 * var(--space-5), var(--container));
  margin-inline: auto;
}

/* language visibility: JS toggles [lang] attr on body; CSS hides the other */
[data-i18n-es], [data-i18n-en] { display: none; }
body[data-lang='es'] [data-i18n-es] { display: revert; }
body[data-lang='en'] [data-i18n-en] { display: revert; }
body[data-lang='es'] span[data-i18n-en],
body[data-lang='en'] span[data-i18n-es] { display: none; }
