/* ==========================================================================
   BM English School - "fun" layer: 3D results drum, tilt cards and the
   floating English letters background.
   Everything animates with transform/opacity only (GPU-cheap on phones).
   ========================================================================== */

/* ---------- 1. Results: a real rotating 3D drum ---------- */
.carousel-ticker-wrapper.drum {
  --w: 340px;
  perspective: 1700px !important;
  perspective-origin: 50% 50%;
  overflow: hidden;
  padding: 2rem 0 3rem;
}

.drum-pivot {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
}

.carousel-ticker-wrapper.drum .carousel-ticker-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform-style: preserve-3d !important;
  will-change: transform;
  /* continuous, slow turn; duration is set by fun.js (seconds per card x cards) */
  animation-name: drumTurn !important;
  animation-duration: var(--dur, 180s) !important;
  animation-timing-function: linear !important;
  animation-iteration-count: infinite !important;
  animation-play-state: running !important;
}

/* keeps turning under the mouse; only stops while off screen */
.carousel-ticker-wrapper.drum.drum-off .carousel-ticker-track { animation-play-state: paused !important; }

@keyframes drumTurn {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-360deg); }
}

.drum .baraban-card { -webkit-font-smoothing: antialiased; }

.drum .baraban-card {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--w) !important;
  min-width: 0 !important;
  max-width: none !important;
  margin-left: calc(var(--w) / -2);
  transform: rotateY(var(--a, 0deg)) translateZ(var(--r, 800px)) !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.drum .baraban-card:hover {
  transform: rotateY(var(--a, 0deg)) translateZ(calc(var(--r, 800px) + 30px)) !important;
  box-shadow: 0 30px 60px -25px rgba(255, 90, 0, 0.6);
  border-color: rgba(255, 90, 0, 0.5);
}

.carousel-ticker-wrapper.drum { position: relative; }

@media (max-width: 640px) {
  .carousel-ticker-wrapper.drum { --w: 280px; perspective: 1100px !important; }
  .drum .baraban-card .quote-3d { display: none; }
}



/* ---------- 2. 3D tilt cards (mouse devices only) ---------- */
.fx-tilt { transform-style: preserve-3d; }
.fx-tilt.fx-tilting { transition: transform 0.08s linear, box-shadow 0.3s ease !important; }
.fx-tilt.fx-tilt-out { transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease !important; }

.fx-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.6), rgba(255, 180, 107, 0.12) 35%, transparent 60%);
  z-index: 5;
}

.fx-tilt:hover .fx-glare { opacity: 1; }

/* ---------- 3. Floating English letters background ---------- */
.bg-words {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-word {
  position: absolute;
  top: 0;
  left: var(--x);
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--s);
  line-height: 1;
  color: #FF5A00;
  opacity: var(--o);
  white-space: nowrap;
  will-change: transform;
  animation: wordFloat var(--t) linear var(--delay) infinite;
}

.bg-word.outline {
  color: transparent;
  -webkit-text-stroke: 1.5px #FF5A00;
}

@keyframes wordFloat {
  from { transform: translate3d(0, 110vh, 0) rotate(var(--r0)); }
  50% { transform: translate3d(var(--sway), 45vh, 0) rotate(0deg); }
  to { transform: translate3d(0, -20vh, 0) rotate(var(--r1)); }
}

/* Let the letters show through section backgrounds (cards stay solid white) */
.hero-section {
  background:
    radial-gradient(60% 70% at 85% 30%, rgba(255, 138, 0, 0.12) 0%, rgba(255, 138, 0, 0) 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 247, 240, 0.7) 100%) !important;
}

section[style*="surface-soft"] { background: rgba(248, 250, 252, 0.6) !important; }
#location { background: rgba(255, 255, 255, 0.4) !important; }

@media (prefers-reduced-motion: reduce) {
  .bg-word { animation: none; transform: translate3d(0, var(--still), 0); }
}

@media (max-width: 640px) {
  .drum .score-badge-3d { font-size: 1.05rem; padding: 0.4rem 0.7rem; }
  .drum .student-avatar-3d { width: 44px; height: 44px; min-width: 44px; min-height: 44px; font-size: 0.95rem; }
  .drum .card-header-3d { padding: 1rem; }
  .drum .student-name-3d { font-size: 0.95rem; }
}

/* ---------- Mobile menu: compact list that always fits ---------- */
.mobile-drawer-content {
  padding: 1.25rem 1.25rem 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.drawer-header { margin-bottom: 1rem; }
.drawer-header .brand-logo-img { width: 40px; height: 40px; }
.drawer-header .logo-text { font-size: 1.05rem; }
.drawer-close-btn { width: 36px; height: 36px; }

.drawer-links { gap: 0; }

.drawer-link {
  font-size: 0.98rem;
  font-weight: 700;
  padding: 0.8rem 0.25rem;
}

.drawer-link .material-symbols-outlined {
  font-size: 1.15rem;
  color: #94A3B8;
}

.drawer-link:active { color: var(--fx-orange); }

.mobile-drawer-content .social-icon-btn {
  width: auto;
  height: auto;
  padding: 0.55rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.mobile-drawer-content > div:last-child { padding-top: 1.25rem !important; }
.mobile-drawer-content .btn-accent { padding: 0.9rem 1.25rem; font-size: 0.95rem; }

/* The AI button must not cover the menu while it is open */
body:has(.mobile-drawer.open) .ai-widget-button { opacity: 0; pointer-events: none; }

/* ---------- Result cards: one fixed size, no quote, no button ---------- */
.carousel-ticker-wrapper.drum { --w: 290px; }

.baraban-card.result-card {
  height: 330px;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1.1rem;
  background: #FFFFFF;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 24px;
  overflow: hidden;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 36px -18px rgba(15, 23, 42, 0.25);
  /* only cheap properties animate (the old 'transition: all' re-animated width/margins on every layout) */
  transition: box-shadow 0.3s ease, border-color 0.3s ease !important;
}

.result-card::before { display: none; }

.rc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rc-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 90, 0, 0.1);
  color: #FF5A00;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.95rem;
}

.rc-exam {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: #0F172A;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.rc-score {
  margin-top: 0.9rem;
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  font-family: var(--font-heading);
  line-height: 1;
}

.rc-score b {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #FF5A00;
}

.rc-score small {
  font-size: 1rem;
  font-weight: 700;
  color: #94A3B8;
}

.rc-name {
  margin-top: 0.7rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.rc-course {
  font-size: 0.8rem;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Breakdown pinned to the bottom with a fixed height: 2 or 4 cells, same card size */
.rc-breakdown {
  margin-top: auto;
  height: 96px;
  display: grid;
  gap: 0.45rem;
}

.rc-breakdown.rc-cols-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.rc-breakdown.rc-cols-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.rc-breakdown > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0 0.7rem;
  border-radius: 12px;
  background: #FFF7F0;
  border: 1px solid rgba(255, 90, 0, 0.1);
}

.rc-cols-2 > div { flex-direction: column; justify-content: center; align-items: flex-start; }

.rc-breakdown small {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748B;
}

.rc-breakdown b {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.95rem;
  color: #0F172A;
}

.rc-cols-2 b { font-size: 1.35rem; }

@media (max-width: 640px) {
  .carousel-ticker-wrapper.drum { --w: 260px; }
  .baraban-card.result-card { height: 310px; }
  .rc-score b { font-size: 2.8rem; }
}
