:root {
  --bg: #b8cfe5;
  --bg-alt: #9fb9d6;
  --text: #0f1e30;
  --text-soft: #34465e;
  --rule: #7f9bbb;
  --accent: #0d3b66;
  --accent-soft: #8ab4d9;
  --code-bg: #1e1e22;
  --code-text: #e8e8ea;
  --max: 760px;
  --max-wide: 1100px;
}

* { box-sizing: border-box; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: #c8dceb;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
  max-width: var(--max-wide);
  flex-wrap: wrap;
}
.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  line-height: 1.15;
}
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-tag { font-size: 0.82rem; color: var(--text-soft); margin-top: 2px; }
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- main / hero ---------- */
main { padding: 2.5rem 0 4rem; }
.hero { padding: 1rem 0 2rem; border-bottom: 1px solid var(--rule); margin-bottom: 2.5rem; }
.hero h1 { font-size: 2.4rem; margin: 0 0 .5rem; letter-spacing: -0.02em; line-height: 1.15; }
.hero .lede { font-size: 1.2rem; color: var(--text-soft); margin: 0; }

.intro { margin: 0 0 3rem; }
.intro p { font-size: 1.05rem; }

/* ---------- post list / cards ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-card {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-card:last-child { border-bottom: none; }
.post-card h2, .post-card h3 { margin: 0 0 .35rem; line-height: 1.25; }
.post-card h2 { font-size: 1.35rem; }
.post-card h3 { font-size: 1.15rem; }
.post-card h2 a, .post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover, .post-card h3 a:hover { color: var(--accent); }
.post-card p { margin: .25rem 0; }
.post-card .post-meta { color: var(--text-soft); font-size: 0.88rem; }
.post-card .read-more { color: var(--accent); text-decoration: none; font-weight: 500; }
.post-card .read-more:hover { text-decoration: underline; }

.more-link { margin-top: 2rem; }
.more-link a { color: var(--accent); text-decoration: none; font-weight: 500; }
.more-link a:hover { text-decoration: underline; }

.recent h2, .blog-list h1 { font-size: 1.6rem; margin: 0 0 .5rem; letter-spacing: -0.01em; }

/* ---------- post (single) ---------- */
.post-header { margin-bottom: 2rem; }
.post-header h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: .25rem 0 0;
  letter-spacing: -0.02em;
}
.post-meta { color: var(--text-soft); font-size: 0.9rem; margin: 0; }
.post-meta a { color: var(--text-soft); text-decoration: none; border-bottom: 1px solid var(--rule); }
.post-meta a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.post-featured { margin: 1.5rem 0 2rem; }
.post-featured img { width: 100%; height: auto; border-radius: 4px; display: block; }

.post-body h2, .post-body h3, .post-body h4 {
  margin-top: 2.2rem;
  margin-bottom: .6rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.post-body h2 { font-size: 1.5rem; }
.post-body h3 { font-size: 1.25rem; }
.post-body h4 { font-size: 1.08rem; }

.post-body p { margin: 1rem 0; }
.post-body a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.post-body a:hover { background: var(--accent-soft); }

.post-body img { max-width: 100%; height: auto; border-radius: 4px; }

.post-body code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  background: var(--bg-alt);
  padding: .12em .4em;
  border-radius: 3px;
  font-size: 0.92em;
}
.post-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem 1.1rem;
  border-radius: 5px;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
}
.post-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: .25rem 0 .25rem 1.1rem;
  margin: 1.5rem 0;
  color: var(--text-soft);
  font-style: italic;
}
.post-body ul, .post-body ol { padding-left: 1.5rem; margin: 1rem 0; }
.post-body li { margin: .35rem 0; }
.post-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.post-body strong { color: var(--text); }

/* ---------- page (about / contatti) ---------- */
.page h1 { font-size: 2rem; margin-top: 0; letter-spacing: -0.02em; }
.page { line-height: 1.7; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding: 1.5rem 0;
  background: #c8dceb;
}
.site-footer .container { max-width: var(--max-wide); }
.site-footer p { color: var(--text-soft); font-size: 0.88rem; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  html { font-size: 16px; }
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 2rem; }
  .post-header h1 { font-size: 1.6rem; }
  .site-nav { gap: 1.2rem; }
}

/* ---------- contatti: 2-column layout with sidebar ---------- */
.with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  max-width: var(--max-wide);
  margin: 0 auto;
}
@media (min-width: 880px) {
  .with-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
}

.with-sidebar .page h1 { margin-top: 0; }
.with-sidebar .lede { color: var(--text-soft); font-size: 1.05rem; margin-bottom: 2rem; }
.with-sidebar h3 { margin-top: 2rem; font-size: 1.15rem; }
.with-sidebar pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: .9rem 1rem;
  border-radius: 5px;
  font-size: .85rem;
  display: inline-block;
}
.with-sidebar .map { margin: 2rem 0 0; }
.with-sidebar .map iframe { display: block; border: 1px solid var(--rule); border-radius: 5px; }
.with-sidebar .map figcaption { text-align: right; font-size: .82rem; padding-top: .4rem; }
.with-sidebar .map figcaption a { color: var(--text-soft); }
.with-sidebar .meta-info {
  margin-top: 2rem;
  padding: 1rem 1.2rem;
  background: var(--bg-alt);
  border-radius: 5px;
  font-size: .92rem;
  color: var(--text-soft);
}

.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.side-card {
  background: #c8dceb;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.4rem 1.3rem;
}
.side-card.ilion {
  background: linear-gradient(180deg, #f0f4f9, var(--bg-alt));
}
.side-eyebrow {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-soft);
  margin: 0 0 .25rem;
  font-weight: 600;
}
.side-brand {
  font-size: 1.4rem;
  margin: 0 0 .1rem;
  letter-spacing: -0.01em;
}
.side-sub {
  font-size: .72rem;
  letter-spacing: .2em;
  color: var(--accent);
  margin: 0 0 1rem;
  font-weight: 700;
}
.side-card p { margin: .6rem 0; font-size: .95rem; line-height: 1.55; }
.side-services {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}
.side-services li {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .92rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--rule);
}
.side-services li:last-child { border-bottom: none; }
.side-services .dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  padding: .65rem 1.1rem;
  border-radius: 5px;
  text-decoration: none !important;
  font-weight: 600;
  font-size: .95rem;
  transition: background .15s;
}
.btn:hover { background: #082240; }
.side-cta { margin-top: 1.2rem; text-align: center; }
.side-note {
  text-align: center;
  font-size: .82rem;
  color: var(--text-soft);
  margin: .5rem 0 0;
}
.side-card.recent h3 {
  margin: 0 0 .8rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-soft);
}
.side-card.recent ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.side-card.recent li {
  padding: .55rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: .92rem;
  line-height: 1.4;
}
.side-card.recent li:last-child { border-bottom: none; }
.side-card.recent a {
  color: var(--text);
  text-decoration: none;
}
.side-card.recent a:hover { color: var(--accent); }

/* ---------- home redesign ---------- */
.hero { text-align: left; }
.hero-eyebrow {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 .4rem;
}
.hero h1 {
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0 0 .8rem;
  letter-spacing: -0.02em;
}
.hero .lede {
  font-size: 1.18rem;
  color: var(--text-soft);
  margin: 0 0 1.5rem;
  max-width: 640px;
}
.hero-cta { margin: 0; display: flex; gap: .8rem; flex-wrap: wrap; }
.btn-ghost {
  background: transparent;
  color: var(--accent) !important;
  border: 1.5px solid var(--accent);
}
.btn-ghost:hover { background: var(--accent); color: #fff !important; }

/* about-short */
.about-short {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
  margin: 3.5rem 0;
  padding: 2rem;
  background: var(--bg-alt);
  border-radius: 8px;
}
@media (min-width: 720px) {
  .about-short {
    grid-template-columns: 180px 1fr;
    gap: 2rem;
    padding: 2.5rem;
  }
}
.about-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  justify-self: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}
.about-text h2 { margin: 0 0 .7rem; font-size: 1.5rem; letter-spacing: -0.01em; }
.about-text p { margin: .7rem 0; }
.about-text .read-more { color: var(--accent); font-weight: 600; text-decoration: none; }
.about-text .read-more:hover { text-decoration: underline; }

/* skills grid */
.skills { margin: 3.5rem 0; }
.skills > h2 {
  font-size: 1.6rem;
  margin: 0 0 1.5rem;
  letter-spacing: -0.01em;
}
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 600px) { .skills-grid { grid-template-columns: 1fr 1fr; } }
.skill {
  padding: 1.3rem 1.4rem;
  background: #f0f4f9;
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.skill h3 {
  margin: 0 0 .5rem;
  font-size: 1.08rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.skill p { margin: 0; font-size: .94rem; line-height: 1.55; color: var(--text-soft); }
.skill strong { color: var(--text); }

/* section head */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.5rem;
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
.section-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.section-link:hover { text-decoration: underline; }

/* cards (with optional thumbnail) */
.post-list.cards { display: grid; grid-template-columns: 1fr; gap: 1.2rem; padding: 0; margin: 0; list-style: none; }
.post-list.cards .post-card {
  border: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 6px;
  background: #f0f4f9;
  overflow: hidden;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .post-list.cards .post-card:has(.card-thumb) { grid-template-columns: 220px 1fr; }
}
.card-thumb { display: block; line-height: 0; }
.card-thumb img { width: 100%; height: 100%; min-height: 160px; max-height: 220px; object-fit: cover; display: block; }
.card-body { padding: 1.3rem 1.4rem; }
.card-body h3 { margin: 0 0 .25rem; font-size: 1.15rem; line-height: 1.3; }
.card-body p { margin: .25rem 0; }

/* CTA strip */
.cta-strip {
  margin: 4rem 0 0;
  padding: 2.5rem 2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-align: center;
}
.cta-strip h2 { margin: 0 0 .5rem; font-size: 1.5rem; color: #fff; }
.cta-strip p { margin: .5rem 0; color: var(--accent-soft); }
.cta-strip .btn {
  background: #fff;
  color: var(--accent) !important;
  margin-top: .8rem;
  font-weight: 700;
}
.cta-strip .btn:hover { background: var(--accent-soft); }

/* ---------- language switcher ---------- */
.lang-sep { color: var(--rule); padding: 0 .3rem; user-select: none; }
.lang-switch {
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .08em;
  color: var(--accent) !important;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  padding: .2rem .55rem !important;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.lang-switch:hover {
  background: var(--accent);
  color: #fff !important;
}
