:root {
  --bg: #f2f4f6;
  --ink: #18202b;
  --muted: #5a6474;
  --rule: #d9dee4;
  --link: #2340d0;
  --font: 'Schibsted Grotesk', system-ui, sans-serif;
  --wrap: 1120px;
  --text: 40rem;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #101419;
    --ink: #e6eaf0;
    --muted: #9aa3b2;
    --rule: #2a313b;
    --link: #93a6ff;
  }
}
:root[data-theme='dark'] {
  --bg: #101419;
  --ink: #e6eaf0;
  --muted: #9aa3b2;
  --rule: #2a313b;
  --link: #93a6ff;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  margin-bottom: 1.5rem;
}

/* Intro */

.intro {
  padding-top: clamp(48px, 10vw, 120px);
  padding-bottom: clamp(56px, 9vw, 112px);
}

.intro h1 {
  font-size: clamp(3.5rem, 1rem + 11vw, 9.5rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.92;
  margin-left: -0.04em;
}

.intro-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: clamp(28px, 4vw, 44px);
  max-width: var(--text);
}

.me {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  margin-top: 4px;
}

.lede {
  margin: 0;
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.5rem);
  line-height: 1.45;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  list-style: none;
  padding: 0;
  margin: 28px 0 0 84px;
  font-weight: 600;
}

/* Projects */

.projects {
  padding-bottom: clamp(40px, 6vw, 72px);
}

.project {
  margin-bottom: clamp(48px, 7vw, 88px);
}

.tile {
  display: block;
  background: var(--tile);
  border-radius: 24px;
  padding: clamp(20px, 5vw, 56px) clamp(20px, 5vw, 56px) 0;
  overflow: hidden;
}

.tile img {
  width: 100%;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.04),
    0 18px 50px -12px color-mix(in srgb, var(--tile-ink) 45%, transparent);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tile:hover img {
  transform: translateY(-6px);
}

.project-text {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(0, 2.2fr);
  column-gap: 32px;
  margin-top: 24px;
}

.project-text h3 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  grid-row: span 2;
}

.project-text h3 a {
  color: inherit;
  text-decoration: none;
}
.project-text h3 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.project-text p {
  margin: 0;
  max-width: var(--text);
}

.project-text .meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 1rem;
}

/* Work */

.work {
  padding-bottom: clamp(48px, 7vw, 88px);
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 52rem;
  border-top: 1px solid var(--rule);
}

.timeline > li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 16px;
  border-bottom: 1px solid var(--rule);
}

.when {
  padding: 16px 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.timeline summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  padding: 16px 32px 16px 0;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.timeline summary::-webkit-details-marker {
  display: none;
}
.timeline summary strong {
  font-weight: 600;
}
.timeline summary span {
  color: var(--muted);
}
.timeline summary::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}
.timeline details[open] summary::after {
  transform: translateY(-30%) rotate(-135deg);
}

.timeline details > p,
.timeline details > ul {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: var(--text);
}
.timeline details > ul {
  padding-left: 1.1em;
}
.timeline details li + li {
  margin-top: 6px;
}

/* Earlier */

.earlier {
  padding-bottom: clamp(48px, 7vw, 88px);
}
.earlier h2 {
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
}
.earlier ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: var(--text);
}
.earlier li + li {
  margin-top: 14px;
}
.earlier li {
  color: var(--muted);
}
.earlier strong {
  font-weight: 600;
}

footer {
  border-top: 1px solid var(--rule);
  padding-top: 28px;
  padding-bottom: 56px;
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.5rem);
}
footer p {
  margin: 0;
}

/* Small screens */

@media (max-width: 640px) {
  body {
    font-size: 1.0625rem;
  }
  .contact {
    margin-left: 0;
  }
  .me {
    width: 52px;
    height: 52px;
  }
  .tile {
    border-radius: 20px;
    padding: 24px 40px 0;
  }
  .tile img {
    border-radius: 22px 22px 0 0;
    max-height: 420px;
    object-fit: cover;
    object-position: top;
  }
  .project-text {
    display: block;
    margin-top: 18px;
  }
  .project-text h3 {
    margin-bottom: 8px;
  }
  .timeline > li {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .when {
    padding: 14px 0 0;
    font-size: 0.9375rem;
  }
  .timeline summary {
    padding-top: 2px;
    flex-direction: column;
  }
}

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