/* Nicolas Cozzarin – site styles.
   Colours: a neutral paper, blue-black ink and one institutional blue.
   Type: Schibsted Grotesk for the homepage and headings, Source Serif 4 for long-form posts. */

/* Self-hosted fonts (SIL Open Font License, see assets/fonts). No third-party requests. */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../assets/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../assets/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../assets/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../assets/fonts/source-serif-4-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url("../assets/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --paper: #FAFAF8;
  --ink: #18202B;
  --slate: #56606E;
  --rule: #DCE0E5;
  --accent: #1D4E89;
  --accent-strong: #163D6C;
  --on-accent: #FFFFFF;
  --wash: #EEF2F7;
  --code-bg: #F2F4F7;

  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --wrap: 60rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --label-col: 12rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11151B;
    --ink: #E7EAEE;
    --slate: #A1AAB6;
    --rule: #2B323C;
    --accent: #8FB6EA;
    --accent-strong: #B5CFF2;
    --on-accent: #0E1826;
    --wash: #18202A;
    --code-bg: #171C24;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-feature-settings: "kern", "liga";
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

img { max-width: 100%; height: auto; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- top bar & footer ---------- */

.topbar { border-bottom: 1px solid var(--rule); }
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 3.25rem;
}
.topbar-spacer { flex: 1; }
.site-name { flex: 1; font-weight: 700; color: var(--ink); text-decoration: none; }
.topbar-link { color: var(--slate); font-size: 0.95rem; }

.lang-switch { display: flex; gap: 0.25rem; font-size: 0.9rem; font-weight: 500; }
.lang-switch a, .lang-switch .current {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-decoration: none;
}
.lang-switch a { color: var(--slate); }
.lang-switch a:hover { color: var(--ink); background: var(--wash); }
.lang-switch .current { color: var(--ink); background: var(--wash); }

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--rule);
  color: var(--slate);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}
.footer-inner span { font-weight: 600; color: var(--ink); margin-right: auto; }
.site-footer a { color: var(--slate); }
.site-footer a:hover { color: var(--ink); }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 0 2.5rem;
  align-items: start;
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem);
}

.portrait {
  width: 100%;
  max-width: 12rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6.5vw, 4.25rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.headline {
  margin: 0.75rem 0 0;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.pitch {
  margin: 1.1rem 0 0;
  max-width: 38em;
  font-size: 1.125rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.15rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { background: var(--accent-strong); color: var(--on-accent); }

.action-link { font-weight: 500; }

.facts {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  color: var(--slate);
  font-size: 0.95rem;
}
.facts li + li { margin-top: 0.2rem; }

/* ---------- sections ---------- */

.block {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 0 2.5rem;
  padding: 2.25rem 0;
  border-top: 1px solid var(--rule);
}

.block > h2 {
  margin: 0.15rem 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
}

.block-body { max-width: 42rem; }
.block-body > p:first-child { margin-top: 0; }
.block-body p { margin: 0 0 0.9rem; }

h3 { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.35; }

.meta { color: var(--slate); font-size: 0.95rem; }

/* selected work */

.work {
  padding: 0.1rem 0 0.1rem 1.1rem;
  border-left: 3px solid var(--accent);
}
.work + .work { margin-top: 2rem; }
.work h3 { font-size: 1.2rem; }
.work .meta { margin: 0.15rem 0 0.7rem; }
.work p { margin: 0 0 0.6rem; }
.work .result { font-weight: 500; }
.work-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-top: 0.8rem !important; font-weight: 500; }
.more { margin-top: 1.75rem !important; }

/* experience, education, volunteering */

.entries { list-style: none; margin: 0; padding: 0; }
.entry + .entry { margin-top: 1.6rem; }
.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
}
.dates {
  color: var(--slate);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.org { margin: 0.1rem 0 0.25rem !important; font-weight: 500; }
.entry .meta { margin: 0 0 0.4rem !important; }
.entry ul { margin: 0.4rem 0 0; padding-left: 1.1rem; list-style: disc; }
.entry li + li { margin-top: 0.3rem; }
.entries.compact .entry + .entry { margin-top: 1.2rem; }
.entries.compact p { margin: 0 !important; }

/* research, skills */

.research dt, .skills dt { font-weight: 600; }
.research dd { margin: 0.2rem 0 1.1rem; }
.research dd:last-child { margin-bottom: 0; }

.skills { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.55rem 1rem; margin: 0; }
.skills dd { margin: 0; }

.plain { margin: 0; padding-left: 1.1rem; }
.plain li + li { margin-top: 0.3rem; }

.contact-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; font-weight: 500; }

/* ---------- posts & pages ---------- */

.page-title { font-size: clamp(2rem, 5vw, 2.75rem); letter-spacing: -0.03em; margin: 3rem 0 1.5rem; }

.post-list { list-style: none; padding: 0; margin: 0; max-width: 42rem; }
.post-list li { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.post-list time { display: block; color: var(--slate); font-size: 0.9rem; }
.post-list a { font-size: 1.2rem; font-weight: 600; }
.post-list p { margin: 0.35rem 0 0; color: var(--slate); }

.post { max-width: 44rem; margin: 0 auto; }
.post-header { padding: clamp(2.5rem, 6vw, 4rem) 0 1.5rem; }
.post-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4.8vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.post-header .meta { margin: 1rem 0 0; }

.glance {
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.4rem;
  background: var(--wash);
  border-radius: 6px;
  font-size: 0.98rem;
}
.glance h2 { margin: 0 0 0.75rem; font-size: 1rem; }
.glance dl { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.45rem 1rem; margin: 0; }
.glance dt { font-weight: 600; }
.glance dd { margin: 0; }

.post-content {
  font-family: var(--serif);
  font-size: 1.14rem;
  line-height: 1.7;
}
.post-content h2, .post-content h3, .post-content h4 {
  font-family: var(--sans);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.75rem;
}
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content h4 { font-size: 1.05rem; }
.post-content hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.post-content img { display: block; margin: 1rem auto; border-radius: 4px; }
.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 1.25rem 0;
  display: block;
  overflow-x: auto;
}
.post-content th, .post-content td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.post-content th { font-weight: 600; }
.post-content blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--slate); }

code, pre { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
:not(pre) > code { font-size: 0.88em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre, .highlight pre {
  font-size: 0.85rem;
  line-height: 1.55;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}
figure.highlight { margin: 1.25rem 0; }
.highlight pre { margin: 0; }

.share { margin: 3rem 0 0; color: var(--slate); font-size: 0.95rem; display: flex; gap: 1rem; flex-wrap: wrap; }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.post-nav a { text-decoration: none; font-weight: 600; line-height: 1.35; }
.post-nav a:hover { text-decoration: underline; }
.post-nav .next { text-align: right; }
.post-nav-label { display: block; color: var(--slate); font-weight: 400; font-size: 0.9rem; margin-bottom: 0.2rem; }

/* ---------- syntax highlighting (Rouge) ---------- */

.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #6A737D; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kc, .highlight .kr, .highlight .ow { color: #B3261E; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sd, .highlight .se, .highlight .si, .highlight .sr { color: #0A5A2E; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .kt { color: #0550AE; }
.highlight .nf, .highlight .fm, .highlight .nc { color: #6F42C1; }
.highlight .nb, .highlight .bp, .highlight .nd { color: #953800; }
.highlight .nt, .highlight .na { color: #0550AE; }

@media (prefers-color-scheme: dark) {
  .highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #8B949E; }
  .highlight .k, .highlight .kd, .highlight .kn, .highlight .kc, .highlight .kr, .highlight .ow { color: #FF7B72; }
  .highlight .s, .highlight .s1, .highlight .s2, .highlight .sd, .highlight .se, .highlight .si, .highlight .sr { color: #A5D6FF; }
  .highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .kt { color: #79C0FF; }
  .highlight .nf, .highlight .fm, .highlight .nc { color: #D2A8FF; }
  .highlight .nb, .highlight .bp, .highlight .nd { color: #FFA657; }
  .highlight .nt, .highlight .na { color: #7EE787; }
}

/* ---------- small screens ---------- */

@media (max-width: 52rem) {
  .hero, .block { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 7.5rem; margin-bottom: 1.5rem; }
  .block > h2 { margin-bottom: 0.9rem; font-size: 1.15rem; }
  .skills, .glance dl { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .skills dd, .glance dd { margin-bottom: 0.6rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}

@media print {
  .topbar, .site-footer, .actions, .share, .post-nav, .lang-switch { display: none; }
  body { background: #FFFFFF; color: #000000; font-size: 11pt; }
  .block { break-inside: avoid; }
}

/* courses and certifications */
.courses { list-style: none; margin: 0; padding: 0; }
.courses li + li { margin-top: 1.1rem; }
.courses h3 { font-size: 1rem; }
.courses .meta { margin: 0.05rem 0 0.2rem !important; }
.courses p { margin: 0 !important; }

/* links to other language versions of a post */
.translations { color: var(--slate); font-size: 0.95rem; margin: 0.5rem 0 0; }
.translations a { margin-left: 0.35rem; }
.post-list .translations { font-size: 0.9rem; }
.post-nav a { font-weight: 600; }
.post-list .translations a { font-size: inherit; font-weight: 500; }

/* "Show credential" link under a course */
.courses .credential { margin-top: 0.45rem !important; }
.credential a {
  display: inline-block;
  padding: 0.12rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
}
.credential a:hover { border-color: var(--accent); background: var(--wash); }
