:root {
  --page: #ffffff;
  --ink: #111318;
  --body: #2f343d;
  --mute: #697180;
  --soft: #8b929e;
  --line: #e7e9ee;
  --line-soft: #eff1f4;
  --accent: #0f7a5a;
  --accent-soft: #e6f4ee;
  --live: #1f9d57;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --display: "Schibsted Grotesk", "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --col: 56rem;
  --read: 42rem;
  --gutter: 1.5rem;
  --pad: clamp(20px, 5vw, 64px);
  --shadow-1: 0 1px 1px rgb(16 24 40 / 0.03), 0 1px 3px rgb(16 24 40 / 0.04);
  --shadow-2: 0 1px 2px rgb(16 24 40 / 0.04), 0 8px 16px -6px rgb(16 24 40 / 0.08), 0 20px 40px -20px rgb(16 24 40 / 0.18);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  background: var(--page);
  color: var(--body);
  font-family: var(--sans);
  font-size: clamp(16px, 0.8rem + 0.25vw, 19px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(60rem 40rem at 0% -10%, rgb(15 122 90 / 0.07), transparent 60%),
    radial-gradient(40rem 30rem at 100% 0%, rgb(31 157 87 / 0.035), transparent 60%);
  background-repeat: no-repeat;
}

::selection {
  background: #d3eee2;
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

strong {
  color: var(--ink);
  font-weight: 600;
}

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

p,
li {
  text-wrap: pretty;
}

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

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg .fill,
svg.solid {
  fill: currentColor;
  stroke: none;
}

/* Top bar */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(255 255 255 / 0.86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(var(--col), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

.wordmark {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wordmark:hover {
  text-decoration: none;
}

/* Section nav */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.pills a {
  display: flex;
  align-items: center;
  min-height: 3.5rem;
  padding: 0 0.7rem;
  color: var(--mute);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease, box-shadow 0.15s ease;
}

.pills a:hover {
  color: var(--ink);
  text-decoration: none;
}

.pills a.on {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* Intro */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13.5rem;
  gap: 3.5rem;
  align-items: start;
  padding-top: 4.5rem;
}

.intro h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2.4rem, 1.4rem + 3vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.intro .lead {
  margin-bottom: 1.5rem;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 500;
}

.intro p {
  max-width: 38rem;
}

.intro p + p {
  margin-top: 0.9rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: 1.5rem;
  font-weight: 600;
}

#contact .links {
  margin-top: 1rem;
}

.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: 10px;
  box-shadow: 0 18px 40px -22px rgb(16 24 40 / 0.45);
}

.socials {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.socials a {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  color: var(--soft);
  transition: color 0.15s ease, background-color 0.15s ease;
}

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

.socials svg {
  width: 20px;
  height: 20px;
}

.latest {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  align-items: baseline;
  margin-top: 1.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  background: var(--accent-soft);
  font-size: 0.95rem;
}

.latest span {
  color: var(--mute);
}

.latest a {
  font-weight: 600;
}

.intro-socials {
  justify-content: flex-start;
  margin: 1.2rem 0 0 -0.6rem;
}

/* Column */

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

h1,
h2 {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

h1 {
  margin-bottom: 1.2rem;
  font-size: 2.5rem;
}

h2 {
  margin-bottom: 1.3rem;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.block {
  padding-top: 4.5rem;
}

/* Selected work */

.highlights {
  list-style: none;
  border-top: 1px solid var(--line);
}

.highlights li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.highlights a strong {
  color: inherit;
}

.highlights .note {
  color: var(--mute);
  font-size: 0.9rem;
}

@media (min-width: 760px) {
  .highlights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 2.5rem;
  }
}

/* Cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.9);
  color: var(--body);
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.3s var(--ease), border-color 0.3s ease, transform 0.3s var(--ease);
}

a.card:hover {
  text-decoration: none;
  border-color: rgb(15 122 90 / 0.28);
  box-shadow: var(--shadow-2);
  transform: translateY(-3px);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.card h3 {
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

a.card:hover h3 {
  color: var(--accent);
}

.card-body > p {
  margin-top: 0.45rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.card-body > .read {
  margin-top: 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.card-body > .meta {
  margin-top: auto;
  padding-top: 1rem;
  color: var(--mute);
  font-size: 0.8rem;
}

.card-body > p:not(.meta) + .meta {
  margin-top: auto;
}

.card-body > h3 + p {
  margin-bottom: 0.2rem;
}

.dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.45rem;
  vertical-align: 0.1em;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 3px rgb(31 157 87 / 0.16);
}

.go {
  position: absolute;
  top: 1.35rem;
  right: 1.35rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: var(--mute);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.3s var(--ease);
}

.go svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 2;
}

a.card:hover .go {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translate(2px, -2px);
}

.tile {
  display: grid;
  flex-shrink: 0;
  order: -1;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 15px;
  background: var(--tile-bg);
  color: var(--tile-fg);
  box-shadow: inset 0 0 0 1px rgb(16 24 40 / 0.04);
  transition: transform 0.35s var(--ease);
}

.tile.logo {
  object-fit: cover;
  box-shadow: 0 0 0 1px rgb(16 24 40 / 0.06), 0 6px 14px -8px rgb(16 24 40 / 0.45);
}

a.card:hover .tile {
  transform: translateY(-2px) rotate(-3deg);
}

.tile svg {
  width: 28px;
  height: 28px;
}

.t-strata { --tile-bg: #e6f4ec; --tile-fg: #1c7a44; }
.t-eval   { --tile-bg: #e9eefc; --tile-fg: #3355d1; }
.t-voice  { --tile-bg: #fdefe4; --tile-fg: #b9561d; }
.t-fda    { --tile-bg: #f1ecfb; --tile-fg: #6a45b0; }
.t-chile  { --tile-bg: #e2f3f5; --tile-fg: #13707e; }

/* Timeline: years, a rail with one dot per organisation, then roles */

.timeline {
  --years: 6.5rem;
  --rail: calc(var(--years) + 1.25rem);
  list-style: none;
}

.timeline > li {
  position: relative;
  display: grid;
  grid-template-columns: var(--years) 1fr;
  column-gap: 2.5rem;
  padding-bottom: 1.75rem;
}

.timeline > li:last-child {
  padding-bottom: 0;
}

/* The rail runs from this dot down to the next one */
.timeline > li::before {
  content: "";
  position: absolute;
  top: 0.95rem;
  bottom: -0.45rem;
  left: var(--rail);
  width: 1px;
  background: var(--line);
}

.timeline > li:last-child::before {
  display: none;
}

.timeline > li::after {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: var(--rail);
  width: 11px;
  height: 11px;
  border: 2px solid #c9ced8;
  border-radius: 50%;
  background: var(--page);
  transform: translateX(-5px);
}

.timeline > li.now::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.years {
  padding-top: 0.12rem;
  color: var(--mute);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.what strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.role,
.roles {
  margin-top: 0.2rem;
  color: var(--mute);
  font-size: 0.95rem;
  line-height: 1.5;
}

.roles {
  max-width: 26rem;
  list-style: none;
}

.roles li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
  padding: 0.35rem 0;
}

.roles li + li {
  border-top: 1px dashed var(--line);
}

.roles .when {
  color: var(--soft);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* Writing list (homepage and /writing/) */

.posts {
  list-style: none;
  border-top: 1px solid var(--line);
}

.posts li {
  border-bottom: 1px solid var(--line-soft);
}

.posts a {
  display: grid;
  grid-template-columns: 8rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1.1rem 0.25rem;
  color: var(--body);
}

.posts a:hover {
  text-decoration: none;
}

.posts .date {
  color: var(--mute);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.posts .title {
  display: block;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.015em;
  transition: color 0.15s ease;
}

.posts .summary {
  display: block;
  margin-top: 0.2rem;
  color: var(--mute);
  font-size: 0.92rem;
}

.posts .arrow {
  color: var(--soft);
  transition: transform 0.25s var(--ease), color 0.2s ease;
}

.posts a:hover .title,
.posts a:hover .arrow {
  color: var(--accent);
}

.posts a:hover .arrow {
  transform: translateX(3px);
}

.empty {
  color: var(--mute);
}

.more {
  display: inline-block;
  margin-top: 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Footer */

.foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 5.5rem;
  padding: 2rem 0 3.5rem;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 0.85rem;
  text-align: center;
}

.foot-row {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.5rem;
}

.foot .socials {
  margin-top: 0;
}

.foot strong {
  color: var(--body);
}

.to-top {
  color: var(--mute);
  font-size: 0.8rem;
}

.to-top:hover {
  color: var(--ink);
  text-decoration: none;
}

/* Reading pages (/writing/) */

.page-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(var(--read), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 2rem 0 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
}

.page-top .pills a {
  min-height: 2.25rem;
  padding: 0.4rem 0.8rem;
}

.reading {
  width: min(var(--read), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding-top: 3.5rem;
}

.back {
  display: inline-flex;
  gap: 0.4rem;
  margin-bottom: 2rem;
  color: var(--mute);
  font-size: 0.9rem;
}

.back:hover {
  color: var(--ink);
  text-decoration: none;
}

.post-date {
  color: var(--mute);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.reading h1 {
  margin: 0.4rem 0 0.8rem;
  font-size: clamp(2rem, 1.4rem + 2vw, 2.75rem);
}

.lede {
  color: var(--mute);
  font-size: 1.2rem;
  line-height: 1.55;
}

.prose {
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 1.1rem;
  line-height: 1.75;
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2,
.prose h3 {
  margin: 2em 0 0.2em;
  color: var(--ink);
  font-family: var(--display);
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.prose h2 {
  font-size: 1.5rem;
}

.prose h3 {
  font-size: 1.2rem;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose li::marker {
  color: var(--accent);
}

.prose blockquote {
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid rgb(15 122 90 / 0.35);
  color: var(--mute);
  font-style: italic;
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: 0.35rem;
  background: #f3f4f7;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #f8f9fb;
  font-size: 0.9rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  margin-inline: auto;
  border-radius: 0.8rem;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.reading + .foot,
.reading .foot {
  width: 100%;
}

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

/* Motion */

@media (prefers-reduced-motion: no-preference) {
  .intro,
  .block,
  .reading {
    animation: rise 0.8s var(--ease) both;
  }

  #projects { animation-delay: 0.18s; }
  #writing { animation-delay: 0.24s; }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(12px);
      filter: blur(3px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Narrow screens */

@media (max-width: 640px) {
  :root {
    --gutter: 1.25rem;
  }

  .wordmark {
    display: none;
  }

  .pills {
    flex-wrap: nowrap;
    gap: 0;
    margin-left: -0.55rem;
  }

  .pills a {
    min-height: 3rem;
    padding: 0 0.55rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 2rem;
  }

  .portrait {
    order: -1;
    width: 5.5rem;
    aspect-ratio: 1;
    object-position: 50% 28%;
  }

  h2 {
    font-size: 1.5rem;
  }

  .block {
    padding-top: 3.25rem;
  }

  .card {
    padding: 1.25rem;
  }

  .tile {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .tile svg {
    width: 20px;
    height: 20px;
  }

  .card h3 {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 2.5rem 0 52px;
  }

  .go {
    top: 1.1rem;
    right: 1.1rem;
  }

  .timeline {
    --rail: 0.3rem;
  }

  .timeline > li {
    grid-template-columns: 1fr;
    padding-left: 1.6rem;
  }

  .timeline > li::after {
    top: 0.3rem;
  }

  .timeline > li::before {
    top: 0.8rem;
  }

  .years {
    text-align: left;
  }

  .posts a {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .posts .arrow {
    display: none;
  }

  .foot {
    margin-top: 4rem;
  }

  .prose {
    font-size: 1.05rem;
  }
}

/* Wide screens */

@media (min-width: 1024px) {
  .foot {
    align-items: stretch;
    text-align: left;
  }

  .foot-row {
    flex-direction: row;
    justify-content: space-between;
  }

  .foot .socials {
    margin-right: -0.55rem;
  }

  .to-top {
    align-self: flex-start;
  }

  .page-foot .foot-row {
    flex-direction: row;
  }
}
