:root {
  --paper:  #E7EBEE;
  --ink:    #14181C;
  --muted:  #59646D;
  --rule:   #C5CFD5;
  --wash:   #DDE3E7;

  --deep:      #0D1A17;
  --deep-text: #E8EFEC;
  --deep-dim:  #7D8F89;

  --accent:      #0B6B4E;
  --accent-glow: #3FBF8A;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:  #131A18;
    --ink:    #E2E9E6;
    --muted:  #8B9A95;
    --rule:   #29332F;
    --wash:   #1B2320;
    --deep:   #080F0D;
    --accent: #3FBF8A;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 36rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ————— fascia superiore ————— */

.band {
  background: var(--deep);
  color: var(--deep-text);
  padding: 5.5rem 0 3rem;
}

.band--page { padding: 2.5rem 0 2.75rem; }

.band a { color: var(--deep-dim); }
.band a:hover { color: var(--accent-glow); }

.back {
  display: inline-block;
  margin-bottom: 2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.back:hover { text-decoration: underline; }

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 3.75rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.band--page h1 { font-size: clamp(1.75rem, 5.5vw, 2.5rem); }

.eyebrow {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-glow);
}

.record {
  margin: 2rem 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--deep-dim);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.record::-webkit-scrollbar { display: none; }
.record b { color: var(--accent-glow); font-weight: 400; }

.source {
  margin: 1.25rem 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--deep-dim);
}

/* ————— corpo ————— */

main { padding: 3.5rem 0 0; }

section + section { margin-top: 2.75rem; }

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

h2 {
  margin: 3rem 0 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
}

h2 .num {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  margin-right: 0.6rem;
  vertical-align: 0.15em;
}

.label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 3.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 45%, 100% { opacity: 1; }
  55%, 70%      { opacity: 0.2; }
}

ul, ol { margin: 0 0 1rem; padding-left: 1.35rem; }
li { margin-bottom: 0.4rem; }
li:last-child { margin-bottom: 0; }
li > ul, li > ol { margin-top: 0.4rem; }

strong { font-weight: 600; }

/* ————— codice ————— */

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--wash);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

pre {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  background: var(--deep);
  color: var(--deep-text);
  font-size: 0.8125rem;
  line-height: 1.7;
  overflow-x: auto;
  border-radius: 3px;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ————— tabelle ————— */

.table-scroll { overflow-x: auto; margin: 1.25rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.9rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--ink);
  white-space: nowrap;
}

/* ————— riquadro "da ricordare" ————— */

.ricorda {
  margin: 1.75rem 0;
  padding: 1.1rem 1.25rem;
  background: var(--wash);
  border-left: 2px solid var(--accent);
}

.ricorda p.t {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.ricorda ul { margin: 0; }
.ricorda li { font-size: 1rem; }

/* ————— indice degli appunti ————— */

.indice { margin: 0; padding: 0; list-style: none; }

.indice li {
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.indice a {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  text-decoration: none;
  align-items: baseline;
}

.indice a:hover .t { color: var(--accent); }

.indice .n {
  flex: 0 0 2rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
}

.indice .t { font-weight: 600; }
.indice .d { display: block; font-size: 0.9375rem; color: var(--muted); font-weight: 400; }

/* ————— colophon ————— */

.specs { margin: 0; font-family: var(--mono); font-size: 0.8125rem; line-height: 1.9; color: var(--muted); }
.specs div { display: flex; gap: 1rem; border-bottom: 1px solid var(--rule); padding: 0.35rem 0; }
.specs dt { flex: 0 0 6.5rem; }
.specs dd { margin: 0; color: var(--ink); }

/* ————— collegamenti ————— */

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover { color: var(--accent); }

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

/* ————— piede ————— */

footer {
  margin-top: 3.5rem;
  padding: 1.5rem 0 4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }

.sep { margin: 0 0.7rem; opacity: 0.4; }

@media (prefers-reduced-motion: reduce) {
  .light { animation: none; }
}
