/* Reesource · identità Reesource Nexus
   Palette: Deep Forest, Nexus Green, Teal Light, Mist, Charcoal, Warm Gray, Signal Purple.
   Tipografia: Geist (titoli e testo), Geist Mono (etichette). */
:root {
  --forest: #15352a;
  --teal: #8fd3c4;

  --bg: #fbfcfb;
  --surface: #eef3f0;
  --fg: #1f2624;
  --muted: #5e655f;
  --line: #d5ded8;
  --accent: #2c8a58;
  --accent-ink: #1f6e44;
  --signal: #6a4fc8;
  --band: #15352a;
  --band-fg: #eef3f0;
  --band-muted: #a9c4b8;
  --band-line: #2d5244;

  --font: "Geist", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --measure: 760px;
  --wide: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101a16; --surface: #16241e; --fg: #e6ece8; --muted: #a3b0a8; --line: #2a3b33;
    --accent: #5cc28b; --accent-ink: #7dd3a4; --signal: #a08cf0;
    --band: #0b1411; --band-fg: #e6ece8; --band-muted: #93ab9f; --band-line: #22372e;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-weight: 500; line-height: 1.12; text-wrap: balance; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 600; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); letter-spacing: -0.03em; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--bg); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: 16px; }

.wrap { max-width: var(--wide); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.eyebrow { font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Intestazione */
header.site { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .8rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--fg); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.03em; flex-shrink: 0; }
.brand .logo-mark { width: 34px; height: 18px; color: var(--accent); }
.brand .logo-img { width: 30px; height: 30px; object-fit: contain; }
nav.main { display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: none; }
nav.main::-webkit-scrollbar { display: none; }
nav.main a { text-decoration: none; color: var(--muted); font-size: .93rem; padding: .35rem .6rem; border-radius: 6px; white-space: nowrap; }
nav.main a:hover { color: var(--fg); background: var(--surface); }
nav.main a[aria-current="page"] { color: var(--fg); background: var(--surface); font-weight: 600; }
@media (max-width: 760px) {
  header.site .wrap { flex-direction: column; align-items: stretch; gap: .4rem; padding-block: .6rem; }
  nav.main { margin-inline: -.6rem; }
}

/* Bande scure */
.band { background: var(--band); color: var(--band-fg); }
.band a { color: var(--teal); }
.btn, .hero-text p:last-child a:only-child { display: inline-flex; align-items: center; gap: .5rem; padding: .75rem 1.2rem; border-radius: 999px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; font-size: .97rem; }
.band .btn, .hero-text p:last-child a:only-child { background: var(--teal); color: var(--forest); }
.btn:hover, .hero-text p:last-child a:only-child:hover { filter: brightness(1.07); }
.hero-text p:last-child strong, .hero-text p:last-child a strong { font-weight: 600; }

/* Home: apertura */
.hero { padding-block: clamp(3.2rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.hero-grid > * { min-width: 0; }
.hero-text { display: flex; flex-direction: column; gap: 1.4rem; }
.hero-text h2, .hero-text .h-lg { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 600; letter-spacing: -0.035em; }
.hero-text p { font-size: 1.18rem; color: var(--band-muted); max-width: 56ch; }
.hero-text p:last-child { margin-top: .2rem; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 2.2rem; } }

.measure { margin: 0; border: 1px solid var(--band-line); border-radius: 14px; padding: 1.4rem 1.4rem 1.1rem; background: color-mix(in srgb, var(--band) 85%, #000); }
.measure svg { width: 100%; height: auto; display: block; }
.measure figcaption { font-family: var(--mono); font-size: .72rem; color: var(--band-muted); margin-top: .8rem; letter-spacing: .03em; }
.m-axis { stroke: var(--band-line); stroke-width: 2; }
.m-mono { font-family: var(--mono); font-size: 11px; fill: var(--band-muted); }
.m-t0 { fill: var(--teal); opacity: .35; }
.m-t1 { fill: var(--teal); }
.m-ws { fill: var(--band-muted); opacity: .5; }
.m-rep { fill: var(--signal); }
.m-curve { fill: none; stroke: var(--teal); stroke-width: 1.5; stroke-dasharray: 4 5; }
.m-label { font-family: var(--font); font-size: 13px; fill: var(--band-fg); }
.m-note { font-family: var(--font); font-size: 13px; fill: var(--band-muted); }

/* Testata delle pagine interne */
.phead { border-bottom: 1px solid var(--line); }
.phead .wrap { padding-block: clamp(2.6rem, 6vw, 4.2rem) clamp(2rem, 4vw, 2.8rem); }
.phead-in { display: flex; flex-direction: column; gap: 1rem; max-width: var(--measure); margin-inline: auto; }
.crumb { font-family: var(--mono); font-size: .74rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.crumb a { color: var(--muted); }
.meta { font-family: var(--mono); font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Contenuto da Notion */
.section { padding-block: clamp(2.6rem, 6vw, 4.5rem); }
.content { display: grid; grid-template-columns: minmax(0, 1fr) min(var(--measure), 100%) minmax(0, 1fr); row-gap: 1.1rem; }
.content > * { grid-column: 2; min-width: 0; }
.content > .cards, .content > .posts, .content > .columns, .content > .table-wrap, .content > .db-title { grid-column: 1 / -1; width: 100%; max-width: var(--wide); justify-self: center; }
.content > h2 { margin-top: 2rem; }
.content > h2:first-child { margin-top: 0; }
.content > h3 { margin-top: 1rem; }
.content p { font-size: 1.06rem; }
.content ul, .content ol { margin: 0; padding-left: 1.25rem; display: grid; gap: .5rem; }
.content li > ul, .content li > ol { margin-top: .5rem; }
.content li::marker { color: var(--accent-ink); }
.content hr { border: 0; border-top: 1px solid var(--line); margin-block: 1.4rem; width: 100%; }
.content blockquote { margin: .4rem 0; border-left: 2px solid var(--accent); padding-left: 1.1rem; font-weight: 300; font-size: 1.3rem; line-height: 1.45; letter-spacing: -0.01em; }
.content blockquote em { font-style: normal; }
.content code { font-family: var(--mono); font-size: .88em; background: var(--surface); padding: .1em .35em; border-radius: 4px; }
.content pre.code { overflow-x: auto; background: var(--surface); padding: 1rem; border-radius: 10px; font-size: .9rem; }
.content pre.code code { background: none; padding: 0; }

figure.img { margin: .6rem 0; }
figure.img img { border-radius: 12px; }
figure.img figcaption { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.only-mobile { display: none; }
@media (max-width: 640px) { .only-mobile { display: block; } .only-desktop { display: none; } }

.callout { display: flex; gap: .9rem; border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem 1.4rem; background: var(--bg); }
.callout .icon { font-size: 1.3rem; line-height: 1.3; }
.callout-body { display: flex; flex-direction: column; gap: .7rem; min-width: 0; flex: 1; }
.callout-body > p:first-child strong:only-child { font-size: 1.12rem; letter-spacing: -0.01em; }
.callout.note { border: 0; border-left: 3px solid var(--signal); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--signal) 7%, var(--bg)); }
.callout ul { padding-left: 0; list-style: none; gap: .55rem; }
.callout ul li { padding-left: 1.3rem; position: relative; }
.callout ul li::before { content: ""; position: absolute; left: 0; top: .72em; width: .6rem; height: 2px; background: var(--accent); }

.columns { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 1.4rem; }
.columns .col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (max-width: 820px) { .columns { grid-template-columns: 1fr; } }

details.toggle { border-top: 1px solid var(--line); padding-top: .6rem; }
details.toggle > summary { cursor: pointer; list-style: none; display: flex; gap: .6rem; align-items: baseline; font-weight: 600; }
details.toggle > summary::before { content: "+"; font-family: var(--mono); color: var(--accent-ink); }
details.toggle[open] > summary::before { content: "−"; }
details.toggle > summary h2, details.toggle > summary h3 { display: inline; }
details.toggle > *:not(summary) { margin-top: 1rem; }

.db-title { margin-top: 1.4rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.cards.one { grid-template-columns: minmax(0, 420px); }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: var(--fg); background: var(--bg); transition: border-color .15s; }
.card:hover { border-color: var(--accent); }
.card-img { aspect-ratio: 16 / 9; background: var(--surface); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { display: flex; flex-direction: column; gap: .6rem; padding: 1.1rem 1.2rem 1.1rem; flex: 1; }
.card-title { font-weight: 600; font-size: 1.1rem; letter-spacing: -0.015em; line-height: 1.25; }
.card time { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.card .go { margin-top: auto; font-size: .88rem; color: var(--accent-ink); font-weight: 600; }

.posts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.post-card { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.6rem; padding-block: 1.6rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--fg); align-items: start; }
.post-card:not(:has(.post-img)) { grid-template-columns: minmax(0, 1fr); }
.post-img { aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--surface); }
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-body { display: flex; flex-direction: column; gap: .55rem; }
.post-title { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; }
.post-card:hover .post-title { color: var(--accent-ink); }
.post-ex { color: var(--muted); }
.post-card time { font-family: var(--mono); font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 640px) { .post-card { grid-template-columns: 1fr; gap: 1rem; } }

.bookmark { display: flex; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem; text-decoration: none; color: var(--fg); overflow-wrap: anywhere; }
.bookmark:hover { border-color: var(--accent); }
.embed iframe { width: 100%; border: 0; border-radius: 10px; }
.embed.video iframe { aspect-ratio: 16 / 9; height: auto; }
.embed:not(.form):not(.video) iframe { min-height: 420px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; }
.todo { display: flex; gap: .5rem; }
.todo.done { color: var(--muted); text-decoration: line-through; }

/* Colori del testo da Notion, adattati alla palette */
.tx-gray, .tx-brown { color: var(--muted); }
.tx-green, .tx-blue { color: var(--accent-ink); }
.tx-purple, .tx-pink { color: var(--signal); }
.tx-orange, .tx-yellow, .tx-red { color: #b4541f; }
[class^="hl-"] { background: color-mix(in srgb, var(--teal) 30%, transparent); padding: 0 .15em; border-radius: 3px; }

/* Home: colonna larga, testo comunque leggibile */
.home .content { grid-template-columns: minmax(0, 1fr) min(var(--wide), 100%) minmax(0, 1fr); }
.home .content > p, .home .content > ul, .home .content > ol { max-width: 66ch; }
.home .content > h2 { margin-top: 2.6rem; }
.home .content > h2:first-child { margin-top: 0; }
@media (max-width: 640px) { .card-img { aspect-ratio: 2 / 1; } }

/* Articoli */
body:not(.home) .content > p:first-child { font-size: 1.18rem; color: var(--muted); }
.content .sources, .content h2 + ul a { overflow-wrap: anywhere; }

/* Banda finale e piè di pagina */
.cta .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding-block: clamp(2.2rem, 5vw, 3.5rem); }
.cta-text { display: flex; flex-direction: column; gap: .6rem; }
.cta-text p { color: var(--band-muted); max-width: 52ch; }
footer.site { border-top: 1px solid var(--line); background: var(--surface); }
footer.site .wrap { padding-block: 2.4rem; display: grid; gap: 1.4rem; }
footer.site nav { display: flex; gap: .6rem 1.1rem; flex-wrap: wrap; }
footer.site nav a { color: var(--fg); text-decoration: none; font-size: .92rem; }
footer.site nav a:hover { color: var(--accent-ink); }
footer.site .legal { font-size: .8rem; color: var(--muted); line-height: 1.7; max-width: 90ch; }

/* Pagina non trovata */
.notfound { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
