/* Logical properties only (inline = along the text, block = top/bottom): the same rules work for Hebrew (rtl) and English (ltr). */
:root {
  --ink: #17202a;
  --muted: #5b6573;
  --paper: #fffdf7;
  --card: #ffffff;
  --line: #e4e0d4;
  --teal: #0f766e;
  --teal-soft: #ccfbf1;
  --sun: #f59e0b;
  --sun-soft: #fef3c7;
  --coral: #e11d48;
  --coral-soft: #ffe4e6;
  --sky: #2563eb;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 6px 20px rgb(0 0 0 / 6%);
  color-scheme: light;
  font-family: system-ui, "Segoe UI", "Noto Sans Hebrew", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; min-block-size: 100vh; display: flex; flex-direction: column; }
main { flex: 1; inline-size: min(1100px, 100% - 32px); margin-inline: auto; padding-block: 24px 48px; outline: none; }
a { color: var(--teal); }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.2; margin-block: 0 12px; }
h2 { font-size: 1.3rem; margin-block: 24px 10px; }
h3 { font-size: 1.05rem; margin-block: 16px 6px; }
p { margin-block: 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.hidden { display: none !important; }

/* Header */
header { background: var(--teal); color: #fff; }
.bar { inline-size: min(1100px, 100% - 32px); margin-inline: auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-block: 10px; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; margin-inline-end: auto; }
.brand img { inline-size: 34px; block-size: 34px; }
.bar a.nav, .bar button.nav { color: #fff; background: transparent; border: 1px solid rgb(255 255 255 / 35%); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; text-decoration: none; }
.bar .nav:hover { background: rgb(255 255 255 / 12%); }
.badge { display: inline-block; min-inline-size: 20px; padding-inline: 6px; border-radius: 999px; background: var(--sun); color: #000; font-size: .8rem; text-align: center; margin-inline-start: 6px; }
footer { border-block-start: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
footer .bar { color: var(--muted); }
footer a { color: var(--muted); }

/* Buttons and forms */
.button, button.button { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--teal); color: #fff; }
.button:hover { filter: brightness(1.08); }
.button.secondary { background: var(--teal-soft); color: var(--teal); }
.button.sun { background: var(--sun); color: #1c1300; }
.button.danger { background: var(--coral-soft); color: var(--coral); }
.button.link { background: none; color: var(--teal); padding-inline: 4px; text-decoration: underline; }
.button[disabled] { opacity: .5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-block: 16px; }
form.stack, .stack { display: grid; gap: 14px; max-inline-size: 520px; align-content: start; }
label { display: grid; gap: 4px; font-weight: 600; }
label .hint { font-weight: 400; color: var(--muted); font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: inherit; inline-size: 100%;
}
textarea { min-block-size: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.notice { padding: 12px 16px; border-radius: 12px; background: var(--sun-soft); margin-block: 12px; }
.notice.error { background: var(--coral-soft); color: #7f1d1d; }
.notice.ok { background: var(--teal-soft); color: #134e4a; }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.two { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.hero { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: center; padding-block: 16px 8px; }
.hero p { font-size: 1.15rem; }
.steps3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); counter-reset: s; margin-block: 24px; }
.steps3 div { counter-increment: s; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.steps3 div::before { content: counter(s); display: inline-grid; place-items: center; inline-size: 30px; block-size: 30px; border-radius: 50%; background: var(--sun); font-weight: 700; margin-inline-end: 8px; }
.work-card { display: grid; gap: 8px; text-decoration: none; color: inherit; padding: 0; overflow: hidden; }
.work-card .pic { aspect-ratio: 4 / 3; background: var(--teal-soft); display: grid; place-items: center; overflow: hidden; }
.work-card .pic img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.work-card .body { padding: 0 14px 14px; display: grid; gap: 4px; }
.work-card h3 { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); }
.chip.sun { background: var(--sun-soft); color: #7c4a03; }
.chip.coral { background: var(--coral-soft); color: var(--coral); }
.code-big { font-family: ui-monospace, Consolas, monospace; font-size: 2rem; letter-spacing: .15em; direction: ltr; unicode-bidi: isolate; display: inline-block; padding: 4px 14px; background: var(--sun-soft); border-radius: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; direction: ltr; unicode-bidi: isolate; word-break: break-all; }
table { border-collapse: collapse; inline-size: 100%; }
th, td { text-align: start; padding: 8px; border-block-end: 1px solid var(--line); vertical-align: top; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-block: 12px; }
.filters > * { inline-size: auto; flex: 1 1 160px; }

/* Wizard */
.progress { display: flex; gap: 6px; margin-block: 8px 20px; flex-wrap: wrap; }
.progress button { flex: 1 1 100px; border: 0; border-radius: 999px; padding: 8px; font: inherit; background: var(--line); color: var(--muted); cursor: pointer; }
.progress button.done { background: var(--teal-soft); color: var(--teal); }
.progress button.now { background: var(--teal); color: #fff; }
.part { border-radius: var(--radius); padding: 16px; margin-block: 12px; }
.part.open { background: #f0fdfa; border: 1px dashed var(--teal); }
.part.closed { background: #fff7ed; border: 1px dashed var(--sun); }
.part > .tag { font-weight: 700; font-size: .9rem; }
.props { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.prop { display: grid; gap: 4px; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; background: #fff; font-weight: 400; }
.prop:has(input:checked) { border-color: var(--teal); background: #f0fdfa; }
.prop strong { font-size: 1.05rem; }
.analogue { background: var(--sun-soft); border-radius: 12px; padding: 10px 14px; margin-block: 6px; }
.picture-preview { max-inline-size: 360px; border-radius: var(--radius); border: 1px solid var(--line); }

/* Lineage */
.tree { display: grid; gap: 8px; }
.tree .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.node { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: inherit; }
.node.me { background: var(--teal); color: #fff; border-color: var(--teal); }
.node.gone { color: var(--muted); font-style: italic; }

/* Reviews */
.review { border-block-start: 1px solid var(--line); padding-block: 10px; }
.review .who { font-weight: 600; }

/* Certificate */
.certificate { max-inline-size: 900px; margin-inline: auto; background: #fff; border: 10px double var(--teal); border-radius: 8px; padding: 40px; text-align: center; display: grid; gap: 10px; }
.certificate .title { font-size: 2.2rem; font-weight: 800; color: var(--teal); }
.certificate .work { font-size: 1.8rem; font-weight: 700; }
.certificate dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; text-align: start; max-inline-size: 640px; margin: 12px auto; }
.certificate dt { color: var(--muted); }
.certificate dd { margin: 0; }
.certificate .disclaimer { font-size: .85rem; color: var(--muted); }

@media print {
  @page { size: A4 landscape; margin: 12mm; }
  header, footer, .no-print { display: none !important; }
  main { inline-size: 100%; padding: 0; }
  .certificate { border-width: 8px; box-shadow: none; }
}
@media (max-width: 520px) {
  .code-big { font-size: 1.5rem; }
  .certificate { padding: 18px; }
  .certificate dl { grid-template-columns: 1fr; }
}

/* Arrow that points "back" in both directions of writing */
.back::before { content: '← '; }
[dir=rtl] .back::before { content: '→ '; }

/* World of living things */
.hero-pic { inline-size: 100%; max-inline-size: 560px; justify-self: center; border-radius: 20px; box-shadow: var(--shadow); }
.pic-figure { margin: 0; display: grid; gap: 6px; }
.pic-figure figcaption { color: var(--muted); font-size: .9rem; text-align: center; }
.guide { display: flex; gap: 12px; align-items: flex-end; margin-block: 12px; }
.guide img { inline-size: 84px; block-size: auto; border-radius: 14px; flex: none; }
.guide .bubble { position: relative; background: #fff; border: 2px solid var(--teal); border-radius: 18px; padding: 12px 16px; font-size: 1.15rem; font-weight: 600; }
.guide .bubble::before { content: ''; position: absolute; inset-block-end: 14px; inset-inline-start: -10px; inline-size: 16px; block-size: 16px; background: #fff;
  border-block-end: 2px solid var(--teal); border-inline-start: 2px solid var(--teal); transform: rotate(45deg); }
[dir=rtl] .guide .bubble::before { transform: rotate(-45deg); }
.diagram { inline-size: 100%; max-inline-size: 460px; block-size: auto; justify-self: center; }
.anatomy { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.organs { margin: 0; padding-inline-start: 0; list-style: none; display: grid; gap: 10px; counter-reset: organ; }
.organs li { display: flex; gap: 10px; counter-increment: organ; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.organs li::before { content: counter(organ); flex: none; inline-size: 26px; block-size: 26px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.organs p { margin: 2px 0 0; }
.organ-icon { font-size: 1.4rem; }
.organ-icon.big { font-size: 2.4rem; }
.nature { color: #166534; font-size: .92rem; }
.compare .living { background: #f0fdf4; border-color: #86efac; }
.challenges { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.challenges li { display: grid; gap: 10px; align-content: space-between; }
.challenges li p { font-size: 1.1rem; font-weight: 600; margin: 0; }
.ladder { list-style: none; padding: 0; display: grid; gap: 10px; }
.ladder li { display: grid; gap: 2px; background: #fff; border: 1px solid var(--line); border-inline-start: 6px solid var(--teal); border-radius: 12px; padding: 10px 14px;
  margin-inline-start: calc(var(--step) * 28px); }
@media (max-width: 520px) { .ladder li { margin-inline-start: calc(var(--step) * 10px); } }
.anatomy > .diagram { position: sticky; inset-block-start: 16px; }
.grid .pic-figure img { aspect-ratio: 4 / 3; object-fit: cover; }
