/* francescomanzoni.com
   Black and white, one typeface. The only script is the background in sky.js.
   The CSP blocks inline style attributes: every style lives here. */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("/assets/fonts/familjen-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Familjen Grotesk";
  src: url("/assets/fonts/familjen-grotesk-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: only light;
  --ink: #000;
  --paper: #fff;
  --soft: #555;
  --soft-on-ink: #d0d0d0;
  --pad: clamp(20px, 5vw, 40px);
  --ease: 0.15s;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--ink) var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.5 "Familjen Grotesk", system-ui, sans-serif;
}
::selection { background: var(--ink); color: var(--paper); }
a { color: var(--ink); text-underline-offset: 4px; transition: color var(--ease); }
a:hover { color: var(--soft); }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.skip {
  position: absolute; top: 0; left: var(--pad); padding: 8px 14px;
  background: var(--ink); text-decoration: none; transform: translateY(-100%);
}
.skip, .skip:hover { color: var(--paper); }
.skip:focus { transform: none; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 32px var(--pad) 56px; }

/* Header */
header.site {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 12px 28px; font-size: 17px; margin-bottom: clamp(48px, 9vw, 96px);
}
.home { text-decoration: none; font-weight: 600; }
.home:hover { text-decoration: underline; }
header.site nav { display: flex; gap: 28px; }

/* Links that gain an underline on hover */
.ul { text-decoration: none; border-bottom: 1.5px solid transparent; padding-bottom: 2px; transition: border-color var(--ease), color var(--ease); }
.ul:hover, .ul:focus-visible, .ul.on, .ul.always { border-bottom-color: var(--ink); }

/* Links that invert on hover */
.big {
  display: inline-block; padding: 4px 10px; margin: 0 -10px;
  font-size: clamp(40px, 6vw, 64px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05;
  text-underline-offset: 10px; text-decoration-thickness: 3px;
  transition: background-color var(--ease), color var(--ease);
}
.big:hover, .big:focus-visible { background: var(--ink); color: var(--paper); }

/* Hero */
.hero {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: clamp(12px, 4vw, 56px); margin: 0 0 clamp(28px, 5vw, 48px);
}
.hero h1, h1.page {
  margin: 0; font-weight: 700; line-height: 0.88; letter-spacing: -0.05em;
  font-size: clamp(44px, 12vw, 156px);
}
.hero h1 { flex: 1 1 auto; min-width: 0; }
h1.page { margin-bottom: clamp(28px, 5vw, 48px); }
.castle { display: block; flex: 0 0 auto; width: clamp(84px, 25.8vw, 344px); height: auto; }
.lede {
  margin: 0 0 clamp(56px, 9vw, 96px); max-width: 860px;
  font-size: clamp(21px, 2.4vw, 28px); line-height: 1.38; letter-spacing: -0.01em;
}

h2.label { margin: 0; font-size: 17px; font-weight: 600; }

/* Timeline: four disclosure events that keep changing order */
.timeline {
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  padding: 32px 0 36px; margin-bottom: clamp(56px, 9vw, 96px);
}
.row-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.timeline .row-head { margin-bottom: 8px; font-size: 17px; }
.track { position: relative; height: 120px; margin: 0 clamp(28px, 5vw, 48px); }
.track .axis { position: absolute; left: 0; right: 0; top: 52px; border-top: 1px solid var(--ink); }
.ev {
  position: absolute; top: 44px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  font-size: clamp(14px, 1.6vw, 17px); white-space: nowrap;
  animation: 15s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.ev .dot { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); }
.ev .sq { display: block; width: 16px; height: 16px; border: 8px solid var(--ink); }
.ev.exp { font-weight: 700; }
.ev.rep { left: 8%;  animation-name: evRep; }
.ev.fix { left: 36%; animation-name: evFix; }
.ev.dis { left: 64%; animation-name: evDis; }
.ev.exp { left: 92%; animation-name: evExp; }
@keyframes evRep { 0%, 28% { left: 8%; }  33%, 61% { left: 36%; } 66%, 94% { left: 8%; }  100% { left: 8%; } }
@keyframes evFix { 0%, 28% { left: 36%; } 33%, 61% { left: 92%; } 66%, 94% { left: 92%; } 100% { left: 36%; } }
@keyframes evDis { 0%, 61% { left: 64%; } 66%, 94% { left: 36%; } 100% { left: 64%; } }
@keyframes evExp { 0%, 28% { left: 92%; } 33%, 61% { left: 8%; }  66%, 94% { left: 64%; } 100% { left: 92%; } }

.caps { display: grid; font-size: clamp(20px, 3vw, 30px); line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
.cap { grid-area: 1 / 1; margin: 0; opacity: 0; animation: 15s linear infinite; }
.cap.c1 { opacity: 1; animation-name: cap1; }
.cap.c2 { animation-name: cap2; }
.cap.c3 { animation-name: cap3; }
@keyframes cap1 { 0%, 28% { opacity: 1; } 31%, 97% { opacity: 0; } 100% { opacity: 1; } }
@keyframes cap2 { 0%, 30% { opacity: 0; } 33%, 61% { opacity: 1; } 64%, 100% { opacity: 0; } }
@keyframes cap3 { 0%, 63% { opacity: 0; } 66%, 94% { opacity: 1; } 97%, 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  :root { --ease: 0s; }
  .ev, .cap { animation: none; }
}

/* Background constellation, drawn by /assets/sky.js behind everything */
.sky { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
@media print { .sky { display: none; } }

/* Home sections fade up as they scroll in. Browsers without scroll timelines show them as they are. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .timeline, .latest, .cols > section, .contact {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 100%;
    }
  }
}
@keyframes rise { from { opacity: 0; transform: translateY(32px); } }

/* Post lists (home and writing index) */
.latest { margin-bottom: clamp(64px, 10vw, 104px); }
.latest .row-head { margin-bottom: 20px; font-size: 17px; }
.posts { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--ink); }
.post-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 40px;
  padding: 22px 32px 22px 0; border-top: 1px solid var(--ink); text-decoration: none; /* same text width as the hover state, so rows never rewrap */
  transition: background-color var(--ease), color var(--ease), padding var(--ease);
}
.post-row .date { flex: 0 0 140px; font-size: 17px; font-variant-numeric: tabular-nums; color: var(--soft); transition: color var(--ease); }
.post-row .title { flex: 1 1 420px; min-width: 0; font-size: clamp(22px, 2.6vw, 28px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.post-row .desc { display: block; margin-top: 6px; font-size: 18px; font-weight: 400; letter-spacing: 0; color: var(--soft); transition: color var(--ease); }
.post-row:hover, .post-row:focus-visible { background: var(--ink); color: var(--paper); padding: 22px 16px; }
.post-row:hover .date, .post-row:hover .desc,
.post-row:focus-visible .date, .post-row:focus-visible .desc { color: var(--soft-on-ink); }

.writing h1.page { margin-bottom: 56px; }
.writing .posts { margin-bottom: 40px; }
.writing .post-row .title { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.025em; line-height: 1.15; }
.note { margin: 0; font-size: 17px; color: var(--soft); }

/* Work and projects */
.cols { display: flex; flex-wrap: wrap; gap: 56px 72px; margin-bottom: clamp(56px, 9vw, 88px); }
.cols > section { min-width: 0; }
.cols > section:first-child { flex: 1 1 420px; }
.cols > section:last-child { flex: 1 1 340px; }
.cols h2.label { margin-bottom: 20px; }

.work { list-style: none; margin: 0; padding: 0; font-size: clamp(20px, 2.2vw, 25px); line-height: 1.3; font-weight: 500; letter-spacing: -0.01em; }
.work li { padding: 14px 28px 14px 0; border-top: 1px solid var(--ink); transition: background-color var(--ease), color var(--ease), padding var(--ease); }
.work li:last-child { border-bottom: 1px solid var(--ink); }
@media (hover: hover) {
  .work li:hover { background: var(--ink); color: var(--paper); padding: 14px; }
  .work li:hover::selection { background: var(--paper); color: var(--ink); }
}

.projects { display: flex; flex-direction: column; gap: 28px; }
.proj { display: block; padding: 14px; margin: -14px; text-decoration: none; transition: background-color var(--ease), color var(--ease); }
.proj .name { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px; }
.proj p { margin: 6px 0 0; color: var(--soft); transition: color var(--ease); }
.proj:hover, .proj:focus-visible { background: var(--ink); color: var(--paper); }
.proj:hover p, .proj:focus-visible p { color: var(--soft-on-ink); }

.contact .label { margin: 0 0 8px; }
.contact .links { display: flex; flex-wrap: wrap; gap: 8px 48px; }

/* Posts */
article.post { max-width: 760px; }
.meta { margin: 0 0 20px; font-size: 17px; color: var(--soft); }
article.post h1 { margin: 0 0 56px; font-size: clamp(44px, 7vw, 88px); font-weight: 700; line-height: 0.95; letter-spacing: -0.045em; }
.subtitle { margin: -36px 0 56px; font-size: clamp(24px, 2.6vw, 30px); font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }
.prose { font-size: clamp(19px, 1.9vw, 21px); line-height: 1.6; }
.prose > p:first-child { font-size: clamp(22px, 2.4vw, 26px); line-height: 1.42; }
.prose p, .prose ul, .prose ol, .prose pre { margin: 0 0 22px; }
.prose h2 { margin: 48px 0 14px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.prose h3 { margin: 36px 0 10px; font-size: 23px; font-weight: 700; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 0 0 10px; }
.prose a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.prose blockquote { margin: 32px 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--ink); font-size: clamp(24px, 2.6vw, 30px); font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }
.prose blockquote p { margin: 0; }
.prose pre { padding: 20px 22px; border: 1.5px solid var(--ink); overflow-x: auto; font-size: 15px; line-height: 1.6; }
.prose code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; }
.prose pre code { font-size: inherit; }
.prose img { max-width: 100%; height: auto; }
.post-nav {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px;
  margin-top: 64px; padding-top: 24px; border-top: 2px solid var(--ink); font-size: 18px;
}

footer.site p { margin: 72px 0 0; font-size: 14px; color: var(--soft); }

/* Line breaks */
article.post h1, .subtitle, .prose h2, .prose h3, .post-row .title, .cap { text-wrap: balance; }
.lede, .proj p, .prose p, .post-row .desc { text-wrap: pretty; }
