:root {
  --paper: #f3f6fa;
  --panel: #e2eaf5;
  --rule: #cbd6e4;
  --ink: #0e1a2e;
  --ink-soft: #4a5872;
  --blue: #1b5fd1;
  --blue-deep: #1449a6;
  --btn: #1b5fd1;
  --btn-hover: #1449a6;
  --topbar-bg: rgba(243, 246, 250, 0.88);
  --footer-bg: #0e1a2e;
  --cable: rgba(27, 95, 209, 0.13);
  --cable-port: rgba(27, 95, 209, 0.45);
  --signal: rgba(27, 95, 209, 0.55);
  --net-rgb: 27, 95, 209;
  --measure: 68ch;
  --gutter: clamp(16px, 5vw, 56px);
  color-scheme: light;
}

/* Dark theme: chosen with the toggle, or the device setting when no choice is saved */
:root[data-theme="dark"] {
  --paper: #0c1525;
  --panel: #17243a;
  --rule: #26364f;
  --ink: #e7edf7;
  --ink-soft: #9fb0ca;
  --blue: #7aaaff;
  --blue-deep: #a3c4ff;
  --btn: #2563d6;
  --btn-hover: #1d55bd;
  --topbar-bg: rgba(12, 21, 37, 0.86);
  --footer-bg: #070e1a;
  --cable: rgba(122, 170, 255, 0.12);
  --cable-port: rgba(122, 170, 255, 0.45);
  --signal: rgba(122, 170, 255, 0.6);
  --net-rgb: 122, 170, 255;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #0c1525;
    --panel: #17243a;
    --rule: #26364f;
    --ink: #e7edf7;
    --ink-soft: #9fb0ca;
    --blue: #7aaaff;
    --blue-deep: #a3c4ff;
    --btn: #2563d6;
    --btn-hover: #1d55bd;
    --topbar-bg: rgba(12, 21, 37, 0.86);
    --footer-bg: #070e1a;
    --cable: rgba(122, 170, 255, 0.12);
    --cable-port: rgba(122, 170, 255, 0.45);
    --signal: rgba(122, 170, 255, 0.6);
    --net-rgb: 122, 170, 255;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

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

body {
  margin: 0;
  background: var(--paper);
  transition: background-color 0.25s ease, color 0.25s ease;
  color: var(--ink);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--blue);
}

a:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  z-index: 10;
}

.skip:focus {
  left: 8px;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
  background: var(--topbar-bg);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  display: block;
  border-radius: 50%;
}

:root[data-theme="dark"] .brand img {
  box-shadow: 0 0 0 1px rgba(122, 170, 255, 0.45);
}

.topbar ul {
  display: flex;
  gap: clamp(12px, 3vw, 28px);
  list-style: none;
  padding: 0;
}

.topbar nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 28px);
}

/* Light and dark toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--blue);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Hero */
main {
  padding: 0 var(--gutter);
  max-width: calc(1120px + 2 * var(--gutter));
  margin: 0 auto;
}

.site {
  overflow-x: clip;
}

.hero {
  position: relative;
  padding: clamp(56px, 11vw, 128px) 0 clamp(48px, 8vw, 88px);
}

.hero > *:not(.hero-net) {
  position: relative;
  z-index: 1;
}

.hero-net {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
}

.net-bg {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-net .net-bg {
  -webkit-mask-image: radial-gradient(ellipse 46% 52% at 96% 22%, #000 25%, transparent 100%);
  mask-image: radial-gradient(ellipse 46% 52% at 96% 22%, #000 25%, transparent 100%);
}

.hero-role {
  color: var(--blue);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  margin-bottom: 20px;
}

.hero-headline {
  font-size: clamp(2.5rem, 7.2vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  max-width: 14ch;
  text-wrap: balance;
}

.hero-summary {
  margin-top: 32px;
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: 1.125rem;
}

.facts {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--ink);
  max-width: 960px;
}

.facts > div {
  padding: 14px 16px 0 0;
}

.facts dt {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.facts dd {
  font-weight: 600;
  line-height: 1.35;
  margin-top: 4px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

.btn {
  display: inline-block;
  padding: 12px 22px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  border: 2px solid var(--btn);
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

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

.btn-line {
  color: var(--blue);
}

.btn-line:hover {
  background: var(--panel);
}

/* Sections */
.section {
  padding: clamp(48px, 7vw, 80px) 0;
  border-top: 1px solid var(--rule);
}

.section h2,
.contact h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.25rem);
  letter-spacing: -0.02em;
  font-weight: 750;
  line-height: 1.15;
  margin-bottom: 32px;
}

h3 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Timeline */
.timeline {
  list-style: none;
  padding: 0;
}

.job {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  position: relative;
  padding-bottom: 44px;
}

.job:last-child {
  padding-bottom: 0;
}

.job-what {
  position: relative;
  padding-left: 32px;
  border-left: 2px solid var(--rule);
}

.job-what::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--blue);
}

.job:first-child .job-what::before {
  background: var(--blue);
}

.job-when {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 2px;
}

.dates {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.place {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.org {
  color: var(--blue);
  font-weight: 600;
  margin-top: 2px;
}

.intro {
  margin-top: 12px;
  max-width: var(--measure);
}

.job-what ul {
  margin-top: 12px;
  padding-left: 1.1em;
  max-width: var(--measure);
}

.job-what li + li {
  margin-top: 6px;
}

.job-what li::marker {
  color: var(--blue);
}

/* Projects */
.projects {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 48px;
}

.project {
  border-top: 2px solid var(--ink);
  padding-top: 18px;
}

.project .context {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 4px 0 14px;
}

.project > p:not(.context) {
  max-width: var(--measure);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin-top: 18px;
}

.tags li {
  background: var(--panel);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.9rem;
}

.sub-h {
  margin: 56px 0 16px;
  font-size: 1.2rem;
}

.minor {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 40px;
}

.minor li {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
}

.minor-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.minor-title span {
  display: block;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.minor p:not(.minor-title) {
  color: var(--ink-soft);
}

.plain.compact li + li {
  margin-top: 8px;
}

/* Skills and community */
.skills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 40px;
}

.skills dt {
  font-weight: 700;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.skills dd {
  color: var(--ink-soft);
}

.community dd {
  color: var(--ink);
}

/* Education and certs */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.plain {
  list-style: none;
  padding: 0;
}

.plain li + li {
  margin-top: 24px;
}

.plain p {
  margin-top: 2px;
}

.muted {
  color: var(--ink-soft);
}

/* Contact */
.contact {
  position: relative;
  overflow: hidden;
  background: var(--footer-bg);
  border-top: 1px solid var(--rule);
  color: #f3f6fa;
  padding: clamp(56px, 9vw, 104px) var(--gutter) 32px;
  margin-top: 24px;
}

.contact .net-bg {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(to right, transparent 25%, #000 85%);
  mask-image: linear-gradient(to right, transparent 25%, #000 85%);
}

.contact > *:not(.net-bg) {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

.contact h2 {
  margin-bottom: 12px;
}

.contact p {
  color: #b9c7dd;
}

.contact-email {
  display: block;
  margin-top: 28px;
  color: #fff;
  font-size: clamp(1.4rem, 4.4vw, 2.75rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration-color: #8db4ff;
  text-underline-offset: 8px;
  text-decoration-thickness: 3px;
  overflow-wrap: anywhere;
}

.contact-email:hover {
  text-decoration-color: #fff;
}

.contact-links {
  margin-top: 20px;
}

.contact-links a {
  color: #fff;
}

.contact a:focus-visible {
  outline-color: #8db4ff;
}

.copyright {
  margin-top: 64px;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 900px) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 8px;
  }
  .skills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .projects {
    grid-template-columns: 1fr;
  }
  .minor {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .hero-net .net-bg {
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 45%);
    mask-image: linear-gradient(to bottom, #000 0%, transparent 45%);
    opacity: 0.7;
  }
  .contact .net-bg {
    opacity: 0.6;
  }
  .topbar nav {
    display: none;
  }
  .job {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .job-when {
    padding-left: 32px;
    border-left: 2px solid var(--rule);
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 10px;
    padding-bottom: 6px;
  }
  .job {
    padding-bottom: 0;
  }
  .job-what {
    padding-bottom: 40px;
  }
  .job:last-child .job-what {
    padding-bottom: 0;
  }
  .job-what::before {
    display: none;
  }
  .job-when {
    position: relative;
  }
  .job-when::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--paper);
    border: 3px solid var(--blue);
  }
  .job:first-child .job-when::before {
    background: var(--blue);
  }
  .skills,
  .minor,
  .split {
    grid-template-columns: 1fr;
  }
  .facts {
    grid-template-columns: 1fr;
  }
}

/* Roles */
.roles {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 48px;
  align-items: start;
}

.roles-intro {
  max-width: var(--measure);
  font-size: 1.125rem;
}

.role-list {
  list-style: none;
  padding: 0;
  border-top: 2px solid var(--ink);
}

.role-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 600;
}

@media (max-width: 680px) {
  .roles {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Cables running behind the main content */
main {
  position: relative;
}

main > section {
  position: relative;
  z-index: 1;
}

.cables {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.cables svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cables .cable {
  fill: none;
  stroke: var(--cable);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.cables .cable-thick {
  stroke-width: 3;
}

.cables .signal {
  fill: none;
  stroke: var(--signal);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 6 494;
  animation: signal-flow 16s linear infinite;
}

.cables .signal-slow {
  animation-duration: 24s;
  animation-direction: reverse;
}

@keyframes signal-flow {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Trunk cable down the left gutter, with a port at each section heading */
.section > h2 {
  position: relative;
}

@media (min-width: 900px) {
  main::before {
    content: "";
    position: absolute;
    top: 100vh;
    bottom: 0;
    left: calc(var(--gutter) / 2);
    width: 2px;
    background: var(--cable);
    z-index: 0;
  }

  .section > h2::before {
    content: "";
    position: absolute;
    left: calc(var(--gutter) / -2 - 6px);
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -6px;
    border: 2px solid var(--cable-port);
    border-radius: 2px;
    background: var(--paper);
  }

  .section > h2::after {
    content: "";
    position: absolute;
    left: calc(var(--gutter) / -2 + 6px);
    top: 50%;
    width: calc(var(--gutter) / 2 - 18px);
    height: 2px;
    margin-top: -1px;
    background: var(--cable);
  }
}

/* Pointer and touch network layer, always behind the content */
.pointer-net {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

@media (max-width: 680px) {
  .cables {
    opacity: 0.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cables .signal {
    animation: none;
    display: none;
  }
  body {
    transition: none;
  }
}
