/* =====================================================
   CROWNSY — FLOATING CONTACT WIDGET
   TIMELESS EDITORIAL
===================================================== */

/* =====================================================
   01. ROOT VARIABLES
===================================================== */

:root {
  --cwa-black: #171715;
  --cwa-charcoal: #282722;
  --cwa-ivory: #f7f5ef;
  --cwa-white: #ffffff;

  --cwa-muted: #4e4d4c;
  --cwa-gold: #000000;
  --cwa-border: #a3a3a3;
  --cwa-border-dark: #a3a19b;

  --cwa-shadow: 0 8px 28px rgba(23, 23, 21, 0.12);

  --cwa-popup-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);

  --cwa-transition: 0.28s ease;
}

/* =====================================================
   02. FLOATING ACTION CONTAINER
===================================================== */

.floating-actions {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9990;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  width: max-content;
  max-width: calc(100% - 32px);

  box-sizing: border-box;
}

/* =====================================================
   03. SHARED FLOATING BUTTONS
===================================================== */

.floating-wa,
.floating-msg {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  flex: 0 1 auto;
  min-width: 148px;
  min-height: 46px;
  padding: 12px 16px;

  box-sizing: border-box;

  border: 1px solid transparent;
  border-radius: 0;

  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 1.2px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;

  cursor: pointer;

  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;

  box-shadow: var(--cwa-shadow);

  transition:
    background-color var(--cwa-transition),
    color var(--cwa-transition),
    border-color var(--cwa-transition),
    box-shadow var(--cwa-transition),
    transform var(--cwa-transition);
}

/* =====================================================
   04. MESSAGE US
===================================================== */

.floating-msg {
  background: var(--cwa-black);
  color: var(--cwa-white);
  border-color: var(--cwa-black);
}

.floating-msg:hover {
  background: var(--cwa-ivory);
  color: var(--cwa-black);
  border-color: var(--cwa-border);

  transform: translateY(-2px);
}

/* =====================================================
   05. WHATSAPP US
===================================================== */

.floating-wa {
  background: var(--cwa-ivory);
  color: var(--cwa-black);
  border-color: var(--cwa-border);
}

.floating-wa:hover {
  background: var(--cwa-black);
  color: var(--cwa-white);
  border-color: var(--cwa-black);

  transform: translateY(-2px);
}

/* =====================================================
   06. KEYBOARD FOCUS
===================================================== */

.floating-wa:focus-visible,
.floating-msg:focus-visible {
  outline: 2px solid var(--cwa-gold);
  outline-offset: 4px;
}

/* =====================================================
   07. POPUP OVERLAY
===================================================== */

.wa-popup {
  position: fixed;
  inset: 0;
  z-index: 2147483000;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100vh;
  height: 100dvh;

  padding: 24px;

  box-sizing: border-box;

  background: rgba(17, 17, 15, 0.66);

  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);

  visibility: hidden;
  opacity: 0;
  pointer-events: none;

  overflow-x: hidden;
  overflow-y: auto;

  overscroll-behavior: contain;

  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

/* Hidden attribute: popup benar-benar tidak ditampilkan */

.wa-popup[hidden] {
  display: none !important;
}

/* Popup dalam keadaan terbuka */

.wa-popup.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* =====================================================
   08. POPUP PANEL
===================================================== */

.wa-box {
  position: relative;

  flex: 0 1 390px;
  width: 100%;
  max-width: 390px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);

  margin: auto;

  padding: 40px 32px 28px;

  box-sizing: border-box;

  overflow-x: hidden;
  overflow-y: auto;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

  background: var(--cwa-ivory);
  color: var(--cwa-black);

  border: 1px solid var(--cwa-border);
  border-radius: 0;

  box-shadow: var(--cwa-popup-shadow);

  text-align: center;

  opacity: 0;
  transform: translateY(14px);

  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

/* Animasi saat popup dibuka */

.wa-popup.is-open .wa-box {
  opacity: 1;
  transform: translateY(0);
}

/* Aksen garis editorial di bagian atas */

.wa-box::before {
  content: "";

  display: block;

  width: 42px;
  height: 1px;

  margin: 0 auto 25px;

  background: var(--cwa-gold);
}

/* =====================================================
   09. POPUP TYPOGRAPHY
===================================================== */

.wa-eyebrow {
  display: block;

  margin: 0 0 14px;

  color: var(--cwa-muted);

  font-family: inherit;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 2px;

  text-transform: uppercase;
}

.wa-box h2 {
  margin: 0 0 14px;
  padding: 0;

  color: var(--cwa-black);

  font-family: "Libre Baskerville", "Times New Roman", Georgia, serif;

  font-size: 26px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.3px;
}

.wa-box p {
  max-width: 290px;

  margin: 0 auto 26px;
  padding: 0;

  color: var(--cwa-muted);

  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.9;
}

/* =====================================================
   10. WHATSAPP CONTACT OPTIONS
===================================================== */

.wa-options {
  display: flex;
  flex-direction: column;
  gap: 10px;

  width: 100%;
}

/* Individual contact option */

.wa-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  width: 100%;
  min-height: 64px;
  padding: 15px 17px;

  box-sizing: border-box;

  background: transparent;
  color: var(--cwa-black);

  border: 1px solid var(--cwa-border);
  border-radius: 0;

  font-family: inherit;
  text-align: left;
  text-decoration: none;

  transition:
    background-color var(--cwa-transition),
    color var(--cwa-transition),
    border-color var(--cwa-transition),
    transform var(--cwa-transition);
}

/* Hover effect */

.wa-option:hover {
  background: var(--cwa-black);
  color: var(--cwa-white);

  border-color: var(--cwa-black);

  transform: translateY(-1px);
}

/* Left-side text */

.wa-option-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 5px;

  min-width: 0;
}

/* Main option label */

.wa-option-title {
  display: block;

  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 1px;

  text-transform: uppercase;
}

/* Secondary label */

.wa-option-description {
  display: block;

  color: var(--cwa-muted);

  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;

  transition: color var(--cwa-transition);
}

.wa-option:hover .wa-option-description {
  color: rgba(255, 255, 255, 0.72);
}

/* Subtle external-link arrow */

.wa-option-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  flex: 0 0 24px;

  width: 24px;
  height: 24px;

  color: var(--cwa-gold);

  font-family: Arial, sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;

  transition:
    color var(--cwa-transition),
    transform var(--cwa-transition);
}

.wa-option:hover .wa-option-arrow {
  color: var(--cwa-white);
  transform: translate(2px, -2px);
}

/* Contact link keyboard focus */

.wa-option:focus-visible {
  outline: 2px solid var(--cwa-gold);
  outline-offset: 3px;
}

/* =====================================================
   11. CLOSE BUTTON
===================================================== */

.wa-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 36px;
  margin: 20px 0 0;
  padding: 7px 12px;

  background: transparent;
  color: var(--cwa-muted);

  border: 1px solid transparent;
  border-radius: 0;

  font-family: inherit;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 1.5px;

  text-transform: uppercase;

  cursor: pointer;
  touch-action: manipulation;

  transition:
    color var(--cwa-transition),
    border-color var(--cwa-transition),
    background-color var(--cwa-transition);
}

.wa-close:hover {
  color: var(--cwa-black);
  border-color: var(--cwa-border);
}

.wa-close:focus-visible {
  outline: 2px solid var(--cwa-gold);
  outline-offset: 3px;
}

/* =====================================================
   12. PREVENT BACKGROUND SCROLL
===================================================== */

body.wa-popup-open {
  overflow: hidden;
  overscroll-behavior: none;
}

/* =====================================================
   13. TABLET
===================================================== */

@media (max-width: 768px) {
  .floating-actions {
    right: 18px;
    bottom: 20px;
    gap: 8px;
  }

  .floating-wa,
  .floating-msg {
    min-width: 136px;
    min-height: 44px;
    padding: 11px 13px;

    font-size: 9px;
    letter-spacing: 0.9px;
  }

  .wa-popup {
    padding: 22px;
  }

  .wa-box {
    flex-basis: 370px;
    max-width: 370px;
    max-height: calc(100vh - 44px);
    max-height: calc(100dvh - 44px);

    padding: 36px 28px 26px;
  }
}

/* =====================================================
   14. MOBILE
===================================================== */

@media (max-width: 480px) {
  .floating-actions {
    right: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 12px;

    justify-content: center;
    gap: 8px;

    width: auto;
    max-width: none;
  }

  .floating-wa,
  .floating-msg {
    flex: 1 1 0;

    width: auto;
    min-width: 0;
    max-width: 180px;
    min-height: 43px;

    padding: 11px 8px;

    font-size: 9px;
    letter-spacing: 0.7px;
  }

  .wa-popup {
    align-items: center;
    justify-content: center;

    padding: max(16px, env(safe-area-inset-top)) 16px
      max(16px, env(safe-area-inset-bottom));
  }

  .wa-box {
    flex: 0 1 350px;

    width: 100%;
    max-width: 350px;

    max-height: calc(
      100vh - max(16px, env(safe-area-inset-top)) -
        max(16px, env(safe-area-inset-bottom))
    );

    max-height: calc(
      100dvh - max(16px, env(safe-area-inset-top)) -
        max(16px, env(safe-area-inset-bottom))
    );

    padding: 32px 22px 24px;
  }

  .wa-box::before {
    margin-bottom: 22px;
  }

  .wa-box h2 {
    font-size: 23px;
  }

  .wa-box p {
    margin-bottom: 22px;

    font-size: 12px;
    line-height: 1.8;
  }

  .wa-option {
    min-height: 60px;
    padding: 13px 14px;
  }
}

/* =====================================================
   15. SMALL MOBILE
===================================================== */

@media (max-width: 360px) {
  .floating-actions {
    right: 10px;
    left: 10px;
    gap: 7px;

    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .floating-wa,
  .floating-msg {
    padding: 10px 6px;

    font-size: 8px;
    letter-spacing: 0.45px;
  }

  .wa-popup {
    padding-right: 12px;
    padding-left: 12px;
  }

  .wa-box {
    padding: 28px 18px 22px;
  }

  .wa-box h2 {
    font-size: 21px;
  }

  .wa-eyebrow {
    font-size: 8px;
    letter-spacing: 1.6px;
  }

  .wa-option-title {
    font-size: 10px;
  }

  .wa-option-description {
    font-size: 10px;
  }
}

/* =====================================================
   16. SHORT VIEWPORT
===================================================== */

@media (max-height: 520px) {
  .wa-popup {
    align-items: flex-start;
  }

  .wa-box {
    margin-top: auto;
    margin-bottom: auto;

    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);

    padding-top: 24px;
    padding-bottom: 20px;
  }

  .wa-box::before {
    margin-bottom: 16px;
  }

  .wa-box h2 {
    font-size: 21px;
  }

  .wa-box p {
    margin-bottom: 16px;
    line-height: 1.7;
  }

  .wa-option {
    min-height: 54px;
    padding: 11px 13px;
  }

  .wa-close {
    margin-top: 12px;
  }
}

/* =====================================================
   17. REDUCED MOTION
===================================================== */

@media (prefers-reduced-motion: reduce) {
  .floating-wa,
  .floating-msg,
  .wa-popup,
  .wa-box,
  .wa-option,
  .wa-option-arrow,
  .wa-option-description,
  .wa-close {
    transition: none !important;
    animation: none !important;
  }

  .floating-wa:hover,
  .floating-msg:hover,
  .wa-option:hover {
    transform: none;
  }

  .wa-box {
    transform: none;
  }

  .wa-popup.is-open .wa-box {
    transform: none;
  }
}
