/* ── Yootil Calculator Standard v1 — result component ───────────────────────
   CORE-001..005. Shared markup for: the answer, a plain-English sentence, a
   breakdown of secondary figures, the formula with the user's values
   substituted in, and the assumptions the result depends on.

   Rendered two ways from the SAME markup:
     - statically in the page, pre-filled with a real worked example, so a
       visitor and a crawler both get a complete answer before any interaction
     - by result-ui.js on input, replacing it in place

   Both must produce identical structure, or the page visibly reflows on first
   keystroke.

   Mobile is the default here, not an afterthought: single column, the answer
   scales with the viewport, and the working scrolls inside its own box rather
   than widening the page.
   ------------------------------------------------------------------------- */

.yr-result {
  background: #fff;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 24px;
}

/* The panel always sits inside the results column of a two-column calculator
   layout, so it inherits that column's width and needs no wrapper of its own.
   An earlier .yr-standalone rule existed for panels dropped between two
   full-width <section>s, where they ran edge to edge; no page does that now. */

/* ── the answer ─────────────────────────────────────────────────────────── */
.yr-answer {
  background: var(--color-slate, #1a2332);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.yr-answer::after {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(85, 54, 253, .2);
}
.yr-label {
  position: relative; z-index: 1;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: rgba(255, 255, 255, .75); margin-bottom: 6px;
}
.yr-value {
  position: relative; z-index: 1;
  font-size: clamp(30px, 9vw, 46px); font-weight: 800; line-height: 1.05;
  color: #fff; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}

/* ── the plain-English sentence ─────────────────────────────────────────── */
/* The single most citable element on the page: a complete sentence carrying
   the user's own numbers. Kept in the light area so it reads as prose. */
.yr-sentence {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  font-size: 16px; line-height: 1.6; color: var(--color-slate, #1a2332);
}
.yr-sentence strong { font-weight: 700; }

/* ── sections ───────────────────────────────────────────────────────────── */
.yr-section { padding: 16px 20px; border-bottom: 1px solid var(--color-border, #e5e7eb); }
.yr-result > .yr-section:last-child { border-bottom: none; }
.yr-section h3 {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--color-text-secondary, #6b7280); margin: 0 0 10px;
}

/* ── breakdown ──────────────────────────────────────────────────────────── */
/* Container-driven, not viewport-driven. This block lives in the results
   column of a two-column layout, so the width of the WINDOW says nothing
   about the room it has. auto-fit gives two columns only once the block
   itself can fit two 240px tracks; below that it stays single-column.
   A (min-width: 700px) media query put two columns in a ~330px column
   between 768px and 1000px, and the labels wrapped under their values. */
.yr-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  column-gap: 32px;
  margin: 0;
}
/* flex-wrap is the safety net: the value never shrinks (a wrapped number is
   unreadable), so when a long label and its value cannot share a line the
   value drops to its own, still right-aligned, instead of overflowing and
   being clipped by the panel. */
.yr-breakdown div {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 4px 16px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--color-border, #e5e7eb); min-width: 0;
}
.yr-breakdown div:last-child { border-bottom: none; }
.yr-breakdown dt { font-size: 14px; color: var(--color-text-secondary, #6b7280); min-width: 0; }
.yr-breakdown dd {
  margin: 0 0 0 auto; flex: none; font-size: 14px; font-weight: 700;
  color: var(--color-slate, #1a2332); font-variant-numeric: tabular-nums;
}

/* ── show your working ──────────────────────────────────────────────────── */
/* Scrolls inside its own box. A long substitution must never widen the page. */
.yr-working { margin: 0; }
.yr-working-row { overflow-x: auto; padding-bottom: 2px; }
.yr-working-row + .yr-working-row { margin-top: 10px; }
.yr-working-label {
  font-size: 11px; font-weight: 700; color: var(--color-text-secondary, #6b7280);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px;
}
.yr-formula {
  font-family: Consolas, 'Courier New', monospace; font-size: 14px; line-height: 1.7;
  color: var(--color-slate, #1a2332); white-space: nowrap;
}
.yr-formula .yr-sub { color: var(--color-purple, #5536FD); font-weight: 700; }

/* ── assumptions ────────────────────────────────────────────────────────── */
.yr-assumptions { margin: 0; padding-left: 18px; }
.yr-assumptions li {
  font-size: 13px; line-height: 1.6; color: var(--color-text-secondary, #6b7280);
  margin-bottom: 5px;
}
.yr-assumptions li:last-child { margin-bottom: 0; }



/* ── CORE-006 scenario comparison ─────────────────────────────────────────
   A small table of what-ifs with the user's own scenario marked. Scrolls
   inside its own box: a third column must never widen the page. */
.yr-scenarios-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.yr-scenarios { width: 100%; border-collapse: collapse; font-size: 13px; }
.yr-scenarios th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--color-text-secondary, #6b7280);
  padding: 0 12px 8px 0; border-bottom: 1px solid var(--color-border, #e5e7eb);
  white-space: nowrap;
}
.yr-scenarios td {
  padding: 9px 12px 9px 0; border-bottom: 1px solid var(--color-border, #e5e7eb);
  color: var(--color-text-secondary, #6b7280); white-space: nowrap;
}
.yr-scenarios tr:last-child td { border-bottom: none; }
.yr-scenarios th:last-child, .yr-scenarios td:last-child { padding-right: 0; }
/* right-align the numbers so magnitudes line up down the column */
.yr-scenarios .yr-num { text-align: right; font-variant-numeric: tabular-nums; }
/* the row that is actually theirs */
.yr-scenarios .yr-current td {
  color: var(--color-slate, #1a2332); font-weight: 700;
  background: var(--color-bg-light, #f8f9fa);
}
.yr-scenarios .yr-current td:first-child { box-shadow: inset 3px 0 0 var(--color-purple, #5536FD); padding-left: 9px; }
.yr-scenarios-note { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--color-text-secondary, #6b7280); }


/* ── CORE-007 generated visualisation ─────────────────────────────────────*/
.yr-chart { width: 100%; }
.yr-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.yr-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.yr-key {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--color-text-secondary, #6b7280);
}
.yr-key i { width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* ── key facts / micro-answers (blueprint template item 11) ──────────────
   Short answers that stand on their own, so a reader can skim them and an
   answer engine can quote one without the surrounding page.

   auto-fit rather than a viewport media query: the number of columns follows
   the space this block actually has, not the width of the window. */
.yr-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
  margin: 0;
}
.yr-facts > div {
  background: var(--color-bg-light, #f8f9fa);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 16px 18px;
  min-width: 0;
}
.yr-facts dt {
  font-size: 15px; font-weight: 700; line-height: 1.4;
  color: var(--color-slate, #1a2332); margin-bottom: 6px;
}
.yr-facts dd {
  margin: 0; font-size: 14px; line-height: 1.65;
  color: var(--color-text-secondary, #6b7280);
}
.yr-facts dd strong { color: var(--color-slate, #1a2332); font-weight: 700; }

/* ── wider screens ──────────────────────────────────────────────────────── */
@media (min-width: 700px) {
  .yr-answer { padding: 24px 28px; }
  .yr-sentence { padding: 18px 28px; font-size: 17px; }
  .yr-section { padding: 18px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .yr-result, .yr-result * { transition: none !important; animation: none !important; }
}
