/* The Trick pages (openspec change trick-pages): /tricks/ and /tricks/<slug>/, generated by tools/trick-pages/.
   Loaded after theme/site.css (the shared page styles). Tokens only, Daybreak and Deep Space, 320px wide without
   overflow. Nothing moves by itself: a step fades in only after a press, and never under reduced motion, Pause motion
   (html.motion-paused) or Calm (html.calm, both set before paint from this device's settings). */

/* Breadcrumbs: Home, Speed tricks, the Trick */
.tk-crumbs ol { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); font-size: var(--text-small-size); color: var(--ink-muted); }
.tk-crumbs li + li::before { content: "/"; margin-right: var(--space-2); }
.lv-page .tk-crumbs a { color: var(--ink-muted); }

/* The Sutra line: the Sanskrit name in the sutra purple, the meaning quoted, the 1965 book, the Deep dive link */
.tk-sutra { margin: var(--space-3) 0 0; font-size: var(--text-lede-size); line-height: 1.5; }
.tk-sutra b { font-weight: 700; color: var(--plum-strong); }
.tk-sutra q { font-style: italic; }
.tk-sutra q::before, .tk-sutra q::after { content: none; }
.tk-sutra q::before { content: "\201C"; } .tk-sutra q::after { content: "\201D"; }

/* The calculator card */
.tk-calc { margin: var(--space-6) 0 0; padding: var(--space-5); border: 2px solid var(--plum); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--plum) 10%, var(--card)); }
.lv-page .tk-calc h2 { margin-top: 0 !important; }
.tk-in { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin-top: var(--space-4); }
.tk-in label { display: grid; gap: var(--space-1); font-weight: 700; font-size: var(--text-label-size); min-width: 0; }
.tk-in input { box-sizing: border-box; width: 10em; max-width: 100%; min-height: var(--control-height); padding: var(--space-2) var(--space-3); border: 2px solid var(--edge); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font: 600 var(--text-body-size)/1.3 var(--font-sans); font-variant-numeric: tabular-nums; }
.tk-in input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tk-btns { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tk-err { margin: var(--space-3) 0 0; color: var(--coral-strong); font-weight: 700; }
.tk-err:empty { display: none; }

/* The steps: earlier steps stay, the current one is lifted */
.tk-board { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.tk-board:empty { display: none; }
.tk-step { padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); opacity: .72; }
.tk-step.cur { opacity: 1; border: 2px solid var(--edge); box-shadow: var(--shadow-ledge); }
.tk-show { display: block; font: 700 var(--text-title-size)/1.45 var(--font-sans); font-variant-numeric: tabular-nums; letter-spacing: .02em; overflow-wrap: anywhere; }
.tk-step p { margin: var(--space-1) 0 0; }
.hl { border-radius: var(--radius-2xs); padding: 0 .18em; color: var(--on-accent); }
.hl-coral { background: var(--coral); } .hl-teal { background: var(--teal); } .hl-sky { background: var(--sky); } .hl-sun { background: var(--sun); } .hl-plum { background: var(--plum); }

/* Back, Next, Show all and the polite step line */
.tk-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.tk-nav[hidden] { display: none; } /* until the first steps are drawn (display: flex would override the attribute) */
.tk-at { flex-basis: 100%; margin: 0; font-weight: 700; color: var(--ink-muted); }
.tk-at:empty { display: none; }
.tk-calc .md-btn { min-height: 44px; }
.tk-calc .md-btn[aria-disabled="true"] { opacity: .45; cursor: default; box-shadow: var(--shadow-ledge); transform: none; }
.lv-page a.md-btn--primary { color: var(--on-accent); }
.lv-page a.md-btn:focus-visible, .tk-calc .md-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* A step fades in only after a press (data-moved), never under reduced motion, Pause motion or Calm */
.tk-calc[data-moved] .tk-step.cur { animation: tk-step-in var(--duration-medium) var(--ease-out); }
@keyframes tk-step-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .tk-step { animation: none !important; }
  .tk-calc .md-btn, .lv-page a.md-btn { transition: none; }
  .tk-calc .md-btn:is(:hover, :active), .lv-page a.md-btn:is(:hover, :active) { transform: none; }
}
html.motion-paused .tk-step, html.calm .tk-step { animation: none !important; }
html.motion-paused .tk-calc .md-btn:is(:hover, :active), html.calm .tk-calc .md-btn:is(:hover, :active),
html.motion-paused .lv-page a.md-btn:is(:hover, :active), html.calm .lv-page a.md-btn:is(:hover, :active) { transform: none; }

/* With JavaScript off the worked example stands in for the calculator. With it, the block keeps its place but shows
   only once the module has marked it ready, so a module that failed to load leaves no dead buttons */
@media (scripting: none) { .tk-calc { display: none; } }
.tk-calc:not([data-ready]) { visibility: hidden; }

/* The worked example, written out in full: the board and the sentence of every step */
.tk-steps { margin: var(--space-4) 0 0; padding-left: 1.6em; display: grid; gap: var(--space-3); }
.tk-steps li { padding-left: var(--space-1); }
.tk-steps .tk-say { display: block; margin-top: var(--space-1); }
.tk-practice { margin: var(--space-6) 0 0; }
.lv-page .tk-practice a.md-btn { min-height: 48px; font-size: 1.05rem; }
.tk-more { margin-top: var(--space-5); color: var(--ink-muted); }

/* The index: one card per Trick, named by the Trick's title, with when to use it */
.tk-list { list-style: none; margin: var(--space-5) 0; padding: 0; display: grid; gap: var(--space-3); }
.tk-list li { min-width: 0; padding: var(--space-3) var(--space-4); border: 2px solid var(--edge); border-radius: var(--radius-lg); background: var(--card); overflow-wrap: anywhere; }
.lv-page .tk-list a { font: 600 var(--text-card-title-size)/1.2 var(--display); color: var(--ink); text-decoration-color: var(--plum); }
.lv-page .tk-list a:hover { color: var(--plum-strong); }
.tk-when { display: block; margin-top: var(--space-1); color: var(--ink-muted); }
