/* l'intelligente — inchiostro, carta e pennellate gialle */
:root {
  --paper: #fcfaf1;
  --ink: #151515;
  --ink-soft: #3a3832;
  --muted: #6b675c;
  --yellow: #ffd60a;
  --yellow-wash: #fff3b0;
  --line: rgba(21, 21, 21, .85);
  --wobbly: 255px 12px 225px 12px / 12px 225px 12px 255px;
  --wobbly-2: 12px 225px 12px 255px / 255px 12px 225px 12px;
  --sans: "Bricolage Grotesque", "Inter", system-ui, -apple-system, sans-serif;
  --serif: "Literata", Georgia, serif;
  --hand: "Caveat Brush", "Bradley Hand", cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 20px; }
.hand { font-family: var(--hand); font-weight: 400; }

/* ---------- evidenziatore a pennello ---------- */
.brush, .hl {
  background-image: url(brush.svg);
  background-repeat: no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl { background-size: 0% 46%; background-position: 0 88%; transition: background-size .35s ease; }
a:hover .hl, a:focus-visible .hl { background-size: 100% 46%; }

/* ---------- header ---------- */
.top { position: relative; padding-top: 18px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 14px 6px; position: relative; }
.logo { font-family: var(--sans); font-weight: 800; font-size: clamp(50px, 9.5vw, 104px); letter-spacing: -0.045em; line-height: 1.05; }
.logo .brush { background-size: 100% 62%; background-position: 0 78%; padding-left: .12em; margin-left: -.12em; }
.logo .dot { color: var(--ink); }
.logo.small { font-size: 30px; }
.tagline { margin: 0; font-family: var(--sans); font-weight: 500; font-size: 17px; letter-spacing: -0.005em; color: var(--ink-soft); }

.nav { display: flex; gap: 4px 22px; flex-wrap: wrap; padding-block: 12px 18px; position: relative; }
.nav::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 14px; background: url(scribble.svg) center / 100% 100% no-repeat; }
.nav a { font-weight: 700; font-size: 15px; letter-spacing: .01em; padding: 2px 4px; background: url(brush.svg) 0 85% / 0% 55% no-repeat; transition: background-size .25s; }
.nav a:hover, .nav a.on { background-size: 100% 55%; }

/* ---------- ticker ---------- */
.ticker { display: flex; align-items: center; margin-top: 22px; border: 2px solid var(--line); border-radius: var(--wobbly); overflow: hidden; background: rgba(255,255,255,.5); }
.ticker-label { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 16px; white-space: nowrap; background: url(brush.svg) center / 92% 70% no-repeat; }
.ticker-track { overflow: hidden; flex: 1; }
.ticker-inner { display: flex; gap: 44px; white-space: nowrap; width: max-content; animation: scroll 55s linear infinite; padding-left: 12px; font-size: 14.5px; }
.ticker-inner a:hover { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; }
.ticker-inner b { font-weight: 800; margin-right: 6px; }
.ticker:hover .ticker-inner { animation-play-state: paused; }
@keyframes scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-inner { animation: none; } }

/* ---------- etichette ---------- */
.label { font-family: var(--sans); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; margin: 52px 0 20px; display: flex; align-items: center; gap: 14px; }
.label::after { content: ""; flex: 1; height: 14px; background: url(scribble.svg) center / 100% 100% no-repeat; }
.label.hand { font-family: var(--hand); font-weight: 400; font-size: 30px; letter-spacing: 0; }
.kicker { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; padding: 1px 6px; margin-bottom: 8px; background: url(brush.svg) center / 100% 85% no-repeat; }
time, .meta { color: var(--muted); font-size: 13px; }

/* ---------- immagini ---------- */
.media { aspect-ratio: 16 / 9; overflow: hidden; position: relative; }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
a:hover .media img { transform: scale(1.03); }
.ph { display: grid; place-items: center; background: url(blob.svg) center / 78% 70% no-repeat; }
.ph span { font-family: var(--hand); font-size: clamp(30px, 4.6vw, 52px); }

/* ---------- apertura ---------- */
.hero { margin-top: 30px; }
.hero-main { display: grid; grid-template-columns: 1.55fr 1fr; gap: 40px; align-items: center; }
.hero-main .media.big { aspect-ratio: 16 / 9; }
.hero-main h1 { font-weight: 800; font-size: clamp(32px, 3.9vw, 52px); line-height: 1.02; letter-spacing: -0.04em; margin: 0 0 18px; }
.hero-main .hl { background-size: 0% 40%; }
.hero-main .kicker { font-size: 13px; }
.lead { font-size: 18px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 12px; }
.hero-text .lead { font-size: 20px; }

/* ---------- griglia ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 40px 30px; }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card-link { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.card h3 { font-size: 21px; font-weight: 700; line-height: 1.22; letter-spacing: -0.02em; margin: 0 0 8px; }
.card p { margin: 0 0 10px; color: var(--ink-soft); font-size: 15.5px; }
.card.mini h3 { font-size: 18px; }
.card.mini p { display: none; }

/* ---------- articolo ---------- */
.post { max-width: 760px; margin: 44px auto 0; }
.post-head h1 { font-weight: 800; font-size: clamp(34px, 5.2vw, 56px); line-height: 1.04; letter-spacing: -0.04em; margin: 4px 0 16px; }
.post-head .lead { font-size: 20px; }
.post-media { margin: 26px -20px 30px; }
.post-body { font-family: var(--serif); font-size: 19px; line-height: 1.72; }
.post-body h2 { font-family: var(--sans); font-weight: 800; font-size: 25px; letter-spacing: -0.02em; margin: 38px 0 8px; }
.post-body h2::after { content: ""; display: block; width: 90px; height: 10px; margin-top: 2px; background: url(brush.svg) center / 100% 100% no-repeat; }
.post-body p { margin: 0 0 18px; }
.post-body a { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 4px; text-underline-offset: 2px; }
.post-body blockquote { position: relative; margin: 32px 0; padding: 24px 28px; font-family: var(--sans); font-weight: 700; font-size: 22px; line-height: 1.35; letter-spacing: -0.01em; }
.post-body blockquote::before { content: ""; position: absolute; inset: 0; background: url(blob.svg) center / 100% 100% no-repeat; z-index: -1; transform: rotate(.6deg); }
.post-body ul { padding-left: 22px; }
.post-body li { margin-bottom: 8px; }
.post-body li::marker { color: #e0b400; font-size: 1.2em; }

.tags, .share { font-family: var(--sans); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 28px; font-size: 14px; }
.tags span { color: var(--ink-soft); font-weight: 600; padding: 2px 10px; border: 1.5px solid var(--line); border-radius: var(--wobbly-2); }
.share span { font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .1em; margin-right: 4px; }
.share a { border: 2px solid var(--line); border-radius: var(--wobbly); padding: 5px 16px; font-weight: 700; text-decoration: none; transition: background-color .15s, transform .15s; }
.share a:hover { background: var(--yellow); transform: rotate(-1.5deg); }
.credit { font-family: var(--sans); font-size: 12px; color: var(--muted); margin: -22px 0 26px; }
.source { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 20px; }

.cat-title { font-weight: 800; font-size: clamp(44px, 8vw, 84px); letter-spacing: -0.05em; margin: 36px 0 28px; display: inline-block; padding: 0 .1em; background: url(brush.svg) 0 80% / 100% 55% no-repeat; }
.empty { color: var(--muted); }

/* ---------- footer ---------- */
.foot { margin-top: 80px; background: var(--ink); color: var(--paper); position: relative; }
.foot::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 14px; background: url(scribble.svg) center / 100% 100% no-repeat; }
.foot-row { padding-block: 40px; display: grid; gap: 10px; }
.foot .logo .brush { background: none; color: var(--yellow); padding-left: 0; margin-left: 0; }
.foot .logo .dot { color: var(--yellow); }
.foot p { margin: 0; color: #cfcab8; font-size: 14px; }
.foot .social a { color: var(--yellow); font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-main { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 520px) {
  .tagline { font-size: 15px; }
  .post-body { font-size: 18px; }
  .lead { font-size: 17px; }
  .post-media { margin-inline: 0; }
}

.tag-wrap { text-align: right; }
.ai-note { margin: 4px 0 0; font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.ai-note::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); margin-right: 6px; vertical-align: 1px; }
.ai-disclosure { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 6px; }
@media (max-width: 640px) { .tag-wrap { text-align: left; } }

.inline-fig { margin: 30px 0; }
.inline-fig img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.inline-fig figcaption { font-family: var(--sans); font-size: 12.5px; line-height: 1.4; color: var(--muted); margin-top: 8px; }
@media (min-width: 900px) { .inline-fig { float: right; width: 46%; margin: 6px -70px 18px 28px; } .post-body h2 { clear: both; } }

.auth { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.auth-btn { font: 700 13.5px var(--sans); color: var(--ink); background: transparent; border: 1.5px solid var(--ink); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.auth-btn:hover { background: var(--yellow); }
.auth-btn.solid { background: var(--ink); color: var(--paper); }
.auth-btn.solid:hover { background: var(--yellow); color: var(--ink); }
@media (max-width: 640px) { .auth { margin-left: 0; width: 100%; } }

.welcome { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(21,21,21,.45); animation: wfade .3s ease; }
.welcome-card { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 8px 8px 0 var(--ink); animation: wpop .35s ease; }
.welcome-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-bottom: 2px solid var(--ink); border-radius: 12px 12px 0 0; }
.welcome-body { padding: 20px 24px 24px; }
.welcome-body h2 { font-weight: 800; font-size: 26px; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 10px; }
.welcome-body p { margin: 0 0 18px; color: var(--ink-soft); font-size: 15.5px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.auth-btn.big { font-size: 15px; padding: 10px 20px; }
.welcome-skip { font: 600 14.5px var(--sans); background: none; border: 0; color: var(--ink-soft); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 8px 4px; }
.welcome-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper); font-size: 20px; line-height: 1; cursor: pointer; }
@keyframes wfade { from { opacity: 0; } }
@keyframes wpop { from { transform: translateY(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .welcome, .welcome-card { animation: none; } }

[hidden] { display: none !important; }

.contact-mail { font-family: var(--sans); font-weight: 800; font-size: clamp(22px, 4vw, 32px); letter-spacing: -0.02em; margin: 0 0 8px; overflow-wrap: anywhere; }
.contact-mail a { text-decoration-thickness: 5px !important; }

.upd { display: inline-block; margin: 0 0 8px 8px; font: 800 11px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: #fff; background: #d23a24; padding: 3px 8px; border-radius: 4px; vertical-align: top; }
.upd::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.howmade { font-family: var(--sans); font-size: 14.5px; line-height: 1.55; margin: 34px 0 6px; padding: 20px 22px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; }
.howmade h3 { margin: 0 0 10px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; display: inline-block; padding: 0 6px; background: url(brush.svg) center / 100% 80% no-repeat; }
.howmade p { margin: 0 0 8px; color: var(--ink-soft); }
.howmade strong { color: var(--ink); }
.howmade .src { margin: 0 0 10px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.howmade .src a { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none !important; }
.howmade .src a:hover { background: var(--yellow); }
.howmade .corr { background: #fff1ee; border-left: 4px solid #d23a24; padding: 8px 12px; color: var(--ink); }
.howmade-err { font-size: 13px; margin-bottom: 0 !important; }
.corr-list { list-style: none; padding: 0; }
.corr-list li { padding: 14px 0; border-bottom: 1px solid var(--rule, #e4e0d6); }

.caffe .post-body h2 { font-size: 21px; margin-top: 30px; }
.caffe .post-body h2::after { display: none; }
.caffe .post-body p { font-size: 18px; }
.caffe-more { margin-top: 30px; font-family: var(--sans); font-weight: 700; }
