/* Mattia Malipiero — personal site, version 1 (light, calm, precise)
   One typeface (Instrument Sans), navy ink on white, one ultramarine accent. */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/instrument-sans-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;
}

/* Latin Extended: only downloaded when a page uses a letter outside basic Latin. */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/instrument-sans-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;
}

/* ---------- Tokens ---------- */

:root {
  --paper: #ffffff;
  --mist: #f1f4fa;
  --mist-deep: #e7ebf5;
  --ink: #10162f;
  --slate: #56607e;
  --line: #dce1ee;
  --dot: #c5cde2;
  --accent: #2b4bff;
  --accent-deep: #1c35d1;
  --accent-wash: #e6eaff;
  --on-accent-soft: #dde3ff;

  --wrap: 70rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --r-panel: 1.25rem;
  --r-tile: 0.875rem;

  --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --pop: cubic-bezier(0.2, 1.4, 0.4, 1);
  --glide: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Base ---------- */

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

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

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

#projects {
  scroll-margin-top: 1.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1;
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

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

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

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.625rem 1rem;
  border-radius: 0.625rem;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 1rem;
}

.nowrap {
  white-space: nowrap;
}

.icon {
  flex: none;
  width: 1rem;
  height: 1rem;
}

/* ---------- Header ---------- */

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  font-size: 0.9375rem;
  font-weight: 500;
}

.site-nav a {
  padding: 0.625rem 0;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.45em;
}

.site-nav .nav-cta {
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.site-nav .nav-cta:hover {
  border-color: var(--ink);
  text-decoration: none;
}

/* ---------- Buttons and small parts ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.625rem 1.375rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn:hover {
  border-color: var(--ink);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tags li {
  padding: 0.1875rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

/* A blue dot marks what is ongoing */
.now-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  vertical-align: 0.06em;
}

.when {
  white-space: nowrap;
}

.when.is-now {
  color: var(--ink);
}

/* Illustration panel: tinted, with a fine dot grid */
.figure {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--r-panel);
  background-color: var(--mist);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.5px);
  background-size: 16px 16px;
  background-position: 8px 8px;
}

/* The SVG keeps its own proportions inside the panel (object-fit stays at its default) */
.figure img {
  width: 100%;
  height: 100%;
}

/* ---------- Home: hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem 3rem;
  align-items: end;
  padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(3.5rem, 8vw, 6rem);
}

.hero h1 {
  font-size: clamp(3.5rem, 1.9rem + 7vw, 6.75rem);
  font-weight: 600;
  line-height: 0.94;
  letter-spacing: -0.045em;
}

.hero h1 span {
  display: block;
}

.hero-tagline {
  margin-top: 1.5rem;
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.hero-intro {
  max-width: 34ch;
  margin-top: 0.625rem;
  color: var(--slate);
  font-size: 1.0625rem;
}

.hero .actions {
  margin-top: 2rem;
}

.hero-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0;
}

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

.tile {
  padding: 1.125rem 1.25rem 1.25rem;
  border-radius: var(--r-tile);
  background: var(--mist);
}

.tile-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--slate);
  font-size: 0.875rem;
  font-weight: 500;
}

.tile-title {
  margin-top: 0.5rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.tile-note {
  margin-top: 0.125rem;
  color: var(--slate);
  font-size: 0.9375rem;
  line-height: 1.4;
}

/* ---------- Sections ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.section-head h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.more {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Project cards (home) ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2.5rem, 5vw, 3.5rem) 1.75rem;
}

.card {
  position: relative;
}

.card .figure {
  transition: background-color 0.2s;
}

.card:hover .figure {
  background-color: var(--mist-deep);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.125rem 1rem;
  margin-top: 1.125rem;
  color: var(--slate);
  font-size: 0.875rem;
  font-weight: 500;
}

/* In a narrow card the date drops under the type instead of either one breaking in two. */
.card-meta > span {
  white-space: nowrap;
}

.card h3 {
  margin-top: 0.375rem;
  font-size: clamp(1.375rem, 1.25rem + 0.5vw, 1.5rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.card h3 a {
  text-decoration: none;
}

/* The title link covers the whole card */
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-panel);
}

.card:hover h3 a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
}

.card h3 a:focus-visible {
  outline: none;
}

.card h3 a:focus-visible::after {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}

.card-summary {
  max-width: 44ch;
  margin-top: 0.375rem;
  color: var(--slate);
  font-size: 1rem;
}

.card .tags {
  margin-top: 0.875rem;
}

/* ---------- Contact tile (home) ---------- */

.contact {
  margin-top: clamp(4rem, 9vw, 7rem);
}

.contact-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem 2rem;
  align-items: end;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  border-radius: 1.75rem;
  background: var(--accent);
  color: #fff;
}

.contact-tile :focus-visible {
  outline-color: #fff;
}

.contact-tile h2 {
  color: var(--on-accent-soft);
  font-size: 1rem;
  font-weight: 500;
}

.contact-mail {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: clamp(1.3125rem, 0.6rem + 3.4vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-mail:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 1px solid rgb(255 255 255 / 0.45);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.contact-links a:hover {
  border-color: #fff;
  background: #fff;
  color: var(--accent);
}

/* ---------- Footer ---------- */


.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.5rem 2rem;
  border-top: 1px solid var(--line);
  color: var(--slate);
  font-size: 0.875rem;
}

.site-footer ul {
  display: flex;
  gap: 1.5rem;
  font-weight: 500;
}

.site-footer a {
  display: inline-block;
  padding: 0.375rem 0;
  color: var(--ink);
}

/* ---------- Page head (projects index, not found) ---------- */

.page-head {
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(1.75rem, 4vw, 3rem);
}

.page-head h1 {
  font-size: clamp(2.75rem, 1.8rem + 4.2vw, 4.75rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

.page-head p {
  margin-top: 0.75rem;
  color: var(--slate);
  font-size: 1.0625rem;
}

/* ---------- Projects index ---------- */

.index {
  border-bottom: 1px solid var(--line);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr) 18rem 2.75rem;
  gap: 1.75rem;
  align-items: center;
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
}

.row .figure {
  border-radius: 0.875rem;
  background-size: 12px 12px;
  background-position: 6px 6px;
  transition: background-color 0.2s;
}

.row:hover .figure {
  background-color: var(--mist-deep);
}

.row h2 {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.row h2 a {
  text-decoration: none;
}

.row h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.row:hover h2 a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
}

.row h2 a:focus-visible {
  outline: none;
}

.row h2 a:focus-visible::after {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  border-radius: 0.5rem;
}

.row-summary {
  max-width: 44ch;
  margin-top: 0.375rem;
  color: var(--slate);
  font-size: 0.9375rem;
}

.row .tags {
  margin-top: 0.75rem;
}

.row-facts {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9375rem;
}

.row-facts div {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr);
  gap: 0.75rem;
}

.row-facts dt {
  color: var(--slate);
}

.row-facts dd {
  font-weight: 500;
}

.row-go {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.row:hover .row-go {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ---------- Project page ---------- */

.crumbs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
}

.mini-pager {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--slate);
  font-size: 0.875rem;
  font-weight: 500;
}

.mini-pager span {
  margin-right: 0.375rem;
}

.mini-pager a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--ink);
  transition: border-color 0.15s;
}

.mini-pager a:hover {
  border-color: var(--ink);
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  grid-template-areas:
    "head key"
    "figure facts";
  gap: clamp(2rem, 4vw, 3rem) 2rem;
  padding-top: clamp(1.25rem, 3.5vw, 2.75rem);
}

.project-head {
  grid-area: head;
}

.kicker {
  color: var(--slate);
  font-size: 0.9375rem;
  font-weight: 500;
}

.project-head h1 {
  margin-top: 0.5rem;
  font-size: clamp(2.375rem, 1.6rem + 3.4vw, 3.75rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.lead {
  max-width: 40ch;
  margin-top: 1.125rem;
  font-size: clamp(1.125rem, 1.02rem + 0.5vw, 1.3125rem);
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.project-head .actions {
  margin-top: 1.75rem;
}

.project-figure {
  grid-area: figure;
  aspect-ratio: auto;
  min-height: 22rem;
}

.facts {
  grid-area: facts;
}

/* The headline fact of a project, on the accent colour */
.key {
  grid-area: key;
  align-self: end;
  padding: 1.375rem 1.5rem 1.5rem;
  border-radius: var(--r-panel);
  background: var(--accent);
  color: #fff;
}

.key-label {
  color: var(--on-accent-soft);
  font-size: 0.9375rem;
  font-weight: 500;
}

.key-value {
  margin-top: 0.375rem;
  font-size: clamp(3.25rem, 2.4rem + 3.4vw, 4.75rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
}

.key-value.is-words {
  font-size: clamp(1.625rem, 1.4rem + 1vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.key-value.is-words span {
  display: block;
}

.key-note {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
}

.bars {
  display: grid;
  gap: 1.125rem;
  margin-top: 0.875rem;
}

.bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.125rem 1rem;
}

.bar-name {
  font-size: 1rem;
  font-weight: 500;
}

.bar-num {
  font-size: clamp(1.75rem, 1.5rem + 1.1vw, 2.25rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
}

.bar-track {
  grid-column: 1 / -1;
  height: 0.5rem;
  margin-top: 0.375rem;
  border-radius: 0.25rem;
  background: rgb(255 255 255 / 0.22);
}

.bar-fill {
  display: block;
  width: calc(var(--v) * 1%);
  height: 100%;
  border-radius: 0.25rem;
  background: #fff;
}

.bar.is-second .bar-fill {
  background: rgb(255 255 255 / 0.6);
}

.facts div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.75rem;
  border-top: 1px solid var(--line);
}

.facts div:last-child {
  border-bottom: 1px solid var(--line);
}

.facts dt {
  color: var(--slate);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.6;
}

.facts dd {
  font-size: 1rem;
  font-weight: 500;
}

.facts dd a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.facts .tags {
  padding-block: 0.0625rem;
}

.block {
  margin-top: clamp(3rem, 7vw, 5rem);
}

.block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 1.25rem;
}

.block-head h2 {
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.block-head p {
  color: var(--slate);
  font-size: 0.9375rem;
  font-weight: 500;
}

/* Steps are a real sequence, so they are numbered */
.steps {
  display: grid;
  grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
  gap: 0.75rem;
  counter-reset: step;
}

.steps li {
  padding: 1.125rem 1.25rem 1.375rem;
  border-radius: var(--r-tile);
  background: var(--mist);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.35;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 1.5rem;
  border-radius: 0.5rem;
  background: var(--paper);
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1;
}

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: clamp(3rem, 7vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.pager .is-prev,
.pager .is-next {
  display: grid;
  gap: 0.375rem;
  align-content: start;
  padding: 1.125rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  text-decoration: none;
  transition: border-color 0.15s;
}

.pager .is-prev:hover,
.pager .is-next:hover {
  border-color: var(--ink);
}

.pager-dir {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--slate);
  font-size: 0.875rem;
  font-weight: 500;
}

.pager-title {
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.pager .is-next {
  justify-items: end;
  text-align: right;
}

.pager-all {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 0.75rem;
}

/* ---------- Not found ---------- */

.lost {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem 3rem;
  align-items: center;
  padding-block: clamp(2rem, 6vw, 5rem);
}

.lost h1 {
  font-size: clamp(2.5rem, 1.8rem + 3.4vw, 4.25rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

.lost p {
  margin-top: 0.875rem;
  color: var(--slate);
}

.lost .actions {
  margin-top: 1.75rem;
}

/* ---------- One entrance per page ----------
   Movement only, no fading: everything is readable from the first frame. */

@keyframes rise {
  from {
    transform: translateY(0.625rem);
  }
}

@keyframes pop {
  from {
    transform: scale(0.93);
  }
}

.hero h1 span,
.hero-tagline,
.hero-intro,
.hero .actions,
.hero-links {
  animation: rise 0.6s var(--glide) backwards;
}

.hero h1 span:nth-child(2) {
  animation-delay: 0.05s;
}

.hero-tagline,
.hero-intro {
  animation-delay: 0.1s;
}

.hero .actions,
.hero-links {
  animation-delay: 0.15s;
}

.now .tile,
.key {
  animation: pop 0.5s var(--pop) backwards;
}

.now .tile:nth-child(1) {
  animation-delay: 0.2s;
}

.now .tile:nth-child(2) {
  animation-delay: 0.3s;
}

.now .tile:nth-child(3) {
  animation-delay: 0.4s;
}

.project-head {
  animation: rise 0.6s var(--glide) backwards;
}

.key {
  animation-delay: 0.2s;
}

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

/* ---------- Smaller screens ---------- */

@media (max-width: 62rem) {
  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .steps li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.875rem;
    align-items: start;
    padding: 0.875rem 1rem 0.9375rem;
  }

  .steps li::before {
    margin-bottom: 0;
  }

  .row {
    grid-template-columns: 12rem minmax(0, 1fr) 2.75rem;
    gap: 0.5rem 1.5rem;
  }

  .row .figure,
  .row-go {
    grid-row: 1 / span 2;
  }

  .row .figure {
    align-self: start;
  }

  .row-go {
    grid-column: 3;
  }

  .row-main {
    align-self: end;
  }

  .row-facts {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.5rem;
    align-self: start;
    color: var(--slate);
    font-size: 0.875rem;
  }

  .row-facts div {
    display: block;
  }

  .row-facts .row-where {
    display: none;
  }

  .row-facts dt {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .row-facts dd {
    font-weight: 500;
  }

  .row-facts div + .row-when::before {
    content: "";
    display: inline-block;
    width: 1px;
    height: 0.8em;
    margin-right: 0.5rem;
    background: var(--dot);
  }

  .row-facts .row-when dd {
    display: inline;
  }
}

@media (max-width: 56rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .project-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "figure"
      "key"
      "facts";
    gap: 1.25rem;
  }

  .project-head {
    padding-bottom: clamp(0.75rem, 3vw, 1.5rem);
  }

  .project-figure {
    aspect-ratio: 16 / 10;
    min-height: 0;
  }

  .lost {
    grid-template-columns: minmax(0, 1fr);
  }

  .lost .figure {
    order: -1;
    max-width: 28rem;
  }
}

/* Below this width the email address no longer fits beside the links, so the links go under it. */
@media (max-width: 72rem) {
  .contact-tile {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 52rem) {
  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 44rem) {

  .contact-tile {
    grid-template-columns: minmax(0, 1fr);
    border-radius: 1.5rem;
  }

  .row {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.25rem 1rem;
    padding-block: 1.25rem;
  }

  .row .figure {
    border-radius: 0.625rem;
    background-size: 10px 10px;
    background-position: 5px 5px;
  }

  .row-summary,
  .row-go,
  .row .tags {
    display: none;
  }

  .row-facts {
    display: block;
  }

  .row-facts div + .row-when::before {
    content: none;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager .is-next {
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 36rem) {
  .nav-wide {
    display: none;
  }

  .site-header-inner {
    height: 4rem;
  }

  .hero .btn {
    flex: 1 1 auto;
  }

  .facts div {
    grid-template-columns: 5.75rem minmax(0, 1fr);
  }
}

@media (max-width: 23rem) {
  .brand-name {
    display: none;
  }
}
