/*
 * Homepage welcome card and calculator cards.
 *
 * Both float above the ruler with position: fixed, so they never change the
 * page height or the scroll positions the ruler animation is keyed to.
 * The ruler's own CSS (styles.css) and script (rulerfunctions.js) are untouched.
 * z-index 9 keeps them under the sticky header (z-10) and its mobile menu.
 */

.lr-welcome,
.lr-cards {
  box-sizing: border-box;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  left: 50%;
  position: fixed;
  transform: translateX(-50%);
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 9;
}

.lr-welcome *,
.lr-cards * {
  box-sizing: border-box;
}

.lr-is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ---------- Welcome card (shown at the top of the page) ---------- */

.lr-welcome {
  background: rgba(255, 252, 245, 0.97);
  border: 1px solid rgba(50, 76, 99, 0.2);
  border-radius: 16px;
  box-shadow: 0 18px 40px -18px rgba(31, 49, 66, 0.55);
  color: #1f3142;
  max-width: 460px;
  padding: 20px 22px 18px;
  /* Sits in the open sky above the ruler on wide screens. */
  top: 100px;
  width: calc(100vw - 48px);
}

.lr-welcome__close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #4b5b6b;
  cursor: pointer;
  display: flex;
  font-size: 22px;
  height: 32px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 32px;
}

.lr-welcome__close:hover,
.lr-welcome__close:focus-visible {
  background: rgba(50, 76, 99, 0.1);
}

.lr-welcome__eyebrow {
  color: #8a5a00;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0;
  text-transform: uppercase;
}

.lr-welcome__title {
  color: #1f3142;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  margin: 4px 32px 0 0;
}

.lr-welcome__text {
  font-size: 15px;
  line-height: 1.55;
  margin: 8px 0 0;
}

.lr-welcome__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
}

.lr-welcome__start {
  align-items: center;
  background: #324c63;
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  gap: 6px;
  padding: 10px 18px;
}

.lr-welcome__start:hover,
.lr-welcome__start:focus-visible {
  background: #233849;
}

.lr-welcome__link {
  color: #324c63;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Small teacher line under the actions; links to classroom-kit.html. */
.lr-welcome__kit {
  border-top: 1px solid rgba(50, 76, 99, 0.15);
  color: #4b5b6b;
  font-size: 13.5px;
  line-height: 1.4;
  margin: 12px 0 0;
  padding-top: 10px;
}

.lr-welcome__kit a {
  color: #8a5a00;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lr-welcome__kit a:hover,
.lr-welcome__kit a:focus-visible {
  color: #5e3d00;
}

/* ---------- Calculator cards (shown at the end of the ruler) ---------- */

.lr-cards {
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid rgba(50, 76, 99, 0.18);
  bottom: 0;
  box-shadow: 0 -10px 30px -18px rgba(31, 49, 66, 0.45);
  padding: 12px 16px 14px;
  width: 100%;
}

.lr-cards__inner {
  margin: 0 auto;
  max-width: 1100px;
}

.lr-cards__title {
  color: #1f3142;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
}

.lr-cards__list {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  list-style: none;
  margin: 0;
  padding: 0;
}

.lr-cards__card {
  background: #fff;
  border: 1px solid #d9dee4;
  border-radius: 12px;
  color: #1f3142;
  display: block;
  height: 100%;
  padding: 10px 12px;
  text-decoration: none;
}

.lr-cards__card:hover,
.lr-cards__card:focus-visible {
  border-color: #324c63;
  box-shadow: 0 6px 16px -10px rgba(31, 49, 66, 0.6);
}

.lr-cards__card--main {
  background: #324c63;
  border-color: #324c63;
  color: #fff;
}

.lr-cards__card--main:hover,
.lr-cards__card--main:focus-visible {
  background: #233849;
}

.lr-cards__name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.lr-cards__why {
  display: block;
  font-size: 12.5px;
  line-height: 1.35;
  margin-top: 2px;
  opacity: 0.85;
}

/* Phones and small tablets */
@media (max-width: 680px) {
  .lr-welcome {
    border-radius: 14px;
    left: 12px;
    max-width: none;
    padding: 14px 14px 14px 16px;
    right: 12px;
    top: 92px;
    transform: none;
    width: auto;
  }

  .lr-welcome__title {
    font-size: 19px;
  }

  .lr-welcome__text {
    font-size: 14px;
    line-height: 1.45;
    margin-top: 6px;
  }

  .lr-welcome__actions {
    gap: 8px 14px;
    margin-top: 10px;
  }

  .lr-welcome__start,
  .lr-welcome__link {
    font-size: 14px;
  }

  .lr-welcome__start {
    padding: 9px 15px;
  }

  .lr-welcome__kit {
    font-size: 13px;
    margin-top: 10px;
    padding-top: 8px;
  }

  .lr-cards {
    padding: 8px 0 10px;
  }

  .lr-cards__title {
    font-size: 13px;
    margin: 0 12px 6px;
  }

  /* One swipeable row so the panel stays short and never covers the ruler's own button. */
  .lr-cards__list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 12px 2px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .lr-cards__list > li {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .lr-cards__card {
    padding: 8px 12px;
  }

  .lr-cards__name {
    font-size: 14px;
    white-space: nowrap;
  }

  .lr-cards__why {
    display: none;
  }
}

/* Very short screens: keep the welcome card compact. */
@media (max-height: 600px) {
  .lr-welcome__text {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lr-welcome,
  .lr-cards {
    transition: none;
  }
}
