/* ==========================================================================
   Field to report (#how)
   One Phase I site visit followed from field notes to a signed report.

   Loaded by index.html only, after styles.css, and depends on its tokens.
   The markup is the finished state: everything here renders complete with no
   JS. fieldreport.js hides it and plays it back, so any rule that sets a
   resting value (--hl, --strike, --p, the flip chips) sets the FINAL value.

   The stage is dark in both themes, like the hero app's sidebar. Its own text
   tones are fixed --fr-* values; the cards sitting on it follow the page theme
   through the normal tokens.
   ========================================================================== */

/* Padding comes from .section-pad, so the seam rule in styles.css halves the
   gap to the tools section below, which shares this page tone */
.fr-section {
  position: relative;
}

/* Wider than .container: three columns need the room */
.fr-wrap {
  width: min(1400px, 100% - var(--gutter) * 2);
  margin-inline: auto;
}

.fr {
  --fr-stage: #0a2a21;
  --fr-ink: #eaf3ee;
  --fr-ink-2: rgba(234, 243, 238, 0.76);
  --fr-ink-3: rgba(234, 243, 238, 0.58);
  --fr-line: rgba(234, 243, 238, 0.12);
  --fr-line-2: rgba(234, 243, 238, 0.22);
  --fr-glow: #5fd3a2;
  --fr-glow-2: #7cc8ee;
  --fr-warm: #f5c86a;
  --fr-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Surfaces on the stage follow the page theme */
  --fr-card: var(--bg-elev);
  --fr-well: var(--bg-sunken);
  --fr-pen: #24448c;
  --fr-hl-c: rgba(245, 200, 106, 0.62);
  --fr-skel-rgb: 8, 36, 28;

  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(14px, 2vw, 28px);
  border-radius: var(--r-xl);
  background:
    radial-gradient(110% 80% at 0% 0%, rgba(53, 185, 113, 0.17), transparent 55%),
    radial-gradient(90% 70% at 100% 100%, rgba(27, 145, 190, 0.15), transparent 60%),
    var(--fr-stage);
  color: var(--fr-ink);
  box-shadow:
    0 2px 4px rgba(8, 36, 28, 0.06),
    0 40px 90px -30px rgba(8, 36, 28, 0.5);
}

/* Faint survey grid, fading out toward the edges */
.fr::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(234, 243, 238, 0.1) 1px, transparent 1.3px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 35%, transparent 100%);
  pointer-events: none;
}

:root[data-theme="dark"] .fr {
  --fr-stage: #0c251d;
  --fr-pen: #a9c2ff;
  --fr-hl-c: rgba(240, 201, 79, 0.3);
  --fr-skel-rgb: 234, 243, 238;
  box-shadow:
    0 0 0 1px var(--fr-line),
    0 40px 90px -30px rgba(0, 0, 0, 0.7);
}

/* Focus rings: the stage is dark, so the brand green ring would disappear */
.fr-bar :focus-visible {
  outline-color: var(--fr-glow);
}

.fr-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Chapter bar
   -------------------------------------------------------------------------- */

.fr-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "steps ctrls";
  align-items: start;
  gap: var(--s-3) var(--s-4);
  margin-bottom: clamp(16px, 2vw, 24px);
}

.fr-steps {
  grid-area: steps;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fr-steps li {
  display: flex;
}

.fr-step {
  --p: 1;
  position: relative;
  display: grid;
  align-content: start;
  gap: 3px;
  width: 100%;
  padding: 10px 12px 16px;
  border-radius: var(--r-md);
  color: var(--fr-ink-3);
  text-align: left;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.fr-step:hover {
  background: rgba(234, 243, 238, 0.05);
  color: var(--fr-ink-2);
}

.fr-step[aria-current="step"] {
  background: rgba(234, 243, 238, 0.07);
  color: var(--fr-ink);
}

.fr-step-top {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}

.fr-step-num {
  color: var(--fr-glow);
  font: 600 11px/1 var(--fr-mono);
  letter-spacing: 0.04em;
}

.fr-step-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.012em;
}

.fr-step-desc {
  font-size: 12.5px;
  line-height: 1.42;
}

.fr-step-track {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--fr-line);
  overflow: hidden;
}

.fr-step-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--fr-glow), var(--fr-glow-2));
  transform: scaleX(var(--p));
  transform-origin: left;
}

.fr-now {
  display: none;
  grid-area: now;
  align-self: center;
  color: var(--fr-ink-2);
  font-size: 13px;
  line-height: 1.4;
}

.fr-ctrls {
  grid-area: ctrls;
  display: flex;
  gap: var(--s-2);
  padding-top: 6px;
}

.fr-ctrl {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--fr-line-2);
  border-radius: 50%;
  background: rgba(234, 243, 238, 0.04);
  color: var(--fr-ink);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}

.fr-ctrl:hover {
  background: rgba(234, 243, 238, 0.1);
  border-color: rgba(234, 243, 238, 0.36);
}

.fr-ctrl svg {
  width: 16px;
  height: 16px;
}

.fr-i-pause,
.fr.is-playing .fr-i-play {
  display: none;
}

.fr.is-playing .fr-i-pause {
  display: block;
}

/* Without JS, or without GSAP, there is nothing to play */
.fr-ctrls,
.fr.is-static .fr-ctrls {
  visibility: hidden;
}

.fr.is-ready .fr-ctrls {
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Canvas: three columns, wires behind, flying chips above
   -------------------------------------------------------------------------- */

.fr-canvas {
  --aura-x: 50%;
  --aura-w: 70%;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: clamp(36px, 4vw, 56px);
  align-items: start;
}

.fr-aura {
  position: absolute;
  z-index: 0;
  top: -12%;
  bottom: -12%;
  left: var(--aura-x);
  width: var(--aura-w);
  translate: -50% 0;
  background: radial-gradient(closest-side, rgba(95, 211, 162, 0.15), transparent);
  pointer-events: none;
  transition: left 900ms var(--ease), width 900ms var(--ease);
}

.fr-wires {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.fr-fly {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.fr-col {
  position: relative;
  z-index: 2;
  min-width: 0;
  transition: opacity 700ms var(--ease), filter 700ms var(--ease);
}

/* While the demo runs, the camera follows the work: columns not involved in
   the current chapter step back into the dark. Dimmed with a filter rather
   than opacity, because light cards at partial opacity over the green turn
   muddy. Wide layout only; narrow screens show one column at a time. */
@media (min-width: 1060px) {
  .fr.is-live .fr-col {
    filter: brightness(0.5) saturate(0.55);
  }

  .fr.is-live[data-chapter="0"] .fr-col-field,
  .fr.is-live[data-chapter="1"] .fr-col-field,
  .fr.is-live[data-chapter="1"] .fr-col-record,
  .fr.is-live[data-chapter="2"] .fr-col-record,
  .fr.is-live[data-chapter="2"] .fr-col-report,
  .fr.is-live[data-chapter="3"] .fr-col,
  .fr.is-live.is-tracing .fr-col {
    filter: none;
  }
}

/* Column heads sit on the dark stage */
.fr-col-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin-bottom: var(--s-3);
}

.fr-col-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--fr-line);
  border-radius: 10px;
  background: rgba(234, 243, 238, 0.07);
  color: var(--fr-glow);
}

.fr-col-icon svg {
  width: 17px;
  height: 17px;
}

.fr-col-logo {
  background: rgba(255, 255, 255, 0.94);
  border-color: transparent;
}

.fr-col-logo img {
  width: 20px;
  height: 20px;
}

.fr-col-title {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.fr-col-title strong {
  color: var(--fr-ink);
  font-size: 14px;
  letter-spacing: -0.01em;
}

.fr-col-title small {
  overflow: hidden;
  color: var(--fr-ink-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fr-sync,
.fr-state,
.fr-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--fr-line-2);
  border-radius: var(--r-pill);
  color: var(--fr-ink-2);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.fr-sync i,
.fr-state::before,
.fr-hint i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fr-glow);
  box-shadow: 0 0 0 3px rgba(95, 211, 162, 0.2);
}

.fr-state::before {
  content: "";
}

.fr-state span {
  display: none;
}

.fr[data-chapter="0"] .fr-state [data-for="0"],
.fr[data-chapter="1"] .fr-state [data-for="1"],
.fr[data-chapter="2"] .fr-state [data-for="2"],
.fr[data-chapter="3"] .fr-state [data-for="3"] {
  display: inline;
}

.fr.is-done .fr-state {
  border-color: rgba(95, 211, 162, 0.45);
  color: var(--fr-glow);
}

/* The hint only means something once there is a finished report to trace */
.fr-hint {
  display: none;
}

.fr.is-ready .fr-hint {
  display: inline-flex;
}

@media (prefers-reduced-motion: no-preference) {
  .fr.is-playing .fr-sync i,
  .fr.is-playing .fr-state::before,
  .fr.is-done .fr-hint i {
    animation: frPulse 1.4s ease-in-out infinite;
  }
}

@keyframes frPulse {
  50% {
    box-shadow: 0 0 0 6px rgba(95, 211, 162, 0);
  }
}

/* --------------------------------------------------------------------------
   Shared card chrome
   -------------------------------------------------------------------------- */

.fr-card,
.fr-panel,
.fr-paper {
  background: var(--fr-card);
  color: var(--ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 18px 36px -16px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.16);
}

.fr-stack {
  display: grid;
  gap: 10px;
}

.fr-card {
  padding: 10px 12px 12px;
  border-radius: var(--r-md);
}

.fr-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: 8px;
}

.fr-card-head span {
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.fr-card-head em {
  color: var(--ink-3);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.fr-count {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Highlighter. Drawn as a background so a sweep follows the text across line
   wraps; --hl is the sweep, at rest it is fully drawn. */
.fr-hl {
  --hl: 100%;
  padding: 0 2px;
  margin: 0 -2px;
  border-radius: 3px;
  background: linear-gradient(var(--fr-hl-c), var(--fr-hl-c)) no-repeat 0 70% / var(--hl) 62%;
  color: inherit;
  transition: box-shadow var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}

/* Field notes */
.fr-note-lines {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--fr-pen);
  font-family: var(--font-script);
  font-size: 18.5px;
  font-weight: 600;
  line-height: 1.2;
}

.fr-note-lines li {
  padding: 2px 0 1px;
  border-bottom: 1px solid var(--line);
}

.fr-note-lines li:last-child {
  border-bottom: 0;
}

.fr-ink {
  display: inline-block;
}

/* Photos */
.fr-thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.fr-thumb {
  /* --pulse belongs to the timeline, --ring to tracing; kept apart so the
     inline value GSAP leaves behind never blocks the class */
  --ring: 0;
  --pulse: 0;
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 7px;
  background: var(--fr-well);
}

.fr-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px var(--brand);
  opacity: max(var(--ring), var(--pulse));
}

.fr-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fr-thumb figcaption {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(8, 36, 28, 0.66);
  color: #fff;
  font: 600 9.5px/1 var(--fr-mono);
}

.fr-thumb-more {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-2);
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}

/* Agency records */
.fr-rec-rows {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}

.fr-rec-rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 4px 5px 4px 9px;
  border-radius: 8px;
  background: var(--fr-well);
}

/* Two-state chips. At rest the second state shows. */
.fr-flip {
  display: inline-grid;
  flex: none;
  overflow: hidden;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.fr-flip > span {
  grid-area: 1 / 1;
  padding: 4px 8px;
  text-align: center;
}

.fr-flip-a {
  background: var(--warn-tint);
  color: var(--warn-ink);
  visibility: hidden;
}

.fr-flip-b {
  background: var(--brand-tint);
  color: var(--brand-ink);
}

/* Historical sources */
.fr-hist {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
  line-height: 1.4;
}

.fr-aerial {
  display: block;
  width: 58px;
  height: 44px;
  border-radius: 6px;
  filter: sepia(0.35);
}

.fr-hist-sub {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11.5px;
}

/* --------------------------------------------------------------------------
   Envee project record
   -------------------------------------------------------------------------- */

.fr-panel {
  overflow: hidden;
  border-radius: var(--r-lg);
}

.fr-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.fr-record-head span {
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fr-record-head strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.fr-record-head em {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.fr-map {
  margin: 10px 12px 2px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--fr-well);
}

.fr-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.fr-map-road {
  fill: var(--line);
}

.fr-map-label {
  fill: var(--ink-3);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.fr-map-parcel {
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.fr-map-bldg rect {
  fill: var(--bg-elev);
  stroke: var(--ink-3);
  stroke-width: 1;
}

.fr-map-bldg path {
  fill: none;
  stroke: var(--line-2);
}

.fr-map-unit {
  fill: var(--warn-tint);
  stroke: var(--warn-ink);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.fr-map-pad {
  fill: var(--ink-3);
}

.fr-map-north path {
  fill: var(--ink-3);
}

.fr-map-north text {
  fill: var(--ink-3);
  font-size: 7px;
  font-weight: 700;
}

.fr-pin circle {
  fill: var(--brand);
  stroke: var(--bg-elev);
  stroke-width: 2;
  transition: stroke var(--dur-2) var(--ease), stroke-width var(--dur-2) var(--ease);
}

.fr-pin text {
  fill: var(--on-brand);
  font-size: 6.5px;
  font-weight: 800;
}

.fr-facts {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 6px 6px 6px;
  list-style: none;
}

.fr-fact {
  --flash: 0;
  --pulse: 0;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 9px;
  background-color: rgba(95, 211, 162, calc(max(var(--flash), var(--pulse)) * 0.18));
  background-image: linear-gradient(var(--fr-skel), var(--fr-skel));
  background-repeat: no-repeat;
  background-position: 25px 50%;
  background-size: 58% 8px;
  font-size: 12.5px;
  line-height: 1.32;
  transition: box-shadow var(--dur-2) var(--ease), filter var(--dur-2) var(--ease);
}

.fr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fr-cat, var(--brand));
}

.fr-fact[data-cat="site"] {
  --fr-cat: var(--accent);
}

.fr-fact[data-cat="history"] {
  --fr-cat: var(--warn-ink);
}

.fr-fact[data-cat="records"] {
  --fr-cat: var(--ink-3);
}

.fr-tags {
  display: flex;
  gap: 4px;
}

.fr-src,
.fr-flag {
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.fr-src {
  background: var(--fr-well);
  color: var(--ink-3);
}

.fr-flag {
  background: var(--warn-tint);
  color: var(--warn-ink);
  font-weight: 750;
}

.fr-record-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11.5px;
}

.fr-record-foot b {
  margin-right: 2px;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Skeletons: the empty slots in the record and the report template, there
   from the first frame so the stage is never a void. --skel is 1 while a slot
   waits for data and 0 once filled. At rest (no JS) every slot is filled.
   -------------------------------------------------------------------------- */

.fr-fact,
.fr-doc-meta dd,
.fr-doc-sec p,
.fr-doc-findings tr,
.fr-log figure {
  --skel: 0;
  --fr-skel: rgba(var(--fr-skel-rgb), calc(var(--skel) * 0.09));
}

.fr-doc-meta dd {
  background: linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 0 55% / 100% 8px;
}

/* One bar per line of text: line-height is 11.5px x 1.5 */
.fr-doc-sec p {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 5px,
    var(--fr-skel) 5px 12px,
    transparent 12px 17.25px
  );
}

.fr-doc-findings td {
  background: linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 0 50% / 72% 7px;
}

.fr-doc-findings td:last-child {
  background-position: 100% 50%;
  background-size: 60px 14px;
}

.fr-log figure {
  background:
    linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 0 50% / 52px 39px,
    linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 59px calc(50% - 6px) / 55% 6px,
    linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 59px calc(50% + 6px) / 35% 6px;
}

/* --------------------------------------------------------------------------
   The report
   -------------------------------------------------------------------------- */

.fr-paper {
  position: relative;
  padding: 14px 18px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
}

/* The pages underneath, so it reads as a document and not a card */
.fr-paper::before,
.fr-paper::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 6px;
  background: var(--fr-card);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.6);
}

.fr-paper::before {
  inset: 7px -7px -7px 7px;
  opacity: 0.55;
}

.fr-paper::after {
  inset: 14px -14px -14px 14px;
  opacity: 0.28;
}

.fr-doc-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  margin-bottom: 9px;
  border-bottom: 2px solid var(--brand);
}

.fr-doc-firm {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px dashed var(--line-2);
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-align: center;
}

.fr-doc-title strong {
  display: block;
  font-size: 12.5px;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.fr-doc-title span {
  color: var(--ink-3);
  font-size: 11px;
}

.fr-doc-status .fr-flip-a {
  background: var(--fr-well);
  color: var(--ink-3);
}

.fr-doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 0 0 9px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--fr-well);
}

.fr-doc-meta div {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.fr-doc-meta dt {
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fr-doc-meta dd {
  margin: 0;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.45;
}

.fr-doc-sec {
  margin-bottom: 7px;
}

.fr-doc-sec h3 {
  margin-bottom: 1px;
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.4;
}

.fr-doc-sec p {
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.5;
}

.fr-w {
  display: inline-block;
}

/* Citations: small, but the hit area is padded out for touch */
.fr-cite {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  margin: 0 1px 0 3px;
  padding: 0 3px;
  border-radius: 4px;
  background: var(--brand-tint);
  color: var(--brand-ink);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  vertical-align: 1px;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.fr-cite::after {
  content: "";
  position: absolute;
  inset: -8px -4px;
}

.fr-cite:hover,
.fr-cite.is-lit {
  background: var(--brand);
  color: var(--on-brand);
}

.fr-doc-findings table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.fr-doc-findings th {
  padding: 3px 6px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.fr-doc-findings td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  transition: background var(--dur-2) var(--ease);
}

.fr-doc-findings th:first-child,
.fr-doc-findings td:first-child {
  padding-left: 0;
}

.fr-doc-findings td:nth-child(2) {
  color: var(--brand-ink);
  font-size: 10.5px;
  font-weight: 750;
}

.fr-doc-findings th:last-child,
.fr-doc-findings td:last-child {
  padding-right: 0;
  text-align: right;
}

.fr-doc-findings .fr-flip {
  font-size: 10px;
}

.fr-log {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 3px;
}

.fr-log figure {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin: 0;
}

.fr-log svg {
  display: block;
  width: 52px;
  height: 39px;
  border-radius: 4px;
  transition: box-shadow var(--dur-2) var(--ease);
}

.fr-log figcaption {
  color: var(--ink-3);
  font-size: 9.5px;
  line-height: 1.3;
}

.fr-sign {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* Direct children only: the signature and the stamp carry spans of their own */
.fr-sign div > span {
  display: block;
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fr-sig {
  display: block;
  min-width: 150px;
  margin: 1px 0 2px;
  border-bottom: 1px dashed var(--line-2);
  color: var(--fr-pen);
  font-family: var(--font-script);
  font-size: 25px;
  font-weight: 600;
  line-height: 1;
}

.fr-sig span {
  display: inline-block;
}

.fr-sign small {
  display: block;
  color: var(--ink-3);
  font-size: 10.5px;
}

.fr-stamp {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  margin-right: 4px;
  padding: 4px 9px 5px;
  border: 2px solid var(--brand);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px var(--fr-card), inset 0 0 0 2.5px var(--brand);
  color: var(--brand);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-transform: uppercase;
  opacity: 0.9;
  rotate: -8deg;
}

.fr-stamp b {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

/* Source popover for a pinned or focused citation */
.fr-pop {
  position: absolute;
  z-index: 5;
  left: 0;
  top: 0;
  max-width: 230px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg-inverse);
  color: var(--ink-inverse);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: var(--shadow-2);
  pointer-events: none;
}

.fr-pop::before {
  content: "Source";
  display: block;
  color: var(--fr-glow);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root[data-theme="dark"] .fr-pop {
  background: #eaf3ee;
  color: #08241c;
}

:root[data-theme="dark"] .fr-pop::before {
  color: #11684f;
}

/* Output row under the paper, on the stage */
.fr-out {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.fr-out-chip,
.fr-out-sent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

.fr-out-chip {
  padding: 6px 10px;
  border: 1px solid rgba(95, 211, 162, 0.4);
  border-radius: var(--r-pill);
  background: rgba(95, 211, 162, 0.12);
  color: var(--fr-ink);
}

.fr-out-chip i,
.fr-out-sent i {
  width: 12px;
  height: 12px;
  background: var(--fr-glow);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.fr-out-file {
  display: grid;
  color: var(--fr-ink-2);
  font: 600 11px/1.3 var(--fr-mono);
}

.fr-out-file small {
  color: var(--fr-ink-3);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 500;
}

.fr-out-sent {
  margin-left: auto;
  color: var(--fr-glow);
}

/* --------------------------------------------------------------------------
   Wires and things in flight (built by fieldreport.js)
   -------------------------------------------------------------------------- */

.fr-wire {
  fill: none;
  stroke: var(--fr-glow);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.42;
  transition: opacity var(--dur-2) var(--ease), stroke-width var(--dur-2) var(--ease);
}

.fr-wire-sync {
  stroke-dasharray: 2 5;
  opacity: 0.5;
}

.fr-port {
  fill: var(--fr-stage);
  stroke: var(--fr-glow);
  stroke-width: 1.5;
}

.fr-packet {
  fill: #ffffff;
  filter: drop-shadow(0 0 3px var(--fr-glow)) drop-shadow(0 0 6px rgba(95, 211, 162, 0.7));
}

.fr-ghost {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--r-pill);
  background: #effcf5;
  color: #0a3d2e;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(95, 211, 162, 0.7),
    0 10px 26px -6px rgba(95, 211, 162, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.3);
}

.fr-ghost::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1f9d6c;
}

.fr-ghost-photo {
  padding: 0;
  overflow: hidden;
  border-radius: 7px;
  transform-origin: 0 0;
}

.fr-ghost-photo::before {
  display: none;
}

.fr-ghost-photo svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Tracing: a citation lights up everything it came from
   -------------------------------------------------------------------------- */

.fr .fr-hl.is-lit {
  box-shadow: 0 0 0 2px var(--brand);
}

.fr .fr-thumb.is-lit {
  --ring: 1;
}

.fr .fr-fact.is-lit {
  box-shadow: inset 0 0 0 1.5px var(--brand);
  --flash: 0.7;
}

.fr .fr-pin.is-lit circle {
  stroke: var(--warm-solid);
  stroke-width: 3.5;
}

.fr .fr-map-unit.is-lit {
  stroke-width: 2;
}

.fr .fr-wire.is-lit {
  opacity: 1;
  stroke-width: 2.4;
}

.fr .fr-doc-findings tr.is-lit td {
  background: var(--brand-tint);
}

.fr .fr-log figure.is-lit svg {
  box-shadow: 0 0 0 2px var(--brand);
}

.fr.is-tracing .fr-wire:not(.is-lit) {
  opacity: 0.1;
}

.fr.is-tracing :is(.fr-fact, .fr-thumb, .fr-log figure):not(.is-lit) {
  filter: opacity(0.4);
}

/* --------------------------------------------------------------------------
   Ledger: the old way, struck through chapter by chapter
   -------------------------------------------------------------------------- */

.fr-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.08fr);
  gap: 10px;
  margin: clamp(14px, 1.6vw, 20px) 0 0;
  padding: clamp(12px, 1.2vw, 14px) 0 0;
  border-top: 1px solid var(--fr-line);
  list-style: none;
}

.fr-led {
  --on: 1;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 8px 12px 9px;
  border: 1px solid rgba(234, 243, 238, calc(0.04 + var(--on) * 0.06));
  border-radius: var(--r-md);
  background: rgba(95, 211, 162, calc(var(--on) * 0.06));
  font-size: 12.5px;
  line-height: 1.38;
}

.fr-led-k {
  color: var(--fr-ink-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fr-led-before {
  display: block;
  color: var(--fr-ink-3);
}

/* Inline, so the strike is drawn per line when the text wraps */
.fr-led-text {
  --strike: 100%;
  background: linear-gradient(var(--fr-ink-3), var(--fr-ink-3)) no-repeat 0 58% / var(--strike) 1.5px;
}

.fr-led-before em {
  display: block;
  margin-top: 1px;
  color: var(--fr-warm);
  font-size: 11.5px;
  font-style: normal;
  font-weight: 650;
}

.fr-led-after {
  color: var(--fr-glow);
  font-weight: 700;
}

.fr-led-total {
  align-content: center;
  border-color: rgba(95, 211, 162, calc(0.1 + var(--on) * 0.25));
  background: rgba(95, 211, 162, calc(0.03 + var(--on) * 0.09));
}

.fr-led-num {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: var(--fr-ink);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}

.fr-led-num b {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.fr-led-num small {
  margin-left: 4px;
  color: var(--fr-ink-2);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.fr-led-note {
  color: var(--fr-ink-3);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Under the stage
   -------------------------------------------------------------------------- */

.fr-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4) var(--s-6);
  margin-top: var(--s-6);
  padding-inline: var(--s-1);
}

.fr-foot p {
  max-width: 62ch;
  color: var(--ink-3);
  font-size: var(--t-sm);
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Mid widths: tighten before the layout changes
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .fr-step-desc {
    font-size: 12px;
  }

  .fr-ledger {
    grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1fr);
  }
}

/* Three columns at their tightest. Every pixel goes to the cards. */
@media (min-width: 1060px) and (max-width: 1240px) {
  .fr {
    padding: 20px;
  }

  .fr-canvas {
    gap: 36px;
  }

  /* Subtitles would only truncate beside the status pills */
  .fr-col-title small {
    display: none;
  }

  /* Source tags drop under the fact so the text keeps a full line */
  .fr-fact {
    grid-template-columns: 8px minmax(0, 1fr);
    row-gap: 3px;
  }

  .fr-tags {
    grid-column: 2;
  }

  .fr-log figure {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 3px;
    background:
      linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 0 0 / 100% 66%,
      linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 0 100% / 80% 6px;
  }

  .fr-log svg {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* --------------------------------------------------------------------------
   Narrow: one column at a time, following the chapter
   -------------------------------------------------------------------------- */

@media (max-width: 1059px) {
  .fr-canvas {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-6);
    max-width: 540px;
    margin-inline: auto;
  }

  .fr-wires,
  .fr-fly,
  .fr-aura {
    display: none;
  }

  /* With JS the columns share one cell and swap; without it they simply stack */
  .fr.is-ready .fr-col,
  .fr.is-static .fr-col {
    grid-area: 1 / 1;
    visibility: hidden;
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 420ms var(--ease), transform 420ms var(--ease), visibility 0s linear 420ms;
  }

  .fr.is-ready[data-chapter="0"] .fr-col-field,
  .fr.is-ready[data-chapter="1"] .fr-col-record,
  .fr.is-ready[data-chapter="2"] .fr-col-report,
  .fr.is-ready[data-chapter="3"] .fr-col-report,
  .fr.is-static[data-chapter="0"] .fr-col-field,
  .fr.is-static[data-chapter="1"] .fr-col-record,
  .fr.is-static[data-chapter="2"] .fr-col-report,
  .fr.is-static[data-chapter="3"] .fr-col-report {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
  }

  .fr-ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fr-led-total {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--s-4);
  }

  .fr-led-total .fr-led-k {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .fr-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "now ctrls"
      "steps steps";
  }

  .fr-now {
    display: block;
  }

  .fr-step {
    padding: 8px 8px 14px;
  }

  .fr-step-name {
    font-size: 13px;
  }

  .fr-step-desc {
    display: none;
  }

  .fr-step-top {
    display: grid;
    gap: 3px;
  }

  .fr-step-track {
    left: 8px;
    right: 8px;
  }

  .fr-col-head {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .fr {
    border-radius: var(--r-lg);
  }

  .fr-steps {
    gap: 4px;
  }

  .fr-step {
    padding-inline: 6px;
  }

  .fr-step-track {
    left: 6px;
    right: 6px;
  }

  .fr-ledger {
    gap: 8px;
  }

  .fr-led {
    padding: 9px 10px 10px;
    font-size: 12px;
  }

  .fr-led-num {
    font-size: 30px;
  }

  /* Photo log: picture over caption, there is no room beside it */
  .fr-log figure {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 4px;
  }

  .fr-log svg {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .fr-log figure {
    background:
      linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 0 0 / 100% 72%,
      linear-gradient(var(--fr-skel), var(--fr-skel)) no-repeat 0 100% / 80% 6px;
  }

  .fr-paper {
    padding: 14px 14px 12px;
  }

  .fr-paper::after {
    display: none;
  }

  .fr-paper::before {
    inset: 6px -5px -6px 5px;
  }

  .fr-doc-meta {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .fr-doc-meta div:first-child {
    grid-column: 1 / -1;
  }

  .fr-out-sent {
    margin-left: 0;
  }
}

@media print {
  .fr-ctrls,
  .fr-wires,
  .fr-fly,
  .fr-aura {
    display: none !important;
  }
}
