/*
  Styles for jacopodeberardinis.com. Plain CSS with no build step.
  Colours, fonts and shared sizes are tokens on :root.
*/

:root {
  --ink: #111827;
  --text: #374151;
  --soft: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --surface: #ffffff;
  --band: #f9fafb;
  --chip: #f3f4f6;

  --display: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --container: 72rem;
  --measure: 52rem;
  --radius: 0.875rem;
  --shadow: 0 1px 2px rgb(17 24 39 / 0.05), 0 1px 3px rgb(17 24 39 / 0.07);
  --shadow-lift: 0 10px 24px rgb(17 24 39 / 0.1), 0 3px 6px rgb(17 24 39 / 0.05);

  /* A short sound wave, like the one across the record in the logo */
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 20' fill='%23111827'%3E%3Crect x='2.5' y='8' width='3' height='4' rx='1.5' fill-opacity='.3'/%3E%3Crect x='9.5' y='6' width='3' height='8' rx='1.5' fill-opacity='.45'/%3E%3Crect x='16.5' y='7.5' width='3' height='5' rx='1.5' fill-opacity='.55'/%3E%3Crect x='23.5' y='4.5' width='3' height='11' rx='1.5' fill-opacity='.7'/%3E%3Crect x='30.5' y='2' width='3' height='16' rx='1.5' fill-opacity='.85'/%3E%3Crect x='37.5' y='5.5' width='3' height='9' rx='1.5' fill-opacity='.95'/%3E%3Crect x='44.5' y='0' width='3' height='20' rx='1.5'/%3E%3Crect x='51.5' y='5.5' width='3' height='9' rx='1.5' fill-opacity='.95'/%3E%3Crect x='58.5' y='2' width='3' height='16' rx='1.5' fill-opacity='.85'/%3E%3Crect x='65.5' y='4.5' width='3' height='11' rx='1.5' fill-opacity='.7'/%3E%3Crect x='72.5' y='7.5' width='3' height='5' rx='1.5' fill-opacity='.55'/%3E%3Crect x='79.5' y='6' width='3' height='8' rx='1.5' fill-opacity='.45'/%3E%3Crect x='86.5' y='8' width='3' height='4' rx='1.5' fill-opacity='.3'/%3E%3C/svg%3E");
}

/* Base */

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

/* Keeps [hidden] working on elements that set their own display (news items) */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

p {
  text-wrap: pretty;
}

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

a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

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

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.5rem 0.875rem;
  border-radius: 0.375rem;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transform: translateY(-300%);
}

.skip:focus {
  transform: none;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  font-size: 1.125rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 0.9375rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--ink);
  color: #fff;
}

.btn-dark {
  background: var(--ink);
  color: #fff;
}

.btn-dark:hover {
  border-color: var(--text);
  background: var(--text);
}

/* "Read more" links at the end of a paragraph */
.go {
  white-space: nowrap;
}

.go::after {
  content: "→";
  display: inline-block;
  margin-left: 0.3em;
}

/* Navigation */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to right, rgb(255 255 255 / 0.94), rgb(243 244 246 / 0.94));
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 2rem, var(--container));
  height: 4.5rem;
  margin-inline: auto;
}

.brand img {
  width: 3.25rem;
  height: 3.25rem;
}

.topbar ul {
  display: flex;
  gap: 2rem;
}

.topbar ul a {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.topbar ul a:hover {
  color: var(--ink);
}

@media (max-width: 40rem) {
  .topbar-inner {
    height: 3.75rem;
  }

  .brand img {
    width: 2.5rem;
    height: 2.5rem;
  }

  .topbar ul {
    gap: 1.125rem;
  }

  .topbar ul a {
    font-size: 0.875rem;
  }
}

/* Below 360px there's only room for the four section links. */
@media (max-width: 22.49rem) {
  .brand {
    display: none;
  }
}

/* Masthead */

.masthead {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: 4rem 3.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--band);
  text-align: center;
}

/* Faint record grooves behind the name */
.masthead::before {
  content: "";
  position: absolute;
  inset: -60% -5%;
  z-index: -1;
  background: repeating-radial-gradient(circle at 50% 50%, rgb(17 24 39 / 0.085) 0 1px, transparent 1px 12px);
  -webkit-mask-image: radial-gradient(closest-side, transparent 20%, #000 45%, transparent 100%);
  mask-image: radial-gradient(closest-side, transparent 20%, #000 45%, transparent 100%);
}

.masthead h1 {
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(2.5rem, 1.5rem + 4vw, 3.875rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.tagline {
  margin-top: 0.875rem;
  color: var(--soft);
  font-family: var(--display);
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  font-weight: 300;
}

.tagline span {
  display: inline-block;
}

.tagline span + span::before {
  content: "•";
  margin-inline: 0.6em;
  color: var(--muted);
}

@media (max-width: 30rem) {
  .tagline span {
    display: block;
  }

  .tagline span + span::before {
    content: none;
  }
}

/* Intro: text on the left, the contact card with photo ("stamp") on the right */

.intro {
  padding-block: 3.5rem 4.5rem;
}

.intro-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 60rem) {
  .intro-grid {
    grid-template-columns: minmax(0, 1fr) 25rem;
    column-gap: 4rem;
  }
}

.lead {
  font-size: 1.125rem;
}

.motto {
  margin-top: 2rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
  font-weight: 300;
  line-height: 1.4;
}

.motto::before,
.section-head h2::after {
  content: "";
  display: block;
  width: 4.6rem;
  height: 1rem;
  background: var(--wave) center / contain no-repeat;
}

.motto::before {
  margin-bottom: 1rem;
}

.roles {
  margin-top: 1.75rem;
  font-size: 1.0625rem;
}

.previously {
  margin-top: 1rem;
  color: var(--soft);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 1.75rem;
}

.pills a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.pills a:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.stamp {
  justify-self: center;
  width: 100%;
  max-width: 26rem;
  overflow: hidden;
}

.stamp img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  object-position: 50% 30%;
}

.stamp dl {
  padding: 0.25rem 1.5rem 0.5rem;
}

.stamp dl > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--chip);
}

.stamp dl > div:last-child {
  border-bottom: 0;
}

.stamp dt {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.stamp dt .bi {
  color: var(--soft);
  font-size: 1.0625rem;
}

.stamp dd {
  color: var(--soft);
  font-size: 0.9375rem;
  text-align: right;
}

@media (max-width: 26rem) {
  .stamp dl > div {
    flex-direction: column;
    gap: 0.25rem;
  }

  .stamp dd {
    padding-left: 1.75rem;
    text-align: left;
  }
}

/* Sections */

.band {
  padding-block: 4rem 4.5rem;
}

.band-alt {
  border-block: 1px solid var(--line);
  background: var(--band);
}

.section-head {
  max-width: var(--measure);
  margin: 0 auto 2.5rem;
  text-align: center;
}

.section-head h2 {
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.875rem, 1.5rem + 1.4vw, 2.375rem);
  font-weight: 300;
  line-height: 1.2;
}

.section-head h2::after {
  margin: 0.875rem auto 0;
}

.section-head p {
  margin-top: 1.5rem;
  font-size: 1.0625rem;
}

.section-foot {
  max-width: var(--measure);
  margin: 2.25rem auto 0;
  color: var(--soft);
  text-align: center;
}

/* Centred copy reads better with even line lengths */
.section-head p,
.section-foot,
.journey p:last-child {
  text-wrap: balance;
}

/* Research */

.themes {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 48rem) {
  .themes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.theme {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 1.25rem;
  padding: 1.5rem 1.75rem;
}

.theme .icon {
  grid-row: 1 / span 2;
}

.theme h3 {
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.35;
}

.theme p {
  margin-top: 0.375rem;
  color: var(--soft);
}

/* News */

/* One item after another, newest first, at a comfortable reading width */
.news {
  display: grid;
  gap: 1rem;
  max-width: 58rem;
  margin-inline: auto;
}

.news-item {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem;
}

.news-item:focus {
  outline: none;
}

.news-item:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.news-item time {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  padding: 0.625rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  background: var(--band);
  line-height: 1.15;
  text-align: center;
}

.news-item time span:first-child {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.news-item time span:last-child {
  margin-top: 0.2rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 500;
}

.news-item h3 {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.35;
}

.news-item h3 .bi {
  flex: none;
  color: var(--soft);
}

.news-item p {
  margin-top: 0.5rem;
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 2.25rem;
}

@media (max-width: 30rem) {
  .news-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.875rem;
    padding: 1.25rem;
  }

  .news-item time {
    flex-direction: row;
    gap: 0.35rem;
    justify-self: start;
    padding: 0.3rem 0.7rem;
  }

  .news-item time span:last-child {
    margin-top: 0;
    font-size: 0.875rem;
  }
}

/* Teaching */

.journey {
  position: relative;
  display: grid;
  gap: 2rem;
  margin-bottom: 3rem;
}

.journey > li {
  position: relative;
  text-align: center;
}

@media (min-width: 48rem) {
  .journey {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* The line linking the three parts */
  .journey::before {
    content: "";
    position: absolute;
    top: 1.625rem;
    right: 16.67%;
    left: 16.67%;
    height: 1px;
    background: var(--line-strong);
  }
}

.node {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 0.5rem var(--band);
  color: #fff;
  font-size: 1.25rem;
}

.step {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.journey h3 {
  margin-top: 0.125rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.1875rem;
  font-weight: 500;
}

.journey p:last-child {
  max-width: 20rem;
  margin: 0.5rem auto 0;
  color: var(--soft);
  font-size: 0.9375rem;
}

.projects {
  display: grid;
  gap: 2rem;
  padding: 2rem;
}

@media (min-width: 60rem) {
  .projects {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    column-gap: 3rem;
    align-items: center;
    padding: 2.25rem 2.5rem;
  }
}

.projects h3 {
  margin-top: 1rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.3;
}

.projects p {
  margin-top: 0.75rem;
}

.modules {
  display: grid;
  gap: 0.75rem;
}

.modules li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  column-gap: 1rem;
  align-items: center;
  padding: 0.9rem 1.25rem;
  border-radius: 0.75rem;
  background: var(--chip);
}

.modules strong {
  grid-row: 1 / span 2;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 600;
}

.modules span {
  color: var(--ink);
  font-weight: 500;
  line-height: 1.4;
}

.modules small {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Contact */

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
}

.socials {
  display: flex;
  gap: 0.5rem;
}

.socials a {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  color: var(--soft);
  font-size: 1.25rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.socials a:hover {
  background: var(--chip);
  color: var(--ink);
}

/* Footer */

.footer {
  background: var(--ink);
  color: #9ca3af;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding-block: 2.75rem;
  font-size: 0.875rem;
  text-align: center;
}

.footer img {
  width: 2.75rem;
  height: 2.75rem;
  filter: invert(1);
}

.footer strong {
  color: #e5e7eb;
  font-weight: 500;
}
