/* THE MILESTONE TIMELINE — the rail behind the button at the foot of NEUStory.
   Dr KC's reference: a rail across the middle, year markers on it, and the
   cards alternating above and below so the eye zig-zags along the years
   instead of reading a list.

   Kept in its own file, like profile.css and reelbox.css, so a timeline
   cannot disturb a section that was already working. */

/* ── the overlay ── */
.mstone {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(0.6rem, 2vw, 2rem);
}
.mstone[hidden] { display: none; }
.mstone__scrim {
  position: absolute; inset: 0;
  background: rgba(4, 10, 22, 0.72);
  backdrop-filter: blur(6px);
}

.mstone__box {
  position: relative;
  width: min(1400px, 100%);
  max-height: min(92vh, 900px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #f7fafe 0%, #ffffff 46%, #f2f7fd 100%);
  color: #0d1b2a;
  border-radius: clamp(16px, 2vw, 26px);
  box-shadow: 0 40px 120px -40px rgba(4, 10, 22, 0.75);
  overflow: hidden;
  animation: mstone-in 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes mstone-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .mstone__box { animation: none; } }

/* ── the head ── */
.mstone__head {
  padding: clamp(16px, 2.4vw, 30px) clamp(18px, 3vw, 42px) clamp(8px, 1.4vw, 16px);
  border-bottom: 1px solid rgba(13, 27, 42, 0.08);
}
.mstone__kicker {
  margin: 0 0 4px;
  color: var(--blue, #0078FF); font-weight: 800;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
}
.mstone__h {
  margin: 0 0 6px;
  font-size: clamp(22px, 3.2vw, 40px); line-height: 1.05; letter-spacing: -0.02em;
}
.mstone__lead {
  margin: 0; max-width: 62ch;
  color: rgba(13, 27, 42, 0.62); line-height: 1.55;
  font-size: clamp(13px, 1.3vw, 16px);
}
.mstone__x {
  position: absolute; top: clamp(10px, 1.6vw, 18px); right: clamp(10px, 1.6vw, 18px);
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(13, 27, 42, 0.12); background: #fff;
  font-size: 24px; line-height: 1; color: #0d1b2a;
  cursor: pointer;
}
.mstone__x:hover { background: #eef4fd; }

/* ── the rail ──
   THREE ROWS: a card above, the rail, a card below. Every item is one column
   of the same grid, so the pegs line up on one straight line however tall the
   cards on either side turn out to be — which is what makes it read as a
   timeline rather than as two rows of cards with a line between them. */
/* A FLEX CONTAINER, so that the rail inside it can be given the height there
   actually is. `height: 100%` on the rail did nothing at all: a percentage
   height needs a definite height to measure against, and `.mstone__box` has a
   max-height and no height — its own height comes from its content, so asking
   the content how tall it should be is circular and the browser correctly
   ignores it. `align-items: stretch` does not have that problem: it hands the
   child the container's used height once layout has worked it out.

   The tell was that a hard pixel height on the rail made the rows collapse to
   171px immediately — the row sizing was never the fault. */
.mstone__scroll {
  flex: 1; min-height: 0;
  display: flex; align-items: stretch;
  overflow-x: auto; overflow-y: hidden;
  padding: clamp(10px, 1.6vw, 22px) clamp(18px, 3vw, 42px);
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}
.mstone__scroll:focus-visible { outline: 3px solid var(--blue, #0078FF); outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) { .mstone__scroll { scroll-behavior: auto; } }

/* THE ROWS ARE minmax(0, 1fr), NOT 1fr, and the difference is the whole
   layout. A plain `1fr` row will not shrink below the tallest thing in it —
   its minimum is min-content — so with a 350px card above and a 350px card
   below, the grid insisted on being 760px tall inside a 600px space, the rail
   was pushed almost a hundred pixels below centre, and the lower cards ran
   out through the foot of the panel. `minmax(0, …)` lets the rows take the
   height there is; the cards below cap themselves to their row and clip
   politely instead of the whole rail sliding. */
.mtl {
  list-style: none; margin: 0; padding: 0;
  flex: none;                            /* keep its full width; the box scrolls */
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(210px, 21vw, 280px);
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);   /* above · rail · below */
  gap: 0 clamp(10px, 1.4vw, 20px);
  align-items: stretch;
  min-width: min-content;
}

/* An item owns all three rows of its column; which row its card sits in is
   what makes it an up or a down. */
.mtl__item {
  display: grid;
  grid-row: 1 / -1;
  grid-template-rows: subgrid;
  position: relative;
  --c: #7aa2ff;                          /* the chapter's colour, set below */
}
/* ── AND `hidden` HAS TO MEAN HIDDEN ──────────────────────────────────────
   `display: grid` above beats the `hidden` attribute, which is only
   `display: none` from the browser's own stylesheet. milestones.js has always
   set `li.hidden = !ok`, so the filter has always been RIGHT — and has never
   once removed a card from the rail. It only reordered them.

   That is what Dr KC was looking at when he picked 2026 and got 2020 cards
   back with "8 of 33" written underneath: eight matched, thirty-three were
   still on the rail. The whole reason the filter exists — "able to
   select/sort/filter by year, date, month", because an audit question is
   "everything in 2025" — has not worked since the day it was built.

   Measured before this line: eleven of thirteen marked hidden, eleven still
   drawn at 276x506.

   The FIFTH time this trap has bitten here. `.pop__go[hidden]`,
   `.pack__card[hidden]`, `.mfilter__on[hidden]` and `.gstage__view[hidden]`
   are the others. Anything on this site that sets `display` and is ever
   hidden by the attribute needs its own line, every time. */
.mtl__item[hidden] { display: none; }
/* subgrid is the clean way to do this and is widely supported now, but a
   browser without it must not collapse the rail — so the rows are restated. */
@supports not (grid-template-rows: subgrid) {
  .mtl__item { grid-template-rows: 1fr auto 1fr; }
}
.mtl__item--up   .mcard { grid-row: 1; align-self: end;   margin-bottom: 14px; }
.mtl__item--down .mcard { grid-row: 3; align-self: start; margin-top: 14px; }
/* never taller than the row it is standing in — with the margin taken off,
   or the last 14px of every card would be the thing that overflows */
.mtl__item--up   .mcard { max-height: calc(100% - 14px); }
.mtl__item--down .mcard { max-height: calc(100% - 14px); }
.mtl__peg { grid-row: 2; }

/* THE RAIL ITSELF is drawn by the pegs, not by one long line under them:
   a line under an overflowing grid stops at the viewport and leaves the
   later years floating. Each peg carries its own segment, so the rail is
   exactly as long as the timeline is. */
.mtl__peg {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 58px;
}
/* AN OPAQUE GREY, NOT A TRANSLUCENT ONE. Each peg's segment reaches a whole
   gap either side so the rail cannot break on a sub-pixel rounding — which
   means neighbouring segments overlap by the width of the gap. At 13% black
   that overlap painted itself twice and left a darker dash at the midpoint
   between every pair of dots, evenly spaced all the way down the rail and
   looking for all the world like a deliberate dashed line. An opaque colour
   is the same grey however many times it is painted. */
.mtl__peg::before {
  content: ''; position: absolute;
  left: calc(-1 * clamp(10px, 1.4vw, 20px)); right: calc(-1 * clamp(10px, 1.4vw, 20px));
  top: 50%; height: 3px; transform: translateY(-50%);
  background: #dee4ec;
}
/* THE RAIL STOPS AT THE ENDS OF WHAT IS SHOWN, and `:first-child` cannot say
   that any more. The rail filters now — hide the first three milestones and
   `:first-child` still points at one of them, so the line ran off the left
   edge into nothing. The classes are put on by milestones.js after each
   filter, on the first and last VISIBLE item. */
.mtl__item.is-first .mtl__peg::before { left: 50%; border-radius: 2px 0 0 2px; }
.mtl__item.is-last  .mtl__peg::before { right: 50%; border-radius: 0 2px 2px 0; }

/* ── THE PEG IS A BUTTON NOW ──
   Taufik: "only appear pop-up when being click". On a rail of a hundred the
   peg is how the ones that are not cards are reached, so it has to be
   pressable — and a <button> is pressable by a keyboard and announced by a
   screen reader, which a <span> with a click handler is not. */
.mtl__peg { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.mtl__peg:focus-visible { outline: 3px solid var(--c); outline-offset: 4px; border-radius: 14px; }

/* ── AND IT CARRIES ITS ICON ──
   "change dot to icons example if award, icon is trophy. if training the
   education hat, etc. make it style like NEU."

   NEU's shapes are round, soft-shadowed and ringed — the logo is eight dots,
   the mascot is drawn, nothing on this site has a hard corner. So the icon
   sits in a white disc with the kind's own colour as a ring around it, which
   is the same treatment the dot had, grown enough to hold a glyph. `--kh` is
   the kind's hue and arrives from the server. */
.mtl__dot {
  position: relative; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px; line-height: 1;
  background: #fff;
  border: 3px solid hsl(var(--kh, 212) 72% 52%);
  box-shadow: 0 0 0 3px hsl(var(--kh, 212) 72% 52% / 0.22),
              0 6px 14px -6px rgba(9, 20, 34, 0.55);
  transition: transform 0.2s cubic-bezier(0.2, 1.35, 0.35, 1), box-shadow 0.2s ease;
}
.mtl__peg:hover .mtl__dot {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 0 0 5px hsl(var(--kh, 212) 72% 52% / 0.28),
              0 10px 20px -8px rgba(9, 20, 34, 0.6);
}
/* a peg with no card above it is the whole entry, so it is the thing the eye
   should find — slightly larger, and it keeps its colour at rest */
.mtl__item--peg .mtl__dot { width: 38px; height: 38px; font-size: 18px; }
.mtl__item--peg .mtl__peg::after { display: none; }   /* no card, so no stalk */
/* the stalk from the dot up or down to its card */
.mtl__peg::after {
  content: ''; position: absolute; left: 50%; width: 2px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--c) 55%, transparent);
}
.mtl__item--up   .mtl__peg::after { bottom: 50%; height: 22px; }
.mtl__item--down .mtl__peg::after { top: 50%; height: 22px; }

/* THE YEAR, announced once — on the first card that belongs to it. Repeating
   "2025" over every card in 2025 is what makes an infographic look like a
   spreadsheet. */
.mtl__year {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(50% + 16px);
  font-style: normal; font-weight: 800; font-size: 13px; letter-spacing: 0.04em;
  color: #0d1b2a;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 999px; padding: 2px 10px;
  box-shadow: 0 6px 14px -8px rgba(9, 20, 34, 0.5);
  white-space: nowrap;
}
/* a card hanging BELOW the rail would sit on its own year badge */
.mtl__item--down .mtl__year { top: auto; bottom: calc(50% + 16px); }

/* ── a card on the rail ── */
.mcard {
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, 0.09);
  border-top: 4px solid var(--c);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 46px -34px rgba(9, 20, 34, 0.6);
}
/* the whole card opens the milestone now (Taufik, 14 October 2026: "make it
   click to any part of the card to view detail"), so it says so to the
   pointer; the links on it keep their own */
#mstonePanel .mtl__item--big .mcard { cursor: pointer; transition: box-shadow 0.18s ease; }
#mstonePanel .mtl__item--big .mcard:hover { box-shadow: 0 24px 50px -30px rgba(9, 20, 34, 0.7); }
/* THE HEIGHT BUDGET, and it is a budget rather than a set of nice numbers.
   A card gets half of what is left after the rail — about 260px on a 900px
   window — and a 16:9 picture across a 276px card is 155px of that on its
   own. The text had 76px to live in and the first thing it lost was the
   headline: several cards showed a date, a photograph, and nothing else.

   So the picture is given a height rather than a ratio, and every part of the
   text except the body is `flex: none`. The body is the only thing that can
   give, and it gives by ellipsis rather than by pushing the headline out of
   the card. Whatever the window height, a card shows at minimum its date,
   its headline and its link. */
.mcard__media {
  display: block; flex: none;
  height: clamp(84px, 12.5vh, 132px);
  background: #e8eef7;
}
.mcard__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mcard__text {
  flex: 1; padding: 10px 13px 12px;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.mcard__when {
  flex: none; margin: 0 0 2px;
  font-weight: 800; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--c);
}
/* two lines of headline, and never fewer than the whole of them */
.mcard__h {
  flex: none; margin: 0 0 5px;
  font-size: 14.5px; line-height: 1.25; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* THE BODY IS CLAMPED, not left to run. These are news paragraphs of wildly
   different lengths, and one 400-word card would set the height of every row
   in the grid — the cards are stretched to a common height by the layout, so
   the tallest one decides. Four lines is enough to know what happened. */
.mcard__body {
  flex: 1 1 auto; min-height: 0;
  margin: 0; font-size: 12.5px; line-height: 1.45; color: rgba(13, 27, 42, 0.7);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* `margin-top: auto` keeps the link on the floor of the card whether the body
   ran to three lines or to none, so the row of links reads straight across */
.mcard__link {
  flex: none; margin-top: auto; padding-top: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--blue, #0078FF); text-decoration: none;
}
.mcard__link:hover { text-decoration: underline; }

/* THE ONES WITH NO DATE. They are not hidden and not guessed at: they stand at
   the end of the rail, plainly marked, where anybody who can edit Backstage
   can see there is something to fill in. */
.mtl__item--undated { --c: #93a3b8; }
.mtl__item--undated .mcard { border-top-style: dashed; }
.mtl__item--undated .mcard__when { color: #7c8ba0; }
.mtl__item--undated .mtl__dot { background: #fff; border-color: #c3ccd9; box-shadow: none; }

/* ── the chapter colours, the same eight the rest of the site uses ── */
.mtl__item[data-pillar="neucity"]    { --c: #ff9f1c; }
.mtl__item[data-pillar="neunature"]  { --c: #2ec4a6; }
.mtl__item[data-pillar="neumotion"]  { --c: #4aa8ff; }
.mtl__item[data-pillar="neufactory"] { --c: #a86bff; }
.mtl__item[data-pillar="neuslm"]     { --c: #00d4c8; }
.mtl__item[data-pillar="neutalents"] { --c: #ff5fa2; }
.mtl__item[data-pillar="neustudio"]  { --c: #ffd166; }
.mtl__item[data-pillar="neustory"]   { --c: #7aa2ff; }
/* an undated card keeps the grey, whatever chapter it belongs to */
.mtl__item--undated[data-pillar] { --c: #93a3b8; }

/* ── the foot ── */
.mstone__foot {
  display: flex; align-items: center; gap: clamp(10px, 2vw, 20px);
  padding: clamp(10px, 1.4vw, 16px) clamp(18px, 3vw, 42px);
  border-top: 1px solid rgba(13, 27, 42, 0.08);
  background: #fff;
}
.mstone__arrows { display: flex; gap: 8px; }
.mstone__arrow {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(13, 27, 42, 0.12); background: #fff;
  font-size: 20px; line-height: 1; color: #0d1b2a; cursor: pointer;
}
.mstone__arrow:hover { background: #eef4fd; }
.mstone__count {
  margin: 0; font-size: 12.5px; color: rgba(13, 27, 42, 0.55);
}
.mstone__all {
  margin-left: auto;
  font-weight: 700; font-size: 13.5px;
  color: var(--blue, #0078FF); text-decoration: none;
}
.mstone__all:hover { text-decoration: underline; }

/* ================= A PHONE READS A TIMELINE DOWNWARDS =================
   A rail across the screen is 280px of card in a 390px window: one card
   visible, and no sense of a run of years at all. So on a phone the rail
   turns ninety degrees — it goes down the left-hand side and the cards stack
   beside it, which is the same information and the only shape that fits.

   Not a media query on width alone: a phone on its side is 844px wide and
   390px tall, and the horizontal rail needs HEIGHT for a card above and a
   card below. Both cases want the upright rail. */
@media (max-width: 820px), (max-height: 560px) {
  .mstone { padding: 0; }
  .mstone__box { max-height: 100vh; height: 100vh; border-radius: 0; width: 100%; }
  .mstone__scroll {
    overflow-x: hidden; overflow-y: auto;
    padding: 14px clamp(12px, 4vw, 20px) 20px;
  }
  .mtl {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-rows: none;
    grid-template-columns: 46px 1fr;      /* the rail · the card */
    gap: 0;
    min-width: 0;
    /* AND IT MUST NOT KEEP ITS max-content WIDTH. `flex: none` is right for
       the sideways rail — that is what makes the box scroll — and wrong here,
       where it left the upright timeline 2752px wide inside a 390px phone and
       scrolling in both directions at once. */
    flex: 1 1 auto; width: 100%;
  }
  .mtl__item {
    grid-row: auto;
    grid-template-rows: none;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
  }
  @supports not (grid-template-columns: subgrid) {
    .mtl__item { grid-template-columns: 46px 1fr; }
  }
  /* up and down stop meaning anything — every card is to the right of the rail.
     BOTH ARE PINNED TO ROW 1, not left on `auto`: auto-placement fills the
     card into row 1 column 2 first, and the cursor never goes back for the
     free cell at row 1 column 1, so the peg dropped into row 2 and every dot
     sat between its own card and the next one down. */
  .mtl__item--up .mcard, .mtl__item--down .mcard {
    grid-row: 1; grid-column: 2;
    align-self: auto; margin: 0 0 14px; max-height: none;
  }
  .mtl__peg {
    grid-row: 1; grid-column: 1;
    height: auto; align-items: flex-start; padding-top: 16px;
  }
  /* the rail runs down the column instead of across it */
  .mtl__peg::before {
    left: 50%; right: auto; top: 0; bottom: -14px; height: auto; width: 3px;
    transform: translateX(-50%);
  }
  .mtl__item:first-child .mtl__peg::before { top: 16px; }
  .mtl__item:last-child  .mtl__peg::before { bottom: 50%; }
  .mtl__peg::after { display: none; }     /* no stalk: the card is alongside */
  .mtl__year {
    position: static; transform: none; margin-top: 6px;
    writing-mode: vertical-rl; padding: 8px 2px;
  }
  .mstone__foot { flex-wrap: wrap; }
}

/* ══════════ G.R.A.I.N. ON THE SAME RAIL ══════════════════════════════════
   Dr KC: do this one like the milestone, but G to R to A to I to N, and the
   letter that was pressed is the one shining. Everything above is reused as
   it stands — the rail, the pegs, the cards, the arrows, the wheel, the drag,
   and the turn to an upright rail on a phone. Only three things are new: a
   colour for each stage, a letter where the year goes, and the shine. */

/* A COLOUR THAT GROWS. The five values are one thing growing, so the rail
   grows with it: the seed in two hands is the palest, and by the tree in
   fruit it is the full brand blue with the green of leaf in it. This is not
   decoration — read the dots alone, left to right, and the sequence is
   already legible before a word of it is. */
.mstone--grain .mtl__item[data-letter="G"] { --c: #9ec9ff; }
.mstone--grain .mtl__item[data-letter="R"] { --c: #6fb0ff; }
.mstone--grain .mtl__item[data-letter="A"] { --c: #3f93ff; }
.mstone--grain .mtl__item[data-letter="I"] { --c: #0078ff; }
.mstone--grain .mtl__item[data-letter="N"] { --c: #12b886; }

/* THE LETTER WHERE THE YEAR GOES. Same badge, same place on the rail; it is
   a single capital rather than four digits, so it is set round and heavier
   or it reads as a typo rather than as a heading. */
.mstone--grain .mtl__letter {
  min-width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900; letter-spacing: 0;
  color: var(--c);
  border-color: color-mix(in srgb, var(--c) 40%, transparent);
}

/* ── THE ONE THAT WAS PRESSED IS THE ONE SHINING ──
   A HIGHLIGHT, NOT A SPOTLIGHT. The others are not dimmed, faded or greyed:
   the entire reason a card opens the whole word is that the whole word can
   be read, and darkening four fifths of it to point at one would undo that.
   So the lit stage gains rather than the rest losing — it comes forward, its
   colour fills in, and it is ringed in its own light. */
.mstone--grain .mtl__item--lit .mcard {
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent),
    0 18px 44px -18px color-mix(in srgb, var(--c) 70%, transparent),
    0 22px 60px -34px rgba(9, 20, 34, 0.6);
  transform: translateY(-4px) scale(1.03);
}
/* the transform origin faces the rail, so a lifted card grows AWAY from the
   line rather than across it and the stalk still meets the card's edge */
.mstone--grain .mtl__item--lit.mtl__item--up   .mcard { transform-origin: 50% 100%; }
.mstone--grain .mtl__item--lit.mtl__item--down .mcard { transform-origin: 50% 0%; }
.mstone--grain .mcard { transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease; }

.mstone--grain .mtl__item--lit .mcard__when,
.mstone--grain .mtl__item--lit .mcard__h { color: color-mix(in srgb, var(--c) 78%, #0d1b2a); }

.mstone--grain .mtl__item--lit .mtl__letter {
  color: #fff; background: var(--c);
  border-color: color-mix(in srgb, var(--c) 60%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 26%, transparent),
              0 8px 18px -8px color-mix(in srgb, var(--c) 80%, transparent);
}

/* THE DOT KEEPS BREATHING. One slow pulse on the rail is what "shining"
   actually looks like at a glance across a room, which is where this gets
   read from — Dr KC presents this on a screen behind him. */
.mstone--grain .mtl__item--lit .mtl__dot {
  width: 24px; height: 24px;
  animation: grain-shine 2.4s ease-in-out infinite;
}
@keyframes grain-shine {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 34%, transparent),
                         0 6px 14px -6px rgba(9, 20, 34, 0.6); }
  50%      { box-shadow: 0 0 0 10px color-mix(in srgb, var(--c) 16%, transparent),
                         0 0 22px 2px color-mix(in srgb, var(--c) 55%, transparent),
                         0 6px 14px -6px rgba(9, 20, 34, 0.6); }
}
/* ANYBODY WHO ASKED FOR LESS MOVEMENT STILL GETS THE ANSWER, just held
   still: the dot stays at its brightest instead of not being marked at all.
   A highlight that only exists as an animation is not a highlight. */
@media (prefers-reduced-motion: reduce) {
  .mstone--grain .mtl__item--lit .mtl__dot {
    animation: none;
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--c) 16%, transparent),
                0 0 22px 2px color-mix(in srgb, var(--c) 55%, transparent);
  }
  .mstone--grain .mcard { transition: none; }
}

/* THE FOOT HOLDS ONE LINK AND NOTHING ELSE. It used to carry the milestone
   rail's arrows and a "G · R · A · I · N" line; the arrows moved nothing
   because five cards fit, and the letters repeated the panel's own heading.
   The rule that styled that line is gone with it rather than left behind for
   somebody to wonder about — `.mstone__count` itself stays, because the
   milestone rail still uses it.

   `.mstone__all` already carries `margin-left: auto`, so with its two
   neighbours removed the link stays where it was, at the right. */

/* ON A PHONE the rail is upright and the card is alongside it, so a lifted
   card would lean out over the edge of a 390px screen. It comes forward
   without moving instead. */
@media (max-width: 820px), (max-height: 560px) {
  .mstone--grain .mtl__item--lit .mcard { transform: none; }
}

/* ── FIVE IS THE WHOLE WORD, SO FIVE HAS TO FIT ──
   The milestone rail is thirteen cards and counting: it is meant to run off
   the edge and be scrolled, and its fixed 280px columns are right for that.
   G.R.A.I.N. is five and always five, and a word with its last letter hanging
   off the edge is not a word — at 1440 the N sat half outside the panel, so
   the reader had to go looking for the end of an acronym they can already
   recite.

   So this rail SHARES the width instead of claiming a column each. It still
   scrolls if the screen is genuinely too narrow for five (the floor is
   150px), and below 820px it becomes the upright rail like everything else,
   where the rule above is overridden by the block that follows it. */
.mstone--grain .mtl {
  grid-auto-columns: minmax(150px, 1fr);
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

/* A PALE COLOUR IS FOR THE DOT, NOT FOR THE WRITING. Gratitude's blue is the
   lightest on the rail because it is the seed, and at that lightness the
   letter G was pale blue text on white — decorative, and barely readable.
   The badge keeps the stage's colour and takes it far enough towards the ink
   to be read; the dot beside it is still the pale original. */
.mstone--grain .mtl__letter { color: color-mix(in srgb, var(--c) 62%, #0d1b2a); }
.mstone--grain .mtl__item--lit .mtl__letter { color: #fff; }

/* THE LIT BADGE IS READ, NOT ADMIRED. Filling it with the stage's colour and
   writing on it in white looked right on Integrity's full blue and was close
   to invisible on Gratitude's — white on #9ec9ff is under 2:1, which is not a
   letter, it is a suggestion of one. Checked against all five rather than
   against the one I happened to be looking at, and the ink wins on every
   single one of them: 9:1 on the palest, 6:1 on the deepest, where white
   managed 3.6:1 at best. So the fill says which stage, and the ink says which
   letter. */
.mstone--grain .mtl__item--lit .mtl__letter { color: #0d1b2a; }

/* ON A PHONE, A LETTER STAYS THE RIGHT WAY UP.
   The upright rail turns the badge on its side — `writing-mode: vertical-rl`
   — which is the right answer for "31 March 2026" in a 46px column and the
   wrong one for a single capital: G and N lay on their backs, and an N on its
   side is a Z. A letter is as wide as it is tall, so it needs none of the
   room that rule was buying. */
@media (max-width: 820px), (max-height: 560px) {
  .mstone--grain .mtl__letter {
    writing-mode: horizontal-tb;
    padding: 0; margin-top: 8px;
  }
}

/* ══════════ VISION AND MISSION, ON THE SAME RAIL ═════════════════════════
   Two cards where the milestones have thirteen. The rail does not mind, but
   two 280px columns in a 1400px panel would sit in the left-hand corner like
   an accident, so this one shares the width the way G.R.A.I.N. does. */
.mstone--vm .mtl {
  grid-auto-columns: minmax(240px, 1fr);
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
.mstone--vm .mtl__item[data-vm="vision"]  { --c: #0078ff; }
.mstone--vm .mtl__item[data-vm="mission"] { --c: #12b886; }

/* THE SENTENCE IS THE CARD. It is set larger than body text and lighter than
   a heading, because a vision statement read at body size is a bullet point
   and read at heading size is a slogan. */
.vmquote {
  margin: 8px 0 0;
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.55;
  color: #0d1b2a;
  font-style: normal;
}
.vmquote::before { content: '“'; }
.vmquote::after  { content: '”'; }
.mstone--vm .mcard__when {
  font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--c);
}
/* no picture on these two, so the card is text and needs its own padding */
.mstone--vm .mcard__text { padding: clamp(16px, 2vw, 22px); }

/* the roman numeral badge, wider than a single letter needs */
.mstone--vm .mtl__letter { min-width: 34px; color: color-mix(in srgb, var(--c) 62%, #0d1b2a); }

/* ── THE SECOND BUTTON IN NEUFAMILY ──
   Beside "Join our family" on the blue section: an outlined button rather
   than a second white one. Two solid white buttons side by side read as two
   equal demands; the outline says this one opens something rather than
   taking you away. */
.btn--wire {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.7);
}
.btn--wire:hover { background: rgba(255, 255, 255, 0.14); border-color: #fff; }
.family__ctas { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }


/* ── THE FILTER BAR ──────────────────────────────────────────────────────
 * Taufik: "make the milestone able to select/sort/filter by year, date,
 * month, etc." — because an audit question is "everything in 2025" or "every
 * training", and a rail that can only be scrolled answers neither.
 */
/* ── 23 August 2026: FOUR DROPDOWNS, NOT TWENTY CHIPS ──
   Dr KC, arrows at the Year row and the Kind row: "Drop down filter". The
   rows were built from what is on the rail, so they grew with it — eleven
   kinds already, on thirteen milestones, with a hundred planned. One line
   now, whatever is in it. See public/views/_milestones.ejs. */
.mfilter {
  padding: 0 clamp(1rem, 3vw, 2.2rem) 0.8rem;
  border-bottom: 1px solid #e6eaf0;
}
.mfilter__body {
  display: flex; align-items: center; gap: 0.45rem 0.9rem; flex-wrap: wrap;
}
.mfilter__lab {
  font: 800 0.66rem 'Inter', sans-serif; letter-spacing: 0.1em;
  text-transform: uppercase; color: #8b97a8; margin-right: 0.2rem;
}

/* ── THE BUTTON THE WHOLE BAR BECOMES ON A PHONE ──
   Not shown at all on a laptop, where four dropdowns fit on one line and a
   thing to press before you can press anything is only in the way. */
.mfilter__toggle { display: none; }

.mchip {
  display: inline-flex; align-items: center; gap: 0.32rem;
  border: 1.5px solid #dde3ec; background: #fff; color: #16202e;
  border-radius: 999px; padding: 0.3rem 0.72rem;
  font: 600 0.78rem 'Inter', sans-serif; cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.mchip:hover { transform: translateY(-1px); border-color: #c2cbd8; }
.mchip b {
  font: 800 0.66rem 'Inter', sans-serif;
  background: #eef2f7; color: #6b7686; border-radius: 999px; padding: 0.02rem 0.34rem;
}
/* the chosen one takes the kind's own colour, so the bar and the rail agree */
.mchip.is-on {
  background: hsl(var(--kh, 212) 72% 52%); border-color: hsl(var(--kh, 212) 72% 52%);
  color: #fff;
}
.mchip.is-on b { background: rgba(255, 255, 255, 0.24); color: #fff; }
.mchip--none { border-style: dashed; }
.mchip--clear { color: #8b97a8; border-style: dashed; }

.mfilter__sel { display: inline-flex; align-items: center; gap: 0.35rem; }
.mfilter__sel select {
  border: 1.5px solid #dde3ec; border-radius: 999px; background: #fff;
  padding: 0.3rem 0.6rem; font: 600 0.78rem 'Inter', sans-serif; cursor: pointer;
  /* the Kind list carries a label and a count and can be long. It may take
     the room it needs on a laptop and no more than the screen on a phone. */
  max-width: min(16rem, 60vw);
}

.mstone__none { padding: 2rem 1rem; text-align: center; color: #6b7686; font-size: 0.92rem; }

/* the kind badge on a big card, beside the date */
.mcard__kind {
  display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; font-size: 11px; vertical-align: -4px; margin-right: 0.3rem;
  background: hsl(var(--kh, 212) 72% 52% / 0.14);
}

/* The link rows (.mlink*) moved to share.css on 14 October 2026: the chapter
   popup and a story's own page show write-ups the same way now, from one set
   of rules. Every page that loads this file loads that one too. */

/* ── ONE MILESTONE, IN FULL ──────────────────────────────────────────────
 * What a peg opens into. It sits OVER the timeline rather than replacing it,
 * so closing it puts the reader back exactly where they were on the rail —
 * which on a hundred-milestone rail is the difference between browsing and
 * starting again.
 */
.mdet { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1rem; }
.mdet[hidden] { display: none; }
/* THE SCRIM IS NO LONGER A ::before.
   It was `rgba(6,12,22,.55)` with a 3px blur, painted at full strength from
   the first frame — and a pseudo-element cannot be the site's one `.veil`,
   which is what now paints every scrim and paints it CLEAR until the pressed
   peg has flown to the middle and stopped. See public/assets/css/arrive.css
   and the real <div class="veil"> in public/views/_milestones.ejs. */
.mdet__box {
  position: relative; z-index: 1; width: min(38rem, 100%); max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 22px; padding: 1.4rem 1.5rem 1.6rem;
  box-shadow: 0 40px 90px -30px rgba(6, 12, 22, 0.75);
}
.mdet__x {
  position: absolute; top: 0.7rem; right: 0.8rem; width: 2rem; height: 2rem;
  border: 0; background: #f3f6fa; border-radius: 50%; cursor: pointer;
  font-size: 1.2rem; line-height: 1; color: #6b7686;
}
.mdet__x:hover { background: #e6ecf4; }
.mdet__when { font: 700 0.78rem 'Inter', sans-serif; color: #6b7686; margin-bottom: 0.3rem; }
.mdet__kind {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; font-size: 12px; vertical-align: -5px; margin-right: 0.35rem;
  background: hsl(var(--kh, 212) 72% 52% / 0.16);
}
.mdet__h { font-size: 1.25rem; line-height: 1.25; margin-bottom: 0.7rem; }
.mdet__media { display: block; border-radius: 14px; overflow: hidden; margin-bottom: 0.8rem; }
.mdet__media img { width: 100%; height: auto; display: block; }
.mdet__body { font-size: 0.94rem; line-height: 1.6; color: #33404f; }

/* ── ON A PHONE THE FILTER GETS OUT OF THE WAY ────────────────────────────
   Dr KC, twice, with a green arrow down the whole of a phone screenshot:
   "For mobile view, this session block the content … Need to simplify the
   filter, to avoid blocking the content", and "For mobile responsive, it
   blocks the view. this part can be disabled to view the full milestone."

   He opened the timeline on a phone to look at the timeline and could not
   see it: the filter filled the screen and pushed the rail — the whole point
   of the panel — below the fold. So on a phone the bar is one button, shut
   until it is asked for, and the timeline is the first thing there.

   The number on the button is what stops a shut filter being a trap: a rail
   narrowed to two milestones would otherwise look like a rail with two
   milestones on it. See `countOn` in public/assets/js/milestones.js. */
@media (max-width: 640px) {
  .mfilter { padding-left: 1rem; padding-right: 1rem; }

  .mfilter__toggle {
    display: inline-flex; align-items: center; gap: 0.4rem;
    border: 1.5px solid #dde3ec; background: #fff; color: #16202e;
    border-radius: 999px; padding: 0.34rem 0.85rem;
    font: 700 0.8rem 'Inter', sans-serif; cursor: pointer;
  }
  .mfilter__on {
    font: 800 0.66rem 'Inter', sans-serif; min-width: 1.15rem; text-align: center;
    background: hsl(212 72% 52%); color: #fff; border-radius: 999px; padding: 0.02rem 0.34rem;
  }
  .mfilter__on[hidden] { display: none; }
  .mfilter__caret {
    width: 0; height: 0; margin-left: 0.1rem;
    border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-top: 5px solid #8b97a8;
    transition: transform 0.18s ease;
  }
  .mfilter.is-open .mfilter__caret { transform: rotate(180deg); }

  /* shut by default — `display: none` and not a height animation, because the
     rail below has to start at the top of the screen from the first frame */
  .mfilter__body { display: none; padding-top: 0.55rem; }
  .mfilter.is-open .mfilter__body { display: flex; }

  /* each question on its own line: a label and a control, side by side, so
     four of them read as a short list rather than as a wrapped jumble */
  .mfilter__sel { width: 100%; justify-content: space-between; }
  .mfilter__sel select { max-width: 62%; }
  .mfilter__lab { margin-right: 0; }
}
