/* --------------------------------------------------------------------------
   Lorenzo Ferlito - personal site

   Type:  Helvetica for prose, the system monospace for anything that is data
          (dates, venues, captions, section labels). Both ship with the OS,
          so the page loads no webfonts.

   Rule:  section dividers are the Oresund crossing, 1px wide - solid for the
          first half, a gap for Peberholm, then dotted to the far shore.
   -------------------------------------------------------------------------- */

:root {
  --paper: #ffffff;
  --ink: #12171c;
  --muted: #5a6672;
  --rule: #e2e6e9;
  --accent: #0d5661;
  --panel: #101820;
  --panel-fg: #eef1f3;
  --panel-muted: #9fb0b6;
  --panel-link: #7fd0da;

  --measure: 42rem;
  --gutter: 1.35rem;

  --sans: Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1317;
    --ink: #e3e8eb;
    --muted: #93a0aa;
    --rule: #232c33;
    --accent: #58becb;
    --panel: #161d23;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  padding: 3rem var(--gutter) 5rem;
  max-width: var(--measure);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

::selection {
  background: color-mix(in oklab, var(--accent) 22%, transparent);
}

/* ---- links -------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  text-decoration-color: color-mix(in oklab, currentColor 35%, transparent);
  transition: text-decoration-color .15s ease, color .15s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- masthead ----------------------------------------------------------- */

/* full-bleed panel behind the name block: escapes the centred column both sides */
.banner {
  margin: -3rem calc(50% - 50vw) 3rem;
  padding: 3.25rem 0 2.75rem;
  background: var(--panel);
  color: var(--panel-fg);
  border-bottom: 2px solid var(--accent);
  /* the waterline */
}

.banner a {
  color: var(--panel-link);
}

.banner .tagline {
  color: var(--panel-muted);
}

.banner .contact li+li::before {
  color: color-mix(in oklab, var(--panel-muted) 70%, transparent);
}

header {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  gap: 1.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.avatar {
  width: clamp(104px, 26vw, 152px);
  height: clamp(104px, 26vw, 152px);
  flex: none;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .16);
}

h1 {
  margin: 0 0 .45rem;
  font-size: clamp(1.95rem, 1.4rem + 2.4vw, 2.8rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -.028em;
}

.tagline {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .82rem;
}

.contact {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.9;
}

.contact li {
  display: inline;
}

.contact li+li::before {
  content: "  ·  ";
  color: var(--muted);
  white-space: pre;
}

.btn {
  display: inline-block;
  margin: 0;
  padding: .5rem 1rem;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 2px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: .82rem;
}

.banner .btn {
  color: var(--panel-fg);
}

.btn:hover {
  background: rgba(255, 255, 255, .12);
}

.lang {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  padding: .3rem .75rem;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 2px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--panel-fg);
  /* sits over the dark panel in both themes */
  background: rgba(0, 0, 0, .2);
}

.lang:hover {
  background: rgba(255, 255, 255, .12);
}

/* ---- section rule: bridge, island, tunnel ------------------------------- */

h2 {
  margin: 3.25rem 0 1.15rem;
  padding-bottom: .55rem;
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--muted);
  background:
    linear-gradient(var(--accent), var(--accent)) 0 100% / 50% 1.5px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 2px, transparent 2px 6px) 100% 100% / 42% 1px no-repeat;
}

/* ---- prose -------------------------------------------------------------- */

.intro p:first-child {
  margin-top: 0;
  font-size: 1.09rem;
}

.lede {
  font-size: 1.16rem;
  line-height: 1.55;
}

/* ---- selected work ------------------------------------------------------ */

.entry+.entry {
  margin-top: 2rem;
}

.entry h3 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.008em;
}

.entry .meta {
  margin: .3rem 0 .6rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.6;
}

.entry p:last-child {
  margin-bottom: 0;
}

.entry ul {
  margin: .5rem 0 0;
  padding-left: 1.2rem;
}

.entry li {
  margin-bottom: .3rem;
}

/* ---- experience / education -------------------------------------------- */

.roles {
  margin: 0;
  padding: 0;
  list-style: none;
}

.roles li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .15rem 1.25rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: .97rem;
}

.roles li:last-child {
  border-bottom: none;
}

.roles strong {
  font-weight: 600;
}

.what {
  flex: 1 1 16rem;
}

.when {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.aside {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

/* ---- footer ------------------------------------------------------------- */

footer {
  margin-top: 3.5rem;
  padding-top: 1.1rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .78rem;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 0 / 50% 1.5px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 2px, transparent 2px 6px) 100% 0 / 42% 1px no-repeat;
}

footer p {
  margin: 0;
}

/* ---- project pages ------------------------------------------------------ */

.back {
  display: inline-block;
  margin-bottom: 1.75rem;
  font-family: var(--mono);
  font-size: .8rem;
}

/* language switch on a page with no panel behind it */
.lang-inline {
  float: right;
  padding: .3rem .75rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: .76rem;
}

.lang-inline:hover {
  border-color: var(--accent);
}

figure {
  margin: 2rem 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  padding: .85rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #fff;
  /* the SVGs carry a white plot area in both themes */
}

figcaption {
  margin-top: .65rem;
  padding-left: .85rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-family: var(--mono);
  font-size: .76rem;
  line-height: 1.65;
}

.figures {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .78rem;
}

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

@media (max-width: 32rem) {
  body {
    font-size: 1rem;
    padding-bottom: 3.5rem;
  }

  header {
    gap: 1.25rem;
  }

  .banner {
    padding: 4rem 0 2.25rem;
  }

  /* clears the language pill */
  .lede {
    font-size: 1.08rem;
  }
}

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

/* ---- print: the page is the CV until the PDF lands ---------------------- */

@media print {
  :root {
    --paper: #fff;
    --ink: #000;
    --muted: #444;
    --rule: #bbb;
    --accent: #000;
  }

  body {
    max-width: none;
    padding: 0;
    font-size: 10.5pt;
  }

  .banner {
    margin: 0 0 1.5rem;
    padding: 0 0 1rem;
    background: none;
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
  }

  .banner a,
  .banner .tagline {
    color: inherit;
  }

  header {
    padding: 0;
  }

  .lang,
  .lang-inline,
  .back {
    display: none;
  }

  a {
    text-decoration: none;
  }

  h2 {
    margin-top: 1.5rem;
    break-after: avoid;
  }

  .entry,
  .roles li,
  figure {
    break-inside: avoid;
  }
}