/* Pasqyra · the plan (#/plani) and one solution in full (#/plani/<id>). Built by app/js/pq/plan.js.
   Layout and the few things that exist only on these two screens; every colour is a token of pq.css.
   Load after css/pq.css. Rules that set a margin or a font on p, dl, h2–h4, a or a button are written
   `.pq .pq-plan-…` because the resets of pq.css are `.pq p`, `.pq dl`, `.pq h3`, `.pq a`, `.pq .pq-btn`. */

/* ───────────────────────────── the list ───────────────────────────── */
/* The one-line total that stays under the top bar on a phone while the cards scroll. On a laptop the whole
   summary card is pinned on the right instead (the .pq-aside of .pq-split), so the line is not shown. */
.pq-plan-bar { position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 40; display: flex; align-items: center; gap: 4px 12px; min-height: 52px; padding: 2px 2px 2px 16px; border-radius: var(--pq-r-s); background: var(--pq-surface); color: var(--pq-fg); box-shadow: 0 0 0 1px var(--pq-line), var(--pq-shadow); }
.pq-plan-bar-t { flex: 1 1 auto; min-width: 0; font-size: 15px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pq-plan-bar-t b { font-weight: 650; }
.pq-plan-bar-v { flex: none; font-size: 17px; line-height: 1.2; color: var(--pq-mint-t); white-space: nowrap; }
.pq-plan-bar-v .pq-plan-upto { font-size: 13px; }
/* under the count, when some measures are begun: what the saving beside it is of (its own line, cut with … when it does not fit) */
.pq-plan-bar-s { display: block; font-size: 12.5px; font-weight: 400; line-height: 1.3; color: var(--pq-fg-2); overflow: hidden; text-overflow: ellipsis; }
.pq-plan-group { scroll-margin-top: 120px; }
.pq .pq-plan-sum { scroll-margin-top: 124px; }

/* one solution as a card: title, the saving, the facts, the tick */
.pq .pq-plan-card, .pq .pq-plan-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pq-plan-card > .pq-card-h, .pq-plan-head > .pq-card-h { margin-bottom: 0; }
.pq-plan-card > .pq-card-f, .pq-plan-head > .pq-card-f { margin-top: 0; justify-content: space-between; }
.pq .pq-plan-card h3 a { color: inherit; text-decoration: none; }
.pq .pq-plan-card h3 a:hover { text-decoration: underline; }
.pq-plan-chips { margin-top: 6px; }
.pq .pq-plan-card.is-in { box-shadow: 0 0 0 2px var(--pq-ac-fill), var(--pq-shadow); }
.pq .pq-plan-card.is-new, .pq .pq-plan-head.is-new { box-shadow: 0 0 0 2px var(--pq-ok-f), var(--pq-shadow); animation: pq-plan-in .6s var(--pq-ease) both; }
@keyframes pq-plan-in { from { opacity: 0; transform: translateY(16px); } }

.pq-plan-save { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 14px; border-radius: var(--pq-r-s); background: var(--pq-surface-2); }
.pq-plan-k { font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--pq-fg-2); }
.pq-plan-v { margin-left: auto; min-width: 0; text-align: right; font: 700 22px/1.25 var(--pq-num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--pq-fg); }
.pq-plan-save-l .pq-plan-v { font-size: clamp(26px, 7.4vw, 38px); line-height: 1.15; }
.pq-plan-v .pq-u { font-size: .62em; color: var(--pq-fg-2); }
.pq-plan-upto { font: 600 14px/1 var(--pq-text); letter-spacing: 0; color: var(--pq-fg-2); }
.pq-plan-none { font: 600 15px/1.3 var(--pq-text); letter-spacing: 0; color: var(--pq-fg-2); }
/* A card without a figure (a legal duty, no figure in euro): the box is one line of text. The value would otherwise
   keep the tall line of a figure, and the baseline would push the label down and leave a blank band above it. */
.pq-plan-save-plain { align-items: center; }
.pq-plan-save-plain .pq-plan-v, .pq-plan-save-l.pq-plan-save-plain .pq-plan-v { font: 600 15px/1.3 var(--pq-text); letter-spacing: 0; }

.pq .pq-plan-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); gap: 10px 16px; }
.pq-plan-fact { display: grid; gap: 2px; align-content: start; min-width: 0; }
.pq-plan-fact dt { font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--pq-fg-2); }
.pq-plan-fact dd { font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.pq-plan-fact dd .pq-n, .pq-plan-fact dd .pq-range { white-space: normal; }
.pq .pq-plan-note { font-size: 14px; line-height: 1.4; color: var(--pq-fg-2); }
.pq .pq-plan-vatnote { font-size: 13px; }
.pq .pq-plan-tick { min-height: 44px; padding: 0 16px; font-size: 15px; }
.pq .pq-plan-tick .pq-ic, .pq .pq-plan-open .pq-ic { width: 20px; height: 20px; }
.pq .pq-plan-open { min-height: 44px; font-size: 15px; flex-direction: row-reverse; }
/* "remove it from the plan?": asked in place of the button, for a measure that is started or done */
.pq-plan-ask { flex: 1 1 100%; min-width: 0; display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--pq-r-s); background: var(--pq-amber-s); color: var(--pq-fg); }
.pq .pq-plan-ask p { font-size: 14.5px; line-height: 1.4; }
.pq .pq-plan-ask .pq-btn { min-height: 44px; }

/* a card that still waits for numbers: dashed outline, a blank slot where the euro figure will stand */
.pq .pq-plan-lock { box-shadow: none; border: 1.5px dashed var(--pq-line-2); }
.pq .pq-plan-lock.is-in { box-shadow: none; border-color: var(--pq-ac-fill); }
.pq-plan-slot { display: inline-flex; align-items: center; gap: 6px; color: var(--pq-fg-2); vertical-align: middle; }
.pq-plan-slot i { display: inline-block; width: 76px; height: 26px; border-radius: 8px; border: 1.5px dashed var(--pq-line-2); }
.pq-plan-v > .pq-chip { margin-left: 8px; }
/* two fields side by side stand on one line even when one label wraps */
.pq-plan-needs { align-items: end; }
.pq-plan-needlinks .pq-item { min-height: 48px; }
/* WW-SAMPLE on the public sewer: the two counts the answer chooses between, and the plants of the municipality */
.pq-plan-plant { gap: 10px; }
.pq .pq-plan-plant .pq-muted { font-size: 13.5px; line-height: 1.45; }
/* the way to the answers and the profile (a rule that an answer switched off, or removed from the list) */
.pq-plan-answers { min-height: 48px; }

/* the plan's total */
.pq-plan-sum-top { display: grid; gap: 2px; }
.pq-plan-sum-v { font: 700 clamp(30px, 8.4vw, 40px)/1.1 var(--pq-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--pq-mint-t); }
.pq-plan-sum-v .pq-u { font-size: .5em; letter-spacing: 0; color: var(--pq-fg-2); }
.pq-plan-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.4; color: var(--pq-fg-2); }
.pq-plan-notes li { overflow-wrap: anywhere; }
.pq-plan-notes .pq-n { color: var(--pq-fg); }
.pq-plan-items .pq-item { min-height: 48px; }

/* ───────────────────────────── one solution ───────────────────────────── */
.pq .pq-plan-title { font-size: clamp(22px, 5.8vw, 32px); line-height: 1.15; letter-spacing: -.02em; font-weight: 750; }
.pq .pq-plan-h4 { font-size: 15px; font-weight: 650; letter-spacing: 0; }
.pq-plan-steps { margin: 0; padding: 0 0 0 22px; display: grid; gap: 8px; }
.pq-plan-steps li { padding-left: 4px; }
.pq-plan-steps li::marker { font: 700 15px/1 var(--pq-num); }
.pq-plan-rules, .pq-plan-sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14.5px; line-height: 1.45; }
.pq-plan-sources li { overflow-wrap: anywhere; color: var(--pq-fg-2); }
.pq-plan-sources li span { color: var(--pq-fg); }
.pq .pq-plan-sources a { white-space: nowrap; }
.pq-plan-src { font-weight: 600; }
.pq-plan-more > summary { display: flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--pq-link); cursor: pointer; }
.pq-plan-state .pq-steps { margin-bottom: 4px; }
.pq-plan-next > .pq-btn, .pq-plan-state .pq-actions > .pq-btn { flex: 1 1 180px; }

/* the limit race of the wastewater train */
.pq-plan-train-name { display: grid; gap: 4px; }
.pq-plan-train-name b { font-size: 18px; line-height: 1.3; font-weight: 700; }
.pq .pq-plan-method { font-size: 13.5px; line-height: 1.45; }
.pq-plan-ref { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; line-height: 1.35; color: var(--pq-fg-2); text-align: inherit; }
.pq .pq-plan-ref a { overflow-wrap: anywhere; }
/* for whom a date of the law is (an act of the state, permit holders only): its own line under the date's title */
.pq-plan-for { display: block; margin-top: 2px; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--pq-fg-2); }
.pq-plan-stages td:first-child .pq-chip { margin-left: 4px; }
.pq-plan-tried .pq-item { min-height: 0; align-items: flex-start; }
/* on a wide screen the figure keeps a readable width; the tables under it use the whole card */
.pq-plan-race-card .pq-race-plot, .pq-plan-race-card .pq-race-stages { max-width: 920px; }
/* The two tables of the race have up to 8 columns. From 760 px they are real tables: the stage name keeps a
   width that words fit in, and the line under a price does not push the number columns out. */
@media (min-width: 760px) {
  .pq-plan-stages th:first-child, .pq-plan-stages td:first-child, .pq-plan-params th:first-child, .pq-plan-params td:first-child { min-width: 168px; overflow-wrap: normal; }
  .pq-plan-stages td:last-child { min-width: 150px; }
  .pq-plan-ref { max-width: 30ch; }
}
/* Below 760 px they stack like every .pq-table does below 560 px (same rules as pq.css, for these two tables). */
@media (max-width: 759px) {
  .pq-plan-stages thead, .pq-plan-params thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pq-plan-stages, .pq-plan-stages tbody, .pq-plan-params, .pq-plan-params tbody { display: block; }
  .pq-plan-stages tr, .pq-plan-params tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--pq-line); }
  .pq-plan-stages td, .pq-plan-params td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .pq-plan-stages td::before, .pq-plan-params td::before { content: attr(data-th); flex: none; max-width: 50%; text-align: left; font-size: 13px; font-weight: 600; color: var(--pq-fg-2); }
  .pq-plan-stages td:first-child, .pq-plan-params td:first-child { display: block; text-align: left; font-weight: 650; }
  .pq-plan-stages td:first-child::before, .pq-plan-params td:first-child::before { display: none; }
  .pq-plan-stages td:last-child { display: block; text-align: left; }
  .pq-plan-stages td:last-child::before { display: block; max-width: none; margin-bottom: 2px; }
  .pq-plan-stages caption, .pq-plan-params caption { display: block; }
}

/* ───────────────────────────── laptop (≥ 900 px) ───────────────────────────── */
@media (min-width: 900px) {
  .pq-plan-bar { display: none; }
  /* the pinned summary scrolls inside itself when it is taller than the window */
  .pq-plan-split > .pq-plan-aside { max-height: calc(100vh - 104px); max-height: calc(100dvh - 104px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px; margin: -2px; border-radius: var(--pq-r); }
  .pq .pq-plan-aside .pq-plan-sum { box-shadow: 0 0 0 1px var(--pq-line); }
  .pq-plan-v { font-size: 24px; }
}

/* ───────────────────────────── print ───────────────────────────── */
@media print {
  .pq-plan-tick, .pq-plan-open, .pq-plan-ask, .pq-plan-card > .pq-card-f, .pq-plan-head > .pq-card-f, .pq-plan-state .pq-form { display: none !important; }
  .pq .pq-plan-card.is-in, .pq .pq-plan-lock { box-shadow: none !important; }
  .pq-plan-split > .pq-plan-aside { max-height: none; overflow: visible; }
}
