/* =========================================================
   POJOK BACA — INTRO TESTIMONIAL OVERLAY
   Sekali per session. Typewriter + blur backdrop.
   ========================================================= */

/* Saat intro aktif: kunci scroll + sembunyikan konten (visibility = reserve layout, no reflow saat exit) */
body.pb-intro-active {
  overflow: hidden;
}
body.pb-intro-active main,
body.pb-intro-active #main-header,
body.pb-intro-active #main-footer,
body.pb-intro-active #chatbot-container,
body.pb-intro-active #open-chatbot-btn,
body.pb-intro-active #comment-section-container,
body.pb-intro-active .pdf-reader-modal {
  visibility: hidden;
}

/* Overlay default-nya hidden lewat HTML attribute → JS unhide saat mau jalan.
   Cegah overlay nyangkut saat refresh (sessionStorage flag sudah '1'). */
.pb-intro[hidden] {
  display: none !important;
}

/* Overlay root */
.pb-intro {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 40px);
  opacity: 1;
  transform: scale(1);
  transition: opacity 700ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 700ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.pb-intro.is-leaving {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

/* Backdrop blur layer */
.pb-intro__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center,
      rgba(0, 170, 255, 0.10) 0%,
      rgba(0, 0, 0, 0.78) 55%,
      rgba(0, 0, 0, 0.92) 100%);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  z-index: -1;
}

/* Fallback browser tanpa backdrop-filter */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pb-intro__backdrop {
    background: rgba(0, 0, 0, 0.94);
  }
}

/* Content container */
.pb-intro__content {
  position: relative;
  max-width: min(820px, 92vw);
  width: 100%;
  padding: clamp(28px, 5vw, 56px) clamp(24px, 5vw, 64px);
  text-align: left;
  animation: pbIntroFloat 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pbIntroFloat {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Quote mark dekoratif */
.pb-intro__quote-mark {
  position: absolute;
  top: clamp(-20px, -2vw, -8px);
  left: clamp(-8px, 0vw, 8px);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(80px, 14vw, 160px);
  line-height: 1;
  color: var(--primary-color, #00aaff);
  opacity: 0.32;
  user-select: none;
  pointer-events: none;
  text-shadow: 0 0 40px rgba(0, 170, 255, 0.35);
}

/* Quote text (typewriter target) */
.pb-intro__quote {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(20px, 3.1vw, 30px);
  line-height: 1.6;
  color: #f5f5f5;
  margin: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  min-height: 4.8em; /* reserve space supaya layout tak loncat saat ngetik */
  display: block;
}

.pb-intro__quote #pb-intro-quote {
  display: inline;
}

/* Caret kedip */
.pb-intro__caret {
  display: inline-block;
  margin: 0 0 0 2px;
  font-size: clamp(20px, 3.1vw, 30px);
  line-height: 1.6;
  color: var(--primary-color, #00aaff);
  animation: pbCaretBlink 1s steps(1) infinite;
  text-shadow: 0 0 8px rgba(0, 170, 255, 0.8);
  vertical-align: baseline;
}

.pb-intro__caret--done {
  animation: none;
  opacity: 0;
  transition: opacity 300ms ease;
}

@keyframes pbCaretBlink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Attribution (— Tan Malaka, Madilog) */
.pb-intro__attr {
  margin: clamp(20px, 3vw, 32px) 0 0;
  text-align: right;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 500;
  font-size: clamp(14px, 1.8vw, 18px);
  color: var(--secondary-color, #f7b733);
  letter-spacing: 0.05em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.pb-intro__attr em {
  font-style: italic;
  font-weight: 400;
  opacity: 0.9;
}

.pb-intro__attr.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Skip button */
.pb-intro__skip {
  position: fixed;
  bottom: clamp(20px, 4vw, 32px);
  right: clamp(20px, 4vw, 32px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 170, 255, 0.35);
  border-radius: 999px;
  color: #e0e0e0;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms ease,
              transform 500ms ease,
              background 200ms ease,
              border-color 200ms ease,
              box-shadow 200ms ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pb-intro__skip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.pb-intro__skip:hover,
.pb-intro__skip:focus-visible {
  background: rgba(0, 170, 255, 0.15);
  border-color: var(--primary-color, #00aaff);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 170, 255, 0.25);
  outline: none;
  transform: translateY(-2px);
}

.pb-intro__skip i {
  font-size: 12px;
  transition: transform 200ms ease;
}

.pb-intro__skip:hover i {
  transform: translateX(3px);
}

/* Responsif kecil */
@media (max-width: 480px) {
  .pb-intro__content {
    padding: 32px 20px;
  }
  .pb-intro__quote-mark {
    font-size: 72px;
    top: -8px;
  }
  .pb-intro__quote,
  .pb-intro__caret {
    font-size: 18px;
    line-height: 1.55;
  }
  .pb-intro__attr {
    font-size: 13px;
  }
  .pb-intro__skip {
    bottom: 16px;
    right: 16px;
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .pb-intro,
  .pb-intro__content,
  .pb-intro__attr,
  .pb-intro__skip {
    animation: none !important;
    transition: opacity 200ms linear !important;
  }
  .pb-intro__caret {
    animation: none;
    opacity: 0;
  }
  .pb-intro.is-leaving {
    transform: none;
  }
}
