@font-face {
  font-family: "RoobertHebrewMono";
  src: url("RoobertHebrewBETA-SemiMonoRegular.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "RoobertHebrewRealMono";
  src: url("RoobertHebrewBETA-MonoRegular.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "RoobertHebrewMonoBold";
  src: url("RoobertHebrewBETA-SemiMonoBold.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --soft-grey: #f0f0f0;
}

body {
  direction: rtl;
  font-family: "RoobertHebrewMono", sans-serif;
  background: #d8d8d8;
  color: #333;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  font-size: 16px;
  counter-reset: lesson-block;
  transition: background-color 0.25s;
}

/* ── Mode Toggle ── */

.mode-toggle {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d8d8d8;
  border-radius: 999px;
  padding: 6px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.mode-toggle-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: transparent;
  font-family: "RoobertHebrewMonoBold";
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #282828;
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.2s, background-color 0.2s, color 0.2s;
}

.mode-toggle-btn.is-active {
  opacity: 1;
  background-color: #282828;
  color: #ffffff;
}

/* ── Editor Panel ── */

.editor-panel {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 45vw;
  z-index: 5;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f0f0f0;
  box-sizing: border-box;
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

.editor-panel iframe {
  border: 1px solid #e1e1e1 !important;
  border-radius: 4px;
  width: 100% !important;
}

body.editor-mode .editor-panel {
  transform: translateX(0);
}

/* ── Sections Wrapper ── */

.sections-wrapper {
  transition: margin 0.4s ease;
}

body.editor-mode .sections-wrapper {
  margin-left: 45vw;
}

p:not(.highlight),
li:not(.highlight) {
  margin-block-start: 6px !important;
  margin-block-end: 6px !important;
}

strong {
  font-weight: 400;
}

ul {
  padding-inline-start: 0px;
  list-style-type: none;
}

section {
  padding: 20px;
  background-color: white;
  width: calc(100% - 60px);
  max-width: 800px;
  margin: 6rem auto;
  border-radius: 8px;
  border-top-right-radius: 0px;
  position: relative;
}

section:not(.title-section) {
  counter-increment: lesson-block;
}

section:not(.title-section)::before {
  content: "" counter(lesson-block);
  position: absolute;
  top: 0px;
  right: -32px;
  height: 32px;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-left-radius: 0px;
  border-top-right-radius: 4px;
  border-bottom-left-radius: 0px;
  border-bottom-right-radius: 4px;
  background-color: #ffffff;
  color: #282828;
  font-family: "RoobertHebrewMonoBold";
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.title-section {
  background-color: #28282800;
}

h1 {
  font-size: 60px;
  line-height: 1.2;
  font-family: "RoobertHebrewMonoBold";
  margin: 80px 0 20px 0;
}

h2 {
  color: #282828;
  font-size: 24px;
  font-family: "RoobertHebrewMonoBold";
}

pre {
  background: #282828;
  color: #a6ff80;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
  text-align: left;
  direction: ltr;
  transition: all 0.25s;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th,
td {
  border: 1px solid #e1e1e1;
  padding: 0.5rem 1rem;
  text-align: right;
  vertical-align: top;
}

th {
  font-family: "RoobertHebrewMonoBold";
}

code {
  direction: ltr;
  text-align: left;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--soft-grey);
}

pre code {
  padding: 0px;
  background-color: rgba(0, 0, 0, 0) !important;
  font-family: 'RoobertHebrewRealMono' !important;
}

pre code.hljs {
  background: transparent;
}

.highlight {
  font-family: "RoobertHebrewMonoBold";
  color: rgb(0, 0, 0);
  padding: 16px;
  line-height: 1.5;
  background-color: var(--soft-grey);
  border-radius: 4px;
  margin-top: 40px;
  margin-bottom: 0px !important;
}

.flow-diagram {
  text-align: center;
  padding: 24px 16px;
  background-color: var(--soft-grey);
  border-radius: 4px;
}

.flow-diagram p {
  margin: 0 !important;
}

.flow-diagram .flow-arrow {
  font-size: 24px;
  opacity: 0.4;
  line-height: 1;
  padding: 4px 0;
}

.tags-example li {
  display: flex;
  align-items: baseline;
  gap: 30px;
  padding: 16px 0;
  border-bottom: 1px solid rgb(225, 225, 225);
}

.tags-example li:first-child {
  padding-top: 0;
}

.tags-example li:last-child {
  border-bottom: 0px solid black;
}

.tags-example li code {
  display: inline;
  width: 40%;
  min-width: 40%;
}

.tags-example span,
.right {
  direction: rtl;
}

a {
  color: rgb(0, 81, 255);
}

.demo-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 20px;
  background-color: #282828;
  color: #fff;
  font-family: "RoobertHebrewMonoBold";
  font-size: 14px;
  letter-spacing: 0.02em;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.demo-link:hover {
  background-color: #444;
  color: #fff;
}

img {
  width: 100%;
}

.black-bg {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  background-color: #f0f0f0;
  opacity: 0;
  transition: opacity 0.25s;
}

body.show-black-bg .black-bg {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.example {
  cursor: pointer;
  position: relative;
}

.example.exclude {
  z-index: 3;
}

.example p {
  opacity: 1;
  transition: opacity 0.25s;
}

.example.exclude p {
  opacity: 0;
}

.param-table td:first-child {
  font-family: "RoobertHebrewRealMono";
  direction: ltr;
  text-align: left;
  white-space: nowrap;
}

@media (hover: hover) {
  a:hover {
    color: black;
  }
}

@media (max-width: 640px) {
  .mode-toggle {
    right: 12px;
    padding: 4px;
    gap: 4px;
  }

  .mode-toggle-btn {
    font-size: 11px;
    padding: 6px 10px;
  }

  h1 {
    margin: 0;
    font-size: 40px;
    line-height: 1.2;
  }

  .editor-panel {
    width: 100vw;
  }

  body.editor-mode .sections-wrapper {
    display: none;
  }

  body.editor-mode .mode-toggle {
    right: 12px;
  }
}