/*
  Shakuf Accounting (demo) - art direction
  Scene:   the least boring ledger in the world. Squared paper, thick ink
           outlines, hard offset shadows, and money drawn as loud streams
           of colour.
  Palette: ledger paper and near-black ink for everything structural;
           six saturated colours belong to the six places money goes,
           and to nothing else. Marker yellow for the single highlight.
  Type:    IBM Plex Sans Hebrew (text and headlines), IBM Plex Mono (every
           number).
  Shape:   2px ink lines, small radii, shadows that do not blur.
*/

:root {
  --paper: #f4f1ea;
  --card: #fffdf8;
  --ink: #11152b;
  --ink-soft: #4b5068;
  --grid: rgba(17, 21, 43, 0.07);
  --sun: #ffe14a;
  --pocket: #0a7a55;
  --text: 'IBM Plex Sans Hebrew', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --hard: 5px 5px 0 var(--ink);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--paper);
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-x: clip;
}

h1, h2, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
small { font-size: 0.8125rem; font-weight: 400; color: var(--ink-soft); }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ribbon-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 0.4rem var(--gutter);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  text-align: center;
}
.ribbon-bar a:focus-visible { outline-color: var(--paper); }

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--gutter) 0;
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0; color: var(--ink-soft); font-size: 0.9375rem; }
.brand strong {
  display: inline-block;
  margin-inline-end: 0.5em;
  padding: 0 0.35em;
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 700;
}
.lang { padding: 0.5rem 0; text-underline-offset: 0.3em; white-space: nowrap; }

/* ---------- Headline ---------- */

.hero { padding: 2.5rem var(--gutter) 1.5rem; }
h1 {
  font-weight: 700;
  font-size: clamp(2.6rem, 10vw, 6.2rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
mark {
  padding: 0 0.12em;
  background: linear-gradient(transparent 12%, var(--sun) 12% 92%, transparent 92%);
  color: inherit;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.lede { margin-top: 1rem; max-inline-size: 40ch; font-size: 1.1875rem; color: var(--ink-soft); }

/* ---------- Questions and picture ---------- */

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1rem var(--gutter) 2.5rem;
}

.asks {
  display: grid;
  gap: 0;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--hard);
  align-self: start;
}
.ask {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.2rem 0.7rem;
  padding: 1rem 1.1rem 0.8rem;
  border-bottom: 2px solid var(--ink);
}
.ask:last-of-type { border-bottom: 0; }
.ask-n {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.ask-q { font-weight: 700; line-height: 1.25; }
.ask-q small { display: block; margin-top: 0.1rem; }
.ask-v {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 600;
  white-space: nowrap;
}
.ask input[type='range'], .toggle { grid-column: 1 / -1; }
.ask-small { grid-template-columns: minmax(0, 1fr) auto; align-items: center; background: #f0ece2; border-radius: 0 0 4px 4px; }

.toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.toggle button {
  min-block-size: 2.9rem;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--card);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.toggle button[aria-pressed='true'] { background: var(--sun); box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px, -1px); }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  inline-size: 100%;
  block-size: 2.75rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track { block-size: 8px; border-radius: 99px; background: var(--ink); }
input[type='range']::-moz-range-track { block-size: 8px; border-radius: 99px; background: var(--ink); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  inline-size: 30px;
  block-size: 30px;
  margin-top: -11px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 2px 2px 0 var(--ink);
}
input[type='range']::-moz-range-thumb {
  inline-size: 26px;
  block-size: 26px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 2px 2px 0 var(--ink);
}
input[type='range']:disabled { opacity: 0.35; cursor: not-allowed; }

.stepper { display: flex; align-items: center; gap: 0.5rem; }
.stepper button {
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.stepper button[aria-disabled='true'] { opacity: 0.35; cursor: not-allowed; }
.stepper output { min-inline-size: 3.2rem; text-align: center; font-family: var(--mono); font-weight: 600; font-size: 1.1rem; }

.warning {
  margin: 0;
  padding: 0.8rem 1.1rem;
  border-top: 2px solid var(--ink);
  background: #ffd9d2;
  font-weight: 500;
}
.warning[hidden] { display: none; }

.board {
  --labels: 9.6rem;
  --tall: 27rem;
  padding: 1rem 1rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--hard);
}
.source { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; margin-bottom: 0.6rem; font-weight: 700; }
.source b { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; }
.source small[hidden] { display: none; }

.picture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--labels);
  block-size: var(--tall);
}
#river { display: block; inline-size: 100%; block-size: 100%; }
.dests { position: relative; }
.dest {
  position: absolute;
  inset-inline: 0;
  top: 50%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0 0.5rem;
  padding-inline-start: 0.6rem;
  border-inline-start: 4px solid var(--paint);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.dest.is-on { opacity: 1; }
.dest.is-zero { opacity: 0; }
.dest span { grid-column: 1 / -1; font-size: 0.8125rem; line-height: 1.15; color: var(--ink-soft); }
.dest b { font-family: var(--mono); font-size: 1rem; font-weight: 600; white-space: nowrap; }
.dest i { font-family: var(--mono); font-style: normal; font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); }
.dest:first-child span { color: var(--ink); font-weight: 700; }
.dest:first-child b { font-size: 1.15rem; color: var(--pocket); }
.fallback { padding: 2rem; text-align: center; }

/* ---------- The big number and the hundred squares ---------- */

.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  padding: 2.5rem var(--gutter);
  border-block: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.result h2 { font-size: 1.25rem; font-weight: 500; }
.pocket-n {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(3.2rem, 15vw, 7.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #3ddc9c;
  white-space: nowrap;
}
.pocket-note { margin-top: 0.4rem; font-size: 1.125rem; color: #c9cce0; }

.waffle {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  inline-size: min(100%, 21rem);
  aspect-ratio: 1;
}
.waffle i {
  border-radius: 4px;
  background: #2a3055;
  transition: background-color 0.35s ease;
}
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-top: 0.9rem; font-size: 0.875rem; color: #c9cce0; }
.legend li::before {
  content: '';
  display: inline-block;
  inline-size: 0.7em;
  block-size: 0.7em;
  margin-inline-end: 0.45em;
  border-radius: 2px;
  background: var(--paint);
}
.legend li[hidden] { display: none; }

/* ---------- What if, year, meeting ---------- */

.whatif, .calendar, .meet { padding: 3rem var(--gutter) 0.5rem; }
h2 { font-size: clamp(1.8rem, 5vw, 2.9rem); font-weight: 700; line-height: 1.08; letter-spacing: -0.01em; text-wrap: balance; }

.chips { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.25rem; }
.chips button {
  min-block-size: 3rem;
  padding: 0.5rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.chips button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.chips button[aria-pressed='true'] { background: var(--sun); box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px, -1px); }
.scenario-text { margin-top: 1.1rem; min-block-size: 3.4em; max-inline-size: 46ch; font-size: 1.1875rem; color: var(--ink-soft); }
.scenario-text.is-on { color: var(--ink); font-weight: 700; }

.year {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.year li {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  min-block-size: 5.2rem;
  padding: 0.55rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--card);
}
.year li.is-now { background: var(--sun); box-shadow: 3px 3px 0 var(--ink); }
.month { font-family: var(--mono); font-size: 0.875rem; font-weight: 600; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; }
.dots i, .year-legend li::before {
  inline-size: 0.8rem;
  block-size: 0.8rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
}
.year-legend [data-task='vat']::before, .dots i[data-task='vat'] { background: #7b5cff; }
.year-legend [data-task='advance']::before, .dots i[data-task='advance'] { background: #ef3e5b; }
.year-legend [data-task='insurance']::before, .dots i[data-task='insurance'] { background: #e0a800; }
.year-legend [data-task='annual']::before, .dots i[data-task='annual'] { background: var(--ink); }
.year-legend [data-task='declaration']::before, .dots i[data-task='declaration'] { background: #1c8fd6; }
.year-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-top: 1rem; font-size: 0.9375rem; }
.year-legend li::before { content: ''; display: inline-block; margin-inline-end: 0.45em; vertical-align: -0.08em; }
.year-count { margin-top: 1.2rem; max-inline-size: 44ch; font-size: 1.1875rem; font-weight: 700; }
.next-up { margin-top: 0.3rem; color: var(--ink-soft); }

.meet { padding-bottom: 3rem; }
.meet .btn { margin-top: 1.5rem; }
.disclaimer { margin-top: 1.5rem; max-inline-size: 60ch; font-size: 0.875rem; color: var(--ink-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 3.2rem;
  padding: 0.6rem 1.7rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn-main { background: var(--pocket); color: #fff; box-shadow: 4px 4px 0 var(--ink); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.btn-main:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn-main:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-quiet { background: var(--card); color: var(--ink); }
.btn-quiet:hover { background: var(--sun); }

/* ---------- Facts and footer ---------- */

.facts {
  display: grid;
  gap: 1rem;
  padding: 0 var(--gutter) 3.5rem;
}
.facts article {
  padding: 1.4rem 1.3rem 1.6rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--hard);
}
.facts h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.facts p { color: var(--ink-soft); }

.foot {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  padding: 4rem var(--gutter) 5rem;
  background: var(--ink);
  color: var(--paper);
  text-align: center;
}
.foot p { font-size: clamp(1.5rem, 4vw, 2.3rem); font-weight: 700; line-height: 1.15; max-inline-size: 26ch; text-wrap: balance; }
.foot .btn-main { border-color: var(--paper); box-shadow: 4px 4px 0 var(--sun); }
.foot .btn-main:hover { box-shadow: 6px 6px 0 var(--sun); }
.foot :focus-visible { outline-color: var(--sun); }

/* ---------- Sheet ---------- */

dialog {
  inline-size: min(31rem, calc(100vw - 2rem));
  padding: 1.8rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}
dialog::backdrop { background: rgba(17, 21, 43, 0.6); }
dialog h2 { font-size: 1.6rem; }
.bubble {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #dff5ea;
  white-space: pre-line;
  text-align: start;
  overflow-wrap: anywhere;
}
.note { margin-bottom: 1.5rem; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

@media (min-width: 40rem) {
  .board { --labels: 13rem; --tall: 31rem; padding: 1.3rem 1.4rem 1.5rem; }
  .dest span { font-size: 0.9375rem; }
  .dest b { font-size: 1.15rem; }
  .dest:first-child b { font-size: 1.35rem; }
  .year { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .result { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 62rem) {
  .desk { grid-template-columns: 23rem minmax(0, 1fr); gap: 2rem; }
  .year { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .hero { padding-top: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .toggle button, .chips button, .btn, .waffle i, .dest { transition: none; }
  .chips button:hover, .btn-main:hover, .btn-main:active { transform: none; }
}
