:root {
  color-scheme: light;
  --bg: oklch(98.4% 0.004 95);
  --raised: oklch(99.6% 0.002 95);
  --ink: oklch(22% 0.006 95);
  --body: oklch(38% 0.006 95);
  --muted: oklch(50% 0.006 95);
  --line: oklch(92.5% 0.005 95);
  --line-strong: oklch(78% 0.006 95);
  --shadow: 0 2px 2px oklch(0% 0 0 / .05), 0 12px 20px oklch(0% 0 0 / .09);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: oklch(17% 0.004 95);
    --raised: oklch(23% 0.005 95);
    --ink: oklch(94% 0.004 95);
    --body: oklch(78% 0.005 95);
    --muted: oklch(66% 0.005 95);
    --line: oklch(26% 0.005 95);
    --line-strong: oklch(44% 0.005 95);
    --shadow: 0 2px 2px oklch(0% 0 0 / .3), 0 12px 20px oklch(0% 0 0 / .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(17% 0.004 95);
  --raised: oklch(23% 0.005 95);
  --ink: oklch(94% 0.004 95);
  --body: oklch(78% 0.005 95);
  --muted: oklch(66% 0.005 95);
  --line: oklch(26% 0.005 95);
  --line-strong: oklch(44% 0.005 95);
  --shadow: 0 2px 2px oklch(0% 0 0 / .3), 0 12px 20px oklch(0% 0 0 / .4);
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--body);
  font: 400 15px/24px "Schibsted Grotesk", -apple-system, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

main {
  width: min(100% - 48px, 540px);
  margin-inline: auto;
  padding-block: clamp(64px, 14vh, 120px) 136px;
}

/* intro */
.avatar { display: block; border-radius: 8px; margin-bottom: 32px; background: var(--line); }
.intro h1 { font: inherit; color: var(--ink); }
.intro p { margin-top: 12px; }
.intro a, .email a {
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color .16s;
}
.intro a:hover, .email a:hover { text-decoration-color: currentColor; }

/* sections */
section { margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line); }
h2 { font: inherit; color: var(--muted); margin-bottom: 12px; }
.meta { color: var(--muted); white-space: nowrap; }

/* project rows */
.rows { list-style: none; padding: 0; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-block: 3px;
  color: var(--muted);
  text-decoration: none;
}
.row .name { min-width: 0; }
a.row .name {
  color: var(--ink);
  text-decoration: underline transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .16s, text-decoration-color .16s;
}
a.row .name::after {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 6px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath d='M1 8l7-7M2.5 1H8v5.5' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath d='M1 8l7-7M2.5 1H8v5.5' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity .16s, transform .24s var(--ease);
}
@media (hover: hover) {
  .rows:hover a.row:not(:hover) .name { color: var(--muted); }
  a.row:hover .name { text-decoration-color: var(--line-strong); }
  a.row:hover .name::after { opacity: 1; transform: none; }
}
a.row:focus-visible .name::after { opacity: 1; transform: none; }
@media (pointer: coarse) {
  .row { padding-block: 10px; }
}

/* preview card on project links */
.preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3;
  width: 320px; /* matches WIDTH in main.js */
  aspect-ratio: 3 / 2;
  pointer-events: none;
  transform-origin: left center;
  will-change: transform;
}
.preview-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
  opacity: 0;
  transform: scale(.96);
  transform-origin: left center;
  transition: opacity .12s, transform .12s;
}
.preview.on .preview-face {
  opacity: 1;
  transform: none;
  transition: opacity .2s, transform .35s var(--ease);
}
/* The old image stays underneath until the new one has faded in over it. */
.preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0s .16s;
}
.preview img.on { z-index: 1; opacity: 1; transition: opacity .16s; }

/* connect */
.email { position: relative; margin-top: 12px; }
.copy {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  padding: 0;
  vertical-align: -4px;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  transition: color .16s;
}
.copy::before { content: ""; position: absolute; inset: -12px; }
.copy:hover { color: var(--ink); }
.status { color: var(--muted); margin-left: 4px; }
.clock { margin-top: 12px; }

/* theme button */
.theme {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  transition: color .16s;
}
.theme:hover { color: var(--ink); }
@media (max-width: 700px) {
  .theme { position: absolute; } /* on phones it would sit on top of the text as you scroll */
}

/* link dock */
.dock {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 2;
  display: flex;
  padding: 4px;
  transform: translateX(-50%);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 20px;
}
.dock a {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--body);
  text-decoration: none;
  white-space: nowrap;
  transition: color .16s, background-color .16s;
}
.dock a:hover { color: var(--ink); background: color-mix(in oklch, var(--ink) 7%, transparent); }
@media (pointer: coarse) {
  .dock a { padding-block: 10px; }
}
@media (max-width: 380px) {
  .dock { font-size: 12px; }
  .dock a { padding-inline: 6px; }
}

/* inner pages */
main.page { padding-bottom: 96px; }
.back {
  display: inline-block;
  margin-bottom: 32px;
  color: var(--muted);
  text-decoration: none;
  transition: color .16s;
}
.back:hover { color: var(--ink); }
.points { list-style: none; padding: 0; display: grid; gap: 8px; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.text-button {
  padding: 4px 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.text-button:hover { text-decoration-color: currentColor; }
.text-button:disabled { color: var(--muted); text-decoration: none; cursor: default; }
@media (pointer: coarse) {
  .back, .text-button { padding-block: 10px; }
}

/* artwork stays on a light tile in both themes, because it was drawn for light surfaces */
.tile { display: grid; place-items: center; background: oklch(96.4% 0.004 95); border-radius: 8px; }
.tile.navy { background: #223948; }
.icons {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 16px 12px;
}
.icons .tile { aspect-ratio: 1; padding: 18px; }
.icons img { display: block; width: 100%; height: 100%; object-fit: contain; }
.icons figure span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 18px; }
.banner { padding: 32px; margin-top: 32px; }
.banner img { display: block; width: min(100%, 280px); height: auto; }
.looks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.looks .tile { grid-auto-flow: column; justify-content: start; gap: 8px; padding: 12px; margin-bottom: 8px; }
.looks .tile > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 6px; }
.looks .tile > span.navy { background: #223948; }
.looks img { display: block; width: 32px; height: 32px; }
.looks p { color: var(--body); }
.looks b { display: block; font-weight: 400; color: var(--ink); }

/* contrast grid */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.fields label { display: block; color: var(--muted); }
.fields textarea {
  display: block;
  width: 100%;
  min-height: 104px;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.scroller { position: relative; overflow-x: auto; margin-top: 24px; border: 1px solid var(--line); border-radius: 8px; }
.contrast { width: 100%; min-width: 440px; border-collapse: collapse; }
.contrast th { padding: 8px 12px; color: var(--muted); font-size: 13px; font-weight: 400; text-align: left; white-space: nowrap; }
.contrast td { padding: 10px 12px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.contrast .sample { display: block; font-size: 20px; line-height: 28px; font-weight: 500; }
.contrast .ratio { display: block; margin-bottom: 8px; font-size: 13px; }
.badge {
  display: inline-block;
  margin-right: 4px;
  padding-inline: 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 11px;
  line-height: 16px;
}
.badge.fail { border-color: transparent; opacity: .6; text-decoration: line-through; }

/* earth timeline */
.globe { position: relative; aspect-ratio: 1; margin-top: 32px; overflow: hidden; border-radius: 8px; background: #070709; touch-action: pan-y; }
.globe canvas { display: block; width: 100%; height: 100%; }
.globe::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, transparent 35%, rgba(7, 7, 9, .85) 100%);
  pointer-events: none;
}
.globe p { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: #b9b7b0; text-align: center; }
.chapter { margin-top: 20px; }
.chapter h2 { margin: 4px 0 8px; color: var(--ink); }
.pager { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }
button.row { width: 100%; padding-inline: 0; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
button.row .name { color: var(--body); transition: color .16s; }
button.row:hover .name, button.row[aria-current] .name { color: var(--ink); }
button.row[aria-current] .name { font-weight: 500; }

/* graphic design pages: the text keeps to the column and the work goes wider */
.wide { margin-inline: calc(50% - min(50vw - 24px, 540px)); }
.shots { display: grid; gap: 8px; margin-top: 32px; }
.shots img { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--line); }
.shots + .intro { margin-top: 20px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 3px 24px; margin-top: 24px; }
.facts dt { color: var(--muted); }
.facts dd { color: var(--ink); }
.facts + .rows { margin-top: 12px; }
.closing { margin-top: 32px; }

/* home: experience and services */
.row b { font-weight: 400; color: var(--ink); margin-right: 4px; }
.rows + p, h2 + p + .rows { margin-top: 12px; }
.services { list-style: none; padding: 0; display: grid; gap: 12px; margin-top: 12px; }
.services b { display: block; font-weight: 400; color: var(--ink); }

/* photos */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head a { text-decoration: underline transparent; text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .16s, text-decoration-color .16s; }
.section-head a:hover { color: var(--ink); text-decoration-color: var(--line-strong); }
.strip {
  --edge: max(24px, (100vw - 540px) / 2); /* photos.js swaps this for the exact column edge */
  --h: clamp(280px, 64svh, 600px);
  position: relative;
  display: flex;
  gap: 8px;
  margin: 24px calc(-1 * var(--edge)) 0;
  padding: 0 var(--edge);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--edge);
  scrollbar-width: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip:focus-visible { outline-offset: -2px; }
.strip.free { scroll-snap-type: none; }
.strip.dragging { cursor: grabbing; }
.strip li {
  flex: none;
  height: var(--h);
  max-width: calc(100vw - 48px);
  aspect-ratio: var(--ratio);
  overflow: hidden;
  overflow: clip;
  border-radius: 8px;
  background: var(--color);
  scroll-snap-align: start;
}
.strip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .6s;
  -webkit-user-drag: none;
}
.strip img.loaded { opacity: 1; }
@media (max-width: 700px) {
  .strip { --h: min(64svh, 420px); }
}
/* Each photo drifts inside its frame as it crosses the screen, like looking through a window. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .strip img { scale: 1.12; animation: drift linear both; animation-timeline: view(inline 0px); }
    @keyframes drift {
      from { translate: -5% 0; }
      to { translate: 5% 0; }
    }
  }
}

/* one bar for each photo, in that photo's colour */
.colours { display: flex; gap: 2px; height: 20px; margin-top: 16px; cursor: pointer; touch-action: pan-y; }
.colours i {
  flex: 1;
  background: var(--color);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ink) 12%, transparent);
  transform: scaleY(.3);
  transform-origin: bottom;
  transition: transform .3s var(--ease);
}
.colours i.on { transform: none; }
@media (hover: hover) {
  .colours i:not(.on):hover { transform: scaleY(.55); }
}
@media (pointer: coarse) {
  .colours { height: 28px; }
}
.photo-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 4px; }
.photo-bar p { color: var(--ink); min-height: 24px; }
.arrows { display: flex; margin-right: -8px; }
.arrows button {
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: opacity .16s;
}
.arrows button:disabled { color: var(--muted); opacity: .5; cursor: default; }
@media (pointer: coarse) {
  .arrows button { width: 44px; height: 44px; }
  .arrows { margin-right: -14px; }
}

/* page load */
.reveal { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  * { transition: none !important; }
}
