/* מוטי אבנימין · "פרוטוקול בדיקה": גיליון לבן על שולחן שזיף. design.md הוא המקור. */
:root {
  --bg: #3D2338;
  --surface: #FFFFFF;
  --ink: #221A21;
  --muted: #5E5560;
  --primary: #3D2338;
  --primary-ink: #FFFFFF;
  --soft: #FBF2D0;
  --accent: #26BAD7;
  --accent-ink: #1A7F94;
  --gold: #EFBE39;
  --line: #E2DCE1;
  --focus: #3D2338;
  --radius: 4px;
  --k-btn-radius: 3px;
  --font-head: "Noto Serif Hebrew Variable", serif;
  --mono: "Cascadia Mono Variable", ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-head); font-size: 18px; line-height: 1.7; overflow-x: clip;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 34px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 26px; line-height: 1.25; font-weight: 600; margin-bottom: 24px; }
h3 { font-size: 19px; line-height: 1.35; font-weight: 600; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.top :focus-visible, .toc :focus-visible, .foot :focus-visible, .demo-banner :focus-visible, .dock :focus-visible { outline-color: var(--gold); }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--soft); color: var(--ink); padding: 10px 16px; }
.skip-link:focus { top: 12px; }
.demo-banner { min-height: 40px; display: flex; align-items: center; justify-content: center; padding: 8px 12px; color: var(--soft); font-size: 14px; line-height: 1.4; text-align: center; border-bottom: 1px solid rgb(251 242 208 / .15); }

/* ---------- Header on the plum desk (stays: it is a document) ---------- */
.top { position: sticky; top: 0; z-index: 50; background: var(--bg); }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; max-width: 1280px; margin-inline: auto; }
.brand { display: flex; flex-direction: column; color: var(--soft); text-decoration: none; line-height: 1.2; min-height: 44px; justify-content: center; }
.brand__name { font-weight: 700; font-size: 19px; }
.brand__sub { font-family: var(--mono); font-size: 13px; opacity: .9; }
.top .top__btn { --k-btn-bg: #FBF2D0; --k-btn-ink: #3D2338; }

/* ---------- The sheet ---------- */
.desk { padding: 4px 12px 32px; }
.toc { display: none; }
.sheet {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 20px 40px -20px rgb(0 0 0 / .45);
  padding: 24px 20px 40px; position: relative;
}
.head__bar {
  display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; margin-bottom: 24px;
  border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.head__lead { margin-top: 14px; }
.head__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.head__actions .k-btn { flex: 1 1 auto; }
.report-head { margin: 32px 0 0; border-top: 1px solid var(--line); }
.report-head > div { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.report-head dt { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.report-head dd { margin: 0; overflow: hidden; position: relative; }
.report-head dd > span:first-child { display: inline-block; }
.report-head__result dd { overflow: visible; min-height: 60px; }

/* The stamp: a rectangle with a double frame, live text, a static ink texture. */
.stamp {
  position: absolute; inset-inline-start: 64px; top: -14px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 120px; height: 52px; border: 3px solid var(--accent-ink); border-radius: 10px;
  color: var(--accent-ink); line-height: 1; opacity: .92; transform: rotate(-8deg);
  -webkit-mask: url(../images/ink.svg) center / 100% 100%; mask: url(../images/ink.svg) center / 100% 100%;
  pointer-events: none;
}
.stamp::before { content: ""; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 6px; }
.stamp__word { font-family: var(--font-head); font-weight: 800; font-size: 22px; }
.stamp__sub { font-family: var(--mono); font-size: 9px; margin-top: 3px; }
.stamp--echo { display: none; }

/* ---------- Sections ---------- */
.sec { position: relative; padding-top: 48px; margin-top: 8px; border-top: 1px solid var(--line); }
.sec__rail { display: none; }
.sec__no { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--muted); vertical-align: middle; margin-inline-end: 4px; }
.sec__more { margin-top: 16px; }
.k-link { min-height: 44px; display: inline-flex; align-items: center; font-family: var(--mono); font-size: 15px; }

.clauses { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.clauses li { display: grid; grid-template-columns: 22px 40px 1fr; gap: 10px; align-items: start; }
.clauses__no { font-family: var(--mono); font-size: 15px; color: var(--muted); padding-top: 2px; }
.clauses p { color: var(--muted); font-size: 17px; }
.check { position: relative; width: 22px; height: 22px; border: 1.5px solid var(--primary); border-radius: 2px; margin-top: 4px; }
.check svg { position: absolute; inset: -3px; width: 28px; height: 28px; max-width: none; fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.check__cover { position: absolute; inset: -4px; background: var(--surface); transform: scaleX(0); transform-origin: right; }
.out-of-scope { margin-top: 24px; padding: 14px 16px; background: var(--soft); border-radius: var(--radius); font-size: 17px; }

/* Findings: a real table; on phones each row becomes a card. */
.findings { width: 100%; border-collapse: collapse; }
.findings caption { text-align: start; font-family: var(--mono); font-size: 13px; color: var(--muted); padding-bottom: 12px; }
.findings thead { display: none; }
.findings tr { display: block; padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.findings td { display: block; }
.findings__no { font-family: var(--mono); font-size: 14px; color: var(--accent-ink); font-weight: 500; }
.findings__src { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 8px; }

.measures { display: grid; gap: 24px; }
.params { width: 100%; border-collapse: collapse; }
.params th, .params td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.params thead th { background: var(--soft); font-family: var(--mono); font-size: 13px; font-weight: 400; }
.params tbody th { font-weight: 400; }
.params td { font-family: var(--mono); font-size: 16px; font-weight: 500; }
.short-quote { margin: 20px 0 0; padding-inline-start: 14px; border-inline-start: 2px solid var(--accent-ink); }
.short-quote footer { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 6px; }
.measures__photo { margin: 0; }
.measures__photo img, .figs img { width: 100%; height: auto; }

.figs { list-style: none; margin: 0 -20px; padding: 0 20px 12px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; }
.figs li { flex: 0 0 80%; scroll-snap-align: center; }
.figs figure { margin: 0; }
.figs a { display: block; border-radius: 2px; overflow: hidden; }
.figs__tall img { aspect-ratio: 4 / 3; object-fit: cover; }
.figs figcaption { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 8px; }

.inspector { display: grid; gap: 22px; }
.passport { position: relative; width: 160px; padding: 8px; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 18px -10px rgb(0 0 0 / .35); }
.passport__clip { position: absolute; top: -18px; inset-inline-start: 22px; width: 28px; height: 64px; fill: none; stroke: #9E95A0; stroke-width: 3; stroke-linecap: round; z-index: 2; }
.inspector__lead { font-weight: 600; }

.students { display: grid; gap: 8px; margin-top: 8px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 14px 16px; background: var(--soft); border-radius: var(--radius); }
.steps__no { font-family: var(--mono); font-size: 15px; color: var(--muted); padding-top: 3px; }

.sign { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.sign__line { position: relative; border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; display: flex; align-items: flex-end; justify-content: space-between; min-height: 64px; }
.sign__name { font-size: 24px; font-weight: 600; }
.stamp--small { position: relative; inset: auto; top: 6px; width: 96px; height: 40px; }
.stamp--small .stamp__word { font-size: 18px; }
.stamp--small .stamp__sub { font-size: 7px; }
.sign__role { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 6px; }
.sign__cta { margin-top: 24px; }
.sign__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }

/* ---------- Footer + dock ---------- */
.foot { color: var(--soft); font-size: 15px; line-height: 1.6; padding: 8px 12px 32px; }
.foot__grid { display: grid; gap: 14px; max-width: 1280px; margin-inline: auto; }
.foot a { color: var(--soft); display: inline-block; min-height: 44px; padding-block: 10px; }
.dock {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 60; display: flex; gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bg);
  border-top: 1px solid rgb(251 242 208 / .2); transition: transform 300ms var(--k-ease), opacity 300ms var(--k-ease);
}
.dock > * { flex: 1 1 0; }
.dock .k-btn--outline { --k-outline-ink: #FBF2D0; --primary: #FBF2D0; }
.dock.is-hidden { transform: translateY(110%); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .dock { transition: none; } }
body { padding-bottom: 76px; }

/* ---------- Intro: the form fills in, the stamp lands (html.intro only) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.intro .report-head dd > span:first-child { animation: fill-in 380ms var(--k-ease-out) both; }
  html.intro .report-head > div:nth-child(1) dd > span:first-child { animation-delay: 300ms; }
  html.intro .report-head > div:nth-child(2) dd > span:first-child { animation-delay: 410ms; }
  html.intro .report-head > div:nth-child(3) dd > span:first-child { animation-delay: 520ms; }
  html.intro .report-head > div:nth-child(4) dd > span:first-child { animation-delay: 630ms; }
  html.intro .report-head > div:nth-child(5) dd > span:first-child { animation-delay: 740ms; }
  html.intro .report-head > div:nth-child(6) dd > span:first-child { animation-delay: 850ms; }
  html.intro .head .stamp:not(.stamp--echo) { animation: stamp 260ms linear 1000ms both; }
  html.intro .stamp--echo { display: inline-flex; translate: 1px 1px; animation: echo 240ms linear 1260ms both; }
  html.intro .sheet { animation: thump 120ms ease-out 1120ms; }

  .k-motion .check__cover { transform: none; transition: transform 320ms var(--k-ease-out) 200ms; }
  .k-motion .clauses li.is-in .check__cover { transform: scaleX(0); }
  .k-motion .passport__clip { opacity: 0; transform: translateY(-8px); transition: opacity 200ms var(--k-ease) 300ms, transform 200ms var(--k-ease) 300ms; }
  .k-motion .passport.is-in .passport__clip { opacity: 1; transform: none; }
  .k-motion .sign .stamp--small { opacity: 0; }
  .k-motion .sign.is-in .stamp--small { animation: stamp-small 260ms linear 300ms both; }
}
@keyframes fill-in { from { transform: translateY(105%); } to { transform: none; } }
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.35) rotate(-14deg); }
  46% { opacity: .92; transform: scale(.96) rotate(-8deg); }
  77% { transform: scale(1.02) rotate(-8deg); }
  100% { opacity: .92; transform: scale(1) rotate(-8deg); }
}
@keyframes stamp-small {
  0% { opacity: 0; transform: scale(1.3) rotate(-14deg); }
  60% { opacity: .92; transform: scale(.97) rotate(-8deg); }
  100% { opacity: .92; transform: scale(1) rotate(-8deg); }
}
@keyframes echo { 0% { opacity: 0; } 50% { opacity: .18; } 100% { opacity: 0; } }
@keyframes thump { 0% { transform: none; } 50% { transform: translateY(2px); } 100% { transform: none; } }

/* ---------- Subpages ---------- */
body.subpage { padding: 12px; }
.subpage__main { max-width: 760px; margin: 24px auto; background: var(--surface); padding: 32px 24px 40px; border-radius: var(--radius); }
.subpage__main h1 { margin-bottom: 16px; }
.subpage__main h2 { font-size: 22px; margin: 28px 0 10px; }
.subpage__main p, .subpage__main li { margin-bottom: 8px; }
.subpage__eyebrow { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.subpage__back { display: inline-block; min-height: 44px; padding-block: 10px; font-weight: 700; }

/* ================= Desktop: TOC | sheet | margin with huge clause numbers ================= */
@media (min-width: 1100px) {
  h1 { font-size: 52px; }
  h2 { font-size: 34px; margin-bottom: 32px; }
  h3 { font-size: 21px; }
  .sec__no { font-size: 16px; }
  .top__inner { padding-inline: 24px; }
  .desk {
    display: grid; grid-template-columns: 260px 760px 1fr; column-gap: 32px; align-items: start;
    max-width: 1280px; margin-inline: auto; padding: 8px 24px 48px;
  }
  .toc { display: block; position: sticky; top: 96px; color: var(--soft); }
  .toc__title { font-family: var(--mono); font-size: 14px; opacity: .85; margin-bottom: 10px; }
  .toc ol { list-style: none; margin: 0; padding: 0; }
  .toc a {
    position: relative; display: block; padding: 8px 14px 8px 0; color: var(--soft); text-decoration: none; font-size: 16px;
  }
  .toc a span { font-family: var(--mono); font-size: 14px; margin-inline-end: 6px; }
  .toc a::before {
    content: ""; position: absolute; right: 0; top: 8px; bottom: 8px; width: 2px; background: var(--accent);
    transform: scaleY(0); transform-origin: top;
  }
  .toc a[aria-current="true"] { color: var(--gold); padding-inline-start: 12px; }
  .toc a[aria-current="true"]::before { transform: none; }
  .sheet { padding: 40px 56px 64px; }
  .head h1, .head__lead { max-width: 60%; }
  .head h1 { max-width: 80%; }
  .report-head > div { grid-template-columns: 140px 1fr; padding: 12px 0; }
  .report-head dt { font-size: 14px; }
  .report-head__result dd { min-height: 72px; }
  .head .stamp { inset-inline-start: auto; inset-inline-end: -110px; top: -18px; width: 150px; height: 64px; }
  .head .stamp .stamp__word { font-size: 28px; }
  .head .stamp .stamp__sub { font-size: 10px; }
  .sec__rail { display: block; position: absolute; top: 40px; bottom: 0; left: -236px; width: 148px; pointer-events: none; }
  .sec__big { position: sticky; top: 120px; display: block; font-family: var(--mono); font-weight: 200; font-size: 160px; line-height: 1; color: #5A3954; text-align: center; }
  .clauses li { grid-template-columns: 22px 56px 1fr; }
  .findings thead { display: table-header-group; }
  .findings tr { display: table-row; padding: 0; margin: 0; border: 0; }
  .findings td, .findings th { display: table-cell; padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
  .findings thead th { background: var(--soft); font-family: var(--mono); font-size: 14px; font-weight: 400; }
  .findings th:first-child, .findings__no { width: 64px; }
  .findings th:last-child, .findings__src { width: 160px; }
  .findings__src { margin: 0; }
  .measures { grid-template-columns: 1fr 1fr; align-items: start; gap: 32px; }
  .params td { font-size: 18px; }
  .figs { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; margin: 0; padding: 0; overflow: visible; }
  .figs li { flex: none; }
  .figs__tall img { aspect-ratio: auto; }
  .figs li:nth-child(3) { grid-row: span 1; }
  .inspector { grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
  .passport { width: 220px; }
  .students { grid-template-columns: 1fr 1fr; gap: 24px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { grid-template-columns: 1fr; }
  .foot__grid { grid-template-columns: 260px repeat(3, 1fr); padding-inline: 24px; }
  .foot__grid > :first-child { grid-column: 2; }
  .dock { display: none; }
  body { padding-bottom: 0; }
}
@media (min-width: 1100px) and (prefers-reduced-motion: no-preference) {
  .toc a::before { transition: transform 260ms var(--k-ease-out); }
}
