/* ==========================================================================
   Beranda: sambutan pimpinan (#kenali)
   Panel profil vertikal yang mengikuti tinggi sambutan, dengan foto ringkas
   dan identitas masing-masing pimpinan.
   Dimuat setelah stylesheet lain; kelas .sambutan-* tidak dipakai di tempat lain.
   ========================================================================== */
.sambutan {
  --s-ink: #14261c;
  --s-text: #334155;
  --s-muted: #66756d;
  --s-green: #3d6b2c;
  --s-green-ink: #2e5420;
  --s-tint: #ebf2e6;
  --s-soft: #f7faf5;
  --s-line: #e2ebe0;
  --s-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --s-radius: 16px;
  /* Sama dengan kartu staf, ekstrakurikuler, fasilitas, dan berita. */
  --s-card-radius: 22px;
  --s-card-border: #e4ece0;
  --s-card-shadow: 0 12px 30px -8px rgba(20, 38, 28, 0.06), 0 4px 12px -2px rgba(20, 38, 28, 0.03);

  position: relative;
  overflow-x: clip;
  background: #ffffff;
}

.sambutan-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(28px, 3.4vw, 48px);
  align-items: stretch;
}

/* --- Kolom foto ------------------------------------------------------------ */
/* Tinggi panel mengikuti teks; foto tetap dibatasi agar tidak membesar. */
.sambutan-visual {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--s-card-border);
  border-radius: var(--s-card-radius);
  background: var(--s-soft);
  min-width: 0;
  width: 100%;
  max-width: 420px;
  justify-self: end;
}

/* Dua profil tersusun vertikal, dengan potret dan identitas berdampingan. */
.sambutan-portraits {
  display: grid;
  align-content: space-evenly;
  gap: 24px;
}

.sambutan-portraits.is-single {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  justify-self: center;
}

.sambutan-portrait {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

button.sambutan-portrait {
  cursor: pointer;
}

.sambutan-portrait-caption {
  display: grid;
  gap: 6px;
  overflow-wrap: anywhere;
}

.sambutan-portrait-caption strong {
  color: var(--s-ink);
  font: 800 16px/1.4 var(--font-friendly);
}

.sambutan-portrait-caption > span {
  color: var(--s-muted);
  font-size: 13px;
  line-height: 1.5;
}

button.sambutan-portrait:focus-visible {
  outline: none;
}

button.sambutan-portrait:focus-visible .sambutan-portrait-frame {
  outline: 3px solid var(--s-green);
  outline-offset: 4px;
}

.sambutan-portrait-frame {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--s-radius);
  background: var(--s-soft);
  box-shadow:
    0 0 0 1px var(--s-line),
    0 10px 24px -18px rgba(20, 38, 28, 0.25);
  transition:
    box-shadow 500ms ease,
    transform 500ms var(--s-ease);
}

/* Foto aktif ditandai bingkai hijau, ukurannya tetap sama dengan foto lain. */
.sambutan-portrait.is-active .sambutan-portrait-frame {
  box-shadow:
    0 0 0 3px #ffffff,
    0 0 0 5px var(--s-green),
    0 18px 36px -22px rgba(20, 38, 28, 0.35);
}

.sambutan-portraits.is-single .sambutan-portrait-frame {
  box-shadow:
    0 0 0 1px var(--s-line),
    0 18px 36px -22px rgba(20, 38, 28, 0.3);
}

button.sambutan-portrait:not(.is-active):hover .sambutan-portrait-frame {
  transform: translateY(-3px);
}

.sambutan-portrait-frame > img,
.sambutan-portrait-frame > .site-content-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  background: var(--s-soft);
  filter: saturate(0.6);
  transition:
    filter 500ms ease,
    transform 1200ms var(--s-ease);
}

.sambutan-portrait.is-active .sambutan-portrait-frame > img,
.sambutan-portraits.is-single .sambutan-portrait-frame > img,
button.sambutan-portrait:hover .sambutan-portrait-frame > img {
  filter: none;
}

.sambutan-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: var(--s-soft);
  color: #829589;
  text-align: center;
}

.sambutan-placeholder span {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

/* --- Kartu nama + navigasi -------------------------------------------------- */
.sambutan-meta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  padding: 18px 0 12px;
  border-top: 1px solid var(--s-card-border);
}

.sambutan-person {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sambutan-person.is-swapping {
  animation: sambutan-swap 600ms var(--s-ease) both;
}

@keyframes sambutan-swap {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.sambutan-number {
  color: var(--s-green);
  font: 800 11.5px/1.4 var(--font-friendly);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.sambutan-person strong {
  color: var(--s-ink);
  font: 800 16px/1.3 var(--font-friendly);
  letter-spacing: -0.01em;
}

.sambutan-person > span:last-child {
  color: var(--s-muted);
  font-size: 13px;
  line-height: 1.4;
}

.sambutan-controls {
  display: flex;
  flex: none;
  gap: 6px;
}

.sambutan-controls button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #d2e0c8;
  border-radius: 12px;
  background: #ffffff;
  color: var(--s-green-ink);
  transition:
    background-color 200ms ease,
    border-color 200ms ease,
    color 200ms ease,
    transform 200ms ease;
}

.sambutan-controls button:hover {
  border-color: var(--s-green);
  background: var(--s-green);
  color: #ffffff;
  transform: translateY(-2px);
}

.sambutan-controls button:active {
  transform: translateY(0) scale(0.96);
}

.sambutan-controls button:focus-visible {
  outline: 3px solid var(--s-green);
  outline-offset: 2px;
}

/* Garis progres putar otomatis di tepi bawah kartu nama.
   Akhir animasinya memicu sambutan berikutnya (lihat app.js). */
.sambutan-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: transparent;
}

.sambutan-progress > span {
  display: block;
  height: 100%;
  background: var(--s-green);
  transform: scaleX(0);
  transform-origin: left center;
}

.sambutan.is-playing .sambutan-progress {
  background: var(--s-line);
}

.sambutan.is-playing .sambutan-progress > span {
  animation: sambutan-progress var(--sambutan-autoplay, 16000ms) linear forwards;
}

.sambutan.is-paused .sambutan-progress > span {
  animation-play-state: paused;
}

@keyframes sambutan-progress {
  to { transform: scaleX(1); }
}

/* --- Kartu teks (isi lengkap, tanpa dipotong) ------------------------------ */
.sambutan-copy {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(24px, 2.6vw, 36px);
  border: 1px solid var(--s-card-border);
  border-radius: var(--s-card-radius);
  background: #ffffff;
  box-shadow: var(--s-card-shadow);
}

.sambutan-slides {
  position: relative;
  z-index: 1;
  display: grid;
}

.sambutan-quote {
  position: absolute;
  top: clamp(16px, 2vw, 24px);
  right: clamp(16px, 2vw, 26px);
  width: clamp(44px, 4.4vw, 60px);
  height: auto;
  color: #dfe9d8;
  pointer-events: none;
}

.sambutan-slide {
  grid-area: 1 / 1;
  min-width: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, visibility 0s linear 300ms;
}

.sambutan-slide.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 400ms ease 150ms;
}

/* Label salam berbentuk pil seperti versi awal. Radius tidak penuh agar tetap
   rapi bila teksnya turun ke baris kedua. */
.sambutan-greeting {
  display: inline-block;
  max-width: calc(100% - 64px);
  margin: 0;
  padding: 7px 14px;
  border: 1px solid #d2e0c8;
  border-radius: 14px;
  background: var(--s-tint);
  color: var(--s-green-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

/* Ukuran judul mengikuti judul section lain di beranda. */
.sambutan .sambutan-title {
  max-width: 22ch;
  margin: 16px 0 0;
  color: var(--s-ink) !important;
  font-family: var(--font-friendly) !important;
  font-size: clamp(24px, 2.3vw, 32px) !important;
  font-weight: 800 !important;
  line-height: 1.18 !important;
  letter-spacing: -0.025em !important;
  word-spacing: 0 !important;
  text-wrap: balance;
}

/* Tiap kata dibungkus masker agar bisa naik satu per satu. */
.sambutan-word {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
  vertical-align: bottom;
}

.sambutan-word > span {
  display: inline-block;
}

.sambutan-message {
  max-width: 66ch;
  margin-top: 16px;
}

.sambutan-message p {
  margin: 0 0 0.9em;
  color: var(--s-text);
  font-size: 15.5px;
  line-height: 1.75;
}

.sambutan-message p:first-child {
  color: var(--s-ink);
  font-weight: 600;
}

.sambutan-message p:last-child {
  margin-bottom: 0;
}

.sambutan-signoff {
  display: grid;
  gap: 2px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--s-line);
}

.sambutan-signoff span {
  color: var(--s-muted);
  font-size: 14px;
}

.sambutan-signoff strong {
  color: var(--s-ink);
  font: 700 15.5px/1.4 var(--font-friendly);
}

/* ==========================================================================
   Animasi masuk. Hanya aktif setelah app.js menambahkan .is-armed, sehingga
   tanpa JavaScript semua konten tetap terlihat.
   ========================================================================== */
.sambutan.is-armed .sambutan-portrait {
  opacity: 0;
  transform: translateY(28px);
}

.sambutan.is-armed .sambutan-portrait-frame > img {
  transform: scale(1.12);
}

.sambutan.is-armed .sambutan-meta,
.sambutan.is-armed .sambutan-copy {
  opacity: 0;
  transform: translateY(18px);
}

.sambutan.is-armed .sambutan-greeting {
  opacity: 0;
  transform: translateY(10px);
}

.sambutan.is-armed .sambutan-word > span {
  transform: translateY(108%);
  transition: transform 350ms ease-in;
}

.sambutan.is-armed .sambutan-message p,
.sambutan.is-armed .sambutan-signoff {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 250ms ease, transform 250ms ease;
}

.sambutan.is-in .sambutan-portrait {
  opacity: 1;
  transform: none;
  transition:
    opacity 800ms ease calc(var(--t, 0) * 140ms),
    transform 1100ms var(--s-ease) calc(var(--t, 0) * 140ms);
}

.sambutan.is-in .sambutan-portrait-frame > img {
  transform: none;
  transition:
    transform 1600ms var(--s-ease),
    filter 500ms ease;
}

.sambutan.is-in .sambutan-meta {
  opacity: 1;
  transform: none;
  transition: opacity 700ms ease 400ms, transform 900ms var(--s-ease) 400ms;
}

.sambutan.is-in .sambutan-copy {
  opacity: 1;
  transform: none;
  transition: opacity 700ms ease 150ms, transform 1000ms var(--s-ease) 150ms;
}

.sambutan.is-in .sambutan-slide.is-active .sambutan-greeting {
  opacity: 1;
  transform: none;
  transition: opacity 600ms ease 350ms, transform 800ms var(--s-ease) 350ms;
}

.sambutan.is-in .sambutan-slide.is-active .sambutan-word > span {
  transform: none;
  transition: transform 900ms var(--s-ease) calc(420ms + var(--w, 0) * 50ms);
}

.sambutan.is-in .sambutan-slide.is-active .sambutan-message p,
.sambutan.is-in .sambutan-slide.is-active .sambutan-signoff {
  opacity: 1;
  transform: none;
  transition:
    opacity 700ms ease calc(700ms + var(--p, 0) * 80ms),
    transform 900ms var(--s-ease) calc(700ms + var(--p, 0) * 80ms);
}

/* ==========================================================================
   Responsif
   ========================================================================== */
/* Tablet dan HP: satu kolom, foto di atas, kartu teks di bawah. */
@media (max-width: 960px) {
  .sambutan-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .sambutan-visual {
    position: relative;
    top: auto;
    max-width: 600px;
    justify-self: center;
  }

  .sambutan-portraits {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 18px;
  }

  .sambutan-portrait {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 14px;
  }

  .sambutan-portraits.is-single {
    width: min(100%, 220px);
  }
}

@media (max-width: 560px) {
  .sambutan-grid {
    gap: 20px;
  }

  .sambutan-visual {
    gap: 20px;
    padding: 18px;
  }

  .sambutan-portraits {
    gap: 10px;
  }

  .sambutan-portraits.is-single {
    width: min(100%, 220px);
  }

  .sambutan-meta {
    padding: 16px 0 12px;
  }

  .sambutan-portrait-caption strong {
    font-size: 14px;
  }

  .sambutan-person strong {
    font-size: 15px;
  }

  .sambutan-person > span:last-child {
    font-size: 12.5px;
  }

  .sambutan-copy {
    padding: 20px 18px;
  }

  .sambutan-quote {
    top: 14px;
    right: 14px;
    width: 38px;
  }

  .sambutan-greeting {
    max-width: calc(100% - 44px);
    padding: 6px 11px;
    border-radius: 11px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .sambutan .sambutan-title {
    margin-top: 14px;
    font-size: 22px !important;
    line-height: 1.25 !important;
  }

  .sambutan-message {
    margin-top: 12px;
  }

  .sambutan-message p {
    font-size: 14.5px;
    line-height: 1.7;
  }

  .sambutan-signoff {
    margin-top: 18px;
    padding-top: 14px;
  }

  .sambutan-signoff strong {
    font-size: 14.5px;
  }
}

/* ==========================================================================
   Progressive Disclosure Sambutan & Optimasi Proporsi Mobile (<= 767px)
   ========================================================================== */
.sambutan-readmore-btn {
  display: none;
}

@media (max-width: 767px) {
  .sambutan {
    padding: 36px 0;
  }

  .sambutan-header {
    margin-bottom: 18px;
  }

  .sambutan-header h2 {
    font-size: clamp(22px, 5.8vw, 26px);
    line-height: 1.2;
  }

  .sambutan-subtitle {
    margin-top: 8px;
    font-size: 13.5px;
    line-height: 1.55;
  }

  .sambutan-grid {
    gap: 16px;
  }

  .sambutan-visual {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    gap: 12px;
    border-radius: 18px;
  }

  .sambutan-portraits {
    gap: 10px;
  }

  .sambutan-portrait {
    gap: 8px;
    padding: 4px;
    margin: -4px;
  }

  .sambutan-portrait-frame {
    aspect-ratio: 4 / 4.4;
    max-height: 156px;
    border-radius: 12px;
  }

  .sambutan-portraits.is-single {
    width: min(100%, 176px);
  }

  .sambutan-portraits.is-single .sambutan-portrait-frame {
    max-height: 196px;
  }

  .sambutan-portrait-caption {
    gap: 2px;
  }

  .sambutan-portrait-caption strong {
    font-size: 13px;
    line-height: 1.25;
  }

  .sambutan-portrait-caption span {
    font-size: 11px;
    line-height: 1.35;
  }

  .sambutan-meta {
    padding: 10px 0 8px;
    gap: 10px;
  }

  .sambutan-person strong {
    font-size: 14px;
  }

  .sambutan-person > span:last-child {
    font-size: 12px;
  }

  .sambutan-controls button {
    width: 44px;
    height: 44px;
  }

  .sambutan-copy {
    padding: 18px 16px;
    border-radius: 18px;
    min-height: 300px;
  }

  .sambutan .sambutan-title {
    margin-top: 12px;
    font-size: clamp(18px, 4.8vw, 20px) !important;
    line-height: 1.28 !important;
  }

  .sambutan-message {
    margin-top: 10px;
    gap: 8px;
  }

  .sambutan-message p {
    font-size: 14px;
    line-height: 1.62;
    margin: 0 0 6px 0;
  }

  .sambutan-message.is-collapsible:not(.is-expanded) {
    max-height: 94px;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(180deg, #000 68%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 68%, transparent 100%);
  }

  .sambutan-message.is-collapsible:not(.is-expanded) p {
    display: block;
  }

  .sambutan-message.is-collapsible.is-expanded {
    max-height: none;
    overflow: visible;
    mask-image: none;
    -webkit-mask-image: none;
  }

  .sambutan-readmore-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--s-line);
    background: var(--s-tint);
    color: var(--s-green-ink);
    font-family: var(--s-body);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
  }

  .sambutan-readmore-btn:hover,
  .sambutan-readmore-btn:focus-visible {
    background: var(--s-mint);
    border-color: var(--s-green);
    color: var(--s-ink);
    outline: none;
  }

  .sambutan-readmore-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 220ms ease;
  }

  .sambutan-readmore-btn[aria-expanded="true"] .sambutan-readmore-icon {
    transform: rotate(180deg);
  }

  .sambutan-signoff {
    margin-top: 14px;
    padding-top: 12px;
  }
}

@media (max-width: 340px) {
  .sambutan-meta {
    flex-wrap: wrap;
  }

  .sambutan-controls {
    width: 100%;
  }

  .sambutan-controls button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sambutan *,
  .sambutan *::before {
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
    animation: none !important;
  }

  .sambutan .sambutan-portrait-frame > img,
  .sambutan.is-armed .sambutan-word > span {
    transform: none !important;
  }
}
