/* S5: Experience timeline and "How I work". */
.experience {
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 200ms;
  --t-mid: 450ms;
  --t-slow: 700ms;
  --stagger: 55ms;
}

/* Timeline grid */
.experience .timeline {
  position: relative;
  max-width: var(--content);
  margin: 0 auto;
  --dot-y: 38px;
}
.experience .stop {
  display: grid;
  grid-template-columns: 200px 64px minmax(0, 760px);
  padding-bottom: 40px;
}
.experience .stop:last-child { padding-bottom: 0; }
.experience .stop::before {
  content: attr(data-year);
  grid-column: 1;
  grid-row: 1;
  padding-top: 22px;
  font: 500 clamp(2.5rem, 4vw, 3.5rem) / 1 var(--font-display);
  letter-spacing: -.02em;
  color: var(--ink);
}
.experience .stop--next::before { content: none; }
.experience .stop__dot {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: 16px;
  height: 16px;
  margin-top: calc(var(--dot-y) - 8px);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink);
  position: relative;
  z-index: 1;
}
.experience .stop__card { grid-column: 3; grid-row: 1; }
.experience .timeline__spine {
  position: absolute;
  left: 231px;
  top: var(--dot-y);
  bottom: var(--spine-end, 0px);
  width: 2px;
  background: var(--soft);
}
.experience .timeline__fill {
  position: absolute;
  inset: 0;
  background: var(--accent-2);
  transform-origin: 50% 0;
}

/* Card */
.experience .stop__card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--hair), 0 22px 40px -34px color-mix(in srgb, var(--dark) 55%, transparent);
  padding: 28px 32px;
}
.experience .stop__when {
  font: 500 12px / 1.4 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute-text);
}
.experience .stop__role {
  margin-top: 8px;
  font: 500 clamp(1.375rem, 2vw, 1.75rem) / 1.1 var(--font-display);
  letter-spacing: -.02em;
}
.experience .stop__org { margin-top: 4px; font-weight: 600; color: var(--ink-2); }
.experience .stop__what { margin-top: 14px; font-size: 1rem; line-height: 1.65; color: var(--ink-2); max-width: 64ch; }
.experience .stop__award {
  display: inline-block;
  margin-top: 16px;
  padding: .45em .9em;
  border-radius: 16px;
  background: var(--soft);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
}
.experience .stop--next .stop__card { background: transparent; box-shadow: none; border: 1.5px dashed var(--faint); }
.experience .stop--next .stop__dot { background: var(--paper); box-shadow: none; border: 2px dashed var(--faint); }
.experience .stop--next .link { display: inline-block; margin-top: 12px; color: var(--ink); text-decoration-color: var(--accent-2); }

/* Lit and unlit */
@media (prefers-reduced-motion: no-preference) {
  html.js .experience .timeline__fill { transform: scaleY(0); }
  html.js .experience .stop::before { transition: color var(--t-mid) var(--ease); }
  html.js .experience .stop:not(.is-lit)::before { color: var(--mute); }
  html.js .experience .stop__dot {
    transition: transform var(--t-mid) var(--ease-back), background-color var(--t-fast);
  }
  html.js .experience .stop:not(.is-lit):not(.stop--next) .stop__dot { box-shadow: inset 0 0 0 2px var(--faint); }
  html.js .experience .stop.is-lit:not(.stop--next) .stop__dot {
    background: var(--accent-2);
    box-shadow: inset 0 0 0 2px var(--accent-2);
    transform: scale(1.15);
  }
  html.js .experience .stop__card {
    transition: opacity 600ms var(--ease), transform 600ms var(--ease), border-color var(--t-fast);
  }
  html.js .experience .stop:not(.is-lit) .stop__card { opacity: .35; transform: translateY(16px); }
  html.js .experience .stop--next .stop__dot { transition: border-color var(--t-fast); }
  html.js .experience .stop--next.is-lit .stop__dot,
  html.js .experience .stop--next.is-lit .stop__card { border-color: var(--ink); }
  html.js .experience .stop--next:focus-within .stop__card { opacity: 1; transform: none; transition-delay: 0s; }
}

/* How I work */
.experience .how { max-width: var(--content); margin: clamp(80px, 10vw, 140px) auto 0; }
.experience .how__title {
  font: 500 clamp(1.75rem, 3vw, 2.5rem) / .98 var(--font-display);
  letter-spacing: -.02em;
  margin-bottom: 24px;
}
.experience .how__list { border-top: 1px solid var(--ink); }
.experience .how__row { padding: 28px 0 30px; border-bottom: 1px solid var(--line); }
/* The headline is two sentences: the first upright in ink, the second in the accent italic. Two lines at most, from 320 to 1920 px. */
.experience .how__verb {
  max-width: 30em;
  font: 500 clamp(1.25rem, .9rem + 1.6vw, 2.25rem) / 1.14 var(--font-display);
  letter-spacing: -.02em;
  text-wrap: balance;
  color: var(--ink);
  transition: transform var(--t-mid) var(--ease);
}
.experience .how__verb em { display: inline-block; font-style: italic; font-weight: 400; color: var(--accent-2-ink); }
.experience .how__text { margin-top: 12px; font-size: 1.0625rem; line-height: 1.6; color: var(--ink-2); max-width: 68ch; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .experience .how__row:hover .how__verb { transform: translateX(8px); }
}
@media (prefers-reduced-motion: no-preference) {
  html.js .experience #how:not(.is-in) .how__row { opacity: 0; transform: translateY(18px); }
  html.js .experience #how.is-in .how__row {
    transition: opacity 600ms var(--ease), transform 600ms var(--ease);
    transition-delay: calc(var(--r) * 80ms);
  }
  .experience .how__row:nth-child(1) { --r: 0; }
  .experience .how__row:nth-child(2) { --r: 1; }
  .experience .how__row:nth-child(3) { --r: 2; }
  .experience .how__row:nth-child(4) { --r: 3; }
  .experience .how__row:nth-child(5) { --r: 4; }
}
@media (prefers-reduced-motion: reduce) {
  html .experience *, html .experience *::before, html .experience *::after { transition: none !important; animation: none !important; }
}

/* ---- S16: chapters ---- */
.experience [data-group="qualitest"] { --fam: var(--fam-infra); }
.experience [data-group="ale"] { --fam: var(--fam-ep); }
.experience [data-group="client"] { --fam: var(--fam-sw); }
.experience [data-group="personal"] { --fam: var(--fam-ai); }

.experience .stop__headline { font-size: 1.125rem; line-height: 1.55; color: var(--ink); max-width: 62ch; }
.experience .stop__scale { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding: 0; list-style: none; }
.experience .stop__scale li {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink-2);
  font: 500 12px / 1 var(--font-mono);
}
.experience .stop__results { margin-top: 20px; }
.experience .stop__list { display: grid; gap: 12px; padding: 0; list-style: none; }
.experience .stop__list li {
  position: relative;
  padding-left: 20px;
  max-width: 66ch;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.experience .stop__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .65em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
}
.experience .stop__list strong { color: var(--ink); font-weight: 700; }
.experience .stop__more > div > .stop__list { padding-top: 12px; }
.experience .stop__toggle {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  min-height: 40px;
  margin-top: 14px;
  padding: .55em 1.05em;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font: 600 .875rem / 1.2 var(--font-sans);
  cursor: pointer;
  transition: background-color var(--t-fast);
}
.experience .stop__toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.75px solid currentColor;
  border-bottom: 1.75px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--t-mid) var(--ease);
}
.experience .stop__toggle[aria-expanded="true"]::after { transform: translateY(3px) rotate(225deg); }
@media (hover: hover) and (pointer: fine) {
  .experience .stop__toggle:hover { background: color-mix(in srgb, var(--soft) 78%, var(--ink)); }
}
html:not(.js) .experience .stop__toggle { display: none; }
/* Expand and collapse: a grid row from 0fr to 1fr; the collapsed rows are hidden from everyone (scripts off: always open) */
html.js .experience .stop__more {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 320ms var(--ease-io), visibility 0s linear 320ms;
}
html.js .experience .stop__more.is-open {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 320ms var(--ease-io), visibility 0s;
}
html.js .experience .stop__more > div { min-height: 0; overflow: hidden; }

.experience .stop__built { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.experience .stop__label,
.experience .tool__label {
  font: 500 11px / 1.4 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute-text);
}
.experience .stop__label { margin-bottom: 10px; }
.experience .stop__tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.experience .stop__tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--hair);
  color: var(--ink);
  font: 600 13px / 1.2 var(--font-sans);
  text-decoration: none;
  transition: background-color var(--t-fast);
}
@media (hover: hover) and (pointer: fine) {
  .experience .stop__tool:hover { background: var(--soft); }
}
.experience .stop__tool--more {
  padding: 4px 14px;
  background: transparent;
  box-shadow: none;
  border: 1.5px dashed var(--faint);
  font: 500 12px / 1.2 var(--font-mono);
}
.experience .tool__glyph {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fam) 42%, var(--card));
  color: var(--ink);
  font: 500 .75rem / 1 var(--font-display);
  letter-spacing: -.01em;
}
.experience .stop__award { margin-top: 20px; }

/* ---- S16: the shelf ---- */
.experience .shelf { max-width: var(--content); margin: clamp(80px, 10vw, 140px) auto 0; scroll-margin-top: 96px; }
.experience .shelf__title {
  font: 500 clamp(1.75rem, 3vw, 2.5rem) / .98 var(--font-display);
  letter-spacing: -.02em;
}
.experience .shelf__sub { margin-top: 14px; max-width: 62ch; font-size: 1.0625rem; line-height: 1.6; color: var(--ink-2); }
.experience .shelf__filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 28px; }
html:not(.js) .experience .shelf__filters { display: none; }
.experience .shelf__chip { padding: .55em 1em; transition: background-color var(--t-fast), color var(--t-fast); }
.experience .shelf__chip[data-group]:not([data-group="all"])::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: .6em;
  border-radius: 50%;
  background: var(--fam);
}
@media (hover: hover) and (pointer: fine) {
  .experience .shelf__chip:hover:not([aria-pressed="true"]) { background: color-mix(in srgb, var(--chip-bg) 80%, var(--ink)); }
}
.experience .shelf__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 0;
  list-style: none;
}
.experience .tool { position: relative; min-width: 0; }
.experience .tool[hidden] { display: none; }
.experience .tool__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 18px;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(var(--fam), var(--fam)) top / 100% 3px no-repeat,
    var(--card);
  box-shadow: var(--hair);
}
.experience .tool__head { display: flex; align-items: center; gap: 12px; }
.experience .tool__head .tool__glyph { width: 46px; height: 46px; border-radius: 13px; font-size: 1.4rem; }
.experience .tool__name { font: 500 1.25rem / 1.15 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.experience .tool__year { margin-top: 3px; font: 500 12px / 1.3 var(--font-mono); color: var(--mute-text); }
.experience .tool__does,
.experience .tool__replaced { font-size: .90625rem; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
.experience .tool__label { display: block; margin-bottom: 3px; font-size: 10.5px; }
.experience .tool__after { font-family: var(--font-display); font-weight: 400; font-size: 1.05em; }
.experience .tool__arrow { margin: 0 .1em; color: var(--accent-2-ink); }
.experience .tool__more { display: grid; gap: 12px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.experience .tool__stack { display: flex; flex-wrap: wrap; gap: 5px 6px; padding: 0; list-style: none; }
.experience .tool__stack li {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink-2);
  font: 500 11.5px / 1.1 var(--font-mono);
}
.experience .tool__links, .experience .tool__case { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.experience .tool__links .link,
.experience .tool__case .link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  color: var(--ink);
  text-decoration-color: var(--accent-2);
  font-weight: 600;
}
/* focus and #-links land clear of the fixed nav */
.experience .tool, .experience .tool__card, .experience .stop, .experience .stop a, .experience .stop button { scroll-margin-top: 96px; }

/* Fine pointers, scripts on: the details panel fills the tile's own box on hover or keyboard focus (opacity and scale only),
   so it never covers a neighbour or leaves the viewport. The card has a floor height so the panel's content always fits.
   After a jump to a tile (.is-still) a stationary pointer does not open anything until it moves. */
@media (hover: hover) and (pointer: fine) {
  html.js .experience .tool__card { min-height: 14.25rem; padding-bottom: 34px; }
  html.js .experience .tool__card::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 15px;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--faint);
    border-bottom: 1.5px solid var(--faint);
    transform: rotate(45deg);
  }
  html.js .experience .tool__more {
    --ink: var(--on-dark);
    --ink-2: var(--on-dark-2);
    --mute-text: var(--on-dark-2);
    --soft: color-mix(in srgb, var(--on-dark) 14%, transparent);
    --line: var(--line-dark);
    position: absolute;
    inset: 0;
    z-index: 2;
    align-content: start;
    margin: 0;
    padding: 18px;
    border-top: 0;
    border-radius: var(--radius-sm);
    background: var(--dark);
    color: var(--on-dark);
    box-shadow: inset 0 0 0 1px var(--line-dark);
    opacity: 0;
    pointer-events: none;
    transform: scale(.97);
    transition: opacity 180ms linear, transform 240ms var(--ease);
  }
  html.js .experience .tool__more .link { color: var(--accent); text-decoration-color: var(--accent); }
  html.js .experience .shelf__grid:not(.is-still) .tool:hover .tool__more,
  html.js .experience .shelf__grid:not(.is-still) .tool:has(:focus-visible) .tool__more { opacity: 1; pointer-events: auto; transform: none; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html.js .experience .tool__card { transition: transform 240ms var(--ease), box-shadow 240ms; }
  html.js .experience .shelf__grid:not(.is-still) .tool:hover .tool__card,
  html.js .experience .shelf__grid:not(.is-still) .tool:has(:focus-visible) .tool__card { transform: translateY(-3px); }
}

/* ---- S16: motion (transform and opacity only) ---- */
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes tool-in { from { opacity: 0; transform: translateY(20px); } }
@keyframes tool-pulse {
  0% { opacity: 0; transform: scale(.97); }
  25% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.03); }
}
@media (prefers-reduced-motion: no-preference) {
  html.js .experience .stop:not(.is-in) .rise { opacity: 0; }
  html.js .experience .stop.is-in .rise {
    animation: rise-in 600ms var(--ease) backwards;
    animation-delay: calc(var(--k, 0) * 70ms);
  }
  html.js .experience .shelf__grid:not(.is-in) .tool { opacity: 0; }
  html.js .experience .shelf__grid.is-in .tool {
    animation: tool-in 650ms var(--ease) backwards;
    animation-delay: calc(min(var(--i, 0), 12) * 45ms);
  }
  html.js .experience .shelf__grid.is-settled .tool { animation: none; }
  .experience .tool__card.is-pulse::before {
    content: "";
    position: absolute;
    inset: -5px;
    border: 2px solid var(--accent-2);
    border-radius: 19px;
    pointer-events: none;
    animation: tool-pulse 1400ms ease-out;
  }
  /* a focused chapter is shown whole even when the scroll has not lit it yet */
  html.js .experience .stop:focus-within .stop__card { opacity: 1; transform: none; transition-delay: 0s; }
}

/* Tablet */
@media (max-width: 1023.98px) {
  .experience .stop { grid-template-columns: 110px 48px minmax(0, 1fr); }
  .experience .stop::before { font-size: 2rem; padding-top: 26px; }
  .experience .timeline__spine { left: 133px; }
}

/* Phone */
@media (max-width: 699.98px) {
  .experience .timeline { --dot-y: 13px; }
  .experience .stop { grid-template-columns: 28px minmax(0, 1fr); row-gap: 10px; padding-bottom: 32px; }
  .experience .stop:last-child { padding-bottom: 0; }
  .experience .stop::before { grid-area: 1 / 2; padding-top: 0; font-size: 1.5rem; }
  .experience .stop__dot { grid-area: 1 / 1; width: 14px; height: 14px; margin-top: calc(var(--dot-y) - 7px); }
  .experience .stop__card { grid-area: 2 / 2; padding: 22px 20px; }
  .experience .stop--next .stop__card { grid-area: 1 / 2; }
  .experience .timeline__spine { left: 13px; }
  .experience .how__row { padding: 22px 0 24px; }
  .experience .how__text { font-size: 1rem; }
  .experience .stop__headline { font-size: 1.0625rem; }
  .experience .stop__toggle { min-height: 44px; }
  .experience .stop__tool { min-height: 40px; }
  .experience .shelf__filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 19px calc(-1 * var(--gutter)) 23px;
    padding: 5px var(--gutter);
  }
  .experience .shelf__filters::-webkit-scrollbar { display: none; }
  .experience .shelf__chip { flex: none; }
}

/* S16: shelf columns, 4 from 1280 px, 3 from 900, 2 from 560, 1 below */
@media (min-width: 560px) { .experience .shelf__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .experience .shelf__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .experience .shelf__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
