/* Interlect maths practice exam. Scoped under .imt, RTL, mobile first. Colours meet WCAG AA on white. */
.imt {
  --imt-ink: #1f2933;
  --imt-muted: #4f5b69;
  --imt-line: #c9d0d9;
  --imt-soft: #f3f5f8;
  --imt-accent: #1a5fd0;
  --imt-accent-ink: #ffffff;
  --imt-ok: #17702f;
  --imt-ok-soft: #e6f4ea;
  --imt-bad: #b42318;
  --imt-bad-soft: #fdecea;
  --imt-warn: #9a4a06;
  direction: rtl;
  text-align: right;
  color: var(--imt-ink);
  font-size: 1rem;
  line-height: 1.65;
  margin: 1.5rem 0;
}
.imt *, .imt *::before, .imt *::after { box-sizing: border-box; }
.imt h3 { margin: 0 0 .5rem; font-size: 1.15rem; line-height: 1.4; }
.imt h4 { margin: 0 0 .4rem; font-size: 1.05rem; }
.imt p { margin: 0 0 .75rem; }
.imt-loading, .imt-error { padding: 1rem; background: var(--imt-soft); border-radius: 10px; }
.imt-error { color: var(--imt-bad); }
.imt-muted { color: var(--imt-muted); font-size: .9rem; }
.imt-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

/* inline maths stays left to right inside Hebrew text */
.imt-m { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.imt .katex { font-size: 1.08em; }

.imt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.imt-title { font-weight: 700; font-size: 1.1rem; }
.imt-select {
  font: inherit; padding: .45rem .6rem; border: 1px solid var(--imt-line); border-radius: 8px;
  background: #fff; color: var(--imt-ink); max-width: 100%;
}
.imt-cards { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 760px) { .imt-cards { grid-template-columns: repeat(3, 1fr); } }
.imt-card {
  border: 1px solid var(--imt-line); border-radius: 12px; padding: 1rem; background: #fff;
  display: flex; flex-direction: column; gap: .25rem;
}
.imt-card-main { border-color: var(--imt-accent); box-shadow: 0 0 0 1px var(--imt-accent) inset; }
.imt-card .imt-btn { margin-top: auto; align-self: flex-start; }
.imt-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.imt-list { margin: 0 0 .75rem; padding: 0 1.2rem 0 0; }

.imt-btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: .55rem 1.1rem;
  border: 1px solid var(--imt-line); background: var(--imt-soft); color: var(--imt-ink); min-height: 44px;
}
.imt-btn:hover:not([disabled]) { border-color: var(--imt-accent); }
.imt-btn[disabled] { opacity: .5; cursor: not-allowed; }
.imt-btn-primary { background: var(--imt-accent); border-color: var(--imt-accent); color: var(--imt-accent-ink); }
.imt-btn-primary:hover:not([disabled]) { filter: brightness(1.08); }
.imt-btn-small { min-height: 36px; padding: .3rem .8rem; font-size: .95rem; }
.imt-link {
  font: inherit; background: none; border: 0; padding: .25rem 0; color: var(--imt-accent);
  text-decoration: underline; cursor: pointer; align-self: flex-start;
}
.imt-btn:focus-visible, .imt-link:focus-visible, .imt-select:focus-visible, .imt-input:focus-visible,
.imt-tab:focus-visible, .imt-opt > input:focus-visible + span, .imt summary:focus-visible {
  outline: 3px solid var(--imt-accent); outline-offset: 2px;
}

.imt-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem 1rem;
  padding: .6rem .8rem; background: var(--imt-soft); border-radius: 10px; margin-bottom: 1rem; font-size: .95rem;
  position: sticky; top: 0; z-index: 5;
}
.imt-mode { font-weight: 700; }
.imt-timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.imt-timer-low { color: var(--imt-warn); }

.imt-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.imt-tab {
  font: inherit; min-height: 44px; padding: .3rem .8rem; border: 1px solid var(--imt-line); border-radius: 8px;
  background: #fff; color: var(--imt-ink); cursor: pointer; white-space: nowrap;
}
.imt-tab.is-current { border-color: var(--imt-accent); box-shadow: 0 0 0 1px var(--imt-accent) inset; font-weight: 700; }
.imt-tab.is-chosen { background: var(--imt-ok-soft); border-color: var(--imt-ok); }

.imt-q { border: 1px solid var(--imt-line); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; background: #fff; }
.imt-chapter {
  display: inline-block; font-size: .8rem; color: var(--imt-muted); border: 1px solid var(--imt-line);
  border-radius: 999px; padding: .1rem .6rem; margin-bottom: .5rem;
}
.imt-intro { font-size: 1.05rem; }
.imt-fig { display: block; max-width: 100%; height: auto; margin: .5rem 0 1rem; }
.imt-choose { margin-bottom: .75rem; }
.imt-choose[aria-pressed="true"] { background: var(--imt-ok-soft); border-color: var(--imt-ok); color: var(--imt-ok); }

.imt-part { border-top: 1px solid var(--imt-line); padding: .9rem 0 .4rem; }
.imt-part-head { display: flex; gap: .5rem; align-items: baseline; }
.imt-label {
  flex: 0 0 auto; font-weight: 700; min-width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--imt-soft); display: inline-flex; align-items: center; justify-content: center;
}
.imt-fields { display: flex; flex-direction: column; gap: .6rem; margin: .5rem 0; }
.imt-field { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.imt-flabel { font-weight: 600; }
.imt-input {
  font: inherit; width: 9rem; max-width: 100%; padding: .45rem .6rem; border: 1px solid var(--imt-line);
  border-radius: 8px; background: #fff; color: var(--imt-ink); direction: ltr; text-align: left; min-height: 44px;
}
.imt-field-set .imt-input { width: 13rem; }
.imt-note { flex: 1 1 100%; font-size: .85rem; color: var(--imt-muted); }
.imt-point { direction: ltr; display: inline-flex; align-items: center; gap: .3rem; }
.imt-point .imt-input { width: 7rem; }
.imt-opts { border: 0; padding: 0; margin: 0; display: grid; gap: .4rem; min-width: 0; }
.imt-opts legend { font-weight: 600; padding: 0; margin-bottom: .3rem; }
.imt-opts-graphs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .imt-opts-graphs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.imt-opt { display: flex; align-items: flex-start; gap: .5rem; cursor: pointer; }
.imt-opt > input { margin-top: .45rem; width: 1.1rem; height: 1.1rem; flex: 0 0 auto; }
.imt-opt > span { border: 1px solid var(--imt-line); border-radius: 8px; padding: .35rem .6rem; background: #fff; flex: 1 1 auto; }
.imt-opt > input:checked + span { border-color: var(--imt-accent); box-shadow: 0 0 0 1px var(--imt-accent) inset; }
.imt-opt img { display: block; width: 100%; height: auto; }
.imt-opt-cap { display: block; text-align: center; font-weight: 700; }
.imt-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: .5rem 0; }
@media (min-width: 760px) { .imt-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.imt-figs figure { margin: 0; border: 1px solid var(--imt-line); border-radius: 8px; padding: .3rem; background: #fff; }
.imt-figs img { display: block; width: 100%; height: auto; }
.imt-figs figcaption { text-align: center; font-weight: 700; }
.imt-hint { font-size: .85rem; color: var(--imt-muted); margin: .25rem 0 1rem; }

.imt-feedback { margin: .5rem 0; padding: .6rem .8rem; border-radius: 8px; }
.imt-feedback.is-ok { background: var(--imt-ok-soft); color: var(--imt-ok); }
.imt-feedback.is-bad { background: var(--imt-bad-soft); color: var(--imt-bad); }
.imt-feedback strong { display: block; }
.imt-sol { margin: .4rem 0 .6rem; }
.imt-sol summary { cursor: pointer; color: var(--imt-accent); font-weight: 600; }
.imt-sol div { padding: .5rem .2rem; }

.imt-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }

.imt-result { padding: 1rem; border-radius: 12px; background: var(--imt-soft); margin-bottom: 1rem; }
.imt-result.is-pass { background: var(--imt-ok-soft); }
.imt-result.is-pass h3 { color: var(--imt-ok); }
.imt-result.is-fail { background: var(--imt-bad-soft); }
.imt-result.is-fail h3 { color: var(--imt-bad); }
.imt-review-part { border-top: 1px solid var(--imt-line); padding: .6rem 0; }
.imt-mark { font-weight: 700; }
.imt-mark.is-ok { color: var(--imt-ok); }
.imt-mark.is-bad { color: var(--imt-bad); }
.imt-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: .95rem; }
.imt-table th, .imt-table td { border-bottom: 1px solid var(--imt-line); padding: .35rem .4rem; text-align: right; }

.imt-formulas { border: 1px solid var(--imt-line); border-radius: 10px; margin-bottom: 1rem; background: #fff; }
.imt-formulas > summary { cursor: pointer; padding: .6rem .8rem; font-weight: 700; }
.imt-formulas-body { padding: 0 .8rem .8rem; display: grid; gap: .8rem; }
@media (min-width: 760px) { .imt-formulas-body { grid-template-columns: repeat(2, 1fr); } }
.imt-formulas-body h4 { margin-bottom: .2rem; }
.imt-formulas-body ul { margin: 0; padding: 0 1.1rem 0 0; }
.imt-formulas-body li { margin-bottom: .2rem; }

.imt-disclaimer {
  margin-top: 1.5rem; padding: .8rem 1rem; border: 1px dashed var(--imt-line); border-radius: 10px;
  font-size: .85rem; color: var(--imt-muted);
}
.imt-disclaimer p { margin: 0 0 .4rem; }
.imt-disclaimer p:last-child { margin-bottom: 0; }
.imt-disclaimer a { color: inherit; text-decoration: underline; }
