/* ==============================================
   Five Fifths — Transit Diagram
   One route from decision to production. Colour is law:
   it lives only on lines and dots, one colour per practice.
   ============================================== */

@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --ink:      #111111;
  --ink-2:    #3a3a3a;
  --paper:    #ffffff;
  --rule:     #111111;
  --line-a:   #d0291f; /* Architecture */
  --line-e:   #0039a6; /* Engineering */
  --line-l:   #007a35; /* Technical leadership */
  --font: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --gutter: clamp(20px, 4.5vw, 64px);
  --wrap: 1280px;
  --bar: 64px;
  --map: 212px;    /* left column the route lives in */
  --rail-x: 160px; /* rail centre, from the content edge; = the Decision station */
  --line: 10px;
  --trunk: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==============================================
   Base
   ============================================== */

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--bar);
}

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

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  text-wrap: balance;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--ink);
  text-decoration-thickness: 3px;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

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

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ==============================================
   Sign bar (navigation)
   ============================================== */

.signbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: var(--ink);
  color: var(--paper);
}

.signbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: var(--bar);
}

.wordmark {
  color: var(--paper);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark:hover {
  color: var(--paper);
  text-decoration: none;
}

.wordmark-slash {
  margin: 0 0.04em;
}

.signbar :focus-visible {
  outline-color: var(--paper);
}

.signbar-toggle {
  display: none;
  background: none;
  border: 2px solid var(--paper);
  color: var(--paper);
  font: 600 0.95rem/1 var(--font);
  padding: 0.55rem 0.9rem;
}

.signbar-toggle:focus:not(:focus-visible) {
  outline: none;
}

.stops {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* the route line the stops sit on */
.stops::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: var(--paper);
}

.stop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem 0.5rem 0;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.stop:hover {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.stop-dot {
  width: 14px;
  height: 14px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  flex: none;
}

.stop-terminus .stop-dot {
  width: 20px;
  height: 20px;
  border-width: 5px;
}

.stop[aria-current] .stop-dot {
  background: var(--paper);
}

@media (min-width: 900px) {
  .signbar-collapse.collapse {
    display: block;
  }
}

@media (max-width: 899px) {
  .signbar-toggle {
    display: block;
  }

  .signbar-collapse {
    flex-basis: 100%;
  }

  .stops {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.5rem 0 1.25rem;
  }

  .stops::before {
    left: 7px;
    right: auto;
    top: 1.75rem;
    bottom: 2.75rem;
    width: 3px;
    height: auto;
    margin: 0;
  }

  .stop {
    padding: 0.7rem 0;
    font-size: 1.1rem;
    background: transparent;
  }

  .stop-dot {
    position: relative;
    margin-left: 1px;
  }

  .stop-terminus .stop-dot {
    margin-left: -2px;
  }
}

/* ==============================================
   Hero: the route
   ============================================== */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: calc(var(--bar) + clamp(3rem, 8vh, 6rem));
}

.hero-copy,
.hero-legend {
  padding-left: calc(var(--gutter) + var(--map));
}

.hero-legend {
  margin-top: auto;
}

.hero-title {
  font-size: clamp(2.75rem, 6.2vw, 5.25rem);
  font-weight: 760;
  font-stretch: 92%;
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin-bottom: 1.75rem;
}

/* one sentence per line, like a three-line station sign */
.hero-title span {
  display: block;
}

.hero-sub {
  font-size: clamp(1.125rem, 1.6vw, 1.35rem);
  color: var(--ink-2);
  max-width: 36em;
  margin: 0;
}

.route {
  display: grid;
  /* % not vw: vw includes a classic scrollbar, .wrap does not, and the
     Decision drop must land exactly on the page rail */
  grid-template-columns:
    max(var(--gutter), calc((100% - var(--wrap)) / 2))
    var(--rail-x) 1fr auto
    max(var(--gutter), calc((100% - var(--wrap)) / 2));
  align-items: start;
  margin: clamp(2.5rem, 7vh, 4.5rem) 0 clamp(2rem, 5vh, 3rem);
}

.route-lead {
  position: relative;
  height: 180px;
}

.ln {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--line);
  margin-top: calc(var(--line) / -2);
}

.ln-a { top: 30px; background: var(--line-a); }
.ln-e { top: 90px; background: var(--line-e); }
.ln-l { top: 150px; background: var(--line-l); }

.route-merge {
  display: block;
  fill: none;
  stroke-width: var(--line);
  stroke-linejoin: round;
}

.route-merge-h {
  width: var(--rail-x);
  height: 180px;
}

.route-merge-v {
  display: none;
}

.stroke-a { stroke: var(--line-a); }
.stroke-e { stroke: var(--line-e); }
.stroke-l { stroke: var(--line-l); }

.trunk {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
  height: 180px;
  padding-right: clamp(5rem, 10vw, 9rem);
}

.trunk::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 90px;
  height: var(--trunk);
  margin-top: calc(var(--trunk) / -2);
  background: var(--ink);
  transform-origin: left center;
}

.station {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 0;
  padding-top: 72px;
}

.station:first-child {
  align-items: flex-start;
}

.station-dot {
  width: 36px;
  height: 36px;
  border: 6px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  flex: none;
}

.station:first-child .station-dot {
  margin-left: -18px;
}

.station-name {
  margin-top: 0.6rem;
  font-weight: 650;
  font-size: 1rem;
  white-space: nowrap;
}

.station:first-child .station-name {
  margin-left: 22px;
}

.station-dot {
  position: relative;
  z-index: 1;
}

/* the route drops from Decision into the page rail */
.station:first-child::after {
  content: "";
  position: absolute;
  left: calc(var(--trunk) / -2);
  top: 90px;
  width: var(--trunk);
  height: 200vh;
  background: var(--ink);
}

.terminus {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding-top: 62px;
}

.terminus-ring {
  width: 56px;
  height: 56px;
  margin-left: -4px;
  border: 12px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  flex: none;
}

.terminus-sign {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: -2px;
}

.terminus-link {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 1.2rem;
  padding: 0.75rem 1.1rem;
  text-decoration: none;
  white-space: nowrap;
}

.terminus-link:hover {
  color: var(--paper);
  text-decoration: underline;
}

/* The one authored motion: the trunk draws itself, stations land as it passes. */
@media (prefers-reduced-motion: no-preference) {
  .route.will-draw .trunk::before { transform: scaleX(0); }
  .route.will-draw .station-dot,
  .route.will-draw .terminus-ring { transform: scale(0.4); opacity: 0; }

  .route.is-drawn .trunk::before {
    transform: scaleX(1);
    transition: transform 1.4s var(--ease-out);
  }

  .route.is-drawn .station-dot,
  .route.is-drawn .terminus-ring {
    transform: scale(1);
    opacity: 1;
    transition: transform 0.5s var(--ease-out), opacity 0.3s linear;
  }

  .route.is-drawn .station:nth-child(1) .station-dot { transition-delay: 0.05s; }
  .route.is-drawn .station:nth-child(2) .station-dot { transition-delay: 0.3s; }
  .route.is-drawn .station:nth-child(3) .station-dot { transition-delay: 0.55s; }
  .route.is-drawn .station:nth-child(4) .station-dot { transition-delay: 0.8s; }
  .route.is-drawn .terminus-ring { transition-delay: 1.05s; }
}

/* Legend */
.legend {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  border-top: 3px solid var(--rule);
  margin: 0 0 clamp(1.5rem, 4vh, 2.5rem);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 2rem 0 0;
}

.legend dt,
.legend dd {
  margin: 0;
  font-weight: 400;
}

.legend dd {
  font-size: 1rem;
  font-weight: 600;
}

.legend-trunk {
  display: block;
  width: 44px;
  height: var(--trunk);
  background: var(--ink);
}

.bullet {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--paper);
  font-weight: 750;
  font-size: 1rem;
  line-height: 1;
}

.bullet-a { background: var(--line-a); }
.bullet-e { background: var(--line-e); }
.bullet-l { background: var(--line-l); }

/* ==============================================
   Sections ride a vertical trunk
   ============================================== */

.section {
  padding: clamp(4rem, 9vw, 7rem) 0;
}

.railed {
  position: relative;
  padding-left: calc(var(--gutter) + var(--map));
}

/* each section draws its own segment; together they continue the hero's line */
.railed::before {
  content: "";
  position: absolute;
  left: calc(var(--gutter) + var(--rail-x) - var(--trunk) / 2);
  top: calc(-1 * clamp(4rem, 9vw, 7rem));
  bottom: calc(-1 * clamp(4rem, 9vw, 7rem));
  width: var(--trunk);
  background: var(--ink);
  transform-origin: center top;
}

@media (prefers-reduced-motion: no-preference) {
  .railed.will-draw::before { transform: scaleY(0); }
  .railed.is-drawn::before {
    transform: scaleY(1);
    transition: transform 0.9s var(--ease-out);
  }
}

.section-terminus .railed::before {
  bottom: auto;
  height: calc(clamp(4rem, 9vw, 7rem) + 0.6rem);
}

/* 404: no hero above, so clear the fixed sign bar and fill the screen */
.section-lost {
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(var(--bar) + clamp(4rem, 9vw, 7rem));
}

.sec-head {
  position: relative;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.rail-stop {
  position: absolute;
  left: calc(var(--rail-x) - var(--map) - 20px);
  top: 0.15rem;
  width: 40px;
  height: 40px;
  z-index: 1;
  border: 7px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  transition: background-color 0.3s linear;
}

.rail-stop.is-current {
  background: var(--ink);
}

.rail-terminus {
  left: calc(var(--rail-x) - var(--map) - 28px);
  width: 56px;
  height: 56px;
  top: -0.35rem;
  border-width: 12px;
}

.section-title {
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  font-weight: 740;
  font-stretch: 94%;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  max-width: 20ch;
}

.section-lead {
  font-size: 1.2rem;
  color: var(--ink-2);
  max-width: 34em;
  margin: 0;
}

/* Services: one line per practice */
.practices {
  margin: 0;
  padding: 0;
  list-style: none;
}

.practice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: 2.5rem;
  padding-bottom: 2.75rem;
}

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

.practice-line {
  grid-column: 1 / -1;
  position: relative;
  height: 44px;
  margin-bottom: 1.1rem;
}

.practice-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--line);
  margin-top: calc(var(--line) / -2);
}

.practice-a .practice-line::before { background: var(--line-a); }
.practice-e .practice-line::before { background: var(--line-e); }
.practice-l .practice-line::before { background: var(--line-l); }

.practice-line .bullet {
  position: relative;
  width: 44px;
  height: 44px;
  font-size: 1.25rem;
  box-shadow: 0 0 0 5px var(--paper);
}

.practice h3 {
  font-size: 1.5rem;
  margin: 0;
}

.practice p {
  margin: 0;
  color: var(--ink-2);
  max-width: 38em;
}

/* Experience: timetable */
.timetable {
  margin: 0;
  border-top: 3px solid var(--rule);
}

.timetable-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: 2.5rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}

.timetable dt {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-top: 0.3rem;
}

.timetable dd {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Past work: interchange stops on one line */
.interchange {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.interchange::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 15px;
  height: var(--line);
  margin-top: calc(var(--line) / -2);
  background: var(--ink);
}

.stopover {
  position: relative;
}

.stopover-dot {
  display: block;
  width: 30px;
  height: 30px;
  border: 6px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  margin-bottom: 1.25rem;
}

.stopover h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.stopover p {
  font-size: 1rem;
  color: var(--ink-2);
  margin: 0;
}

/* Contact: the terminus */
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
}

.terminus-link-lg {
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  padding: 1rem 1.4rem;
}

.copy-email {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  font: 700 1rem/1 var(--font);
  padding: 0.95rem 1.2rem;
  cursor: pointer;
}

.copy-email:hover {
  background: var(--ink);
  color: var(--paper);
}

.copy-status {
  font-size: 1rem;
  font-weight: 600;
}

/* ==============================================
   Footer
   ============================================== */

.signfoot {
  background: var(--ink);
  color: var(--paper);
  padding: 1.5rem 0;
}

.signfoot-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.signfoot p {
  margin: 0;
  font-size: 0.95rem;
}

.signfoot a {
  color: var(--paper);
}

.signfoot :focus-visible {
  outline-color: var(--paper);
}

/* ==============================================
   Narrow screens: the route turns vertical
   ============================================== */

@media (max-width: 899px) {
  .practice,
  .timetable-row {
    grid-template-columns: 1fr;
    row-gap: 0.5rem;
  }

  /* stopovers stay stations on a line: vertical, dot beside the sign */
  .interchange {
    grid-template-columns: 1fr;
    row-gap: 2rem;
  }

  .interchange::before {
    left: 15px;
    right: auto;
    top: 15px;
    bottom: 15px;
    width: var(--line);
    height: auto;
    margin: 0 0 0 calc(var(--line) / -2);
  }

  .stopover {
    display: grid;
    grid-template-columns: 30px 1fr;
    column-gap: 1.1rem;
  }

  .stopover-dot {
    position: relative;
    grid-row: 1 / span 2;
    margin: 0;
  }

  .legend {
    grid-template-columns: repeat(2, auto);
  }
}

@media (max-width: 767px) {
  :root {
    --map: 64px;
    --rail-x: 32px;
  }

  .hero {
    padding-top: calc(var(--bar) + 2rem);
  }

  .hero-copy {
    padding-left: var(--gutter);
  }

  .station:first-child::after {
    display: none;
  }

  /* on narrow screens the line runs on through the terminus into the page rail */
  .terminus-ring {
    position: relative;
  }

  .terminus-ring::after {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    width: var(--trunk);
    height: 200vh;
    margin-left: calc(var(--trunk) / -2);
    background: var(--ink);
  }

  .hero-title {
    margin-bottom: 1.25rem;
  }

  .route {
    position: relative;
    grid-template-columns: 64px 1fr;
    padding: 0 var(--gutter);
    margin-top: 1.75rem;
  }

  .route-merge-h {
    display: none;
  }

  /* the colour lines enter from the left edge before turning down */
  .route-lead {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--gutter);
    height: 72px;
  }

  .ln-a { top: 10px; }
  .ln-e { top: 28px; }
  .ln-l { top: 46px; }

  .route-merge-v {
    display: block;
    grid-column: 1;
    width: 64px;
    height: 72px;
  }

  .trunk {
    grid-column: 1 / -1;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.9rem;
    height: auto;
    padding: 0.6rem 0 1rem;
  }

  .trunk::before {
    left: 32px;
    right: auto;
    top: 0;
    bottom: 0;
    width: var(--trunk);
    height: auto;
    margin: 0 0 0 calc(var(--trunk) / -2);
    transform-origin: center top;
  }

  .station,
  .station:first-child {
    flex-direction: row;
    align-items: center;
    width: auto;
    padding: 0 0 0 14px;
    gap: 1rem;
  }

  .station-dot,
  .station:first-child .station-dot {
    margin-left: 0;
  }

  .station-name,
  .station:first-child .station-name {
    margin: 0;
    font-size: 1.05rem;
  }

  .terminus {
    grid-column: 1 / -1;
    padding: 0 0 0 4px;
    align-items: center;
    gap: 1rem;
  }

  .terminus-ring {
    margin: 0;
  }

  .terminus-link {
    font-size: 1.05rem;
    white-space: normal;
  }

  .legend {
    grid-template-columns: 1fr;
  }

  .legend-item {
    padding: 0.75rem 0 0;
  }

  .rail-stop {
    left: calc(var(--rail-x) - var(--map) - 18px);
    width: 36px;
    height: 36px;
    border-width: 6px;
  }

  .rail-terminus {
    left: calc(var(--rail-x) - var(--map) - 24px);
    width: 48px;
    height: 48px;
    border-width: 10px;
  }

  @media (prefers-reduced-motion: no-preference) {
    .route.will-draw .trunk::before { transform: scaleY(0); }
    .route.is-drawn .trunk::before { transform: scaleY(1); }
  }
}

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