/* Keep the supplied notification independent of the site's legacy resets. */
#notice {
  --accent: #FACF9F;
  --card: #FFE0BC;
  --text: #34302C;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: normal;
  text-align: start;
}

#notice,
#notice * {
  box-sizing: border-box;
}

#notice * {
  font-family: inherit;
  font-size: inherit;
}

#notice button {
  font: inherit;
  cursor: pointer;
  text-transform: none;
}

#notice button:focus-visible {
  outline: 2px solid #62503F;
  outline-offset: 4px;
}

dialog#notice {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  max-height: none;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

/* Bootstrap's reset displays dialogs even after their open attribute is removed. */
dialog#notice:not([open]) {
  display: none;
}

dialog#notice:focus,
dialog#notice:focus-visible {
  outline: none;
  border: 0;
  box-shadow: none;
}

dialog#notice::backdrop {
  background: transparent;
}

#notice .notice-card {
  position: relative;
  border-radius: 24px;
  background: var(--card);
  isolation: isolate;
}

/* بدون لایهٔ تزئینی اضافه */
#notice .notice-card::before,
#notice .notice-card::after {
  content: none;
}

#notice[open] .notice-card {
  animation: notice-drop-and-open 2400ms linear both;
}

/* حرکت دایره از بالای صفحه، جهش و تبدیل به کارت */
@keyframes notice-drop-and-open {
  0% {
    transform: translateY(-100vh);
    clip-path: inset(
      calc(50% - 16px) calc(50% - 16px) round 16px
    );
    background: var(--accent);
    animation-timing-function: cubic-bezier(.5, 0, .8, .5);
  }

  43% {
    transform: translateY(24px);
    clip-path: inset(
      calc(50% - 16px) calc(50% - 16px) round 16px
    );
    background: var(--accent);
    animation-timing-function: ease-out;
  }

  54% {
    transform: translateY(-20px);
    clip-path: inset(
      calc(50% - 16px) calc(50% - 16px) round 16px
    );
    background: var(--accent);
    animation-timing-function: ease-in;
  }

  63% {
    transform: translateY(0);
    clip-path: inset(
      calc(50% - 16px) calc(50% - 16px) round 16px
    );
    background: var(--accent);
  }

  73% {
    transform: translateY(0);
    clip-path: inset(
      calc(50% - 16px) calc(50% - 16px) round 16px
    );
    background: var(--accent);
    animation-timing-function: cubic-bezier(.2, .8, .2, 1);
  }

  100% {
    transform: translateY(0);
    clip-path: inset(0 round 24px);
    background: var(--card);
  }
}

#notice .notice-content {
  position: relative;
  padding: 28px;
  max-height: calc(100svh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #FFF0DE;
  border-radius: 24px;
}

#notice[open] .notice-content {
  animation: notice-reveal-content 350ms ease-out 2400ms both;
}

@keyframes notice-reveal-content {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#notice .notice-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#notice .notice-badge {
  color: #62574D;
  font-size: 11px;
}

#notice .notice-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: #9B663C;
}

#notice .notice-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 1px 6px;
  border: 1px solid #E4B98C;
  border-radius: 50%;
  background: #FFEBD4;
  color: #49413A;
  font-size: 22px;
  line-height: 1;
}

#notice .notice-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-top: 22px;
  border: 1px solid #E4B98C;
  border-radius: 18px;
  background: var(--accent);
  color: #62503F;
}

#notice h2 {
  margin: 22px 0 10px;
  font-size: 23px;
  line-height: 1.7;
}

#notice .notice-message {
  margin: 0;
  color: #62574D;
  font-size: 14px;
  line-height: 2.1;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#notice .notice-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

#notice .notice-actions button {
  padding: 14px 20px;
  border: 0;
  border-radius: 12px;
  font-size: 13px;
}

#notice .notice-confirm {
  flex: 1;
  background: var(--accent);
  color: var(--text);
  font-weight: bold;
}

#notice .notice-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #EBC7A1;
  color: #706052;
  font-size: 10px;
}

@media (max-width: 400px) {
  #notice .notice-content {
    padding: 22px;
  }

  #notice h2 {
    font-size: 21px;
  }
}

/* The existing admin editor stores rich HTML, including paragraphs and links. */
#notice h2 {
  font-weight: bold;
  color: var(--text);
  text-transform: none;
}

#notice .notice-message {
  white-space: normal;
}

#notice .notice-message p {
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

#notice .notice-message img,
#notice .notice-message video,
#notice .notice-message iframe {
  max-width: 100%;
}

#notice .notice-message img {
  height: auto;
}

#notice .notice-message a {
  color: inherit;
  text-decoration: underline;
}
