/* Mentor4Thesis responsive thesis-support popup — Revision 13 */
:root {
  --m4t-popup-safe-top: max(12px, env(safe-area-inset-top));
  --m4t-popup-safe-right: max(12px, env(safe-area-inset-right));
  --m4t-popup-safe-bottom: max(12px, env(safe-area-inset-bottom));
  --m4t-popup-safe-left: max(12px, env(safe-area-inset-left));
}

body.m4t-popup-open {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.m4t-popup,
.m4t-popup *,
.m4t-popup *::before,
.m4t-popup *::after {
  box-sizing: border-box;
}

.m4t-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: var(--m4t-popup-viewport-height, 100dvh);
  padding:
    var(--m4t-popup-safe-top)
    var(--m4t-popup-safe-right)
    var(--m4t-popup-safe-bottom)
    var(--m4t-popup-safe-left);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: rgba(6, 9, 20, 0.56);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.m4t-popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.m4t-popup {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 1.08fr);
  width: min(1040px, 100%);
  max-width: 100%;
  max-height: calc(100vh - 24px);
  max-height: calc(100svh - var(--m4t-popup-safe-top) - var(--m4t-popup-safe-bottom));
  max-height: calc(var(--m4t-popup-viewport-height, 100dvh) - var(--m4t-popup-safe-top) - var(--m4t-popup-safe-bottom));
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 28px;
  background:
    radial-gradient(circle at 78% 75%, rgba(255, 123, 45, 0.22), transparent 34%),
    linear-gradient(132deg, #10182f 0%, #0b1022 47%, #050711 100%);
  background-clip: padding-box;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
  transform: translateY(12px) scale(0.985);
  transition: transform 220ms ease;
}

.m4t-popup-overlay.is-visible .m4t-popup {
  transform: translateY(0) scale(1);
}

.m4t-popup-media {
  position: relative;
  min-width: 0;
  min-height: 400px;
  overflow: hidden;
  background: #0a1530;
}

/* Soft full-bleed backdrop fills the panel while the real image remains fully visible. */
.m4t-popup-media::before {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: 0;
  background-image: url("/assets/hero-student-study.webp");
  background-position: center;
  background-size: cover;
  filter: blur(17px) brightness(0.62) saturate(0.9);
  transform: scale(1.08);
}

.m4t-popup-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(4, 9, 22, 0.04), rgba(4, 9, 22, 0.2)),
    linear-gradient(180deg, rgba(4, 9, 22, 0.02), rgba(4, 9, 22, 0.18));
  pointer-events: none;
}

.m4t-popup-media img {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.m4t-popup-proof {
  position: absolute;
  left: clamp(12px, 2vw, 18px);
  bottom: clamp(12px, 2vw, 18px);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - clamp(24px, 4vw, 36px));
  min-width: 0;
  padding: 8px 13px 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(7, 10, 22, 0.86);
  background-clip: padding-box;
  color: #fff;
  font-size: clamp(0.7rem, 1.15vw, 0.82rem);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.m4t-popup-proof-stars {
  flex: 0 0 auto;
  color: #ffb833;
  letter-spacing: 0.08em;
  line-height: 1;
}

.m4t-popup-proof-label {
  min-width: 0;
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.m4t-popup-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(34px, 4.6vw, 54px) clamp(30px, 5vw, 58px) clamp(32px, 4.2vw, 48px) clamp(30px, 4.5vw, 52px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: #fff;
}

.m4t-popup-kicker {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: calc(100% - 54px);
  min-width: 0;
  margin-bottom: 16px;
  padding: 8px 13px 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 123, 45, 0.34);
  border-radius: 999px;
  background: rgba(255, 123, 45, 0.14);
  background-clip: padding-box;
  color: #ffd3b3;
  font-size: clamp(0.72rem, 1.2vw, 0.82rem);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.m4t-popup-kicker span {
  display: block;
  min-width: 0;
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.m4t-popup h2 {
  max-width: 10ch;
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(2.55rem, 5.4vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
}

.m4t-popup p {
  max-width: 440px;
  margin: 0 0 26px;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(0.98rem, 1.55vw, 1.08rem);
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.m4t-popup-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.m4t-popup-primary,
.m4t-popup-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 52px;
  padding: 0 21px;
  border-radius: 14px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.m4t-popup-primary {
  background: #ff7a2f;
  color: #fff;
  box-shadow: 0 15px 30px rgba(255, 122, 47, 0.28);
}

.m4t-popup-secondary {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.m4t-popup-primary:hover,
.m4t-popup-secondary:hover {
  transform: translateY(-2px);
}

.m4t-popup-primary:focus-visible,
.m4t-popup-secondary:focus-visible,
.m4t-popup-close:focus-visible {
  outline: 3px solid rgba(255, 184, 51, 0.95);
  outline-offset: 3px;
}

.m4t-popup-close {
  position: absolute;
  right: 17px;
  top: 17px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.m4t-popup-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

@media (max-width: 900px) {
  .m4t-popup {
    grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  }

  .m4t-popup-media {
    min-height: 360px;
  }

  .m4t-popup-content {
    padding: 34px 32px 30px;
  }

  .m4t-popup h2 {
    font-size: clamp(2.35rem, 6.1vw, 3.25rem);
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .m4t-popup-overlay {
    align-items: center;
  }

  .m4t-popup {
    display: grid;
    grid-template-columns: 1fr;
    width: min(100%, 560px);
    max-height: calc(100vh - 24px);
    max-height: calc(100svh - var(--m4t-popup-safe-top) - var(--m4t-popup-safe-bottom));
    max-height: calc(var(--m4t-popup-viewport-height, 100dvh) - var(--m4t-popup-safe-top) - var(--m4t-popup-safe-bottom));
    overflow-y: auto;
    border-radius: 23px;
    -webkit-overflow-scrolling: touch;
  }

  .m4t-popup-media {
    min-height: 0;
    aspect-ratio: 1.52 / 1;
  }

  .m4t-popup-media::before {
    filter: blur(14px) brightness(0.58) saturate(0.92);
  }

  .m4t-popup-content {
    overflow: visible;
    padding: 25px 21px 22px;
  }

  .m4t-popup-kicker {
    max-width: calc(100% - 50px);
    margin-bottom: 12px;
    padding: 7px 11px 8px;
    font-size: 0.75rem;
  }

  .m4t-popup h2 {
    max-width: 12ch;
    margin-bottom: 10px;
    font-size: clamp(2rem, 11vw, 2.85rem);
    line-height: 1;
  }

  .m4t-popup p {
    margin-bottom: 18px;
    font-size: 0.96rem;
    line-height: 1.46;
  }

  .m4t-popup-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 10px;
  }

  .m4t-popup-primary,
  .m4t-popup-secondary {
    width: 100%;
    min-height: 48px;
  }

  .m4t-popup-proof {
    left: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
    padding: 7px 10px 8px;
    font-size: 0.7rem;
  }

  .m4t-popup-close {
    right: 12px;
    top: 12px;
  }
}

/* Landscape phones and short browser windows keep a compact two-column layout. */
@media (max-height: 600px) and (min-width: 560px) {
  .m4t-popup-overlay {
    align-items: center;
  }

  .m4t-popup {
    grid-template-columns: minmax(0, 0.95fr) minmax(330px, 1.05fr);
    width: min(960px, 100%);
    min-height: 0;
    max-height: calc(100vh - 20px);
    max-height: calc(100svh - var(--m4t-popup-safe-top) - var(--m4t-popup-safe-bottom));
    max-height: calc(var(--m4t-popup-viewport-height, 100dvh) - var(--m4t-popup-safe-top) - var(--m4t-popup-safe-bottom));
    overflow: hidden;
    border-radius: 22px;
  }

  .m4t-popup-media {
    min-height: 0;
  }

  .m4t-popup-content {
    padding: 24px 30px 22px;
  }

  .m4t-popup-kicker {
    max-width: calc(100% - 48px);
    margin-bottom: 10px;
    padding: 6px 10px 7px;
    font-size: 0.72rem;
  }

  .m4t-popup h2 {
    margin-bottom: 9px;
    font-size: clamp(2rem, 5.4vw, 3rem);
    line-height: 0.98;
  }

  .m4t-popup p {
    margin-bottom: 16px;
    font-size: 0.94rem;
    line-height: 1.4;
  }

  .m4t-popup-primary,
  .m4t-popup-secondary {
    min-height: 46px;
    padding-inline: 16px;
  }

  .m4t-popup-proof {
    left: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
    padding: 6px 9px 7px;
    font-size: 0.66rem;
  }
}

@media (max-width: 380px) and (orientation: portrait) {
  .m4t-popup-overlay {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .m4t-popup {
    border-radius: 20px;
  }

  .m4t-popup-content {
    padding: 21px 17px 18px;
  }

  .m4t-popup-kicker {
    max-width: calc(100% - 48px);
    padding-inline: 10px;
    font-size: 0.7rem;
  }

  .m4t-popup h2 {
    font-size: clamp(1.9rem, 10.5vw, 2.35rem);
  }

  .m4t-popup p {
    font-size: 0.9rem;
  }

  .m4t-popup-proof {
    gap: 6px;
    padding-inline: 9px;
    font-size: 0.66rem;
  }
}

@media (max-width: 330px) and (orientation: portrait) {
  .m4t-popup-kicker {
    max-width: calc(100% - 46px);
    font-size: 0.66rem;
  }

  .m4t-popup-proof {
    font-size: 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m4t-popup-overlay,
  .m4t-popup,
  .m4t-popup-primary,
  .m4t-popup-secondary {
    transition: none;
  }
}
