/* The Modal (background) */
.webkit_popup_background {
  display: none; /* hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.45); /* darker + a touch of blur reads more "modern glass" than flat black */
  backdrop-filter: blur(2px);
}

/* Modal Content/Box */
.webkit_popup {
  display: flex;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  flex-direction: column;
  align-items: stretch;
  background-color: var(--color-background-white);
  border-radius: var(--radius-medium); /* 12px instead of 5px - softer, less boxy */
  width: fit-content;
  max-width: min(480px, 90vw); /* keeps it from stretching full width on desktop */
  padding: var(--spacing-large);
  font-family: var(--font-family);
  /* one soft, diffuse shadow instead of the old double hard shadow */
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
}

/* The Close Button */
.webkit_popup_close {
  cursor: pointer;
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: calc(var(--spacing-tiny) * -1) calc(var(--spacing-tiny) * -1) 0 0;
  border-radius: 50%;
  color: var(--color-dark);
  opacity: 0.5;
  z-index: 1015;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.webkit_popup_close:hover {
  opacity: 1;
  background-color: var(--color-light);
}

/* The Title */
.webkit_popup_title {
  color: var(--color-dark);
  background-color: transparent; /* drop the gray block behind the text */
  font-size: var(--font-size-header);
  font-weight: 600; /* slightly lighter than bold - reads cleaner at this size */
  width: 100%;
  align-self: stretch;
  padding: 0 0 var(--spacing-medium) 0;
  margin: 0 0 var(--spacing-medium) 0;
  border-bottom: 1px solid var(--color-border-lighter); /* separation without a solid fill */
}

.webkit_popup_content {
  width: 100%;
  margin: 0;
  color: var(--color-dark);
  font-size: var(--font-size-small);
  line-height: 1.5;
}

/* The Button */
.webkit_popup_button {
  background-color: var(--color-secondary);
  color: var(--color-background-white);
  border: none;
  border-radius: var(--radius-small);
  padding: var(--spacing-small) var(--spacing-large);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  align-self: flex-end;
  margin-top: var(--spacing-medium);
  transition: filter 0.15s ease;
}

.webkit_popup_button:hover,
.webkit_popup_button:focus {
  filter: brightness(1.12);
  text-decoration: none;
  cursor: pointer;
}

/* Tooltip type: small anchored popup instead of a full-screen modal */
.webkit_popup_background.tooltip_background {
  position: absolute;
  width: auto;
  height: auto;
  overflow: visible;
  background-color: transparent;
  backdrop-filter: none; /* only the full modal gets the blur treatment */
  z-index: 10000;
}

.webkit_popup.tooltip_container {
  position: static;
  transform: none;
  align-items: stretch;
  padding: var(--spacing-small);
  box-shadow: var(--shadow-light); /* tooltip gets your existing lighter shadow token, not the heavy modal one */
}

/* Hide the (unused) title/content slots so they don't reserve space in tooltips */
.tooltip_container .webkit_popup_title:empty,
.tooltip_container .webkit_popup_content:empty {
  display: none;
}

.tooltip_container .webkit_popup_content {
  width: auto;
  margin: 0;
}