/* ==========================================================================
   How we work: the four-step chain (a port of BH Studios' three principles)
   The titles stay put in a sticky column while the drawings scroll by. The
   drawing at mid-screen is .is-on (site.js): its title lights up, the others
   dim, the line between two numbers fills (--fill) with the scroll. Each
   drawing plays once and holds its last frame; Replay starts it over.
   Without the script the column still sticks and every drawing plays once;
   with reduced motion every drawing shows its finished state. The drawings
   are ports of 960 x 640 design artboards and one 1120 x 600 (tools/method_art.py);
   on phones each one scrolls sideways at a readable size.
   ========================================================================== */

.method {
  --m-top: calc(var(--header-h) + 1.5rem);
  display: grid;
  gap: clamp(1.5rem, 0.75rem + 3vw, 4rem);
}

.method__side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.75rem;
}

.method__titles {
  --m-n: 2.75rem;
  --m-gap: clamp(1.4rem, 0.9rem + 2vh, 2.4rem);
  display: grid;
  gap: var(--m-gap);
}

.method__t {
  position: relative;
  display: grid;
  grid-template-columns: var(--m-n) minmax(0, 1fr);
  gap: 1.1rem;
  transition: opacity 0.35s var(--ease-out);
}

/* The line from each number to the next, and its fill as the page scrolls. */
.method__t:not(:last-child)::before,
.method__t:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(var(--m-n) / 2 - 1px);
  top: var(--m-n);
  width: 2px;
  height: calc(100% - var(--m-n) + var(--m-gap));
}

.method__t:not(:last-child)::before {
  background: repeating-linear-gradient(to bottom, var(--line-strong) 0 6px, transparent 6px 11px);
}

.method__t:not(:last-child)::after {
  background: var(--gold-line);
  transform: scaleY(var(--fill, 0));
  transform-origin: 50% 0;
  transition: transform 0.25s linear;
}

.method__num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--m-n);
  height: var(--m-n);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  transition: background-color var(--dur) var(--ease-out), color var(--dur), border-color var(--dur), box-shadow var(--dur);
}

.method__tx {
  padding-top: 0.45rem;
}

.method__t h3 {
  font-family: var(--font-display);
  font-size: calc(var(--step-2) * var(--display-scale));
  font-weight: var(--display-weight-strong);
  letter-spacing: var(--display-tracking);
  line-height: 1.15;
}

.method__t h3 a {
  text-decoration: none;
  background: linear-gradient(var(--gold-line), var(--gold-line)) 0 100% / 0 1px no-repeat;
  transition: background-size 0.5s var(--ease-out);
}

.method__t p {
  margin-top: 0.5rem;
  max-width: 26em;
  font-size: 0.9375rem;
  color: var(--fg-muted);
}

.method.m-on .method__t:not(.is-on) {
  opacity: 0.4;
}

.method__t.is-done .method__num {
  border-color: var(--gold-line);
}

.method__t.is-on .method__num {
  background: var(--gold-line);
  border-color: var(--gold-line);
  color: var(--yr-ink-deep);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold-line) 18%, transparent);
}

.method__t.is-on h3 a {
  background-size: 100% 1px;
}

.method__replay {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 1.1rem 0.4rem 0.4rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease-out);
}

.method__replay:hover {
  border-color: var(--gold-line);
}

.method__replay-ic {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--gold-line);
  color: var(--yr-ink-deep);
}

.method__replay svg {
  width: 0.85rem;
  height: 0.85rem;
  margin-left: 0.1rem;
  fill: currentColor;
}

.method__replay[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .method__replay { display: none; }
}

.method__art {
  display: grid;
  /* The column never grows to a drawing's min-width: on phones the drawing scrolls instead. */
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: clamp(2.5rem, 1.5rem + 4vw, 5rem);
}

.method__art > li {
  scroll-margin-top: var(--m-top);
}

/* Each drawing brings its own dark panel (tools/method_art.py): the figure adds
   no second frame, and never shows a drawing above the design's 960px size. */
.method__art > li > figure {
  max-width: 60rem;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  transition: opacity 0.4s var(--ease-out);
}

.method.m-on .method__art > li:not(.is-on) figure {
  opacity: 0.45;
}

.method__cap {
  display: none;
  margin-top: 1rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--fg-muted);
}

.method-art {
  display: block;
  width: 100%;
  height: auto;
  /* The designs set Inter with its default glyphs, not the body's alternates. */
  font-family: var(--font-body);
  font-feature-settings: normal;
  font-variant-numeric: normal;
}

.method__hint {
  display: none;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* Phones: at the column's width a 960px drawing would set its 13px text near 5px.
   It keeps 44rem instead (13px text at 9.5px) and scrolls sideways, edge to edge.
   site.js makes the scroller a named, focusable region while it overflows; the
   hint shows then (and always without JavaScript). */
@media (max-width: 47.99em) {
  .method__frame {
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .method__frame:focus-visible {
    outline-offset: -2px;
  }

  .method-art {
    min-width: 44rem;
  }

  /* The 1120 x 600 before-and-after: wider, so its text keeps the same size. */
  .method-art--wide {
    min-width: 51.25rem;
  }

  html:not(.js) .method__hint,
  .method__frame[tabindex] + .method__hint {
    display: block;
  }
}

@media (min-width: 64em) {
  .method {
    grid-template-columns: minmax(16rem, 4fr) minmax(0, 8fr);
    align-items: start;
  }

  .method__side {
    position: sticky;
    top: var(--m-top);
    min-height: min(calc(100svh - var(--m-top) - 2rem), 40rem);
  }
}

/* Phones and tablets: the column becomes a bar under the site header, numbers in a row,
   the words of the step on screen only. Without the script, the titles sit above the drawings. */
@media (max-width: 63.99em) {
  .method.m-live .method__side {
    position: sticky;
    top: var(--header-h);
    z-index: 5;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin-inline: calc(-1 * var(--gutter));
    padding: 0.7rem var(--gutter);
    background: var(--bg);
    box-shadow: 0 1px 0 var(--line);
  }

  .method.m-live .method__titles { --m-n: 2.1rem; flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 0.4rem; }
  .method.m-live .method__t::before,
  .method.m-live .method__t::after { display: none; }
  .method.m-live .method__t { display: flex; gap: 0.6rem; opacity: 1; }
  .method.m-live .method__t:not(.is-on) .method__tx { display: none; }
  .method.m-live .method__t.is-on { flex: 1; min-width: 0; }
  .method.m-live .method__tx { padding-top: 0.1rem; }
  .method.m-live .method__t h3 { font-size: 1.05rem; }
  .method.m-live .method__t p { display: none; }
  .method.m-live .method__cap { display: block; }
  .method.m-live .method__replay { flex: none; padding: 0.25rem; }
  .method.m-live .method__replay-t { display: none; }
  .method__art > li { scroll-margin-top: calc(var(--header-h) + 7rem); }
}

/* --- Drawing vocabulary (tools/method_kit.py) ----------------------------------
   Utilities named after the designs' values: mt- type size, mw- weight,
   ml- tracking, mf- fill, ms- stroke, msw- stroke width, mk- shape helpers.
   The designs' ochre reads --gold-line; their neutrals, teals and light ochre
   keep their own values. */
.mk-panel { fill: #142d39; stroke: #27454f; }
.mk-line,
.mk-icon { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mk-butt { stroke-linecap: butt; }
.mk-dash-2 { stroke-dasharray: 2 2; }
.mk-dash-3 { stroke-dasharray: 3 3; }
.mk-dash-4 { stroke-dasharray: 4 4; }

.mt-10 { font-size: 10px; }
.mt-11 { font-size: 11px; }
.mt-12 { font-size: 12px; }
.mt-13 { font-size: 13px; }
.mt-14 { font-size: 14px; }
.mt-15 { font-size: 15px; }
.mt-17 { font-size: 17px; }
.mt-22 { font-size: 22px; }
.mt-24 { font-size: 24px; }
.mt-34 { font-size: 34px; }
.mt-serif { font-family: var(--font-display); }
.mw-5 { font-weight: 500; }
.mw-6 { font-weight: 600; }
.mw-7 { font-weight: 700; }
.ml-04 { letter-spacing: 0.04em; }
.ml-08 { letter-spacing: 0.08em; }
.ml-10 { letter-spacing: 0.1em; }
.ml-12 { letter-spacing: 0.12em; }
.ml-14 { letter-spacing: 0.14em; }
.ml-16 { letter-spacing: 0.16em; }

.mf-ink { fill: #ede8dd; }
.mf-mute { fill: #9db1b8; }
.mf-dim { fill: #7f97a0; }
.mf-soft { fill: #b7c6cb; }
.mf-pale { fill: #d9d4c8; }
.mf-dark { fill: #0f232d; }
.mf-card { fill: #10242e; }
.mf-chip { fill: #1f3f4b; }
.mf-rule { fill: #27454f; }
.mf-off { fill: #2c4752; }
.mf-wire { fill: #4a6873; }
.mf-bar { fill: #2c5a66; }
.mf-forum { fill: #183543; }
.mf-model { fill: #1d3138; }
.mf-teal { fill: #5cc3c0; }
.mf-teal-lt { fill: #7fd6d3; }
.mf-teal-06 { fill: #5cc3c0; fill-opacity: 0.06; }
.mf-teal-14 { fill: #5cc3c0; fill-opacity: 0.14; }
.mf-mute-12 { fill: #9db1b8; fill-opacity: 0.12; }
.mf-mute-14 { fill: #9db1b8; fill-opacity: 0.14; }
.mf-white-02 { fill: #fff; fill-opacity: 0.02; }
.mf-white-025 { fill: #fff; fill-opacity: 0.025; }
.mf-white-04 { fill: #fff; fill-opacity: 0.04; }
.mf-gold { fill: var(--gold-line); }
.mf-gold-lt { fill: #f0c064; }
.mf-gold-06 { fill: var(--gold-line); fill-opacity: 0.06; }
.mf-gold-07 { fill: var(--gold-line); fill-opacity: 0.07; }
.mf-gold-08 { fill: var(--gold-line); fill-opacity: 0.08; }
.mf-gold-14 { fill: var(--gold-line); fill-opacity: 0.14; }
.mf-gold-16 { fill: var(--gold-line); fill-opacity: 0.16; }
.mf-gold-30 { fill: var(--gold-line); fill-opacity: 0.3; }

.ms-rule { stroke: #27454f; }
.ms-edge { stroke: #3b5965; }
.ms-wire { stroke: #4a6873; }
.ms-bar { stroke: #3e7a84; }
.ms-dim { stroke: #7f97a0; }
.ms-soft { stroke: #b7c6cb; }
.ms-dark { stroke: #0f232d; }
.ms-teal { stroke: #5cc3c0; }
.ms-teal-55 { stroke: #5cc3c0; stroke-opacity: 0.55; }
.ms-teal-90 { stroke: #5cc3c0; stroke-opacity: 0.9; }
.ms-gold { stroke: var(--gold-line); }
.ms-gold-45 { stroke: var(--gold-line); stroke-opacity: 0.45; }
.ms-gold-60 { stroke: var(--gold-line); stroke-opacity: 0.6; }
.msw-125 { stroke-width: 1.25; }
.msw-15 { stroke-width: 1.5; }
.msw-175 { stroke-width: 1.75; }
.msw-2 { stroke-width: 2; }

/* The ongoing workstream (a foreignObject in the plan drawing): SVG has no gradient
   without an id, so this bar keeps the design's own CSS. */
.mk-open-bar {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid #3e7a84;
  border-right-style: dashed;
  border-radius: 10px;
  background: linear-gradient(to right, #2c5a66 0%, #2c5a66 80%, rgba(44, 90, 102, 0.25) 100%);
}

/* --- Motion -----------------------------------------------------------------------
   Every animation is named ma-* (site.js finds them by that prefix), plays once
   and holds its last frame, which is also the element's resting style: without
   animations (reduced motion, print) each drawing shows its final frame. */
/* pathLength="1": one dash the length of the line, then a longer gap, so nothing
   (not even a round cap) shows before the line starts drawing. */
.ma-draw {
  stroke-dasharray: 1 2;
  stroke-dashoffset: 0;
  animation: ma-draw 0.9s var(--ease-out) both;
}

.ma-pop {
  transform-box: fill-box;
  transform-origin: center;
  animation: ma-pop 0.6s var(--ease-out) both;
}

.ma-grow {
  transform-box: fill-box;
  transform-origin: 0 50%;
  animation: ma-grow 0.9s var(--ease-out) both;
}

.ma-fade { animation: ma-fade 0.6s ease-out both; }
.ma-wipe { animation: ma-wipe 0.9s var(--ease-out) both; }
.ma-wipe-down { animation: ma-wipe-down 0.9s var(--ease-out) both; }
.ma-status { animation: ma-status 0.9s ease-in-out both; }

@keyframes ma-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ma-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes ma-grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes ma-fade { from { opacity: 0; } to { opacity: 1; } }
/* Reveals by clipping keep rounded ends and dashes intact. They hold a clip 2px outside
   the shape (inset() cannot interpolate to none), which looks the same as no clip. */
@keyframes ma-wipe { from { clip-path: inset(-2px 100% -2px -2px); } to { clip-path: inset(-2px); } }
@keyframes ma-wipe-down { from { clip-path: inset(-2px -2px 100% -2px); } to { clip-path: inset(-2px); } }
/* No end keyframe: the fill settles on the element's own colour. */
@keyframes ma-status { 0%, 40% { fill: var(--gold-line); } }

/* Delays in tenths of a second. The last ones start at 2.4s, so a drawing is built within about 3.3s. */
.ma-d0 { animation-delay: 0s; }
.ma-d1 { animation-delay: 0.1s; }
.ma-d2 { animation-delay: 0.2s; }
.ma-d3 { animation-delay: 0.3s; }
.ma-d4 { animation-delay: 0.4s; }
.ma-d5 { animation-delay: 0.5s; }
.ma-d6 { animation-delay: 0.6s; }
.ma-d7 { animation-delay: 0.7s; }
.ma-d8 { animation-delay: 0.8s; }
.ma-d9 { animation-delay: 0.9s; }
.ma-d10 { animation-delay: 1s; }
.ma-d11 { animation-delay: 1.1s; }
.ma-d12 { animation-delay: 1.2s; }
.ma-d13 { animation-delay: 1.3s; }
.ma-d14 { animation-delay: 1.4s; }
.ma-d15 { animation-delay: 1.5s; }
.ma-d16 { animation-delay: 1.6s; }
.ma-d17 { animation-delay: 1.7s; }
.ma-d18 { animation-delay: 1.8s; }
.ma-d19 { animation-delay: 1.9s; }
.ma-d20 { animation-delay: 2s; }
.ma-d21 { animation-delay: 2.1s; }
.ma-d22 { animation-delay: 2.2s; }
.ma-d23 { animation-delay: 2.3s; }
.ma-d24 { animation-delay: 2.4s; }

@media print, (prefers-reduced-motion: reduce) {
  .method-art * { animation: none !important; }
}
