/*! Modaqeq (مُدقّق) plan-checking platform. Copyright (c) 2026 Moayad Albahri. All rights reserved.
    Idea developed, designed and built by Moayad Albahri. No copying, reuse or redistribution without written permission. */
/* Modaqeq screens. Identity: direction B «الخط الأحمر» (tokens.css), one palette day and night.
   Logical properties only (RTL). Added here: surfaces and tints, each checked for 4.5:1 text. */
:root {
  --mq-surface: #F3F5F4;      /* panels on the paper ground; ink on it 11.9:1, muted 6.5:1 */
  --mq-line: #C5CFCE;         /* row rules and control borders */
  --mq-line-strong: #8C9AA6;  /* control borders (3:1 against the ground) */
  --mq-pass-tint: #DCE8E1;    /* pass text on it 4.9:1 */
  --mq-red-tint: #F2DEDA;     /* red text on it 4.6:1 */
  --mq-ink-tint: #DAE0E7;
  --mq-focus: #1F3350;        /* keyboard focus ring: the ink, always outside the element so it shows on any fill */
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  --step-3: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-block-start: 88px; }
body {
  margin: 0; background: var(--mq-bg); color: var(--mq-ink);
  font-family: var(--mq-font); font-size: var(--step-0); line-height: 1.7;
  font-feature-settings: "tnum" 1;
}
h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--step-2); }
h2 { font-size: var(--step-1); }
h3 { font-size: var(--step-0); }
p { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }
.muted, .hint { color: var(--mq-muted); }
.hint { font-size: var(--step--1); }
:focus-visible { outline: 3px solid var(--mq-focus); outline-offset: 2px; }
::selection { background: var(--mq-ink); color: var(--mq-on-ink); }
html { scrollbar-color: var(--mq-line-strong) var(--mq-bg); }
input, select, textarea { caret-color: var(--mq-red); accent-color: var(--mq-ink); }
.ico { flex: none; inline-size: 1em; block-size: 1em; vertical-align: -0.125em; }
.pill .ico { inline-size: 14px; block-size: 14px; }

.skip { position: absolute; inset-inline-start: 8px; inset-block-start: -60px; background: var(--mq-ink); color: var(--mq-on-ink); padding: 8px 14px; z-index: 10; }
.skip:focus { inset-block-start: 8px; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-block-size: 44px; padding: 8px 20px; border: 2px solid var(--mq-ink); border-radius: var(--mq-radius);
  background: transparent; color: var(--mq-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:hover { background: var(--mq-ink-tint); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--mq-ink); color: var(--mq-on-ink); }
.btn-primary:hover { background: #2A4468; }
.btn-lg { min-block-size: 52px; padding-inline: 28px; font-size: var(--step-1); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--mq-surface); color: var(--mq-muted); border-color: var(--mq-line); cursor: not-allowed; transform: none; }
.link { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--mq-ink); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.link[disabled] { color: var(--mq-muted); cursor: not-allowed; }

.num-input { display: flex; align-items: stretch; border: 2px solid var(--mq-line-strong); background: var(--mq-surface); }
.num-input:focus-within { border-color: var(--mq-ink); }
.num-input input { inline-size: 100%; min-inline-size: 0; border: 0; background: transparent; font: inherit; color: var(--mq-ink); padding: 8px 12px; min-block-size: 44px; }
.num-input input:focus { outline: none; }
.num-input .unit { display: flex; align-items: center; padding-inline: 10px; color: var(--mq-muted); white-space: nowrap; }
.num-input.is-error { border-color: var(--mq-red); }

.notice { border: 1px solid var(--mq-red); background: var(--mq-red-tint); padding: 12px 16px; }
.notice .actions { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-block-start: 10px; }

/* ---------------------------------------------------------------- top bar */
.bar {
  position: sticky; inset-block-start: 0; z-index: 5; display: flex; align-items: center; gap: 24px;
  padding: 10px var(--gutter); background: var(--mq-bg); border-block-end: 1px solid var(--mq-line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: var(--step-1); }
.bar-links { display: flex; gap: 24px; margin-inline-start: auto; }
.bar-links a { text-decoration: none; color: var(--mq-muted); }
.bar-links a:hover { color: var(--mq-ink); }
.bar-cta { margin-inline-start: 8px; }
.steps { display: flex; gap: 0; margin-block: 0; margin-inline-start: auto; padding: 0; list-style: none; counter-reset: s; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--mq-muted); font-size: var(--step--1); }
.steps li + li::before { content: ""; inline-size: 40px; block-size: 2px; background: var(--mq-line); margin-inline: 10px; }
.steps li.is-done { color: var(--mq-ink); }
.steps li.is-now { color: var(--mq-ink); font-weight: 700; }
.steps li.is-done + li::before { background: var(--mq-red); }

main { display: block; }
main:focus { outline: none; }
.screen { padding-block-end: 96px; }

/* ---------------------------------------------------------------- 0 · product page */
.paper { background-color: var(--mq-bg); background-image: var(--mq-grid-bg); background-size: var(--mq-grid-size); }
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 5vw, 80px); align-items: center;
  padding: clamp(48px, 8vw, 120px) var(--gutter); max-inline-size: none;
}
.hero-copy { max-inline-size: 620px; justify-self: end; }
.hero h1 { font-size: var(--step-3); line-height: 1.2; text-wrap: balance; }
.lede { font-size: var(--step-1); margin-block-start: 28px; max-inline-size: 34ch; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 28px; margin-block-start: 36px; }

.try {
  justify-self: start; inline-size: min(100%, 520px); background: var(--mq-surface); border: 2px solid var(--mq-ink);
  padding: 24px; display: grid; gap: 18px;
}
.try h2 { font-size: var(--step-1); }
.try-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.try-inputs label { display: grid; gap: 6px; font-size: var(--step--1); color: var(--mq-muted); }
.try-result { min-block-size: 210px; }
.try .rule { grid-template-columns: 1fr; border-block-end: 0; padding-block: 4px 0; }
.try .rule-status { flex-direction: row; align-items: center; gap: 10px; }
.rail select { font: inherit; font-weight: 600; color: var(--mq-ink); background: var(--mq-bg); border: 2px solid var(--mq-line-strong); padding: 2px 8px; min-block-size: 36px; }

.band { padding: clamp(64px, 9vw, 140px) var(--gutter); max-inline-size: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; }
.problem { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.problem-copy { display: grid; gap: 18px; }
.problem-copy h2, .how h2, .refs h2, .limits h2 { font-size: var(--step-2); }
.problem-copy p { font-size: var(--step-1); }
.group-table { inline-size: 100%; border-collapse: collapse; }
.group-table caption { text-align: start; font-weight: 700; padding-block-end: 10px; }
.group-table th, .group-table td { padding: 10px 0; border-block-end: 1px solid var(--mq-line); text-align: start; vertical-align: top; font-weight: 400; }
.group-table td.n { text-align: end; font-weight: 700; inline-size: 4ch; }
.group-table .eg { display: block; color: var(--mq-muted); font-size: var(--step--1); }

.how { display: grid; gap: 48px; }
.chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); position: relative; }
.chain::before { /* the red dimension line across the three steps */
  content: ""; position: absolute; inset-inline: 0; inset-block-start: 11px; block-size: 2px; background: var(--mq-red);
}
.chain li { position: relative; padding-block-start: 44px; padding-inline-end: 32px; display: grid; gap: 10px; align-content: start; }
.chain li::before { content: ""; position: absolute; inset-inline-start: 0; inset-block-start: 0; inline-size: 2px; block-size: 24px; background: var(--mq-red); }
.chain li:last-child::after { content: ""; position: absolute; inset-inline-end: 0; inset-block-start: 0; inline-size: 2px; block-size: 24px; background: var(--mq-red); }
.chain h3 { font-size: var(--step-1); }

.refs { display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.refs > div { display: grid; gap: 16px; }
.ref-list { list-style: none; margin: 0; padding: 0; }
.ref-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; padding-block: 18px; border-block-end: 1px solid var(--mq-line); }
.ref-list li:first-child { border-block-start: 2px solid var(--mq-ink); }
.ref-list .ref-name { font-weight: 600; }
.ref-list .ref-file { grid-column: 1; color: var(--mq-muted); font-size: var(--step--1); }
.ref-list .ref-count { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: var(--step-2); font-weight: 700; }
.ref-list .ref-count small { display: block; font-size: var(--step--1); font-weight: 400; color: var(--mq-muted); text-align: center; }

.limits { display: grid; gap: 32px; justify-items: start; }
.limit-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 64px; inline-size: 100%; }
.limit-list li { padding-block: 18px; border-block-start: 1px solid var(--mq-line); }
.limit-list strong { display: block; }

.foot { display: grid; justify-items: center; gap: 6px; padding: 48px var(--gutter); background: var(--mq-surface); text-align: center; font-size: var(--step--1); }

/* ---------------------------------------------------------------- the rule row (product page fragment + report) */
.rule { display: grid; grid-template-columns: 9.5rem 1fr; gap: 6px 24px; padding-block: 22px; border-block-end: 1px solid var(--mq-line); }
.rule-status { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; font-size: var(--step--1); font-weight: 600; white-space: nowrap; }
.pill .sym { font-weight: 700; }
.tone-pass { background: var(--mq-pass-tint); color: var(--mq-pass); }
.tone-fail { background: var(--mq-red-tint); color: var(--mq-red); }
.tone-guide, .tone-note, .tone-expert { background: var(--mq-ink-tint); color: var(--mq-ink); }
.tone-missing, .tone-na { background: transparent; color: var(--mq-muted); border: 1px solid var(--mq-line-strong); }
.rule-id { font-size: var(--step--1); color: var(--mq-muted); }
.draft { font-size: 0.8125rem; color: var(--mq-muted); border: 1px dashed var(--mq-line-strong); padding: 0 6px; }
.rule-body { display: grid; gap: 10px; min-inline-size: 0; }
.rule-title { font-size: var(--step-0); font-weight: 600; }
.figures { display: grid; grid-template-columns: repeat(2, max-content); gap: 4px 40px; align-items: end; margin: 0; }
.figure dt { font-size: var(--step--1); color: var(--mq-muted); }
.figure dd { margin: 0; font-size: var(--step-1); font-weight: 700; white-space: nowrap; }
.measure { position: relative; grid-column: 1 / -1; block-size: 28px; max-inline-size: 420px; }
.measure .track { position: absolute; inset-inline: 0; inset-block-start: 13px; block-size: 2px; background: var(--mq-line-strong); }
.measure .fill { position: absolute; inset-inline-start: 0; inset-block-start: 11px; block-size: 6px; }
.measure .limit { position: absolute; inset-block: 2px; inline-size: 2px; background: var(--mq-ink); }
.measure.tone-pass .fill { background: var(--mq-pass); }
.measure.tone-fail .fill { background: var(--mq-red); }
.measure.tone-guide .fill, .measure.tone-note .fill { background: var(--mq-ink); }
.measure.tone-pass, .measure.tone-fail, .measure.tone-guide, .measure.tone-note { background: none; }
.reason { color: var(--mq-muted); }
.ref-line { font-size: var(--step--1); color: var(--mq-muted); }
.ref-line b { color: var(--mq-ink); font-weight: 600; }
details.quote summary { cursor: pointer; font-size: var(--step--1); font-weight: 600; inline-size: fit-content; }
details.quote blockquote { margin: 8px 0 0; padding: 10px 16px; border-inline-start: 3px solid var(--mq-red); background: var(--mq-surface); }
.missing-link { font-size: var(--step--1); }

/* ---------------------------------------------------------------- 1 · start */
.narrow { max-inline-size: 760px; margin-inline: auto; padding: 48px var(--gutter) 0; display: grid; gap: 36px; }
fieldset.block { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
legend, .upload h2 { font-size: var(--step-1); font-weight: 700; padding: 0; margin-block-end: 4px; }
.kinds { display: flex; flex-wrap: wrap; gap: 10px; }
.kind { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 2px solid var(--mq-line); min-block-size: 44px; }
.kind.is-on { border-color: var(--mq-ink); font-weight: 600; }
.kind.is-on input { accent-color: var(--mq-ink); }
.kind.is-off { color: var(--mq-muted); border-style: dashed; }
.styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 2px solid var(--mq-ink); }
.style-opt { position: relative; display: grid; place-items: center; min-block-size: 64px; font-size: var(--step-1); font-weight: 600; cursor: pointer; }
.style-opt + .style-opt { border-inline-start: 2px solid var(--mq-ink); }
.style-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.style-opt:has(input:checked) { background: var(--mq-ink); color: var(--mq-on-ink); }
.style-opt:has(input:focus-visible) { outline: 3px solid var(--mq-focus); outline-offset: 3px; }
.upload { display: grid; gap: 12px; }
.drop {
  position: relative; display: grid; place-items: center; gap: 6px; text-align: center; min-block-size: 180px; padding: 24px;
  border: 2px dashed var(--mq-line-strong); background-color: var(--mq-surface); cursor: pointer;
  background-image: var(--mq-grid-bg); background-size: var(--mq-grid-size);
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop:hover, .drop.is-over { border-color: var(--mq-ink); }
.drop:focus-within { outline: 3px solid var(--mq-focus); outline-offset: 2px; }
.drop.has-file { border-style: solid; border-color: var(--mq-ink); }
.drop-main { font-size: var(--step-1); font-weight: 600; }
.drop-sub { color: var(--mq-muted); }
.reading { display: grid; gap: 8px; padding: 28px 24px; border: 2px solid var(--mq-ink); background: var(--mq-surface); }
.dim-line { position: relative; block-size: 20px; overflow: hidden; }
.dim-line::before, .dim-line::after { content: ""; position: absolute; inset-block: 0; inline-size: 2px; background: var(--mq-red); }
.dim-line::before { inset-inline-start: 0; } .dim-line::after { inset-inline-end: 0; }
.dim-line span { position: absolute; inset-block-start: 9px; inset-inline-start: 0; block-size: 2px; inline-size: 100%; background: var(--mq-red); transform-origin: right center; animation: draw 2.4s ease-in-out infinite; }
@keyframes draw { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: .25; } }
.start-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }

/* ---------------------------------------------------------------- 2 · values */
.values-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; max-inline-size: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; padding: 40px var(--gutter) 0; align-items: start; }
.values-main { display: grid; gap: 28px; min-inline-size: 0; }
#values-intro { display: grid; gap: 8px; }
.summary { white-space: pre-line; }
.group { border-block-start: 2px solid var(--mq-ink); padding-block-start: 14px; margin-block-end: 36px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.group-head h2 { font-size: var(--step-1); }
.group-head .muted { font-size: var(--step--1); }
.field { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 8px 28px; padding-block: 16px; border-block-end: 1px solid var(--mq-line); align-items: start; }
.field.is-focus { background: var(--mq-ink-tint); box-shadow: 0 0 0 8px var(--mq-ink-tint); }
.field-label { display: grid; gap: 2px; }
.field-label label, .field-label .q { font-weight: 600; }
.field-control { display: grid; gap: 6px; }
.badge { font-size: var(--step--1); color: var(--mq-muted); }
.badge.from-plan { color: var(--mq-pass); }
.badge.is-manual { color: var(--mq-ink); }
.note { font-size: var(--step--1); color: var(--mq-ink); background: var(--mq-surface); padding: 4px 8px; }
.err { font-size: var(--step--1); color: var(--mq-red); font-weight: 600; }
.yesno { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--mq-line-strong); }
.yesno label { position: relative; display: grid; place-items: center; min-block-size: 44px; cursor: pointer; font-weight: 600; }
.yesno label + label { border-inline-start: 2px solid var(--mq-line-strong); }
.yesno input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.yesno label:has(input:checked) { background: var(--mq-ink); color: var(--mq-on-ink); }
.yesno label:has(input:focus-visible) { outline: 3px solid var(--mq-focus); outline-offset: 3px; }
.choices { display: grid; gap: 6px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--mq-line); cursor: pointer; min-block-size: 44px; }
.choice:has(input:checked) { border-color: var(--mq-ink); background: var(--mq-surface); }
.choice input { accent-color: var(--mq-ink); inline-size: 18px; block-size: 18px; }
.choice .c-val { font-weight: 700; }
.choice .c-src { font-size: var(--step--1); color: var(--mq-muted); }
.choose-msg { font-size: var(--step--1); color: var(--mq-red); font-weight: 600; }

.rail { position: sticky; inset-block-start: 88px; display: grid; gap: 18px; padding: 22px; background: var(--mq-surface); border: 2px solid var(--mq-ink); }
.rail-meta { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--step--1); }
.rail-meta dt { color: var(--mq-muted); }
.rail-meta dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.counter { font-size: var(--step-1); font-weight: 700; }
.counter small { display: block; font-size: var(--step--1); font-weight: 400; color: var(--mq-muted); }
.group-nav { display: grid; gap: 2px; border-block-start: 1px solid var(--mq-line); padding-block-start: 12px; }
.group-nav a { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; padding: 6px 0; font-size: var(--step--1); }
.group-nav a:hover { text-decoration: underline; }
.group-nav .n { color: var(--mq-muted); }

.openings h2 { font-size: var(--step-1); }
.openings { display: grid; gap: 10px; border-block-start: 2px solid var(--mq-ink); padding-block-start: 14px; }
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; inline-size: 100%; font-size: var(--step--1); }
table.data th { text-align: start; font-weight: 600; color: var(--mq-muted); padding-block: 8px; padding-inline: 0 10px; border-block-end: 2px solid var(--mq-ink); white-space: nowrap; }
table.data td { padding-block: 8px; padding-inline: 0 10px; border-block-end: 1px solid var(--mq-line); }
table.data td.num { text-align: end; }

/* ---------------------------------------------------------------- 3 · report */
.report-sheet { max-inline-size: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; padding: 40px var(--gutter) 0; }
.sheet-head { display: grid; grid-template-columns: 1fr auto; gap: 16px 40px; align-items: end; padding-block-end: 24px; border-block-end: 2px solid var(--mq-ink); }
.sheet-head h1 { font-size: var(--step-2); max-inline-size: 30ch; }
.sheet-head h1.v-fail { color: var(--mq-red); }
.title-block { margin: 0; display: grid; grid-template-columns: auto auto; gap: 2px 16px; font-size: var(--step--1); border: 2px solid var(--mq-ink); padding: 10px 14px; background: var(--mq-surface); }
.title-block dt { color: var(--mq-muted); }
.title-block dd { margin: 0; font-weight: 600; }
.counts { display: grid; grid-template-columns: repeat(7, 1fr); margin: 0; padding: 0; list-style: none; border-block-end: 1px solid var(--mq-line); }
.counts li { display: grid; gap: 2px; padding-block: 16px; padding-inline: 0 12px; }
.counts li + li { border-inline-start: 1px solid var(--mq-line); padding-inline-start: 12px; }
.counts .n { font-size: var(--step-2); font-weight: 700; line-height: 1.2; }
.counts .w { font-size: var(--step--1); color: var(--mq-muted); display: flex; gap: 6px; }
.counts .tone-pass-t .n { color: var(--mq-pass); }
.counts .tone-fail-t .n { color: var(--mq-red); }
.counts .is-zero .n { color: var(--mq-muted); font-weight: 400; }
.status-group > h2 { font-size: var(--step-1); padding-block: 28px 0; display: flex; gap: 10px; align-items: baseline; }
.status-group > h2 .muted { font-size: var(--step--1); font-weight: 400; }
.disclaimer { margin-block-start: 32px; padding: 14px 0; border-block-start: 2px solid var(--mq-ink); font-weight: 600; }
.report-actions { max-inline-size: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; padding: 24px var(--gutter) 0; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }

/* PDF pages (built off-screen by report-pdf.js): A4 at 96 px per inch, its own compact sizes */
.pdf-page { inline-size: 794px; block-size: 1123px; padding-block: 44px 64px; padding-inline: 44px; background: var(--mq-bg); color: var(--mq-ink); position: relative; overflow: hidden; font-size: 12px; line-height: 1.55; }
.pdf-page .pdf-foot { position: absolute; inset-inline: 44px; inset-block-end: 24px; display: flex; justify-content: space-between; font-size: 10px; color: var(--mq-muted); border-block-start: 1px solid var(--mq-line); padding-block-start: 6px; }
.pdf-page .sheet-head { padding-block-end: 12px; gap: 10px 24px; }
.pdf-page .sheet-head h1 { font-size: 19px; }
.pdf-page .title-block { font-size: 11px; padding: 6px 10px; }
.pdf-page .counts li { padding-block: 8px; }
.pdf-page .counts .n { font-size: 17px; }
.pdf-page .counts .w { font-size: 10px; }
.pdf-page .status-group > h2, .pdf-page > .pdf-body > h2 { font-size: 14px; padding-block: 12px 2px; }
.pdf-page h2 .muted { font-size: 11px; }
.pdf-page .rule { grid-template-columns: 7.5rem 1fr; gap: 2px 14px; padding-block: 8px; }
.pdf-page .rule-body { gap: 3px; }
.pdf-page .rule-title { font-size: 13px; }
.pdf-page .pill { font-size: 11px; padding: 0 8px; }
.pdf-page .rule-id, .pdf-page .draft { font-size: 10px; }
.pdf-page .figures { gap: 0 28px; }
.pdf-page .figure dt { font-size: 10px; }
.pdf-page .figure dd { font-size: 13px; }
.pdf-page .measure { block-size: 14px; max-inline-size: 300px; }
.pdf-page .measure .track { inset-block-start: 6px; }
.pdf-page .measure .fill { inset-block-start: 4px; block-size: 6px; }
.pdf-page .measure .limit { inset-block: 0; }
.pdf-page .reason, .pdf-page .ref-line { font-size: 11px; }
.pdf-page .missing-link { display: none; }
.pdf-page details.quote summary { display: none; }
.pdf-page details.quote blockquote { margin: 2px 0 0; padding: 4px 10px; font-size: 11px; }
.pdf-page .disclaimer { margin-block-start: 16px; font-size: 12px; }

/* ---------------------------------------------------------------- tablet and phone */
@media (max-width: 1000px) {
  .hero, .problem, .refs { grid-template-columns: 1fr; }
  .hero-copy, .try { justify-self: stretch; max-inline-size: none; }
  .try { inline-size: 100%; }
  .values-layout { grid-template-columns: 1fr; }
  .rail { position: sticky; inset-block-start: auto; inset-block-end: 0; order: 2; grid-template-columns: 1fr auto; align-items: center; padding: 12px 16px; gap: 6px 16px; z-index: 4; }
  .rail .rail-meta, .rail .group-nav { display: none; }
  .rail .notice { grid-column: 1 / -1; }
  .counts { grid-template-columns: repeat(4, 1fr); }
  .counts li:nth-child(5) { border-inline-start: 0; padding-inline-start: 0; }
}
@media (max-width: 640px) {
  :root { --step-0: 1rem; }
  .bar { gap: 12px; flex-wrap: wrap; }
  .bar-links { display: none; }
  .bar-cta { margin-inline-start: auto; }
  .steps { inline-size: 100%; margin: 0; order: 3; }
  .steps li + li::before { inline-size: 18px; margin-inline: 6px; }
  .hero h1 { font-size: 2rem; }
  .lede { font-size: var(--step-0); }
  .try-inputs { grid-template-columns: 1fr; }
  .chain { grid-template-columns: 1fr; gap: 28px; }
  .chain::before { inset-inline: auto; inset-inline-start: 0; inset-block: 0; inline-size: 2px; block-size: auto; }
  .chain li { padding-block-start: 0; padding-inline-start: 24px; }
  .chain li::before { inline-size: 14px; block-size: 2px; inset-block-start: 14px; }
  .chain li:last-child::after { display: none; }
  .limit-list { grid-template-columns: 1fr; }
  .styles { grid-template-columns: 1fr; }
  .style-opt + .style-opt { border-inline-start: 0; border-block-start: 2px solid var(--mq-ink); }
  .field { grid-template-columns: 1fr; }
  .rule { grid-template-columns: 1fr; }
  .rule-status { flex-direction: row; align-items: center; gap: 10px; }
  .sheet-head { grid-template-columns: 1fr; }
  .counts { grid-template-columns: repeat(2, 1fr); }
  .counts li { border-inline-start: 0 !important; padding-inline-start: 0 !important; border-block-start: 1px solid var(--mq-line); }
  .counts li:last-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dim-line span { animation: none; transform: none; opacity: .6; }
  .btn { transition: none; }
}
.hint.warn { color: var(--mq-ink); background: var(--mq-red-tint); border: 1px solid var(--mq-red); padding: 4px 8px; }
/* html2canvas sizes inline SVG and inline-flex boxes badly: on paper the status is its word, in a plain box */
.pdf-page .ico { display: none; }
.pdf-page .pill { display: inline-block; line-height: 1.6; }
.pdf-page .tone-missing, .pdf-page .tone-na, .pdf-page .draft { border: 0; background: var(--mq-ink-tint); padding: 0 8px; }
.steps a { color: inherit; text-decoration: none; }
.steps a:hover { text-decoration: underline; text-underline-offset: 4px; }
.intro-lines { display: grid; gap: 10px; }
.legend { margin-block: 12px 0; display: flex; align-items: center; gap: 8px; }
.report .report-actions { padding-block: 32px 0; }
.ref-line { cursor: default; }

/* ================================================================ Workspace design (Moayad's choice, 2026-11-17)
   From the GOV.UK task-list pattern: the value groups as a task list beside the work, one group in front of the
   engineer at a time, «التالي» to move on; the report's counts as a side filter. docs/2026-11-17-ux-map.md */

/* ---- product page: claim on top, then «start here» beside the live rule */
.hero { grid-template-columns: 1fr 1fr; grid-template-areas: "copy copy" "start try"; align-items: start; }
.hero-copy { grid-area: copy; justify-self: start; max-inline-size: 900px; }
.hero-start { grid-area: start; justify-self: stretch; display: grid; gap: 12px; padding: 22px; background: var(--mq-surface); border: 2px solid var(--mq-ink); }
.try { grid-area: try; }
.hero-start h2 { font-size: var(--step-1); }
.hs-styles { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid var(--mq-ink); }
.hs-drop { min-block-size: 112px; }
.hero-actions { margin-block-start: 20px; }

/* ---- values: task list + one group */
.values-layout { grid-template-columns: 300px minmax(0, 1fr); }
.rail { order: -1; }
.group-nav { order: -1; border: 0; padding: 0; gap: 0; }
.group-nav a { padding: 12px 10px; border-block-end: 1px solid var(--mq-line); font-size: var(--step-0); align-items: baseline; }
.group-nav a.is-current { background: var(--mq-ink); color: var(--mq-on-ink); }
.group-nav a.is-current .n { color: var(--mq-on-ink); }
.progress { display: grid; gap: 6px; margin-block-start: 6px; }
.progress-bar { block-size: 6px; background: var(--mq-grid); }
.progress-bar span { display: block; block-size: 100%; inline-size: 0; background: var(--mq-pass); transition: inline-size .4s cubic-bezier(.2, .8, .2, 1); }
.progress p { font-size: var(--step--1); color: var(--mq-muted); }
.group-head { align-items: center; }
.group-head h2 { flex: 1; }
.gstat { font-size: var(--step--1); font-weight: 600; padding: 2px 10px; white-space: nowrap; }
.gstat.is-done { background: var(--mq-pass-tint); color: var(--mq-pass); }
.gstat.is-open-task { background: var(--mq-ink-tint); color: var(--mq-ink); }
.group.is-open { animation: group-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes group-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.group-next { padding-block-start: 16px; display: flex; justify-content: flex-end; }
.field { padding-block: 12px; }

/* ---- report: counts as a side filter, missing rules folded last */
.report-sheet { display: grid; grid-template-columns: 240px minmax(0, 1fr); column-gap: 40px; }
.report-sheet > .sheet-head, .report-sheet > .disclaimer { grid-column: 1 / -1; }
.report-sheet > .counts { grid-column: 1; grid-row: 2 / span 30; align-self: start; position: sticky; inset-block-start: 88px; grid-template-columns: 1fr; border: 0; }
.report-sheet > .counts li { border: 0; border-block-end: 1px solid var(--mq-line); padding: 0; }
.report-sheet > .counts li > .n, .report-sheet > .counts li > .w { padding-block: 4px; }
.report-sheet > .counts .n { font-size: var(--step-1); }
.report-sheet > :not(.sheet-head):not(.counts):not(.disclaimer) { grid-column: 2; }
.count-btn { all: unset; box-sizing: border-box; display: grid; gap: 2px; inline-size: 100%; padding: 10px 8px; cursor: pointer; transition: background-color .15s ease; }
.count-btn:hover { background: var(--mq-ink-tint); }
.count-btn[aria-pressed="true"] { background: var(--mq-ink); color: var(--mq-on-ink); }
.count-btn[aria-pressed="true"] .n, .count-btn[aria-pressed="true"] .w { color: var(--mq-on-ink); }
.count-btn:focus-visible { outline: 3px solid var(--mq-focus); outline-offset: 2px; }
.counts .is-zero { padding: 10px 8px; }
details.folded > summary { cursor: pointer; list-style: none; padding-block: 28px 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
details.folded > summary::-webkit-details-marker { display: none; }
details.folded > summary h2 { font-size: var(--step-1); display: flex; gap: 10px; align-items: baseline; padding: 0; }
details.folded > summary .fold-hint { color: var(--mq-ink); text-decoration: underline; text-underline-offset: 4px; font-size: var(--step--1); }
details.folded[open] > summary .fold-hint { display: none; }
.rule { animation: group-in .3s cubic-bezier(.2, .8, .2, 1) backwards; }

/* ---- tablet and phone: the task list becomes one row of chips above the group; the side filter becomes a 2-column grid */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "copy" "start" "try"; }
  .values-layout { grid-template-columns: 1fr; }
  .rail { order: 2; }   /* back to the fixed bottom bar on phones */
  .rail .group-nav { display: none; }
  .chips { display: flex; gap: 8px; overflow-x: auto; padding-block: 4px 10px; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scrollbar-width: none; }
  .chips a { flex: none; display: flex; gap: 6px; padding: 8px 12px; border: 1px solid var(--mq-line-strong); text-decoration: none; font-size: var(--step--1); min-block-size: 40px; align-items: center; }
  .chips a.is-current { background: var(--mq-ink); color: var(--mq-on-ink); border-color: var(--mq-ink); }
  .chips a .n { color: var(--mq-muted); }
  .chips a.is-current .n { color: var(--mq-on-ink); }
  .report-sheet { grid-template-columns: 1fr; }
  .report-sheet > .counts { grid-column: 1; grid-row: auto; position: static; grid-template-columns: repeat(2, 1fr); }
  .report-sheet > :not(.sheet-head):not(.counts):not(.disclaimer) { grid-column: 1; }
}
@media (min-width: 1001px) { .chips { display: none; } }
.pdf-page .measure { display: none; }   /* html2canvas draws the bar over the figures; the numbers carry the meaning */
@media (prefers-reduced-motion: reduce) {
  .group.is-open, .rule { animation: none; }
  .progress-bar span, .count-btn { transition: none; }
}
.pdf-page *, .pdf-page *::before { animation: none !important; transition: none !important; }   /* paper never catches a motion mid-way */
@media (max-width: 1000px) { .counter { font-size: var(--step-0); } .counter small { display: none; } }   /* a short bottom bar on phones */

/* ================================================================ transitions between screens (Moayad, 2026-11-17)
   Calm loader: paper ground, the mark, the screen's name, the red dimension line drawing itself (the identity's own
   sign). Then the screen's parts rise one after another, 70 ms apart. Transform and opacity only. */
.loader { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px;
  background-color: var(--mq-bg); background-image: var(--mq-grid-bg); background-size: var(--mq-grid-size);
  animation: loader-in .2s ease-out both; }
.loader[hidden] { display: none; }
.loader.is-leaving { animation: loader-out .26s ease-in both; }
.loader img { inline-size: 64px; block-size: 64px; animation: loader-mark .7s cubic-bezier(.2, .8, .2, 1) both; }
.loader p { margin: 0; font-weight: 700; font-size: var(--step-1); color: var(--mq-ink); animation: loader-mark .7s .08s cubic-bezier(.2, .8, .2, 1) both; }
.loader-line { position: relative; inline-size: 160px; block-size: 14px; }
.loader-line::before, .loader-line::after { content: ""; position: absolute; inset-block: 0; inline-size: 2px; background: var(--mq-red); }
.loader-line::before { inset-inline-start: 0; } .loader-line::after { inset-inline-end: 0; }
.loader-line span { position: absolute; inset-inline: 0; inset-block-start: 6px; block-size: 2px; background: var(--mq-red);
  transform-origin: right center; animation: loader-draw .6s .1s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes loader-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes loader-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes loader-mark { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes loader-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
body.is-loading { overflow: hidden; }

.screen.is-entering :is(.start-aside, .hero-copy, .hero-start, .try, .intro-lines, .narrow > .block, .start-actions, #values-title, #values-intro,
  .chips, #values-form .group.is-open, .rail, .report-actions, .sheet-head, .counts, .legend, .status-group) {
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .loader, .loader img, .loader p, .loader-line span { animation: none; }
  .screen.is-entering * { animation: none !important; }
}

/* ================================================================ product page round (2026-11-17)
   Three directions dealt by design-taste-frontend (draw.mjs, brand palette and type kept), switched with ?v=:
   1 «the product performs» · 2 «type and nothing else» · 3 «the quiet instrument». Temporary until Moayad picks. */
.showcase { display: grid; gap: 32px; }
.showcase-head { display: grid; gap: 12px; max-inline-size: 760px; }
.showcase-head h2, .closing h2 { font-size: var(--step-2); }
.showcase-rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.case { margin: 0; padding-inline: 24px; border-inline-start: 1px solid var(--mq-line); display: grid; align-content: start; gap: 6px; }
.case:first-child { border-inline-start: 0; padding-inline-start: 0; }
.case figcaption { font-size: var(--step--1); color: var(--mq-muted); }
.case .rule { grid-template-columns: 1fr; border-block-end: 0; padding-block: 8px 0; }
.case .rule-status { flex-direction: row; align-items: center; gap: 10px; }
.case details.quote { display: none; }
.closing { display: grid; justify-items: start; gap: 18px; }
.closing p { font-size: var(--step-1); max-inline-size: 46ch; }

/* ---- v1 · the product performs: short claim on the start side, the live rule check large on the other */
.hero { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-areas: "copy try" "start try"; align-items: start; }
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 4.2rem); }
.hero-start { justify-self: stretch; }
.try { justify-self: stretch; inline-size: 100%; padding: 32px; font-size: 1.08rem; }
.try h2 { font-size: var(--step-2); }
.try .figure dd { font-size: var(--step-2); }

/* ---- v2 · type and nothing else: the statement fills the first screen; colour does the job of pictures */

/* ---- v3 · the quiet instrument: one narrow column, a medium-weight headline, small exact demonstrations, space */

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "copy" "start" "try"; }
  .showcase-rows { grid-template-columns: 1fr; gap: 24px; }
  .case { border: 0; border-block-start: 1px solid var(--mq-line); padding: 18px 0 0; }
}

/* ---- product page fixes from the design inspector (shared by the three directions) */
.home { --step--1: 1rem; }                                   /* body text 16px minimum on the public page */
.home p { max-inline-size: 60ch; }
.home .band p:not(.hint):not(.muted) { color: var(--mq-ink); }
.home .hero { padding-inline: max(var(--gutter), calc((100% - var(--max)) / 2)); }   /* one frame with the other sections */
.home .band { padding-block: clamp(56px, 7vw, 104px); }
.home .chain p { font-size: var(--step-1); }
.bar { border-block-end: 0; background: var(--mq-surface); }  /* a tone step, not a hairline */
.ref-list li, .ref-list li:first-child { border: 0; padding-block: 14px; }
.ref-list { display: grid; gap: 6px; }
.ref-list li { background: var(--mq-surface); padding-inline: 16px; }
.ref-list .ref-count { font-size: var(--step-1); white-space: nowrap; }
.will-rise { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--d, 0ms); }
.will-rise.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .will-rise { opacity: 1; transform: none; transition: none; } }
.home .group-table .eg, .home .ref-list .ref-file { color: var(--mq-ink); }

/* ---- the facade drawing in the first section (the idea: the plan measured by the red line) */
.hero-art { grid-area: art; display: grid; place-items: center; min-inline-size: 0; }
.hero-art svg, .hero-art img { inline-size: 100%; max-inline-size: 620px; block-size: auto; }
.hero { grid-template-areas: "copy art" "start try"; }
.hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "copy art" "start try"; align-items: center; row-gap: 56px; }
@media (max-width: 1000px) { .hero, .hero { grid-template-areas: "copy" "art" "start" "try"; } }

/* ---- footer: brand, links, references; then rights and the disclaimer */
.foot { display: block; text-align: start; background: var(--mq-ink); color: var(--mq-on-ink); padding: 64px max(var(--gutter), calc((100% - var(--max)) / 2)) 28px; font-size: var(--step-0); }
.foot a { color: var(--mq-on-ink); text-decoration: none; }
.foot a:hover { text-decoration: underline; text-underline-offset: 4px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr; gap: 40px 64px; padding-block-end: 40px; }
.foot-brand { display: grid; gap: 14px; align-content: start; }
.foot-brand .brand { font-size: var(--step-2); }
.foot-brand .brand img { background: var(--mq-bg); padding: 4px; }
.foot-brand p { max-inline-size: 40ch; color: #C9D2DC; }
.foot-col { display: grid; gap: 10px; align-content: start; }
.foot-col h2 { font-size: var(--step-0); color: #C9D2DC; font-weight: 600; margin-block-end: 4px; }
.foot-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block-start: 20px; border-block-start: 1px solid #3A4E6C; font-size: var(--step--1); color: #C9D2DC; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; } }

/* ---- one rhythm for the working screens: the same top space and the same content frame */
.narrow, .values-layout, .report-sheet { padding-block-start: clamp(32px, 4vw, 56px); }
.report .report-actions { padding-block-start: clamp(24px, 3vw, 40px); }
.screen { padding-block-end: clamp(64px, 8vw, 112px); }
/* inspector round 3 */
@media (max-width: 1000px) { .home .hero { grid-template-columns: minmax(0, 1fr); } }
.foot-bar { border-block-start: 0; margin-block-start: 8px; background: #18294A; margin-inline: calc(-1 * max(var(--gutter), calc((100vw - var(--max)) / 2))); padding: 18px max(var(--gutter), calc((100vw - var(--max)) / 2)); }
.foot { padding-block-end: 0; }
/* polish: the footer's bottom row is a plain row across the footer, not a floating box */
.foot-bar { background: none; margin: 0; padding: 18px 0 24px; border-block-start: 1px solid #3A4E6C; }
.foot-bar { border-block-start: 0; padding-block-start: 28px; }   /* space, not a line (design inspector)

/* ================================================================ UX review fixes (2026-11-17, impeccable critique) */
.kind-fixed { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 16px; background: var(--mq-surface); border-inline-start: 0; }
.values-main { max-inline-size: 820px; }                          /* each input stays close to its label */
.intro-notes { margin-block-start: 4px; }
.intro-notes > p { margin-block-start: 8px; }
.report-sheet > .report-actions { grid-column: 1 / -1; padding: 16px 0 8px; margin: 0; max-inline-size: none; }
@media (max-width: 640px) {
  .styles { grid-template-columns: repeat(3, 1fr); }               /* same as the product page */
  .style-opt + .style-opt { border-block-start: 0; border-inline-start: 2px solid var(--mq-ink); }
  .style-opt { min-block-size: 52px; font-size: var(--step-0); }
  .report-sheet > .counts li.is-zero:not(.tone-fail-t) { display: none; }   /* zeros are noise on a phone; «0 مخالف» stays */
}
@media (min-width: 1001px) { .report-sheet > .report-actions { grid-row: 2; } .report-sheet > .counts { grid-row: 3 / span 30; } }

/* ================================================================ design round: balance and motion (2026-11-17)
   Moayad: «بعض الواجهات كبيرة بزيادة والتاسك بار مرات يكون صغير… أوزن بينهم وأبدع بالتاسك بار والموشن».
   Patterns from ui-references: slim top bar (product page), section progress as a stepper (working screens),
   count-up, view transitions, micro-interactions, light parallax. CSS and a little script only. */

/* ---- top bar: one size on every screen, roomier, the brand larger; compacts once the page scrolls */
.bar { min-block-size: 72px; padding-block: 12px; gap: 28px; transition: background-color .25s ease, box-shadow .25s ease; }
.bar .brand { font-size: 1.375rem; gap: 12px; }
.bar .brand img { inline-size: 44px; block-size: 44px; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.bar .brand:hover img { transform: rotate(-6deg) scale(1.05); }
.bar-links { gap: 32px; }
.bar-links a { font-size: var(--step-0); color: var(--mq-ink); }
/* The scrolled bar keeps its height: a height change moves the page under it, flips the state back and makes the shadow shake. */
body.is-scrolled .bar { background: var(--mq-bg); box-shadow: 0 6px 20px rgba(31, 51, 80, .08); }
body.is-scrolled .bar .brand img { transform: scale(.88); }

/* ---- the stepper: three nodes on the red dimension line; the done part of the line is drawn in red */
.steps { gap: 0; align-items: center; margin-inline: auto; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: var(--step-0); color: var(--mq-muted); }
.steps li a, .steps li > span:not(.node) { color: inherit; text-decoration: none; }
.steps li + li::before { content: ""; inline-size: clamp(36px, 6vw, 96px); block-size: 3px; margin-inline: 14px; border-radius: 0;
  background: linear-gradient(var(--mq-red), var(--mq-red)) no-repeat right / 0% 100%, var(--mq-line); transition: background-size .6s cubic-bezier(.65, 0, .35, 1); }
.steps li.is-done + li::before { background-size: 100% 100%, auto; }
.steps .node { inline-size: 14px; block-size: 14px; border: 2px solid var(--mq-line-strong); background: var(--mq-bg); transition: background-color .3s, border-color .3s, transform .3s; flex: none; }
.steps li.is-done .node { background: var(--mq-red); border-color: var(--mq-red); }
.steps li.is-now { color: var(--mq-ink); font-weight: 700; }
.steps li.is-now .node { background: var(--mq-ink); border-color: var(--mq-ink); transform: scale(1.25); box-shadow: 0 0 0 4px var(--mq-ink-tint); }
.steps li.is-done { color: var(--mq-ink); }

/* ---- balance: the working screens were heavier than the bar above them */
.narrow { max-inline-size: 700px; gap: 28px; }
.style-opt { min-block-size: 52px; font-size: var(--step-0); }
.drop { min-block-size: 140px; }
.drop-main { font-size: var(--step-0); }
.start-actions .btn-lg, .closing .btn-lg { font-size: var(--step-0); min-block-size: 48px; }
.rail .btn-lg { font-size: var(--step-0); min-block-size: 48px; }
.counter { font-size: var(--step-0); }
.sheet-head h1 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.75rem); }

/* ---- micro-interactions: a red underline that draws in, buttons that answer the press */
.bar-links a, .foot a, .link { position: relative; text-decoration: none; }
.bar-links a::after, .link::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: -3px; block-size: 2px; background: var(--mq-red);
  transform: scaleX(0); transform-origin: right; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.link::after { transform: scaleX(1); background: var(--mq-line-strong); }
.bar-links a:hover::after, .link:hover::after, .bar-links a:focus-visible::after { transform: scaleX(1); background: var(--mq-red); }
.btn { position: relative; overflow: hidden; }
.btn-primary::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 3px; background: var(--mq-red); transform: scaleX(0); transform-origin: right; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.btn-primary:hover::after, .btn-primary:focus-visible::after { transform: scaleX(1); }
.btn:active { transform: translateY(1px) scale(.985); }
.style-opt, .choice, .yesno label, .group-nav a, .chips a { transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.style-opt:hover:not(:has(input:checked)) { background: var(--mq-ink-tint); }

@media (max-width: 640px) {
  .bar { min-block-size: 60px; }
  .bar .brand img { inline-size: 38px; block-size: 38px; }
  .steps { margin-inline: 0; }
  .steps li { font-size: var(--step--1); gap: 6px; }
  .steps li + li::before { inline-size: 24px; margin-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .bar, .bar .brand img, .steps li + li::before, .steps .node, .bar-links a::after, .link::after, .btn-primary::after { transition: none; }
}
/* balance: the short claim stays beside the long list instead of leaving half the screen bare; closer sections */
@media (min-width: 1001px) { .home .problem-copy { position: sticky; inset-block-start: 110px; } }
.home .band { padding-block: clamp(44px, 5vw, 76px); }

/* ================================================================ round 5 (2026-11-17): «كأنه منتج شركة حقيقي»
   Built only from what is true in the product: live facts, the steps after upload, a report header like the title
   block of an architectural sheet. One rule for every container: 2px ink for what you act on, a tone step for the rest. */

/* ---- facts band: the identity's navy, numbers that count up, red dimension ticks between them */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--mq-ink); color: var(--mq-on-ink);
  padding: 40px max(var(--gutter), calc((100% - var(--max)) / 2)); }
.fact { display: grid; gap: 6px; padding-inline: 24px; position: relative; }
.fact + .fact::before { content: ""; position: absolute; inset-inline-start: 0; inset-block: 6px; inline-size: 2px; background: #E8A49B; }
.fact:first-child { padding-inline-start: 0; }
.fact-n { font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); font-weight: 700; line-height: 1; font-feature-settings: "tnum" 1; }
.fact-n small { font-size: .45em; font-weight: 600; }
.fact-l { color: #C9D2DC; font-size: var(--step-0); max-inline-size: 22ch; }
@media (max-width: 760px) {
  .facts { grid-template-columns: 1fr 1fr; row-gap: 28px; }
  .fact:nth-child(3) { padding-inline-start: 0; }
  .fact:nth-child(3)::before { display: none; }
}

/* ---- start: the form beside «what happens next» */
.start { display: grid; grid-template-columns: minmax(0, 700px) minmax(0, 360px); justify-content: center; gap: 56px;
  padding-inline: var(--gutter); }
.start .narrow { padding-inline: 0; margin: 0; }
.start-aside { align-self: start; position: sticky; inset-block-start: 100px; margin-block-start: clamp(32px, 4vw, 56px);
  display: grid; gap: 18px; padding: 24px; background: var(--mq-surface); }
.start-aside h2 { font-size: var(--step-1); }
.chain-v { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; position: relative; padding-inline-start: 24px; }
.chain-v::before { content: ""; position: absolute; inset-inline-start: 5px; inset-block: 8px; inline-size: 2px; background: var(--mq-red); }
.chain-v li { display: grid; gap: 4px; position: relative; }
.chain-v li::before { content: ""; position: absolute; inset-inline-start: -24px; inset-block-start: 7px; inline-size: 12px; block-size: 12px; background: var(--mq-bg); border: 2px solid var(--mq-red); }
.chain-v span { color: var(--mq-muted); font-size: var(--step--1); }
.aside-note { font-size: var(--step--1); padding-block-start: 12px; border-block-start: 1px solid var(--mq-line); }
@media (max-width: 1000px) {
  .start { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .start-aside { position: static; margin-block-start: 0; order: 2; }
}

/* ---- report header: verdict, one summary line, and a title block like an architectural sheet's */
.verdict-box { display: grid; gap: 8px; }
.verdict-sum { color: var(--mq-muted); font-size: var(--step-0); }
.title-block { grid-template-columns: auto auto; border: 2px solid var(--mq-ink); padding: 0; gap: 0; background: var(--mq-surface); }
.title-block .tb-cap { grid-column: 1 / -1; background: var(--mq-ink); color: var(--mq-on-ink); padding: 6px 14px; font-weight: 700; }
.title-block dt:not(.tb-cap), .title-block dd { padding: 6px 14px; border-block-start: 1px solid var(--mq-line); }
.title-block dd { border-inline-start: 1px solid var(--mq-line); }

/* Nothing looks editable unless it is (Moayad, 2026-11-17): with the browser's caret browsing on, clicking any text
   showed a blinking cursor. The caret is hidden everywhere and shown only in real input boxes; clicking controls
   does not select their text. Reading text stays selectable for copying. */
html { caret-color: transparent; }
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea { caret-color: var(--mq-red); }
button, .btn, .bar, .steps, .style-opt, .choice, .yesno, .group-nav, .chips, .count-btn, .drop, .kind-fixed,
summary, .loader, .hero-art, .fact-n { -webkit-user-select: none; user-select: none; }

/* ---- the scrollbar as a dimension line (Moayad: «هذا خليه مميز برضو»): a navy bar with red end ticks, red on hover.
   Edge and Chrome draw it from ::-webkit-scrollbar, which they ignore once scrollbar-color is set, so the standard
   property is kept for Firefox only. */
html { scrollbar-color: auto; scrollbar-width: auto; }
@supports not selector(::-webkit-scrollbar) { html { scrollbar-color: var(--mq-ink) var(--mq-surface); scrollbar-width: thin; } }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--mq-surface); }
::-webkit-scrollbar-thumb { background: var(--mq-ink); border: 3px solid var(--mq-surface); border-radius: 0;
  box-shadow: inset 0 4px 0 var(--mq-red), inset 0 -4px 0 var(--mq-red); min-height: 48px; }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background: var(--mq-red); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: var(--mq-surface); }
.table-wrap::-webkit-scrollbar, .chips::-webkit-scrollbar { height: 8px; }

/* ---- scroll behaviour, one rule set (Moayad: «مفروض تكون بالوسط… الأشياء هذي زبطها بالموقع»)
   - work panels stick at one distance under the top bar, and so do section jumps from links;
   - a sticky panel never grows taller than the screen (its own scroll keeps the button reachable);
   - a short sticky text on the product page settles at the vertical centre of the view (top set by app.js). */
:root { --sticky-top: 96px; }
html { scroll-padding-block-start: var(--sticky-top); }
@media (min-width: 1001px) {
  .rail { inset-block-start: var(--sticky-top); max-block-size: calc(100vh - var(--sticky-top) - 16px); overflow-y: auto; overscroll-behavior: contain; }
  .report-sheet > .counts { inset-block-start: var(--sticky-top); }
  .start-aside { inset-block-start: var(--sticky-top); }
  .home .problem-copy { inset-block-start: var(--center-top, var(--sticky-top)); transition: inset-block-start .2s ease; }
}

/* ---- no layout jumps (Moayad: «لما افتح الي تحت يقوم يتحركون… راجعها بكامل الموقع»)
   - the hero's second row aligns to the top: opening the quote in the rule panel no longer moves the start box;
   - the line under each value keeps its place, so «يدوي» appearing while typing does not push the fields below;
   - counting numbers reserve their final width (set by app.js). */
.hero { align-items: start; }
.hero-copy, .hero-art { align-self: center; }
[data-badge] { min-block-size: 1.6em; }
.counting { display: inline-block; text-align: start; }
[data-badge] { font-size: var(--step--1); line-height: 1.7; min-block-size: 1.7em; }   /* same height empty or filled: 0 px jump

/* ================================================================ phone round (2026-11-18)
   Measured at 390x844: the inner-screen bar took 114px (brand and steps on two rows), the start box began at 765px
   (under the fold), footer and step links were 24-27px tall (too small for a thumb), the report buttons had two widths. */
@media (max-width: 640px) {
  /* inner screens: logo mark only, steps on the same row as it */
  .bar:has(.steps:not([hidden])) { flex-wrap: nowrap; }
  .bar:has(.steps:not([hidden])) .brand span { display: none; }
  .bar:has(.steps:not([hidden])) .steps { inline-size: auto; order: 0; margin-inline-start: auto; }
  .steps a, .steps li > span:not(.node) { display: inline-block; padding-block: 10px; }
  .steps li + li::before { inline-size: 16px; margin-inline: 6px; }

  /* product page: what to do comes before the picture */
  .home .hero { grid-template-areas: "copy" "start" "art" "try"; }
  .hero-art svg, .hero-art img { max-block-size: 240px; }

  /* thumb-sized links */
  details > summary { padding-block: 9px; }
  .foot a { display: inline-block; padding-block: 9px; }
  .link { display: inline-block; padding-block: 8px; }
  .link::after { inset-block-end: 5px; }

  /* report buttons: one width, one under the other */
  .report-sheet > .report-actions { display: grid; grid-template-columns: 1fr; }
  .report-sheet > .report-actions .btn { inline-size: 100%; justify-content: center; }
}

/* ================================================================ line endings (2026-11-18)
   Moayad: «مو جملة وسطر ثاني كلمة وحدة فقط». Paragraphs avoid a last line with one word (pretty); titles, buttons
   and labels split into even lines (balance); counters and badges never break inside. Browsers without text-wrap
   support simply wrap as before, so nothing breaks there. */
p, li, dd, dt, figcaption, blockquote, summary, small, .lede, .note, .disclaimer, .hint { text-wrap: pretty; }
h1, h2, h3, h4, legend, th, .btn, button, label, .choice, .style-opt, .group-nav a > span:first-child, .chips a > span:first-child { text-wrap: balance; }
.n, [data-ncount], [data-gcount], .gstat, .rule-id, .pill, .sum-item, .count-btn b, .counts li b, .fact-n { white-space: nowrap; }
/* two-line notes read better as two even lines than a long line and a short tail */
#values-intro > p, .legend, .verdict-sum, .hero .lede { text-wrap: balance; }
/* Moayad: «شارع والارتداد / السور ب سطر ثاني». The side list is wide enough for the longest group name, and a name never wraps. */
@media (min-width: 1001px) { .values-layout { grid-template-columns: 340px minmax(0, 1fr); } .group-nav a > span:first-child { white-space: nowrap; } }

/* Public link only: the engine is being prepared inside the visitor's browser (app.js, startEngine). A quiet
   strip at the bottom, ink on surface, with the red dimension line moving under it while it waits. */
.engine-note { position: fixed; inset-block-end: 16px; inset-inline: 16px; margin-inline: auto; max-inline-size: 560px; z-index: 40;
  padding: 10px 16px 12px; background: var(--mq-surface); color: var(--mq-ink); border: 2px solid var(--mq-ink);
  font-size: var(--step--1); text-wrap: pretty; overflow: hidden; }
.engine-note::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 2px; background: var(--mq-red);
  transform-origin: right center; animation: loader-draw 1.6s cubic-bezier(.65, 0, .35, 1) infinite alternate; }
@media (prefers-reduced-motion: reduce) { .engine-note::after { animation: none; } }
