/* Readover shared footer: the same layout on Read, Math, English and Brain.
   Each site sets its own colors (variables below) and its own character image.
   Right: logo, WhatsApp and email. Center: the shared contact form. Left: the character,
   taller than the footer, popping up above its top edge. Bottom: a low legal bar. */
.rf-footer {
  --rf-bg: #281648;
  --rf-bar: #1c0f33;
  --rf-text: #e2e8f0;
  --rf-accent: #c0d73f;
  --rf-button-text: #2b2238;
  --rf-pop: 110px;
  position: relative;
  background: var(--rf-bg);
  color: var(--rf-text);
  text-align: start;
}

/* The character may rise above the footer but never shows below it */
.rf-main {
  position: relative;
  clip-path: inset(calc(-1 * var(--rf-pop) - 60px) 0 0 0);
}

.rf-inner {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 20px 40px;
  box-sizing: border-box;
  display: grid;
  /* Three equal parts: details, form, character. Each sits in the middle of its part */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  align-items: start;
}

/* --- Logo and contact details --- */
/* The block is centered in its column; the phone and email lines start on the same edge,
   so the WhatsApp icon sits right above the mail icon */
.rf-brand {
  display: grid;
  justify-content: center;
  justify-items: start;
  gap: 14px;
  padding-top: 8px;
}

.rf-logo {
  display: block;
  justify-self: center;
  width: 150px;
  height: auto;
  margin-bottom: 6px;
}

.rf-brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
}

.rf-brand a:hover,
.rf-brand a:focus-visible {
  color: var(--rf-accent);
}

.rf-brand svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--rf-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Contact form --- */
.rf-form-title {
  margin: 0 auto 18px;
  width: fit-content;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--rf-accent);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

.rf-footer .ro-contact {
  --ro-accent: var(--rf-accent);
  --ro-button-text: var(--rf-button-text);
  --ro-label: #fff;
  --ro-text: #1c1917;
  --ro-ok: var(--rf-accent);
  --ro-err: #fca5a5;
  --ro-focus: var(--rf-accent);
  --ro-border: transparent;
  max-width: none;
  color: #fff;
}

/* The "email or phone" rule still shows as an error when both are empty, and screen readers still hear it */
.rf-footer .ro-contact .ro-note {
  display: none;
}

/* Email and phone are typed in English: left aligned on Hebrew pages too */
.rf-footer .ro-contact[dir] .ro-ltr,
.rf-footer .ro-contact .ro-ltr {
  text-align: left;
}

.rf-footer .ro-contact .ro-consent {
  color: #fff;
}

.rf-footer .ro-contact > button {
  align-self: center;
  width: 100%;
  max-width: 320px;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 1.05rem;
}

.rf-footer .ro-contact .ro-contact-status {
  text-align: center;
}

/* --- Character --- */
.rf-kid {
  display: block;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .35));
}

@media (min-width: 1024px) {
  /* Placed in the third column (horizontally only) and centered there. Vertically it is
     measured against the whole footer: it stands on the bottom line and is --rf-pop taller
     than the footer, so its head rises above the footer's top edge. */
  .rf-kid {
    position: absolute;
    grid-column: 3;
    grid-row: auto;
    top: auto;
    bottom: 0;
    /* 16px into the gap on each side (half the gap), so wide characters stay centered */
    left: -16px;
    right: -16px;
    margin: 0 auto;
    height: calc(100% + var(--rf-pop));
    width: auto;
    max-width: calc(100% + 32px);
    object-fit: contain;
    object-position: bottom;
  }
}

/* Pops up when the footer scrolls into view (the class is set by a small script) */
.rf-kid {
  transform-origin: bottom center;
  transition: transform .7s cubic-bezier(.175, .885, .32, 1.275), opacity .5s ease;
}

.rf-footer.rf-js .rf-kid {
  transform: translateY(45%);
  opacity: 0;
}

.rf-footer.rf-js.rf-in .rf-kid {
  transform: none;
  opacity: 1;
}

.rf-footer.rf-js.rf-in:hover .rf-kid {
  transform: translateY(-14px) rotate(-2deg);
}

@media (prefers-reduced-motion: reduce) {
  .rf-kid {
    transition: none !important;
  }

  .rf-footer.rf-js .rf-kid,
  .rf-footer.rf-js.rf-in:hover .rf-kid {
    transform: none;
    opacity: 1;
  }
}

/* --- Legal bar: low, and a different shade so it reads apart from the footer --- */
.rf-bar {
  background: var(--rf-bar);
  border-top: 1px solid rgba(255, 255, 255, .08);
  position: relative;
  z-index: 1;
}

.rf-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  box-sizing: border-box;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: .9rem;
  color: rgba(255, 255, 255, .75);
}

.rf-bar p {
  margin: 0;
}

.rf-bar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.rf-bar a {
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
}

.rf-bar a:hover,
.rf-bar a:focus-visible {
  color: var(--rf-accent);
  text-decoration: underline;
}

/* --- Phones and tablets: form first, then phone and email in one row. The logo is hidden
   (the page header already shows it). A small character peeks over the footer's top corner. --- */
@media (max-width: 1023px) {
  .rf-inner {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 24px;
    padding: 64px 16px 32px;
  }

  .rf-form {
    order: 1;
    width: 100%;
    max-width: 520px;
  }

  .rf-footer .rf-logo {
    display: none;
  }

  .rf-brand {
    order: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 28px;
    padding-top: 0;
  }

  .rf-brand a {
    font-size: 1rem;
  }

  /* 120px tall, 56px of it above the footer; the rest stays in the top padding, clear of the title */
  .rf-kid {
    position: absolute;
    top: -56px;
    inset-inline-end: 16px;
    height: 120px;
    width: auto;
    max-width: 40%;
    object-fit: contain;
    object-position: bottom;
  }

  .rf-bar-inner {
    justify-content: center;
    text-align: center;
    /* A site with floating buttons in the bottom corner sets more room here */
    padding: 12px 16px var(--rf-bar-bottom, 12px);
  }

  .rf-bar nav {
    justify-content: center;
  }
}
