/* BASE: tema global, header profil, accordion, tombol, modal dasar, footer */

/* Ikon SVG inline (sprite di index.html) */
.ic {
  width: 1em;
  height: 1em;
  fill: currentColor;
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #3b2820;
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 12px;
}

.linktree-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* LOADING SCREEN */
.page-loader {
  position: fixed;
  inset: 0;
  background-color: #3b2820;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader-emoji {
  font-size: 2.6rem;
  animation: loaderBounce 0.9s ease-in-out infinite;
}

@keyframes loaderBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-14px) scale(1.1); }
}

.loader-dots { display: flex; gap: 6px; }

.loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #e57238;
  border: 1.5px solid #000;
  display: inline-block;
  animation: loaderDot 1s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.15s; background-color: #3b719f; }

.loader-dots span:nth-child(3) { animation-delay: 0.3s; background-color: #c04968; }

@keyframes loaderDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1.25); opacity: 1; }
}

/* RIPPLE EFFECT TOMBOL */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  animation: rippleAnim 0.55s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(2.6); opacity: 0; }
}

.accordion-header,
.polaroid-close-btn {
  position: relative;
  overflow: hidden;
}

/* HEADER PROFIL */
.profile-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  padding: 28px 4px 8px;
  margin-bottom: 20px;
}

.avatar-wrapper { flex-shrink: 0; }

.avatar-img {
  width: 160px;
  height: 160px;
  border-radius: 28px;
  object-fit: cover;
  background-color: #ffffff;
  display: block;
  border: 3px solid #000000;
  box-shadow: 4px 4px 0px #000000;
}

.profile-info { display: flex; flex-direction: column; align-items: center; }

.profile-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
}

.profile-tagline {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-top: 3px;
  font-weight: 600;
}

/* LINKS CONTAINER & ACCORDIONS */
.links-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.accordion-card {
  border: 3px solid #000000;
  border-radius: 16px;
  box-shadow: 4px 4px 0px #000000;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-orange { background-color: #e57238; }

.card-pink   { background-color: #c04968; }

.card-blue   { background-color: #3b719f; }

.accordion-header {
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  text-align: left;
}

.link-icon {
  font-size: 1.3rem;
  margin-right: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1.5px solid #000000;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-text {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.link-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.link-subtitle {
  font-size: 0.72rem;
  opacity: 0.9;
  margin-top: 2px;
}

.accordion-arrow {
  font-size: 0.9rem;
  font-weight: 800;
  margin-left: 8px;
  transition: transform 0.3s ease;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  width: 100%;
  padding: 0 16px;
  transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), padding 0.3s ease;
}

.accordion-card.active .accordion-content {
  max-height: 480px;
  padding: 0 16px 16px 16px;
}

.accordion-card.active .accordion-arrow {
  transform: rotate(180deg);
}

/* GRID LAYOUTS */
.grid-top {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.grid-members {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* ==========================================
   BAGAN POHON (ORG CHART) — root -> pengurus -> anggota
========================================== */
.org-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.org-connector {
  width: 2px;
  height: 14px;
  background-color: #000000;
}

.org-item {
  display: flex;
  justify-content: center;
}

.org-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 8px;
  width: 100%;
}

.org-row.multi {
  position: relative;
  padding-top: 14px;
}

.org-row.multi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 2px;
  background-color: #000000;
}

.org-row.multi > .org-item {
  position: relative;
  padding-top: 14px;
}

.org-row.multi > .org-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 14px;
  background-color: #000000;
}

.org-members-block {
  width: 100%;
  border: 2px dashed rgba(0, 0, 0, 0.35);
  border-radius: 14px;
  padding: 10px 8px 12px;
}

.org-members-label {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  opacity: 0.9;
  margin-bottom: 10px;
}

/* POPUP MODAL BASE */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(30, 20, 15, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0s;
}

/* Animasi di dalam popup / dropdown yang tertutup dijeda (hemat CPU/baterai) */
.modal-overlay:not(.active) *,
.modal-overlay:not(.active) *::before,
.modal-overlay:not(.active) *::after,
.accordion-card:not(.active) .accordion-content *,
.accordion-card:not(.active) .accordion-content *::before,
.accordion-card:not(.active) .accordion-content *::after {
  animation-play-state: paused !important;
}

.polaroid-close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  background-color: #3b2820;
  color: #ffffff;
  border: 2px solid #000000;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 2px 2px 0px #000000;
  z-index: 10;
}

/* FOOTER */
footer { margin-top: 26px; font-size: 0.72rem; opacity: 0.8; font-weight: 700; }

/* ==========================================
   POPUP TENGAH (Musik & Absensi)
========================================== */
.modal-overlay.drawer {
  justify-content: center;
  align-items: center;
  padding: 12px;
  background-color: rgba(10, 6, 4, 0.45);
  /* blur latar sudah ditangani filter pada .linktree-container (lebih murah daripada backdrop-filter) */
  backdrop-filter: none;
}

.modal-overlay.drawer .polaroid-close-btn { top: 12px; right: 12px; }

.modal-overlay.drawer .playlist-header,
.modal-overlay.drawer .sheet-title { padding-right: 40px; }

.linktree-container { transition: filter 0.35s ease, transform 0.35s ease; }

body:has(.modal-overlay.drawer.active) .linktree-container {
  filter: blur(8px);
  transform: scale(0.98);
}

/* HEADER PROFIL — foto di atas, judul di tengah (gaya referensi) */
.profile-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
  padding: 36px 4px 8px;
}

.avatar-wrapper { position: relative; padding-bottom: 14px; }

.avatar-img {
  width: 160px; height: 160px; border-radius: 28px; object-fit: cover;
  border: 3px solid #000; box-shadow: 4px 4px 0 #000;
}

.avatar-badge {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  background: #2f7d57; color: #fff; border: 3px solid #000; border-radius: 999px;
  padding: 3px 12px; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.02em;
  white-space: nowrap; font-family: 'Plus Jakarta Sans', sans-serif;
}

.profile-info { align-items: center; }

.profile-name {
  font-size: 2.1rem; font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

.profile-tagline { font-size: 0.95rem; margin-top: 8px; opacity: 0.6; font-weight: 500; }

.profile-welcome {
  margin-top: 18px; background: #fff; color: #000; border-radius: 14px;
  padding: 12px 22px; font-size: 0.85rem; font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Bubble tunggal: dua teks bergantian */
.profile-welcome { display: inline-grid; justify-items: center; align-items: center; margin-top: 16px; }

.pw-text {
  grid-area: 1 / 1;
  white-space: nowrap;
  opacity: 0;
  animation: pwSwap 6s ease-in-out infinite;
}

.pw-b { animation-delay: 3s; }

@keyframes pwSwap {
  0%        { opacity: 0; transform: translateY(8px); }
  8%, 42%   { opacity: 1; transform: translateY(0); }
  50%, 100% { opacity: 0; transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .pw-text { animation: none; }
  .pw-a { opacity: 1; }
}

/* HEADER PROFIL — foto di kiri, nama & bubble di kanan (foto geser ke kiri saat intro) */
.profile-header {
  flex-direction: row;
  justify-content: center;
  text-align: left;
  gap: 16px;
  padding: 36px 4px 8px;
}

.avatar-img { width: 120px; height: 120px; border-radius: 24px; }

.profile-info { align-items: flex-start; min-width: 0; }

.profile-name { font-size: 1.9rem; justify-content: flex-start; white-space: nowrap; }

.profile-welcome { margin-top: 10px; padding: 9px 14px; font-size: 0.75rem; justify-items: start; }

.pw-text { white-space: normal; }
