/*--------------------------------------------------------------
# St. Luigi School — CMS-driven widgets
# Ticker · News & Notice feeds · Birthday board · Chatbot · Gallery
--------------------------------------------------------------*/

/* ================= Scrolling ticker ================= */
.topscroll-content .stl-tick { padding: 0 4px; }
.topscroll-content .stl-tick-sep { padding: 0 18px; opacity: .6; }
.topscroll-content a { color: #fff !important; text-decoration: none; }
.topscroll-content a:hover { text-decoration: underline; }
.topscroll-content .stl-tick-file {
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  font-size: 13px;
}
.topscroll-content .stl-tick-file i { margin-right: 4px; }

/* ================= News / Notice feeds ================= */
.info-box .scroll-content { animation-duration: 22s; }
.info-box .scroll-content:hover { animation-play-state: paused; }

.stl-feed-item {
  padding: 8px 4px 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, .22);
}
.stl-feed-item:last-child { border-bottom: 0; }
.stl-feed-title {
  margin: 0 0 2px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}
.stl-pin { color: var(--stl-gold-bright, #deb761); }
.stl-feed-date {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--stl-gold-bright, #deb761);
}
.stl-feed-item p { margin: 0 0 4px; }
.stl-feed-link {
  color: var(--stl-gold-bright, #deb761) !important;
  font-weight: 600;
  text-decoration: none;
}
.stl-feed-link:hover { text-decoration: underline; }

/* ================= Birthday board ================= */
.stl-bd-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .25s ease;
}
.stl-bd-row:hover, .stl-bd-row:focus-visible {
  background: rgba(255, 255, 255, .14);
  outline: none;
}
.stl-bd-thumb {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--stl-gold-bright, #deb761);
  background: #10305c;
}
.stl-bd-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #10305c;
  background: linear-gradient(135deg, #e6c67d, #c9a24b);
  font-size: 14px;
  letter-spacing: .02em;
}
.stl-bd-text { display: flex; flex-direction: column; line-height: 1.25; }
.stl-bd-text b { color: #fff; font-weight: 600; }
.stl-bd-text i { font-style: normal; font-size: 12px; opacity: .85; }

/* --- celebration overlay --- */
.stl-bd-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 28, 56, .72);
  backdrop-filter: blur(4px);
  animation: stl-bd-in .28s ease both;
}
.stl-bd-modal.stl-bd-closing { animation: stl-bd-out .24s ease both; }
@keyframes stl-bd-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes stl-bd-out { to { opacity: 0; } }

.stl-bd-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.stl-bd-card {
  position: relative;
  width: min(420px, 100%);
  padding: 34px 28px 30px;
  text-align: center;
  border-radius: 22px;
  background: #fff;
  border-top: 5px solid var(--stl-gold, #c9a24b);
  box-shadow: 0 26px 70px rgba(9, 28, 56, .4);
  animation: stl-bd-pop .5s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes stl-bd-pop {
  from { opacity: 0; transform: translateY(28px) scale(.92); }
  to   { opacity: 1; transform: none; }
}
.stl-bd-close {
  position: absolute;
  top: 10px; right: 14px;
  border: 0;
  background: none;
  font-size: 28px;
  line-height: 1;
  color: #93a3b8;
  cursor: pointer;
}
.stl-bd-close:hover { color: #16365f; }

.stl-bd-balloons {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 24px;
  margin-bottom: 6px;
}
.stl-bd-balloons span { animation: stl-float 2.6s ease-in-out infinite; }
.stl-bd-balloons span:nth-child(2) { animation-delay: .25s; }
.stl-bd-balloons span:nth-child(3) { animation-delay: .5s; }
.stl-bd-balloons span:nth-child(4) { animation-delay: .75s; }
.stl-bd-balloons span:nth-child(5) { animation-delay: 1s; }
@keyframes stl-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-9px) rotate(3deg); }
}

.stl-bd-photo-ring {
  width: 132px;
  height: 132px;
  margin: 6px auto 16px;
  border-radius: 50%;
  padding: 5px;
  background: conic-gradient(from 0deg, #c9a24b, #deb761, #1565c0, #c9a24b);
  animation: stl-spin 7s linear infinite;
}
@keyframes stl-spin { to { transform: rotate(360deg); } }
.stl-bd-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #eef4fc;
  border: 4px solid #fff;
  animation: stl-spin 7s linear infinite reverse;
  font-size: 40px;
}
span.stl-bd-photo { display: flex; }

.stl-bd-greeting {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--stl-blue-deep, #114a8f);
}
.stl-bd-name {
  margin: 6px 0 2px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--stl-gold-dark, #a9853b);
}
.stl-bd-class { margin: 0 0 12px; color: #5a6b82; font-size: .95rem; }
.stl-bd-wish  { margin: 0; color: #48566a; font-size: .95rem; line-height: 1.55; }

@media (prefers-reduced-motion: reduce) {
  .stl-bd-balloons span,
  .stl-bd-photo-ring,
  .stl-bd-photo { animation: none !important; }
  .stl-bd-card  { animation: none !important; }
}

/* ================= Chatbot ================= */
.stl-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10000;
  font-family: var(--default-font, system-ui, sans-serif);
}

/* Lift the back-to-top button so it sits above the chat bubble */
.scroll-top {
  right: 28px !important;
  bottom: 92px !important;
}
.stl-chat-launcher {
  position: relative;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #1a6fd0, #114a8f);
  box-shadow: 0 10px 26px rgba(17, 74, 143, .42);
  display: grid;
  place-items: center;
  transition: transform .28s cubic-bezier(.2, .8, .3, 1), box-shadow .28s ease;
}
.stl-chat-launcher:hover { transform: translateY(-3px) scale(1.04); }
.stl-chat-launcher::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(201, 162, 75, .55);
  opacity: 0;
  animation: stl-ping 2.8s ease-out infinite;
}
@keyframes stl-ping {
  0%   { opacity: .8; transform: scale(.85); }
  70%  { opacity: 0;  transform: scale(1.25); }
  100% { opacity: 0;  transform: scale(1.25); }
}
.stl-chat-launcher .stl-chat-ico-x { display: none; }
.stl-chat-launcher-active .stl-chat-ico-chat { display: none; }
.stl-chat-launcher-active .stl-chat-ico-x { display: block; }
.stl-chat-launcher-active::after { display: none; }

.stl-chat-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(370px, calc(100vw - 44px));
  max-height: min(560px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #dde8f5;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(16, 58, 110, .26);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .26s ease, transform .26s cubic-bezier(.2, .8, .3, 1), visibility .26s;
}
.stl-chat-open .stl-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.stl-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  color: #fff;
  background: linear-gradient(135deg, #1a6fd0, #114a8f);
}
.stl-chat-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stl-chat-avatar {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
}
.stl-chat-head strong { display: block; font-size: 15px; line-height: 1.2; }
.stl-chat-head small {
  display: block;
  font-size: 11.5px;
  opacity: .85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 210px;
}
.stl-chat-x {
  border: 0;
  background: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  opacity: .85;
}
.stl-chat-x:hover { opacity: 1; }

.stl-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f5f9fe;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 220px;
}
.stl-chat-msg { display: flex; }
.stl-chat-bot  { justify-content: flex-start; }
.stl-chat-user { justify-content: flex-end; }
.stl-chat-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-line;
}
.stl-chat-bot .stl-chat-bubble {
  background: #fff;
  color: #2a3648;
  border: 1px solid #e2ecf8;
  border-bottom-left-radius: 5px;
}
.stl-chat-user .stl-chat-bubble {
  background: linear-gradient(135deg, #1a6fd0, #114a8f);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.stl-chat-link {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600;
  font-size: 13.5px;
  color: #1565c0 !important;
  text-decoration: none;
}
.stl-chat-link:hover { text-decoration: underline; }

.stl-chat-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.stl-chat-chip {
  padding: 7px 12px;
  font-size: 12.5px;
  color: #114a8f;
  background: #e8f1fc;
  border: 1px solid #cfe0f4;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease;
}
.stl-chat-chip:hover { background: #d8e8fa; transform: translateY(-1px); }

.stl-chat-dots i {
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 3px;
  border-radius: 50%;
  background: #9fb4cd;
  animation: stl-blink 1.2s infinite;
}
.stl-chat-dots i:nth-child(2) { animation-delay: .18s; }
.stl-chat-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes stl-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.stl-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #e6eef8;
}
.stl-chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  font-size: 14px;
  border: 1px solid #d7e3f2;
  border-radius: 999px;
  outline: none;
  color: #2a3648;
}
.stl-chat-input:focus {
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .13);
}
.stl-chat-send {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #d8b25e, #c9a24b);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .2s ease;
}
.stl-chat-send:hover { transform: scale(1.06); }
.stl-chat-note {
  margin: 0;
  padding: 6px 12px 9px;
  background: #fff;
  font-size: 11px;
  color: #8a9bb1;
  text-align: center;
}

@media (max-width: 480px) {
  .stl-chat { right: 14px; bottom: 14px; }
  .stl-chat-launcher { width: 52px; height: 52px; }
  .stl-chat-panel { width: calc(100vw - 28px); right: 0; bottom: 66px; }
  .scroll-top { right: 20px !important; bottom: 78px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .stl-chat-launcher::after { animation: none; }
  .stl-chat-panel, .stl-chat-launcher, .stl-chat-chip { transition: none; }
}

/* ================= Gallery page ================= */
.stl-gal { padding: 60px 0 80px; background: #fff; }

.stl-gal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e6eef8;
}
.stl-gal-years { display: flex; flex-wrap: wrap; gap: 8px; }
.stl-gal-year {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #114a8f;
  background: #eef4fc;
  border: 1px solid #d7e5f6;
  border-radius: 999px;
  cursor: pointer;
  transition: all .25s ease;
}
.stl-gal-year:hover { background: #dfebfa; transform: translateY(-1px); }
.stl-gal-year.is-on {
  color: #fff;
  background: linear-gradient(135deg, #1a6fd0, #114a8f);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(17, 74, 143, .28);
}

.stl-gal-search { position: relative; flex: 0 1 300px; }
.stl-gal-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #8fa6c2;
}
.stl-gal-search input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  font-size: 14px;
  color: #2a3648;
  border: 1px solid #d7e3f2;
  border-radius: 999px;
  outline: none;
}
.stl-gal-search input:focus {
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .13);
}

.stl-gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
}
.stl-gal-card {
  background: #fff;
  border: 1px solid #e3ebf5;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(16, 58, 110, .08);
  transition: transform .35s cubic-bezier(.22, .7, .3, 1), box-shadow .35s ease;
}
.stl-gal-card:hover, .stl-gal-card:focus-visible {
  transform: translateY(-7px);
  box-shadow: 0 20px 46px rgba(16, 58, 110, .18);
  outline: none;
}
.stl-gal-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #eef4fc;
}
.stl-gal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.22, .7, .3, 1);
}
.stl-gal-card:hover .stl-gal-thumb img { transform: scale(1.07); }
.stl-gal-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(10, 30, 60, .72);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.stl-gal-meta { padding: 18px 20px 20px; }
.stl-gal-badge {
  display: inline-block;
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff;
  background: linear-gradient(135deg, #dcb765, #c9a24b);
  border-radius: 999px;
}
.stl-gal-meta h3 {
  margin: 10px 0 4px;
  font-family: "Playfair Display", serif;
  font-size: 1.22rem;
  font-weight: 700;
  color: #114a8f !important;
}
.stl-gal-date { margin: 0 0 6px; font-size: 12.5px; color: #8496ad; }
.stl-gal-meta p { margin: 0; font-size: 14px; color: #55647a; line-height: 1.55; }
.stl-gal-open {
  display: inline-block;
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1565c0;
}

.stl-gal-empty { text-align: center; padding: 48px 0; color: #6d7d94; font-size: 1.05rem; }

/* --- single album --- */
.stl-gal-head { margin-bottom: 28px; }
.stl-gal-back {
  padding: 8px 16px;
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: #114a8f;
  background: #eef4fc;
  border: 1px solid #d7e5f6;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .25s ease;
}
.stl-gal-back:hover { background: #dfebfa; }
.stl-gal-head h2 {
  margin: 0 0 8px;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 800;
  color: #114a8f !important;
}
.stl-gal-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 13.5px;
  color: #6d7d94;
}
.stl-gal-desc { margin: 0; max-width: 70ch; color: #55647a; line-height: 1.6; }

.stl-gal-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.stl-gal-photo {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #eef4fc;
  box-shadow: 0 8px 22px rgba(16, 58, 110, .10);
  transition: transform .35s cubic-bezier(.22, .7, .3, 1), box-shadow .35s ease;
}
.stl-gal-photo:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 38px rgba(16, 58, 110, .2);
}
.stl-gal-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stl-gal-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 12px 10px;
  font-size: 12.5px;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(10, 30, 60, .82));
  opacity: 0;
  transition: opacity .3s ease;
}
.stl-gal-photo:hover .stl-gal-cap { opacity: 1; }

@media (max-width: 575px) {
  .stl-gal-grid { grid-template-columns: 1fr; }
  .stl-gal-photos { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stl-gal-search { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .stl-gal-card, .stl-gal-photo, .stl-gal-thumb img, .stl-gal-year { transition: none !important; }
  .stl-gal-card:hover, .stl-gal-photo:hover { transform: none !important; }
}

/* Content that already fits should not scroll — keeps it readable and clickable */
.info-box .scroll-content.stl-still {
  position: static;
  bottom: auto;
  animation: none !important;
}

/* Pause the drift as soon as the pointer is anywhere over the box. Hovering the
   moving text itself is not enough — it keeps sliding out from under the cursor,
   which made the clickable birthday names a moving target. Pausing on the box,
   which never moves, also lets a long notice be read at leisure. */
.info-box:hover .scroll-content,
.info-box .scroll-content.stl-paused,
.info-box .scroll-content:hover { animation-play-state: paused; }

/* Names arrive one after another rather than all at once */
.stl-bd-row {
  animation: stlBdIn .5s ease both;
  animation-delay: calc(var(--bd-i, 0) * .09s);
}
@keyframes stlBdIn {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: none; }
}
.stl-bd-none { opacity: .85; }

@media (prefers-reduced-motion: reduce) {
  .stl-bd-row { animation: none; }
}

/* Kept for anything still asking for a hand-scrolled box */
.info-box .scroll-content.stl-manual {
  position: static;
  bottom: auto;
  animation: none !important;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .45) transparent;
}
.info-box .scroll-content.stl-manual::-webkit-scrollbar { width: 5px; }
.info-box .scroll-content.stl-manual::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .4);
  border-radius: 4px;
}

/* ================= Popup (available on every page) ================= */
.popup-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(9, 28, 56, .66);
  backdrop-filter: blur(3px);
}
.popup-modal .popup-content {
  position: relative;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  text-align: center;
  background: #fff;
  border-radius: 16px;
  border-top: 4px solid var(--stl-gold, #c9a24b);
  box-shadow: 0 26px 60px rgba(9, 28, 56, .34);
  animation: stl-pop-in .32s cubic-bezier(.2, .9, .3, 1.1) both;
}
@keyframes stl-pop-in {
  from { opacity: 0; transform: translateY(20px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
.popup-modal .popup-title {
  margin: 0 0 8px;
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--stl-blue-deep, #114a8f) !important;
}
.popup-modal .popup-subtitle { margin: 0 0 16px; font-size: 15px; color: #5a6b82; }
.popup-modal .popup-image { width: 100%; height: auto; border-radius: 10px; display: block; }
.popup-modal .close-btn {
  position: absolute;
  top: 8px; right: 14px;
  font-size: 28px;
  line-height: 1;
  color: #93a3b8;
  cursor: pointer;
  user-select: none;
}
.popup-modal .close-btn:hover { color: var(--stl-blue-deep, #114a8f); }
.popup-modal .popup-footer { margin-top: 16px; }
.popup-modal .popup-btn {
  display: inline-block;
  padding: 11px 26px;
  font-size: 15px;
  font-weight: 600;
  color: #fff !important;
  text-decoration: none;
  background: linear-gradient(135deg, #dcb765, var(--stl-gold, #c9a24b));
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
  .popup-modal .popup-content { animation: none; }
}
