/* Ways to Learn From Users — the two-chart research/validation tool, re-skinned
   to Golden Hour. Scoped under .lfu; shared chrome (intro, segmented toggle,
   panel, chips, meter, facts, fallback list, footnote) comes from resources.css.

   Golden Hour rules honored here: honey/--teal is STRUCTURAL only — dots, axes,
   quadrant rules, the break-even diagonal, the meter track fill. --clay is the
   text-safe accent and marks the SELECTED dot/label. Category is carried by a
   colorblind-safe SHAPE channel (circle = qualitative, square = quantitative,
   diamond = straddles both), matching the legend. No teal/honey as text. */

.lfu { --lfu-plot-bg: #fff; --lfu-line: var(--hair); --lfu-axis: var(--border); }

/* ── no-JS / has-JS surface swapping ──────────────────────────────────────────
   Before JS runs the root carries .no-js, so the interactive-only toggle + chart
   never flash empty; the fallback list + a default detail carry the page. JS
   swaps to .has-js. On narrow viewports the chart collapses to the same list. */
.lfu-tool { margin-top: 24px; padding-top: 44px; }

.lfu-graphbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: clamp(18px, 3vw, 28px);
}
.lfu.no-js .lfu-graphbar { display: none; }

.lfu-viewnote {
  flex: 1 1 260px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.lfu-charts { display: flex; flex-direction: column; align-items: center; width: 100%; }
.lfu-charts > * { width: 100%; }
.lfu.no-js .lfu-charts { display: none; }
@media (min-width: 1000px) { .lfu-charts { min-height: 860px; justify-content: center; } }

.lfu-list { display: none; }
.lfu.no-js .lfu-list { display: flex; }
@media (max-width: 760px) {
  .lfu.has-js .lfu-charts { display: none; }
  .lfu.has-js .lfu-list { display: flex; }
}

/* ── Segmented toggle dots (decorative view hints) ────────────────────────── */
.lfu-seg { flex-wrap: wrap; }
.lfu-seg-btn { display: inline-flex; align-items: center; gap: 9px; }
.lfu-seg-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lfu-seg-dot[data-view="landscape"] { background: var(--honey); }
.lfu-seg-dot[data-view="curve"] { background: linear-gradient(90deg, var(--honey), var(--amber)); }

/* ══ Shared plot chrome (both charts render a .rt … .lfu-plot wrapper) ═══════ */
.lfu .rt { color: var(--ink); font-family: var(--font-display); line-height: 1.5; }
.lfu .rt * { box-sizing: border-box; }
.lfu-grid { max-width: 940px; margin: 0 auto; }
.lfu-scatter { max-width: 1000px; margin: 0 auto; }

/* ── 2×2 landscape ────────────────────────────────────────────────────────── */
.lfu .plot-frame { position: relative; padding: 56px 104px 52px; }
.lfu .plot {
  position: relative;
  aspect-ratio: 1 / 0.86;
  background: var(--lfu-plot-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(22, 20, 18, 0.04), 0 22px 48px -30px rgba(22, 20, 18, 0.3);
  overflow: visible;
}
.lfu .plot::before, .lfu .plot::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 50%; pointer-events: none;
}
.lfu .plot::before { left: 0; background: rgba(199, 122, 26, 0.05); }
.lfu .plot::after  { right: 0; background: rgba(199, 122, 26, 0.02); }

.lfu .grid { position: absolute; inset: 0; pointer-events: none; }
.lfu .grid .q { position: absolute; background: var(--lfu-line); }
.lfu .grid .q.v { top: 0; bottom: 0; width: 1px; }
.lfu .grid .q.h { left: 0; right: 0; height: 1px; }
.lfu .grid .q.v.g25 { left: 25%; } .lfu .grid .q.v.g75 { left: 75%; }
.lfu .grid .q.h.g25 { top: 25%; }  .lfu .grid .q.h.g75 { top: 75%; }
.lfu .grid .axis { position: absolute; background: var(--lfu-axis); }
.lfu .grid .axis.v { left: 50%; top: -14px; bottom: -14px; width: 1.5px; transform: translateX(-50%); }
.lfu .grid .axis.h { top: 50%; left: -14px; right: -14px; height: 1.5px; transform: translateY(-50%); }

.lfu .axlabel { position: absolute; text-align: center; pointer-events: none; }
.lfu .axlabel .k {
  display: block; text-transform: uppercase; font-family: var(--font-mono);
  font-weight: 500; letter-spacing: 0.12em; font-size: 11px; color: var(--ink);
}
.lfu .axlabel .g {
  display: block; margin-top: 3px; font-family: var(--font-serif); font-style: italic;
  font-size: 12.5px; color: var(--muted);
}
.lfu .ax-top    { top: -46px;  left: 50%; transform: translateX(-50%); }
.lfu .ax-bottom { bottom: -44px; left: 50%; transform: translateX(-50%); }
.lfu .ax-left   { top: 50%; left: -100px; width: 96px; transform: translateY(-50%); }
.lfu .ax-right  { top: 50%; right: -100px; width: 96px; transform: translateY(-50%); }

@media (max-width: 660px) {
  .lfu .plot-frame { padding: 50px 30px 46px; }
  .lfu .axlabel .g { display: none; }
  .lfu .ax-left, .lfu .ax-right { top: 50%; width: auto; writing-mode: vertical-rl; }
  .lfu .ax-left  { left: -6px;  transform: translateY(-50%) rotate(180deg); }
  .lfu .ax-right { right: -6px; transform: translateY(-50%); }
}

/* ── Dots (shared by both plots) ──────────────────────────────────────────── */
.lfu .pt {
  position: absolute; transform: translate(-50%, -50%);
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit;
}
.lfu .mark {
  display: block; position: relative; z-index: 2;
  width: 13px; height: 13px; border-radius: 50%; background: var(--honey);
  box-shadow: 0 0 0 4px var(--paper), 0 2px 5px rgba(22, 20, 18, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.lfu .pt.c-quant .mark { background: var(--brick); border-radius: 3px; }
.lfu .pt.c-both .mark {
  background: linear-gradient(135deg, var(--honey) 0 46%, var(--brick) 54% 100%);
  border-radius: 2px; transform: rotate(45deg);
}
.lfu .pt:hover .mark, .lfu .pt:focus-visible .mark { transform: scale(1.18); }
.lfu .pt.c-both:hover .mark, .lfu .pt.c-both:focus-visible .mark { transform: rotate(45deg) scale(1.18); }
.lfu .pt:focus-visible { outline: none; }
.lfu .pt:focus-visible .mark { box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--clay), 0 2px 5px rgba(22, 20, 18, 0.18); }

.lfu .pt.selected { z-index: 15; }
.lfu .pt.selected .mark {
  background: var(--clay); transform: scale(1.12);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--ink), 0 4px 10px rgba(22, 20, 18, 0.28);
}
.lfu .pt.c-both.selected .mark { transform: rotate(45deg) scale(1.12); }

/* inline labels (2×2 only) */
.lfu .lbl {
  position: absolute; top: 50%; left: calc(100% + 8px); transform: translateY(-50%);
  white-space: nowrap; font-family: var(--font-display); font-weight: 500;
  font-size: 11px; color: var(--ink); z-index: 3; border: 1px solid transparent;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.lfu .pt.l .lbl { left: auto; right: calc(100% + 8px); text-align: right; }
.lfu .pt:hover .lbl, .lfu .pt:focus-visible .lbl { color: var(--clay); }
.lfu .pt.selected .lbl {
  color: var(--ink); font-weight: 600;
  background: var(--card); border-color: var(--border);
  padding: 5px 11px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(22, 20, 18, 0.1), 0 10px 24px -12px rgba(22, 20, 18, 0.28);
}

@media (prefers-reduced-motion: no-preference) {
  .lfu .pt.enter { animation: lfu-pop 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
  @keyframes lfu-pop {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  }
}

/* ── Effort vs. believability scatter ─────────────────────────────────────── */
.lfu-scatter-frame { position: relative; padding: 30px 96px 44px; }
.lfu-scatter-plot {
  position: relative;
  aspect-ratio: 1 / 0.84;
  background: var(--lfu-plot-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(22, 20, 18, 0.04), 0 22px 48px -30px rgba(22, 20, 18, 0.3);
}
/* break-even diagonal (trust == effort) — structural honey, kept faint */
.lfu-diag { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lfu-diag line { stroke: var(--honey); stroke-width: 1.4; stroke-dasharray: 5 5; opacity: 0.5; }

.lfu-axis {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.lfu-axis-x { bottom: 12px; left: 50%; transform: translateX(-50%); }
.lfu-axis-y { left: 38px; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); }

.lfu-labels { position: absolute; inset: 0; pointer-events: none; }
.lfu-lab {
  position: absolute; transform: translate(-50%, -50%);
  pointer-events: auto; cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; line-height: 1;
  white-space: nowrap; color: var(--muted);
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 2px var(--paper);
  transition: color 0.12s ease;
}
.lfu-lab:hover { color: var(--ink); }
.lfu-lab[data-selected="true"] {
  z-index: 20; color: var(--ink); font-weight: 500; text-shadow: none;
  background: var(--card); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(22, 20, 18, 0.1), 0 10px 24px -12px rgba(22, 20, 18, 0.28);
}
@media (max-width: 660px) { .lfu-scatter-frame { padding: 26px 40px 40px; } }

/* ── Shared legend ────────────────────────────────────────────────────────── */
.lfu-legend {
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center;
  margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--hair);
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.02em; color: var(--muted);
}
.lfu-legend-item { display: inline-flex; align-items: center; gap: 8px; }
.lfu-legend-sw { width: 11px; height: 11px; flex: none; background: var(--honey); border-radius: 50%; }
.lfu-legend-item[data-color="quant"] .lfu-legend-sw { background: var(--brick); }
.lfu-legend-item[data-color="both"] .lfu-legend-sw { background: linear-gradient(135deg, var(--honey) 0 46%, var(--brick) 54% 100%); }
.lfu-legend-sw[data-shape="square"] { border-radius: 2.5px; }
.lfu-legend-sw[data-shape="diamond"] { border-radius: 1.5px; transform: rotate(45deg); }

/* ── Fallback / narrow list ───────────────────────────────────────────────── */
.lfu-list { flex-direction: column; gap: 2px; margin-top: 8px; }
.lfu-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border: 1px solid transparent; border-radius: 10px;
  background: none; cursor: pointer; text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.lfu-row:hover { background: var(--paper-2); }
.lfu-row.selected { background: var(--label); border-color: var(--border); }
.lfu-row:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
.lfu-row-dot { width: 11px; height: 11px; flex: none; background: var(--honey); border-radius: 50%; }
.lfu-row.c-quant .lfu-row-dot { background: var(--brick); border-radius: 2.5px; }
.lfu-row.c-both .lfu-row-dot { background: linear-gradient(135deg, var(--honey) 0 46%, var(--brick) 54% 100%); border-radius: 1.5px; transform: rotate(45deg); }
.lfu-row-name { flex: 1 1 auto; font-family: var(--font-display); font-size: 15px; color: var(--ink); }
.lfu-row.selected .lfu-row-name { font-weight: 600; }
.lfu-row-effort {
  flex: none; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}

/* ── Detail panel ─────────────────────────────────────────────────────────── */
.lfu-detail { margin-top: clamp(22px, 3vw, 32px); }
.lfu-panel { animation: lfu-panel-in 200ms ease; }
@media (prefers-reduced-motion: reduce) { .lfu-panel { animation: none; } }
@keyframes lfu-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.lfu-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 20px;
}
.lfu-head .res-panel-title { margin: 0; }
.lfu-chips { gap: 7px; }

/* effort tier + believability meter */
.lfu-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px 18px;
  max-width: 460px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hair);
}
.lfu-stat-label { white-space: nowrap; }
.lfu-stat-effort {
  font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink);
}
.lfu-meter-cell { display: flex; flex-direction: column; gap: 5px; }
.lfu-meter-poles {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}

/* facts: what / how / best three-up, "how believable" full-width payoff */
.lfu-facts {
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: "what how best" "worth worth worth";
  gap: clamp(16px, 2.2vw, 24px) clamp(22px, 3vw, 38px);
}
.lfu-fact-what { grid-area: what; min-width: 0; }
.lfu-fact-how { grid-area: how; min-width: 0; }
.lfu-fact-best { grid-area: best; min-width: 0; }
.lfu-fact-worth {
  grid-area: worth; min-width: 0;
  margin-top: clamp(4px, 1vw, 8px);
  padding-top: clamp(16px, 2vw, 20px);
  border-top: 1px solid var(--hair);
}
.lfu-fact-best .res-fact-body::first-letter { text-transform: uppercase; }
.lfu-fact-worth .res-fact-label { color: var(--clay); }
.lfu-fact-worth .res-fact-body { max-width: 74ch; }

@media (max-width: 720px) {
  .lfu-facts { grid-template-columns: 1fr; grid-template-areas: "what" "how" "best" "worth"; }
}

/* ── Footnote / caveat ────────────────────────────────────────────────────── */
.lfu-caveat {
  margin-top: clamp(16px, 2vw, 22px);
  font-family: var(--font-serif); font-style: italic; font-size: 13.5px;
  line-height: 1.6; color: var(--muted); max-width: 72ch;
}
