/* Focus mode: chunks, targets, attention anchors and the article map (static/focus-guide.js).
   Calm on purpose: small sans labels, one accent, no alarms. */
:root {
  --fx-row: 38px;
  /* Fixed bars line their content up with the text column of .prose. */
  --fx-pad-l: max(var(--gutter), calc((100% - 680px) / 2), env(safe-area-inset-left));
  --fx-pad-r: max(var(--gutter), calc((100% - 680px) / 2), env(safe-area-inset-right));
}

.fx-tag {
  font: 600 10px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Cues before a section (one .fx-head per section) ---------- */
.prose > .fx-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 2.4em 0 1.1em;
  font-family: var(--sans);
}
.prose > .fx-head:first-child,
.prose > h2 + .fx-head,
.prose > h3 + .fx-head { margin-top: 0; }

.fx-seg { display: flex; flex-direction: column; gap: 4px; }
.fx-seg[aria-hidden="true"] { width: 32px; border-top: 2px solid var(--line-strong); }
.fx-seg-label {
  font: 600 11px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.prose .fx-seg-gist { margin: 0; font-weight: 600; font-size: 0.95em; line-height: 1.4; color: var(--fg); }

.fx-target { padding: 1px 0 2px 14px; border-left: 2px solid var(--accent); }
.prose .fx-target-q { margin: 4px 0 0; font-size: 0.9em; line-height: 1.4; color: var(--fg); }

.prose .fx-before {
  margin: 0;
  padding-left: 14px;
  border-left: 2px solid var(--line-strong);
  font-size: 0.85em;
  line-height: 1.45;
  color: var(--soft);
}

/* ---------- Check after a section ---------- */
.prose > .fx-check {
  margin: 1.8em 0 2.2em;
  padding: 18px 20px 20px;
  border-radius: 14px;
  background: var(--surface);
  font-family: var(--sans);
}
.prose .fx-check p { margin: 0; }
.prose .fx-check-q { font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--fg); }
.prose .fx-check-ask { margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.fx-check-q + .fx-reveal { margin-top: 14px; }

.fx-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.fx-choice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: 15px/1.45 var(--sans);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, opacity 0.2s;
}
.fx-choice:hover:not(:disabled) { border-color: var(--fg); color: var(--fg); }
.fx-choice:disabled { cursor: default; }
.fx-choice svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }
.fx-check.is-done .fx-choice { opacity: 0.45; }
.fx-check.is-done .fx-choice.is-picked { opacity: 0.7; border-style: dashed; }
.fx-check.is-done .fx-choice.is-right { opacity: 1; border-color: var(--accent); border-style: solid; color: var(--fg); }

.fx-reveal {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font: 600 11px/1.2 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.fx-reveal:hover { border-color: var(--accent); color: var(--accent); }

.fx-check-note { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.fx-check-note:empty { display: none; }
.fx-check-note:focus { outline: none; }
.prose .fx-check-lead { font-size: 15px; line-height: 1.45; color: var(--fg); }
.prose .fx-check-sum { font-size: 15px; line-height: 1.45; color: var(--soft); }
.fx-check-sum .fx-tag { color: var(--muted); }

/* ---------- Fixed bars: the map, or the target line when the map is off ---------- */
.fx-dock {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 39;
  padding: env(safe-area-inset-top) var(--fx-pad-r) 0 var(--fx-pad-l);
  background: rgba(11, 11, 11, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: transform 0.22s ease;
}
/* Right under the reading bar while it is shown (the bar covers our safe-area padding). */
html.fx-under .fx-dock { transform: translateY(calc(var(--reading-h) + 3px)); }

.fx-target-line,
.fx-map-target {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.fx-target-line { padding-top: calc(env(safe-area-inset-top) + 8px); padding-bottom: 9px; visibility: hidden; opacity: 0; transition: transform 0.22s ease, opacity 0.15s, visibility 0s linear 0.15s; }
.fx-target-line.is-shown { visibility: visible; opacity: 1; transition: transform 0.22s ease, opacity 0.15s, visibility 0s; }
.fx-target-line .fx-tag, .fx-map-target .fx-tag { flex-shrink: 0; }
.fx-target-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font: 500 13px/1.35 var(--sans);
  color: var(--soft);
}

/* Map: keep the header clear while the page is at the top. */
html.fx-map-on body { padding-top: calc(var(--fx-row) + 1px + env(safe-area-inset-top)); }
html.fx-map-on main.post [id], html.fx-map-on .post .related {
  scroll-margin-top: calc(var(--reading-h) + 3px + var(--fx-row) + 1px + env(safe-area-inset-top));
}
.fx-map-row { display: flex; height: var(--fx-row); }
.fx-map-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 13px/1 var(--sans);
  text-align: left;
  cursor: pointer;
}
.fx-map-toggle:focus-visible { outline-offset: -2px; border-radius: 4px; }
.fx-map-count {
  flex-shrink: 0;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.fx-map-count::after { content: "\00b7"; margin-left: 10px; color: var(--muted); }
.fx-map-trail { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; }
.fx-map-step { min-width: 1.5em; overflow: hidden; text-overflow: ellipsis; }
.fx-map-step.is-current {
  flex-shrink: 0;
  max-width: 62%;
  color: var(--fg);
  font-weight: 600;
  text-decoration: underline 2px var(--accent);
  text-underline-offset: 6px;
}
.fx-map-arrow, .fx-map-more { flex-shrink: 0; color: var(--line-strong); }
.fx-map-more { color: var(--muted); }
.fx-map-toggle > svg { flex-shrink: 0; color: var(--muted); transition: transform 0.2s, color 0.15s; }
.fx-map-toggle:hover > svg, .fx-map-bar.is-open .fx-map-toggle > svg { color: var(--fg); }
.fx-map-bar.is-open .fx-map-toggle > svg { transform: rotate(180deg); }

.fx-map-target { display: none; padding-bottom: 9px; }
.fx-map-target.is-shown { display: flex; }

.fx-map-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--reading-h) - var(--fx-row) - 48px);
  max-height: calc(100dvh - var(--reading-h) - var(--fx-row) - 48px - env(safe-area-inset-top));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px var(--fx-pad-r) 16px var(--fx-pad-l);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 24px 48px rgb(0 0 0 / 0.55);
}
.fx-map-list[hidden] { display: none; }
.fx-map-list ol { list-style: none; margin: 0; padding: 0; }
.fx-map-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-left: 2px solid transparent;
  background: none;
  color: var(--soft);
  font: 15px/1.35 var(--sans);
  text-align: left;
  cursor: pointer;
}
.fx-map-item:hover { background: var(--surface); color: var(--fg); }
.fx-map-item:focus-visible { outline-offset: -2px; }
.fx-map-item[aria-current] { border-left-color: var(--accent); color: var(--fg); }
.fx-map-num { flex-shrink: 0; min-width: 1.4em; font: 600 12px/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); }
.fx-map-words { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fx-map-name { font-weight: 600; overflow-wrap: anywhere; }
.fx-map-q { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 600px) {
  :root { --fx-row: 36px; }
  .fx-map-toggle { gap: 8px; font-size: 12.5px; }
  .fx-map-count::after { margin-left: 8px; }
  .fx-map-trail { gap: 6px; }
  .prose > .fx-check { padding: 16px 16px 18px; border-radius: 12px; }
  .prose .fx-check-q { font-size: 16px; }
  .fx-map-item { padding: 10px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-dock, .fx-target-line, .fx-target-line.is-shown, .fx-choice, .fx-reveal, .fx-map-toggle > svg { transition: none; }
}
@media print {
  .fx-dock { display: none; }
  html.fx-map-on body { padding-top: 0; }
  .fx-choices, .fx-reveal { display: none; }
}
