/* Process page: an overview of the five stages on one line, then a chapter per stage
   (Discovery and visioning, Concept development, Technical documentation, Construction phase,
   Finishing and handover), as in section 4 of the SP_Web_1 sheet.
   Loaded after css/site.css, which holds the banner, section heads, reveals, call to action and footer. */

:root {
  --sage: #b7c09a;
  --plaster-line: #dcd6ce;
}

/* ---------- Overview: the five stages on a timeline ----------
   One line runs through a node per stage; the stage names alternate above and below it, each joined
   to its node by a short tick. When the timeline comes into view an olive line draws across it, and
   each node lights up and draws its icon as the line reaches it. On small screens it turns upright. */
.pc-overview { padding: clamp(96px, 11vw, 168px) 0 clamp(104px, 12vw, 180px); }

.pc-tl {
  --node: clamp(60px, 5.4vw, 80px);
  --arm: clamp(118px, 10vw, 150px);      /* height above and below the line, for the labels */
  --draw: 2.4s;                          /* how long the olive line takes to cross */
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: clamp(24px, 4vw, 64px) 0 0;
  padding: 0;
  list-style: none;
}
.js .pc-tl.reveal { opacity: 1; transform: none; }   /* the timeline animates itself; no fade for the whole */

/* The line, from the first node's centre to the last, and the olive line that draws over it */
.pc-tl::before,
.pc-tl::after {
  content: "";
  position: absolute;
  top: calc(var(--arm) + var(--node) / 2);
  left: 10%;
  right: 10%;
  height: 1px;
  background: var(--line);
}
.pc-tl::after {
  height: 1.5px;
  margin-top: -.25px;
  background: var(--olive);
  transform-origin: left;
}
.js .pc-tl::after { transform: scaleX(0); transition: transform var(--draw) linear .2s; }
.js .pc-tl.is-in::after { transform: none; }

.pc-tl-item {
  /* When the drawing line reaches this node: the line runs from the first node to the last, so node i is i/4 of the way along */
  --at: calc(.2s + var(--draw) * var(--i) / 4);
}
.pc-tl-link {
  display: grid;
  grid-template-rows: var(--arm) var(--node) var(--arm);
  justify-items: center;
  color: inherit;
  text-decoration: none;
}
.pc-tl-link:focus-visible { outline-offset: 6px; }

/* Labels: above the line for 1, 3 and 5, below it for 2 and 4 */
.pc-tl-label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  padding-inline: 10px;
  text-align: center;
}
.pc-tl-item:nth-child(odd) .pc-tl-label { grid-row: 1; align-self: end; padding-bottom: 34px; }
.pc-tl-item:nth-child(even) .pc-tl-label { grid-row: 3; align-self: start; padding-top: 34px; }
.pc-tl-label::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  height: 22px;
  background: var(--line);
  transition: background-color .5s ease var(--at);
}
.pc-tl-item:nth-child(odd) .pc-tl-label::after { bottom: 0; }
.pc-tl-item:nth-child(even) .pc-tl-label::after { top: 0; }
.pc-tl-num {
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: .12em;
  color: var(--olive);
  font-variant-numeric: tabular-nums;
}
.pc-tl-title {
  margin-top: 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.25rem, .7vw + 1rem, 1.75rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
  transition: color .4s ease;
}

/* Nodes: a ring holding the stage's icon */
.pc-tl-node {
  grid-row: 2;
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--node);
  height: var(--node);
  border: 1px solid #d3cbc0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--olive);
  transition: border-color .5s ease, background-color .4s ease, color .4s ease, box-shadow .6s var(--ease-out), transform .5s var(--ease-out);
}
.pc-tl-icon {
  width: 50%;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

/* Before the line arrives: labels and icons wait; as it passes, each stage lights up in turn */
.js .pc-tl-label { opacity: 0; transform: translateY(10px); transition: opacity .8s ease var(--at), transform 1s var(--ease-out) var(--at); }
.js .pc-tl-item:nth-child(even) .pc-tl-label { transform: translateY(-10px); }
.js .pc-tl-icon > * { stroke-dasharray: 1 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s var(--ease-out) var(--at); }
.js .pc-tl.is-in .pc-tl-label { opacity: 1; transform: none; }
.js .pc-tl.is-in .pc-tl-icon > * { stroke-dashoffset: 0; }
.pc-tl.is-in .pc-tl-node,
html:not(.js) .pc-tl-node {
  border-color: var(--olive);
  box-shadow: 0 0 0 6px var(--paper), 0 0 0 7px rgba(76, 84, 56, .18);
  transition-delay: var(--at);
}
.pc-tl.is-in .pc-tl-label::after { background: var(--olive); }

@media (hover: hover) {
  .pc-tl .pc-tl-link:hover .pc-tl-node { background: var(--olive); color: #f1efe6; transform: scale(1.06); transition-delay: 0s; }
  .pc-tl-link:hover .pc-tl-title { color: var(--olive); }
}
.pc-tl-link:focus-visible .pc-tl-node { background: var(--olive); color: #f1efe6; }

/* ---------- Stages ----------
   A large photograph carrying the stage number, beside the title, a short intro and the steps in a
   two-column grid. The photograph swaps sides from one stage to the next. */
.pc-stage--plaster { background: var(--plaster); }
.pc-stage--plaster .ruled::after { background: var(--plaster-line); }

.pc-stage-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 32px;
  row-gap: 48px;
  align-items: center;
}
.pc-stage-media { grid-column: 1 / 6; grid-row: 1; }
.pc-stage-body { grid-column: 7 / 13; grid-row: 1; }
.pc-stage-grid--flip .pc-stage-media { grid-column: 8 / 13; }
.pc-stage-grid--flip .pc-stage-body { grid-column: 1 / 7; }

/* The photograph, tall, with the stage number set large over its foot */
.pc-stage-media {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #e6e2dc;
}
.pc-stage-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pc-stage-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(28, 26, 22, 0) 55%, rgba(28, 26, 22, .55) 100%);
  pointer-events: none;
}
.pc-stage-num {
  position: absolute;
  z-index: 1;
  left: clamp(18px, 2.2vw, 30px);
  bottom: clamp(10px, 1.4vw, 18px);
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(5.5rem, 7vw + 1.5rem, 10rem);
  line-height: .8;
  letter-spacing: -0.04em;
  color: #fff;
  font-variant-numeric: lining-nums;
  pointer-events: none;
}

.pc-stage-intro {
  margin: clamp(16px, 1.8vw, 22px) 0 0;
  max-width: 32rem;
  font-family: var(--serif);
  font-size: clamp(1.125rem, .5vw + .9rem, 1.3125rem);
  line-height: 1.5;
  color: var(--ink-soft);
}

/* Steps: a two-by-two grid, each under a short rule */
.pc-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(26px, 3vw, 40px) clamp(24px, 3vw, 40px);
  margin: clamp(36px, 4vw, 52px) 0 0;
  padding: 0;
  list-style: none;
}
.pc-step { padding-top: 18px; }
.pc-step.ruled::after { top: 0; }
.pc-step-num {
  display: block;
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: .08em;
  color: var(--olive);
  font-variant-numeric: tabular-nums;
}
.pc-step-title {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.25rem, .6vw + 1rem, 1.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.pc-step-text {
  margin: 8px 0 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* The construction stage sits on the dark band */
.section-dark .pc-stage-intro { color: rgba(236, 233, 227, .84); }
.section-dark .pc-stage-media { background: #2a2c26; }
.section-dark .pc-stage-media img { filter: grayscale(.25) sepia(.1) brightness(.9); }
.section-dark .pc-step-num { color: var(--sage); }
.section-dark .pc-step-text { color: var(--night-soft); }

/* The call to action sits right after the dark band */
.pc-cta { padding-top: clamp(72px, 8vw, 120px); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .pc-stage-grid .pc-stage-media,
  .pc-stage-grid .pc-stage-body { grid-column: 1 / -1; grid-row: auto; }
  .pc-stage-media { aspect-ratio: 16 / 10; }
}

/* Small screens: the timeline turns upright, the line on the left and every label beside its node */
@media (max-width: 760px) {
  .pc-tl { --node: 56px; grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .pc-tl::before,
  .pc-tl::after { top: calc(var(--node) / 2); bottom: calc(var(--node) / 2); left: calc(var(--node) / 2); right: auto; width: 1px; height: auto; }
  .pc-tl::after { width: 1.5px; margin: 0 0 0 -.25px; transform-origin: top; }
  .js .pc-tl::after { transform: scaleY(0); }
  .pc-tl-link { grid-template-columns: var(--node) minmax(0, 1fr); grid-template-rows: auto; column-gap: 20px; justify-items: start; align-items: center; }
  .pc-tl-node { grid-row: 1; grid-column: 1; }
  .pc-tl-item:nth-child(n) .pc-tl-label { grid-row: 1; grid-column: 2; align-self: center; align-items: flex-start; max-width: none; padding: 0; text-align: left; }
  .pc-tl-label::after { display: none; }
  .js .pc-tl-item:nth-child(n) .pc-tl-label { transform: translateX(10px); }
  .js .pc-tl.is-in .pc-tl-item:nth-child(n) .pc-tl-label { transform: none; }
  .pc-tl-title { margin-top: 6px; }
}

@media (max-width: 640px) {
  .pc-steps { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .js .pc-tl::after { transform: none; transition: none; }
  .js .pc-tl-label { opacity: 1; transform: none; transition: none; }
  .js .pc-tl-icon > * { stroke-dashoffset: 0; transition: none; }
  .pc-tl-node { transition: none; }
}
