:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --surface: #131317;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f3f1ec;
  --muted: #a5a29a;
  --accent: #ff8a4c;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 64px);
  --header-h: 72px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 400; margin: 0; }

a { color: inherit; }

/* Read by screen readers and search engines, but not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--gutter);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s, border-color 0.3s;
}

.site-nav { display: flex; gap: 32px; }

/* "Ewan" and the links beside it share one style. */
.brand,
.site-nav__link {
  color: var(--text);
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  text-decoration: none;
  transition: opacity 0.2s;
}

.brand:hover,
.site-nav__link:hover,
.site-nav__link:focus-visible { opacity: 0.7; }

/* Underlines the page you're on. */
.site-nav__link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

/* ---------- Scroll-driven video ---------- */

/* script.js sets --scrub-length from the video's duration; this is the fallback until it loads. */
.scrub {
  position: relative;
  height: var(--scrub-length, 1300vh);
}

/* The large viewport: the whole screen once a phone's address bar has slid away, which it does as
   soon as you scroll. The small one left a black strip under the video then. While the bar shows,
   the bottom of the video just sits behind it. It never changes size while scrolling, so the
   scroll length measured from it (script.js) stays put too. */
.scrub__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  background: #000; /* shows as bars wherever the video's shape doesn't match the screen */
}

/* data-fit on .scrub, set in index.html or the scene editor, chooses how the video fills the screen.
   "screen" fills it edge to edge, trimming the edges if the shapes don't match. */
.scrub__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s;
}

/* "height" shows the video's full height, centred, with black bars at the sides on wide screens. */
.scrub[data-fit="height"] .scrub__video {
  left: 50%;
  width: auto;
  max-width: none;
  object-fit: contain;
  transform: translateX(-50%);
}

.scrub.is-ready .scrub__video { opacity: 1; }

/* Darkens the edges, and the top so the header stays readable. */
.scrub__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent 22%);
}

/* Project orbs. script.js floats each one from right to left along the top or bottom row. */
.scrub__orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb {
  --size: calc(min(128px, 15vh) * var(--depth, 1));
  position: absolute;
  top: var(--y);
  left: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2); /* centres the orb on the point script.js moves */
  color: var(--text);
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 2px 16px rgba(0, 0, 0, 0.6); /* readable on bright sky too */
  visibility: hidden;
  pointer-events: auto;
  will-change: transform;
}

/* The rows sit just under the header and just above the bottom, leaving the middle for the video. */
.orb[data-row="top"] { --y: calc(var(--header-h) + 16px + var(--size) / 2); }
.orb[data-row="bottom"] { --y: calc(100% - 88px - var(--size) / 2); }

/* Only for the Projects page, so it stays out of the scene. */
.orb[data-show]:not([data-show~="home"]) { display: none; }

/* A see-through glass orb: tinted body, glowing rim, and the video blurred behind it. */
.orb__core {
  position: relative;
  flex: none;
  width: var(--size);
  height: var(--size);
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle,
    hsl(var(--hue) 90% 50% / 0.14) 0%,
    hsl(var(--hue) 90% 55% / 0.3) 66%,
    hsl(var(--hue) 100% 78% / 0.95) 100%);
  box-shadow:
    0 0 calc(var(--size) * 0.5) hsl(var(--hue) 100% 60% / 0.6),
    0 0 calc(var(--size) * 1.1) hsl(var(--hue) 100% 60% / 0.25),
    inset 0 0 calc(var(--size) * 0.22) hsl(var(--hue) 100% 72% / 0.6);
  backdrop-filter: blur(6px) saturate(1.4);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s;
}

/* The glowing core, which slowly pulses. */
.orb__core::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--hue) 100% 90% / 0.95) 0%, hsl(var(--hue) 100% 65% / 0.45) 28%, transparent 58%);
  animation: orb-pulse 3.2s ease-in-out infinite;
}

/* Glossy highlight on the top left. */
.orb__core::after {
  content: "";
  position: absolute;
  inset: 8% 34% 58% 16%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.55), transparent 70%);
}

/* A picture in the orb replaces the glowing core. */
.orb__core img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.orb__core:has(img)::before { display: none; }

@keyframes orb-pulse {
  0%, 100% { opacity: 0.75; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* Name and date sit beside the orb; the description hangs below them on hover. */
.orb__label {
  position: relative;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}

.orb__name {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.1;
}

.orb__date {
  margin-top: 4px;
  color: rgba(243, 241, 236, 0.8);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.orb__desc {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 240px;
  color: rgba(243, 241, 236, 0.86);
  white-space: normal;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.3s;
}

.orb:hover .orb__core,
.orb:focus-visible .orb__core {
  transform: scale(1.08);
  box-shadow:
    0 0 calc(var(--size) * 0.7) hsl(var(--hue) 100% 60% / 0.8),
    0 0 calc(var(--size) * 1.4) hsl(var(--hue) 100% 60% / 0.35),
    inset 0 0 calc(var(--size) * 0.28) hsl(var(--hue) 100% 74% / 0.75);
}

.orb:hover .orb__desc,
.orb:focus-visible .orb__desc {
  opacity: 1;
  transform: none;
}

.scrub__loader {
  position: absolute;
  bottom: 32px;
  left: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  transition: opacity 0.4s;
}

.scrub.is-ready .scrub__loader { opacity: 0; pointer-events: none; }

/* The orbs and the loading bar keep to the part of the screen a phone's own bars never cover, so
   the bottom row stays in sight while the video fills everything behind it. The same as the whole
   stage on a computer, where there are no such bars. */
@supports (height: 100svh) {
  .scrub__orbs { bottom: calc(100lvh - 100svh); }
  .scrub__loader { bottom: calc(32px + 100lvh - 100svh); }
}

/* Phones (script.js adds is-touch-scrub): the page itself never scrolls, so the browser leaves its
   address bar where it is and nothing slides. The stage is pinned to the screen and a finger
   drives the video, so there's no scroll length and nothing covers the stage. */
html.is-touch-scrub,
html.is-touch-scrub body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.is-touch-scrub .scrub { height: auto; }

.is-touch-scrub .scrub__stage {
  position: fixed;
  inset: 0;
  height: auto;
}

.is-touch-scrub .scrub__orbs { bottom: 0; }
.is-touch-scrub .scrub__loader { bottom: 32px; }

.scrub__loader-bar {
  width: 140px;
  height: 2px;
  background: var(--line);
}

.scrub__loader-bar span {
  display: block;
  height: 100%;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Project pages (projects/*.html) ---------- */

.project {
  max-width: 1080px;
  margin: 0 auto;
  padding: 140px var(--gutter) 120px;
}

/* Pinned at the top left, so the way back is always one click away. */
.project__back {
  position: fixed;
  top: 20px;
  left: var(--gutter);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(23, 23, 27, 0.75);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.project__back svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.project__back:hover,
.project__back:focus-visible {
  border-color: hsl(var(--hue) 90% 65% / 0.8);
  background: hsl(var(--hue) 50% 18% / 0.85);
}

.project__back:hover svg { transform: translateX(-3px); }

.project__title,
.page__title {
  font-family: var(--serif);
  font-size: clamp(56px, 8vw, 112px);
  line-height: 0.95;
  letter-spacing: -0.015em;
}

.project__summary {
  max-width: 38rem;
  margin: 24px 0 0;
  color: rgba(243, 241, 236, 0.86);
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.5;
}

.project__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 36px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
  list-style: none;
  text-transform: uppercase;
}

/* When it ran: a line for each stretch of time, one under another. The <br>s between them do the
   same where this stylesheet doesn't load. */
.project__dates { display: flex; flex-direction: column; gap: 4px; }
.project__dates br { display: none; }

.project__media {
  margin: 56px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.project__media img,
.project__media video {
  display: block;
  width: 100%;
  height: auto;
}

/* Narrower, for small screenshots that would blur if stretched to the full width. */
.project__media--small { max-width: 768px; }

/* Phone screenshots side by side, each in its own frame. */
.project__media--phones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 24px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
}

.project__media--phones img {
  border: 1px solid var(--line);
  border-radius: clamp(10px, 2vw, 20px);
  background: var(--surface);
}

/* On a phone they'd be too small three across, so they become a strip to swipe through. */
@media (max-width: 640px) {
  .project__media--phones {
    grid-template-columns: none;
    grid-auto-columns: 72%;
    grid-auto-flow: column;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .project__media--phones img { scroll-snap-align: center; }
}

.project__media figcaption {
  padding: 14px 20px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* The heading sits on the left with the text beside it. */
.project__section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: 32px;
  margin-top: 72px;
}

.project__section h2 {
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1.1;
}

.project__body p,
.project__body ul {
  max-width: 42rem;
  margin: 0 0 16px;
  color: rgba(243, 241, 236, 0.86);
  font-size: 18px;
  line-height: 1.7;
}

.project__body ul { padding-left: 1.2em; }
.project__body li + li { margin-top: 8px; }
.project__body li::marker { color: hsl(var(--hue) 90% 70%); }

/* A heatmap built as a table: each square is coloured by its value on one blue ramp, from dark
   (lower) to light (higher), with the value written on it. */
.heat { margin: 32px 0; }

.heat__table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 2px;
  table-layout: fixed;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.heat__table caption,
.data-table caption {
  caption-side: bottom;
  padding-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

.heat__col-axis { width: 28px; }
.heat__col-head { width: 48px; }

.heat__table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.heat__table thead th { padding-bottom: 6px; }
.heat__table th[scope="row"] { padding-right: 8px; text-align: right; }

.heat__axis {
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.heat__axis--y span {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

.heat__table td {
  position: relative;
  height: 40px;
  border-radius: 4px;
  background: var(--fill);
  color: var(--ink);
  text-align: center;
}

/* Hovering a square outlines it and names its two settings. */
.heat__table td:hover {
  z-index: 1;
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.heat__table td:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 19, 23, 0.96);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

.heat__legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.heat__ramp {
  width: 200px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #0d366b, #14488b 12.5%, #1c5cab 25%, #2771ca 37.5%, #3987e5 50%, #61a0ea 62.5%, #86b6ef 75%, #abccf5 87.5%, #cde2fb);
}

/* Tables of results. */
.project__table {
  overflow-x: auto;
  margin: 32px 0 16px;
}

.data-table {
  width: 100%;
  max-width: 42rem;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.data-table thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table thead th:first-child,
.data-table th[scope="row"] {
  font-weight: 400;
  text-align: left;
}

.data-table__group th {
  padding-top: 24px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  text-align: left;
}

.data-table strong { color: hsl(var(--hue) 90% 75%); font-weight: 600; }

/* Text added on its own with the local page editor, outside a section. */
.project__text {
  max-width: 42rem;
  margin: 32px 0 0;
  color: rgba(243, 241, 236, 0.86);
  font-size: 18px;
  line-height: 1.7;
}

/* Notes for AI, added with the local page editor. They never show on the live site. */
.draft-note { display: none; }

/* Lines up with the text column above. */
.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 40px 0 0 calc((100% - 32px) / 4 + 32px);
}

.project__link {
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.project__link:hover {
  border-color: hsl(var(--hue) 90% 65% / 0.8);
  background: hsl(var(--hue) 90% 50% / 0.12);
}

/* ---------- Projects and Contact pages ---------- */

/* The header scrolls away with these pages rather than sitting over their text. */
.page .site-header { position: absolute; }

.page__main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 168px var(--gutter) 120px;
}

.page__note { margin-top: 40px; color: var(--muted); }

/* The title, with the Projects page's sort buttons beside it. */
.page__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
}

/* List or timeline, then what to sort by and which way round. */
.page__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.project-view {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.project-view[hidden] { display: none; }

.project-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.project-sort__by {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.project-sort[hidden],
.project-sort [hidden] { display: none; }

.project-sort button,
.project-view button {
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: rgba(243, 241, 236, 0.7);
  font: 500 14px var(--sans);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.project-sort button:hover,
.project-sort button:focus-visible,
.project-view button:hover,
.project-view button:focus-visible { color: var(--text); }

.project-sort__by button[aria-pressed="true"],
.project-view button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.1); color: var(--text); }

.project-sort .project-sort__dir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--line);
}

.project-sort .project-sort__dir:hover { border-color: rgba(255, 255, 255, 0.3); }

/* On the timeline by date it's always oldest first, so the button turns into a plain label. */
.project-sort .project-sort__dir:disabled {
  border-color: transparent;
  color: rgba(243, 241, 236, 0.7);
  cursor: default;
}

.project-sort__dir svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s;
}

/* The arrow is drawn pointing down; projects.js turns it up where that reads better. */
.project-sort__dir[data-arrow="up"] svg { transform: rotate(180deg); }

/* Projects page: every orb on the home page as a row, newest first. projects.js builds the list. */
.project-list {
  margin: 56px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.project-list li {
  border-bottom: 1px solid var(--line);
  animation: project-list-in 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.project-list a {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 32px;
  padding: 28px 16px;
  color: var(--text);
  text-decoration: none;
}

/* A wash of the project's colour fades in behind the row on hover. */
.project-list a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, hsl(var(--hue) 70% 45% / 0.18), transparent 75%);
  opacity: 0;
  transition: opacity 0.3s;
}

.project-list a:hover::before,
.project-list a:focus-visible::before { opacity: 1; }

/* A small version of the project's orb. */
.project-list__orb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle,
    hsl(var(--hue) 100% 90%) 0%,
    hsl(var(--hue) 100% 65% / 0.5) 30%,
    hsl(var(--hue) 90% 55% / 0.25) 64%,
    hsl(var(--hue) 100% 78% / 0.95) 100%);
  box-shadow:
    0 0 22px hsl(var(--hue) 100% 60% / 0.5),
    inset 0 0 10px hsl(var(--hue) 100% 72% / 0.6);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s;
}

.project-list__orb::after {
  content: "";
  position: absolute;
  inset: 8% 34% 58% 16%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.55), transparent 70%);
}

.project-list a:hover .project-list__orb,
.project-list a:focus-visible .project-list__orb {
  transform: scale(1.12);
  box-shadow:
    0 0 34px hsl(var(--hue) 100% 62% / 0.75),
    inset 0 0 12px hsl(var(--hue) 100% 75% / 0.7);
}

.project-list__text {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.project-list__name {
  font-family: var(--serif);
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1.05;
}

.project-list__desc {
  color: rgba(243, 241, 236, 0.72);
  font-size: 16px;
  line-height: 1.5;
}

.project-list__date {
  position: relative;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-list__date::after {
  content: "→";
  display: inline-block;
  margin-left: 14px;
  color: var(--text);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.3s, transform 0.3s;
}

.project-list a:hover .project-list__date::after,
.project-list a:focus-visible .project-list__date::after {
  opacity: 1;
  transform: none;
}

/* Projects page timeline: a bar for each project from when it started to when it ended, across
   the months, with a line at today. projects.js draws it. */
.project-timeline { margin: 56px 0 0; }
.project-timeline[hidden] { display: none; }

.project-timeline__head,
.project-timeline a {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 6px 28px;
}

.project-timeline__head { padding: 0 16px 10px; }
.project-timeline__axis { position: relative; height: 38px; } /* Now on the top line, the months under it */

.project-timeline__month {
  position: absolute;
  bottom: 0;
  padding-left: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-timeline__month.is-year { color: var(--text); }

.project-timeline__now {
  position: absolute;
  top: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.project-timeline ol {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.project-timeline li {
  border-bottom: 1px solid var(--line);
  animation: project-list-in 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.project-timeline a {
  position: relative;
  padding: 18px 16px;
  color: var(--text);
  text-decoration: none;
}

/* The same wash of the project's colour as the list, on hover. */
.project-timeline a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, hsl(var(--hue) 70% 45% / 0.18), transparent 75%);
  opacity: 0;
  transition: opacity 0.3s;
}

.project-timeline a:hover::before,
.project-timeline a:focus-visible::before { opacity: 1; }

.project-timeline__label {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.project-timeline__name {
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.1;
}

.project-timeline__dates {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* One hairline per month behind the bars. */
.project-timeline__track {
  position: relative;
  align-self: stretch;
  min-height: 28px;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--months, 12)) 100%;
}

.project-timeline__bar {
  position: absolute;
  top: 50%;
  height: 10px;
  margin-top: -5px;
  border-radius: 999px;
  background: hsl(var(--hue) 90% 62%);
  box-shadow: 0 0 16px hsl(var(--hue) 100% 60% / 0.45);
  transition: box-shadow 0.3s;
}

/* Still going: the bar fades out at today. */
.project-timeline__bar.is-current {
  background: linear-gradient(90deg, hsl(var(--hue) 90% 62%) 65%, hsl(var(--hue) 90% 62% / 0.15));
}

.project-timeline a:hover .project-timeline__bar,
.project-timeline a:focus-visible .project-timeline__bar { box-shadow: 0 0 26px hsl(var(--hue) 100% 62% / 0.8); }

.project-timeline__line {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 138, 76, 0.55);
}

@keyframes project-list-in {
  from { opacity: 0; transform: translateY(12px); }
}

/* Contact page */
.contact-list {
  margin: 56px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.contact-list__label {
  flex: 0 0 120px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* An underline draws in under the address on hover. */
.contact-list__link {
  min-width: 0;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  font-family: var(--serif);
  font-size: clamp(28px, 4.2vw, 52px);
  line-height: 1.15;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-size 0.35s;
}

.contact-list__link:hover,
.contact-list__link:focus-visible { background-size: 100% 1px; }

.contact-list__copy {
  margin-left: auto;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: 500 14px var(--sans);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.contact-list__copy:hover,
.contact-list__copy:focus-visible {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

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

@media (max-width: 900px) {
  .orb { --size: calc(min(84px, 12vh) * var(--depth, 1)); gap: 12px; }
  .orb__name { font-size: 20px; }
  .project { padding-top: 104px; }
  .project__back { top: 14px; }
  .project__section { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .project__links { margin-left: 0; }
  .page__main { padding-top: 128px; }
  .project-list a { grid-template-columns: auto minmax(0, 1fr); gap: 8px 18px; padding: 22px 8px; }
  .project-list__orb { width: 36px; height: 36px; }
  .project-list__date { grid-column: 2; }
  .contact-list__label { flex-basis: 100%; }
  .project-timeline__head,
  .project-timeline a { grid-template-columns: minmax(0, 1fr); }
  .project-timeline__head > span:first-child { display: none; }
  .project-timeline a { padding: 16px 8px; }
  .project-timeline__month.is-minor,
  .project-timeline__month.is-crowded,
  .project-timeline.is-long .project-timeline__month.is-quarter { display: none; }
}

@media (max-width: 600px) {
  .brand,
  .site-nav__link { font-size: 22px; }
  .site-nav { gap: 20px; }
  .heat__scroll { overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .orb__core::before,
  .project-list li,
  .project-timeline li { animation: none; }
}
