/* The percentage page's own drawings: the eight sentence-shaped lines, the card that follows the
   line being typed in, and the common-percentage table.

   Everything else — the panel, the hero card, the stat tiles, the FAQ accordion, the related cards,
   the pick panel — comes from styles.css and results.css. Every rule here is scoped to
   .percentage-page, the body class this page opts into, so the older unscoped .pct-* rules in
   styles.css cannot dress another page and these cannot leak off this one. */

/* ---------------------------------------------------------------- The lines */

.percentage-page .pct-lead {
  margin: 0 0 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

/* One question per line, written as a sentence with the figures typed into it, so a line reads the
   way the question is said out loud: "15% of 80 is 12". The line wraps on a phone rather than
   scrolling sideways, and no word is ever broken into a vertical column. */
.percentage-page .pct-row {
  padding: 14px 0 14px 12px;
  border-radius: 0 10px 10px 0;
  transition: background-color 0.15s ease;
}
.percentage-page .pct-row + .pct-row { border-top: 1px solid var(--border); }

/* The name of the sum, so all eight are scannable without reading every sentence. */
.percentage-page .pct-tag {
  margin: 0 0 7px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--muted);
}

.percentage-page .pct-q {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0;
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}
.percentage-page .pct-word { min-width: 0; overflow-wrap: break-word; }

/* Wide enough for a price with a decimal place in it, and no wider, because the words around the
   box are the label. 44px tall so a thumb can hit it. */
.percentage-page .pct-in {
  flex: 0 1 6.5rem;
  width: 6.5rem;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
}
.percentage-page .pct-in:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 1px;
}
.percentage-page .pct-in[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-bg);
}

/* The answer, so the eye lands on it inside the sentence. Long values wrap instead of pushing the
   row wider than the screen. */
.percentage-page .pct-out {
  min-width: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.percentage-page .pct-out.is-undefined { font-weight: 700; color: var(--muted); }

/* What the line is doing, in the size and colour the hints use. */
.percentage-page .pct-why {
  margin: 5px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* The line being typed in is marked down its left edge and washed with the accent, so the card
   above and the line below are plainly the same question. Every row carries the same inset, marked
   or not, so nothing moves sideways when the mark does. */
.percentage-page .pct-row.active {
  background: var(--accent);
  box-shadow: inset 3px 0 0 var(--highlight);
}

.percentage-page .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}
.percentage-page .form-actions .btn-secondary { margin: 0; }
/* ---------------------------------------------------------------- The card */

.percentage-page .pct-hero-live { min-width: 0; }
.percentage-page .calc-meaning { line-height: 1.55; }
.percentage-page .calc-meaning:empty { display: none; }
.percentage-page #hero.is-undefined .value { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
.percentage-page #result-note { margin: 0 0 6px; }

.percentage-page .pct-tiles {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 20px;
}
.percentage-page .pct-tiles .stat { min-width: 0; }
.percentage-page .pct-tiles .label { font-size: 0.78rem; line-height: 1.35; }
.percentage-page .pct-tiles .value {
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- The common table */

.percentage-page .pct-table { min-width: 100%; }
.percentage-page #common-caption {
  caption-side: top;
  padding: 0 0 8px;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}
.percentage-page .pct-table th[scope="row"] {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.percentage-page .pct-table tr.current th,
.percentage-page .pct-table tr.current td {
  font-weight: 800;
  color: var(--primary);
}

/* ---------------------------------------------------------------- The facts */

/* Four full-width cards, one below the other at every screen size, so each idea reads across the
   horizontal card. The quiet orange edge is the standard CozyCalcs fact treatment. */
.percentage-page .calc-info .fact-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.percentage-page .calc-info .fact {
  min-width: 0;
  padding: 14px 16px;
  border-left: 3px solid var(--highlight);
  border-radius: 0 12px 12px 0;
  background: var(--accent);
}
.percentage-page .calc-info .fact h3 {
  display: block;
  margin: 0 0 6px;
  font-size: 0.95rem;
  line-height: 1.45;
  min-width: 0;
}
.percentage-page .calc-info .fact p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

/* ---------------------------------------------------------------- The method */

.percentage-page .formula {
  margin: 10px 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.percentage-page .pct-sources {
  margin: 10px 0 0;
  padding-left: 20px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.percentage-page .pct-sources li { margin-bottom: 6px; }
.percentage-page .pct-sources a { color: var(--primary); }

/* ---------------------------------------------------------------- Narrow screens */

@media (max-width: 640px) {
  .percentage-page .pct-tiles { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .percentage-page .pct-row { padding: 12px 0 12px 10px; }
  .percentage-page .pct-in { flex: 0 1 5.4rem; width: 5.4rem; }
  .percentage-page .pct-q { font-size: 0.92rem; }
}

@media (max-width: 360px) {
  .percentage-page .pct-in { flex: 1 1 4.6rem; width: auto; }
  .percentage-page .pct-row { padding-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .percentage-page * { transition: none !important; animation: none !important; }
}

