:root {
  --ink:    #1a1a1a;
  --muted:  #767676;
  --line:   #e2e2e2;
  --bg:     #ffffff;
  --panel:  #fafafa;
  --accent: #2f6fdb;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; color: var(--ink); text-decoration: none; }
nav { display: flex; align-items: center; gap: 1.25rem; font-size: 0.9rem; }
nav .who { color: var(--muted); }

a { color: var(--accent); }
a:hover { text-decoration: underline; }

main { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
.narrow { max-width: 620px; }
.narrow.wide { max-width: 860px; }

h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 1rem; }
h2 { font-size: 1rem; font-weight: 600; margin: 2rem 0 0.75rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.step-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
.note {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.6rem 0.85rem; font-size: 0.9rem;
}
.flash {
  background: var(--panel); border-inline-start: 3px solid var(--accent);
  padding: 0.6rem 0.85rem; font-size: 0.9rem; margin-bottom: 1.5rem;
}

/* two-column exercise view */
.layout { display: grid; grid-template-columns: 200px 1fr; gap: 3rem; align-items: start; }
aside h2 { margin-top: 0; font-size: 0.8rem; text-transform: uppercase;
           letter-spacing: 0.06em; color: var(--muted); }
.steps { margin: 0; padding-inline-start: 1.25rem; font-size: 0.9rem; }
.steps li { margin-bottom: 0.4rem; }
.steps .current { font-weight: 600; }
.steps .locked { color: #c4c4c4; }
.steps .done a { color: var(--muted); text-decoration: none; }
.steps .done a:hover { color: var(--accent); }

.instructions { white-space: pre-wrap; }

pre {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.875rem; line-height: 1.5;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* screenshots */
.shots { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.shots figure { margin: 0; max-width: 100%; }
.shots img {
  /* Cap the height so a tall screenshot can't push the page down; the full
     image is one click away. */
  max-width: 100%; max-height: 55vh; display: block;
  border: 1px solid var(--line); border-radius: 4px; background: var(--panel);
}
.hint { font-size: 0.85rem; margin-top: -0.25rem; }
.shots figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; }

/* forms */
form { margin-bottom: 1.5rem; }
label { display: block; font-size: 0.9rem; margin: 1rem 0 0.35rem; }
input[type=text], input[type=password], input:not([type]), textarea, input[type=file] {
  width: 100%; padding: 0.55rem 0.7rem; font-size: 0.95rem; font-family: inherit;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px;
}
textarea { resize: vertical; }
textarea, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
                  font-size: 0.875rem; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

button {
  margin-top: 1rem; padding: 0.55rem 1.1rem; font-size: 0.95rem; font-family: inherit;
  color: #fff; background: var(--accent); border: 1px solid var(--accent);
  border-radius: 4px; cursor: pointer;
}
button:hover { filter: brightness(0.93); }
button.link {
  margin: 0; padding: 0.1rem 0.3rem; background: none; border: none;
  color: var(--accent); font-size: 0.875rem;
}
button.link.danger { color: var(--danger); }
button.link:disabled { color: #cfcfcf; cursor: default; }
button.link:hover:not(:disabled) { text-decoration: underline; filter: none; }
form.inline { display: inline; margin: 0; }
.finish { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 0.5rem;
          margin-bottom: 0; }
/* Sticks to the bottom of the window while the exercise is on screen, so the
   button is reachable however tall the screenshot is. */
.finish-bar {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 0.75rem 0 1rem;
}
.finish-bar button { margin-top: 0; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
th, td { text-align: start; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase;
     letter-spacing: 0.05em; color: var(--muted); }
.nowrap { white-space: nowrap; }
.grid .num { text-align: center; width: 2.2rem; }
.tick { color: var(--accent); }
.scroll { overflow-x: auto; }
.legend { font-size: 0.85rem; color: var(--muted); margin-top: 1.5rem; padding-inline-start: 1.25rem; }

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; gap: 1.5rem; }
  aside { order: 2; border-top: 1px solid var(--line); padding-top: 1rem; }
}


/* ---- direction handling -------------------------------------------------
   Python is written left to right even on a Hebrew page, so code keeps its
   own direction. Prose uses `plaintext`, which picks a direction per line
   from its first strong character -- so an English exercise title reads
   correctly inside the Hebrew interface, and vice versa. */
pre, code, .mono, textarea.mono, input[type=file] {
  direction: ltr;
  text-align: left;
}
.instructions, h1, .steps li, figcaption, .legend li, .who {
  unicode-bidi: plaintext;
}
nav .lang {
  padding-inline-start: 1rem;
  border-inline-start: 1px solid var(--line);
}

/* checkbox rows read as one line, not a stacked label */
label.check {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 1.25rem 0 0.25rem; cursor: pointer;
}
label.check input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }
label.check + .hint { margin-top: 0; }

/* the exercise page has no title heading, so its step label needs the room */
article > .step-label { margin-bottom: 1.5rem; }

/* the intro page between signing in and the first exercise */
.intro { padding-top: 2rem; }
.intro p { max-width: 46ch; }
a.button {
  display: inline-block; margin-top: 1rem;
  padding: 0.55rem 1.1rem; border-radius: 4px;
  color: #fff; background: var(--accent); border: 1px solid var(--accent);
  text-decoration: none; font-size: 0.95rem;
}
a.button:hover { filter: brightness(0.93); text-decoration: none; }
