/* =========================================================
   TXT-ERS COMPANION SHEET

   Desktop: centered dialog
   Mobile: bottom sheet
   ========================================================= */

.companion-sheet-host {
  position: fixed;
  inset: 0;

  z-index: 1000;

  display: grid;
  place-items: center;

  padding: 24px;
}

.companion-sheet-host[hidden] {
  display: none;
}

.companion-sheet-backdrop {
  position: absolute;
  inset: 0;

  background:
    rgba(23, 27, 59, 0.44);

  -webkit-backdrop-filter:
    blur(10px);

  backdrop-filter:
    blur(10px);

  opacity: 0;

  transition:
    opacity 220ms ease;
}

.companion-sheet {
  position: relative;
  z-index: 1;

  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 48px));

  display: flex;
  flex-direction: column;

  overflow: hidden;

  border:
    1px solid
    rgba(255, 255, 255, 0.88);

  border-radius: 28px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.97),
      rgba(248, 247, 252, 0.94)
    );

  box-shadow:
    0 32px 90px
    rgba(30, 22, 67, 0.28),

    inset 0 1px 0
    rgba(255, 255, 255, 0.96);

  transform:
    translateY(22px)
    scale(0.985);

  opacity: 0;

  transition:
    transform 240ms
      cubic-bezier(0.22, 0.61, 0.36, 1),

    opacity 200ms ease;
}

.companion-sheet-host.is-open
  .companion-sheet-backdrop {
  opacity: 1;
}

.companion-sheet-host.is-open
  .companion-sheet {
  transform:
    translateY(0)
    scale(1);

  opacity: 1;
}

.companion-sheet-handle {
  display: none;
}

.companion-sheet-header {
  flex: 0 0 auto;

  padding:
    24px
    26px
    20px;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;

  border-bottom:
    1px solid
    rgba(79, 69, 120, 0.10);
}

.companion-sheet-heading {
  min-width: 0;
}

.companion-sheet-eyebrow {
  margin: 0;

  color: #5d48c8;

  font-size: 0.69rem;
  font-weight: 850;
  line-height: 1;

  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.companion-sheet-heading h2 {
  margin: 8px 0 0;

  color: #171b3b;

  font-size:
    clamp(1.45rem, 3vw, 2rem);

  font-weight: 780;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.companion-sheet-close {
  width: 42px;
  height: 42px;

  flex: 0 0 42px;

  display: grid;
  place-items: center;

  border:
    1px solid
    rgba(79, 69, 120, 0.13);

  border-radius: 50%;

  background:
    rgba(255, 255, 255, 0.82);

  color: #34384d;

  box-shadow:
    0 6px 18px
    rgba(37, 29, 79, 0.08);

  font-size: 1.5rem;
  line-height: 1;

  cursor: pointer;
}

.companion-sheet-close:hover {
  background: #ffffff;
}

.companion-sheet-body {
  flex: 1 1 auto;

  min-height: 0;

  padding: 26px;

  overflow-y: auto;
  overscroll-behavior: contain;
}

.companion-sheet-footer {
  flex: 0 0 auto;

  padding:
    16px
    26px
    22px;

  border-top:
    1px solid
    rgba(79, 69, 120, 0.10);

  background:
    rgba(255, 255, 255, 0.78);
}

.companion-sheet-footer[hidden] {
  display: none;
}

body.companion-sheet-open {
  overflow: hidden;
}

.companion-sheet button:focus-visible,
.companion-sheet a:focus-visible,
.companion-sheet textarea:focus-visible,
.companion-sheet input:focus-visible {
  outline:
    3px solid
    rgba(95, 73, 207, 0.32);

  outline-offset: 3px;
}


/* =========================================================
   MOBILE BOTTOM SHEET
   ========================================================= */

@media (max-width: 600px) {
  .companion-sheet-host {
    place-items: end center;

    padding: 0;
  }

  .companion-sheet {
    width: 100%;
    max-height: 92dvh;

    border-radius:
      26px
      26px
      0
      0;

    transform:
      translateY(100%);

    opacity: 1;
  }

  .companion-sheet-host.is-open
    .companion-sheet {
    transform:
      translateY(0);
  }

  .companion-sheet-handle {
    width: 42px;
    height: 5px;

    margin:
      10px
      auto
      0;

    display: block;

    border-radius: 999px;

    background:
      rgba(51, 47, 70, 0.20);
  }

  .companion-sheet-header {
    padding:
      16px
      18px
      16px;
  }

  .companion-sheet-heading h2 {
    font-size: 1.45rem;
  }

  .companion-sheet-close {
    width: 40px;
    height: 40px;

    flex-basis: 40px;
  }

  .companion-sheet-body {
    padding:
      20px
      18px
      calc(
        24px +
        env(safe-area-inset-bottom)
      );
  }

  .companion-sheet-footer {
    padding:
      14px
      18px
      calc(
        18px +
        env(safe-area-inset-bottom)
      );
  }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .companion-sheet,
  .companion-sheet-backdrop {
    transition: none;
  }
}

/* =========================================================
   REFLECTION AND ACTIVITY SHEET CONTENT
   ========================================================= */

.reflection-sheet-content,
.activity-sheet-content {
  min-width: 0;
}

.reflection-sheet-prompt {
  max-width: 600px;

  margin: 0;

  color: #303449;

  font-size: 1rem;
  line-height: 1.72;
}

.reflection-sheet-content .private-notes {
  margin-top: 24px;
}

.companion-sheet-primary-button {
  width: 100%;
  min-height: 50px;

  padding: 12px 18px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 0;
  border-radius: 14px;

  color: #ffffff;

  background:
    linear-gradient(
      135deg,
      #5842c8,
      #7560db
    );

  box-shadow:
    0 10px 24px
    rgba(73, 53, 172, 0.20);

  font: inherit;
  font-size: 0.9rem;
  font-weight: 780;

  cursor: pointer;
}

.companion-sheet-primary-button:hover {
  background:
    linear-gradient(
      135deg,
      #4934b6,
      #6751ce
    );
}

.fallback-practice-copy {
  margin: 0;

  color: #44495d;

  line-height: 1.65;
}
