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

:root {
  --content-primary: rgb(36, 36, 36);
  --content-secondary: rgb(117, 117, 117);
  --background: rgb(255, 255, 255);
  --code-background: rgb(249, 249, 249);
  --code-border: rgb(229, 229, 229);

  --main-width: 780px;
  --main-padding: 1.4em;
  --font-body: 'Literata', Georgia, Cambria, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

/* Tema scelto esplicitamente dall'utente (vedi theme.js). Default: chiaro,
   a prescindere dalle preferenze di sistema. */
:root[data-theme="dark"] {
  --content-primary: rgb(218, 218, 218);
  --content-secondary: rgb(140, 140, 140);
  --background: rgb(20, 20, 20);
  --code-background: rgb(30, 30, 30);
  --code-border: rgb(50, 50, 50);
}

body { transition: background-color 0.15s, color 0.15s; }

html { scroll-behavior: smooth; }

body {
  background: var(--background);
  color: var(--content-primary);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1em;
  line-height: 1.5em;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--main-width);
  margin: 0 auto;
  padding: var(--main-padding);
  padding-bottom: 3rem;
}

a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--content-secondary); }
strong, b { font-weight: 600; }
small, .small { font-size: small; }
.secondary { color: var(--content-secondary); }

/* HEADER */
header { margin-bottom: 2.5rem; }
header h1 { font-size: 2em; font-weight: 600; line-height: 1.3; margin-bottom: 0.3rem; }
header h1 a { text-decoration: none; }
.menu { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: baseline; }
.menu a, .menu button {
  font-family: var(--font-body);
  font-size: small;
  font-weight: 300;
  color: var(--content-secondary);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: inherit;
}
.menu a::before, .menu button::before { content: "/"; }
.menu a:hover, .menu button:hover, .menu a.active { color: var(--content-primary); }
.menu a.active { font-weight: 600; }

/* TITOLI */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
h2 { font-size: 1.8em; margin: 2rem 0 1.5rem; }
h3 { font-size: 1.4em; margin: 1.8rem 0 1rem; }

p { margin: 0 0 1.2rem; }
p:last-child { margin-bottom: 0; }

/* HOME */
.intro { margin-bottom: 2.5rem; }
.intro p { color: var(--content-secondary); }

main > section { margin-bottom: 2.5rem; }
main > section > h2 { font-size: 1.8em; margin: 0 0 1.2rem; }

.entry { margin-bottom: 1.2rem; }
.entry:last-child { margin-bottom: 0; }
.entry-title { font-weight: 600; }
.entry-meta { font-size: small; color: var(--content-secondary); }
.entry-desc { color: var(--content-secondary); }

.inline-list { color: var(--content-secondary); }

.links-list { list-style: none; }
.links-list li { margin-bottom: 0.4rem; }

/* ANTEPRIMA BLOG (fetch da mental-diff) */
.post-list { list-style: none; }
.post-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.9rem; }
.post-list .post-date { font-size: small; color: var(--content-secondary); white-space: nowrap; padding-top: 0.1rem; }

footer { margin-top: 3rem; font-size: small; color: var(--content-secondary); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 1024px) { :root { --main-width: 750px; } }
@media (max-width: 640px) {
  header h1 { font-size: 1.7em; }
  h2, main > section > h2 { font-size: 1.5em; }
  .post-list li { flex-direction: column; gap: 0.1rem; }
}
