/* Ablauf: the eight steps as a stack of big cards. Builds on fern.css and ablauf.css. */

.st-flow { --rail: 3.4rem; --top: calc(4rem + var(--rail) + 1rem); --peek: .6rem; }
.st-head { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: end; }
.st-head .h2 { max-width: 11ch; }
.st-head .ab-flow__lede { margin-top: 0; }

.st { margin-top: clamp(2.5rem, 5vw, 3.5rem); }

/* Step rail: sticks under the nav while the stack runs */
.st-rail { position: sticky; top: 4rem; z-index: 10; height: var(--rail); margin-bottom: 1rem; background: var(--dark); border-bottom: 1px solid var(--dark-line); }
.st-rail ol { display: grid; grid-template-columns: repeat(8, 1fr); height: 100%; margin: 0; padding: 0; list-style: none; }
.st-rail a { display: flex; align-items: center; gap: .45rem; height: 100%; font-size: .88rem; font-weight: 560; color: var(--on-dark-3); transition: color .3s; }
.st-rail a span { font: 600 .7rem var(--mono); }
.st-rail li.on a { color: var(--on-dark); }
@media (hover: hover) and (pointer: fine) { .st-rail a:hover { color: var(--on-dark); } }
.st-rail li.on a span { color: var(--lime); }
.st-rail__bar { position: absolute; left: 0; bottom: -1px; width: 100%; height: 2px; background: var(--lime); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* Cards */
.st-cards { margin: 0; padding: 0; list-style: none; }
/* Room after the last card, so it sticks too and the cards under it stay put */
.st-cards::after { content: ""; display: block; height: 14vh; }
.st-card { position: sticky; top: calc(var(--top) + var(--n) * var(--peek)); scroll-margin-top: calc(var(--top) + var(--n) * var(--peek)); }
/* Tabbing through the stack: the cards lie flat and undimmed, so a later card never covers or greys out the focused link (Shift+Tab) */
.st-cards:has(:focus-visible) .st-card { position: relative; }
.st-cards:has(:focus-visible) .st-card__in { --c: 0; }
/* The gap sits above each card: a gap below would push the cards up before the stack lets go */
.st-card + .st-card { margin-top: 14vh; }
.st-card__in {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: stretch;
  height: min(38.5rem, calc(100svh - var(--top) - 1.5rem)); padding: clamp(1.5rem, 3vw, 2.5rem);
  border-radius: 1.1rem; background: var(--cream); color: var(--ink);
  box-shadow: inset 0 1px 0 light-dark(#fff, rgba(255, 255, 255, .08)), 0 0 0 1px rgba(255, 255, 255, .06), 0 -18px 40px -24px rgba(0, 0, 0, .8), 0 30px 60px -30px rgba(0, 0, 0, .7);
  transform-origin: 50% 0; transform: scale(calc(1 - var(--c, 0) * .06)); filter: brightness(calc(1 - var(--c, 0) * .2));
}
.st-card__in > * { opacity: calc(1 - var(--c, 0) * .6);
}
.st-card__text { display: flex; flex-direction: column; align-items: flex-start; min-height: 0; }
.st-card__meta { display: flex; align-items: center; gap: .7rem; width: 100%; font: 600 .8rem var(--mono); color: var(--faint); }
.st-card__meta .px { width: 2.2rem; height: 2.2rem; }
.st-card .ab-step__lv { margin-left: auto; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); }
.st-card h3 { margin-top: 1.4rem; font-family: var(--display); font-size: clamp(2.4rem, .21rem + 4.7vw, 4rem); font-weight: 650; line-height: .95; letter-spacing: -.04em; }
.st-card h3 a { display: inline-flex; align-items: center; gap: .5rem; }
.st-card h3 svg { width: 1.6rem; height: 1.6rem; color: var(--faint); transition: transform .2s, color .2s; }
@media (hover: hover) and (pointer: fine) { .st-card h3 a:hover svg { color: var(--brand); transform: translateX(4px); } }
.st-card__lede { margin-top: 1rem; max-width: 30rem; font-size: 1.08rem; line-height: 1.5; color: var(--ink-2); }
.st-card__do { display: grid; gap: .8rem; width: 100%; max-width: 32rem; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line-2); }
.st-card__do b { display: block; margin-bottom: .4rem; font-size: .8rem; font-weight: 600; letter-spacing: 0; color: var(--brand); }
.st-card__do > div + div b { color: light-dark(#8A6511, #E8C66E); }
.st-do { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem 1.2rem; margin: 0; padding: 0; list-style: none; font-size: .9rem; line-height: 1.35; color: var(--ink-2); }
.st-do li { position: relative; padding-left: 1.1rem; }
.st-do li::before { content: ""; position: absolute; left: 0; top: .42em; width: .5rem; height: .5rem; background: var(--brand); }
.st-do--you { grid-template-columns: 1fr; color: var(--muted); }
.st-do--you li::before { background: var(--mustard); }
.st-card .ab-appr { margin-top: 1rem; background: light-dark(#FFF6E0, #2E2512); box-shadow: inset 0 0 0 1px rgba(217, 164, 65, .55); color: light-dark(#7A5A12, #E8C66E); }
.st-card__foot { display: flex; flex-direction: column; align-items: flex-start; gap: .7rem; margin-top: auto; padding-top: 1rem; }
.st-card__note { max-width: 30rem; font-size: .8rem; line-height: 1.4; color: var(--faint); }
.st-card__more { display: inline-flex; align-items: center; gap: .4rem; font-size: .92rem; font-weight: 600; color: var(--brand-deep); }
.st-card__more svg { width: 1rem; height: 1rem; transition: transform .2s; }
@media (hover: hover) and (pointer: fine) { .st-card__more:hover { text-decoration: underline; text-underline-offset: 3px; } }
@media (hover: hover) and (pointer: fine) { .st-card__more:hover svg { transform: translateX(3px); } }

/* Example panel: what Handem does, played when the card comes up */
.st-mock { align-self: center; display: flex; flex-direction: column; gap: .6rem; min-height: 0; max-height: 100%; overflow: hidden; padding: 1.1rem; border-radius: .8rem; background: var(--paper); box-shadow: 0 0 0 1px var(--line-2), 0 20px 40px -28px rgba(29, 27, 24, .45); font-size: .88rem; line-height: 1.4; }
.st-mock__top { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: .55rem; border-bottom: 1px solid var(--line); font: 600 .72rem var(--mono); color: var(--faint); }
.st-mock__top span:last-child { align-self: flex-start; white-space: nowrap; padding: 0 .4rem; border-radius: .25rem; background: var(--chrome); }
.m small { display: block; margin-bottom: .1rem; font-size: .72rem; font-weight: 600; color: var(--faint); }
.m-them, .m-us, .m-voice { max-width: 88%; padding: .55rem .75rem; border-radius: .7rem; }
.m-them { background: var(--chrome); border-bottom-left-radius: .2rem; }
.m-us { align-self: flex-end; background: #E4F2DA; border-bottom-right-radius: .2rem; }
.m-voice { background: #EAF1FD; border-bottom-left-radius: .2rem; }
.m-sheet { margin: 0; border-radius: .55rem; box-shadow: inset 0 0 0 1px var(--line); }
.m-sheet div { display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem; padding: .4rem .7rem; border-top: 1px solid var(--line); }
.m-sheet div:first-child { border-top: 0; }
.m-sheet dt { font-weight: 600; color: var(--muted); }
.m-sheet dd { margin: 0; color: var(--ink); }
.m-done { display: flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--brand); }
.m-done svg { width: 1rem; height: 1rem; flex: none; }
.m-slot { display: grid; grid-template-columns: 3rem 1fr; gap: .6rem; padding: .5rem .7rem; border-radius: .45rem; background: var(--chrome); color: var(--muted); }
.m-slot b { font: 600 .8rem var(--mono); color: var(--ink-2); }
.m-slot--open { background: #F3FBE6; box-shadow: inset 0 0 0 1.5px #A8D65A; color: var(--ink); }
.m-wa { padding: .65rem .8rem; border-radius: .6rem; background: #F2F7EE; box-shadow: inset 3px 0 0 var(--brand); }
.m-wa--paid { background: #F3FBE6; box-shadow: inset 3px 0 0 #A8D65A; font-weight: 600; }
.m-btns { display: flex; gap: .5rem; margin-top: .55rem; }
.m-btn { padding: .3rem .8rem; border-radius: .4rem; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); font-style: normal; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.m-btn--go { background: var(--btn); box-shadow: inset 0 0 0 1px var(--btn-edge); color: #fff; }
.m-lines { margin: 0; padding: 0; list-style: none; border-radius: .55rem; box-shadow: inset 0 0 0 1px var(--line); }
.m-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem .7rem; border-top: 1px solid var(--line); }
.m-lines li:first-child { border-top: 0; }
.m-lines em { font-style: normal; font-size: .8rem; color: var(--faint); white-space: nowrap; }
.m-lines .m-warn { color: #A9431A; }
.m-total { font-weight: 650; }
.m-total em { font-size: .88rem; font-weight: 650; color: var(--ink); }
.m-doc { display: flex; flex-direction: column; gap: .15rem; padding: .85rem .9rem; border-radius: .6rem; box-shadow: inset 0 0 0 1px var(--line); }
.m-doc b { font-size: 1rem; }
.m-doc span { color: var(--muted); }
.m-stamp { display: inline-flex; align-self: flex-start; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: .4rem; background: var(--lime); font-weight: 650; color: var(--ink); transform: rotate(-2deg); }
.m-stamp svg { width: .95rem; height: .95rem; }
.m-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: 0; padding: 0; list-style: none; }
.m-track li { padding: .45rem .5rem; border-radius: .4rem; background: var(--chrome); font-size: .78rem; font-weight: 600; text-align: center; color: var(--faint); }
.m-track li.on { background: #FFF1E8; box-shadow: inset 0 0 0 1px rgba(232, 98, 42, .45); color: #A9431A; }

.st-free { margin: 0; max-width: 46rem; }

/* Short laptop screens: tighter card so it still fits in one view */
@media (min-width: 53.8125em) and (max-height: 50em) {
  .st-card__in { padding: 1.4rem 1.9rem; }
  .st-card h3 { margin-top: .8rem; font-size: clamp(2.2rem, .63rem + 3.08vw, 3.1rem); }
  .st-card__lede { margin-top: .6rem; font-size: 1rem; }
  .st-card__do { margin-top: .9rem; padding-top: .9rem; }
  .st-card__do > div + div { display: none; }
  .st-card .ab-appr { margin-top: .7rem; }
}

@media (max-width: 66.25em) {
  .st-rail a { font-size: 0; gap: 0; }
  .st-rail a span { font-size: .78rem; }
  .st-rail li.on a { font-size: .85rem; gap: .4rem; }
  .st-rail ol { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: auto; justify-content: space-between; }
}

@media (max-width: 53.75em) {
  .st-flow { --rail: 2.9rem; --peek: .4rem; }
  .st-head { grid-template-columns: 1fr; gap: 1.4rem; }
  .st-card__in { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 1rem; height: calc(100svh - var(--top) - 1rem); max-height: 44rem; }
  .st-card h3 { margin-top: .8rem; font-size: 2.3rem; }
  .st-card h3 svg { width: 1.2rem; height: 1.2rem; }
  .st-card__lede { margin-top: .5rem; font-size: .95rem; }
  .st-card__do, .st-card__foot { display: none; }
  .st-card .ab-appr { margin-top: .7rem; }
  .st-card__meta .px { width: 1.8rem; height: 1.8rem; }
  .st-mock { align-self: start; padding: .8rem; font-size: .82rem; gap: .45rem; }
}

/* Very short phones (iPhone SE): a little tighter on top so the example keeps its size */
@media (max-width: 53.75em) and (max-height: 43.75em) {
  .st-card h3 { margin-top: .5rem; font-size: 2rem; }
  .st-card__lede { font-size: .86rem; line-height: 1.4; }
  .st-card .ab-appr { margin-top: .5rem; }
}

@media (max-width: 37.5em) {
  .st-card__in { padding: 1.15rem; }
  .st-card__lede { font-size: .9rem; }
  .m-sheet div { grid-template-columns: 5rem 1fr; }
}

/* Motion, only when the visitor hasn't asked for less */
@media (prefers-reduced-motion: no-preference) {
  .st.armed .m { opacity: 0; transform: translateY(10px); transition: opacity .45s cubic-bezier(.2, .7, .2, 1), transform .45s cubic-bezier(.2, .7, .2, 1); }
  .st.armed .on .m { opacity: 1; transform: none; transition-delay: calc(var(--d) * 650ms + 250ms); }
  .st.armed .on .m-stamp { transform: rotate(-2deg); }
  .st.armed .on .m-btn--go { animation: st-press .5s ease-out both; animation-delay: calc(var(--d) * 650ms + 250ms); }
  .st.armed .on .m-done svg { animation: pop .45s steps(3) both; animation-delay: calc(var(--d) * 650ms + 250ms); }
  .st-rail__bar { transition: transform .25s linear; }
}
@keyframes st-press {
  0% { transform: none; }
  40% { transform: scale(.9); background: var(--lime); color: var(--ink); box-shadow: inset 0 0 0 1px #A8D65A; }
  100% { transform: none; background: var(--lime); color: var(--ink); box-shadow: inset 0 0 0 1px #A8D65A; }
}

/* Reduced motion: a plain list of cards, everything shown */
@media (prefers-reduced-motion: reduce) {
  .st-cards::after { display: none; }
  .st-card { position: static; }
  .st-card + .st-card { margin-top: 1rem; }
  .st-card__in { height: auto; }
  .st-rail { display: none; }
}
