/* --------------------------------------------------
   PALETTE (dalla tua immagine)
-------------------------------------------------- */
:root {
  --sand: #cdbb7a;
  --olive: #7e9167;
  --deep-blue: #2c4f66;
  --clay: #8a3433;
  --brown: #574c2c;
  --midnight: #1f2542;

  /* Tema Dark */
  --bg: var(--midnight);
  --bg-soft: #131726;
  --card: var(--deep-blue);
  --card-soft: #203d50;
  --paper: #f5f1e4;

  --text-main: #f9fafb;
  --text-soft: #dfe4ea;
  --text-muted: #9ca3af;

  --border-subtle: rgba(255,255,255,0.08);
  --link: var(--sand);
  --link-hover: #b49e5a;

  --transition: 0.25s ease;
}

/* Tema Light */
:root[data-theme="light"] {
  --bg: #f5f1e4;
  --bg-soft: #ede6d1;
  --card: #ffffff;
  --card-soft: #f9f4e6;

  --text-main: #1f232d;
  --text-soft: #2c3447;
  --text-muted: #585f6b;

  --border-subtle: rgba(0,0,0,0.12);
  --link: var(--clay);
  --link-hover: #662726;
}

/* --------------------------------------------------
   RESET + TYPO
-------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4 {
  font-family: "Playfair Display", serif;
  line-height: 1.25;
}

/* --------------------------------------------------
   LAYOUT
-------------------------------------------------- */
.page {
  max-width: 78rem;
  margin: auto;
  padding: 1.25rem;
}

.card {
  background: var(--card);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  transition: background var(--transition), border var(--transition);
}

.card-paper {
  background: var(--paper);
  color: #1b1b1d;
  border-radius: 1rem;
  padding: 1.8rem;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.readable {
  max-width: 62ch;
}

/* --------------------------------------------------
   HEADER
-------------------------------------------------- */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .7rem 1rem;
}

.nav-links a {
  margin-left: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
  transition: color var(--transition);
}

.nav-links a:hover {
  color: var(--link);
}

/* --------------------------------------------------
   PILL
-------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: .3rem .8rem;
  border-radius: 999px;
  font-size: .65rem;
  letter-spacing: .2em;
  border: 1px solid var(--border-subtle);
  background: rgba(0,0,0,0.26);
}

/* --------------------------------------------------
   TIMELINE
-------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 2.2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.9rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--olive);
  opacity: .7;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.6rem;
}

.timeline-marker {
  position: absolute;
  left: -0.15rem;
  top: .25rem;
  width: .8rem;
  height: .8rem;
  background: var(--sand);
  border-radius: 50%;
  border: 2px solid var(--brown);
}

/* --------------------------------------------------
   TAG LIST / KEYWORDS
-------------------------------------------------- */
.tag {
  padding: .3rem .7rem;
  background: var(--bg-soft);
  border-radius: .5rem;
  border: 1px solid var(--border-subtle);
  font-size: .7rem;
}

/* --------------------------------------------------
   SIDEBAR
-------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --------------------------------------------------
   THEME TOGGLE
-------------------------------------------------- */
.theme-toggle {
  border: 1px solid var(--border-subtle);
  background: transparent;
  padding: .45rem .9rem;
  border-radius: 999px;
  font-size: .8rem;
  cursor: pointer;
  transition: background var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-soft);
}

/* --------------------------------------------------
   SMOOTH ANCHOR HIGHLIGHT
-------------------------------------------------- */
section:target {
  animation: highlight 1s ease-out;
}

@keyframes highlight {
  0% { background: rgba(205,187,122,0.18); }
  100% { background: transparent; }
}
