/* =========================================================
   SVIT Campus Tour — Interactive Flipbook
   Self-contained styles, namespaced under .ct- to avoid
   collisions with the existing T4/Bootstrap site theme.
   ========================================================= */

.ct-flipbook {
  --ct-navy: #0c2f63;
  --ct-navy-deep: #071c40;
  --ct-orange: #f47920;
  --ct-orange-light: #ffb15c;
  --ct-paper: #f8f7f3;
  --ct-paper-edge: #e3ddcd;
  --ct-ink: #1a2233;
  --ct-mist: #eef1f6;

  position: relative;
  max-width: 980px;
  margin: 0 auto;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  color: var(--ct-ink);
  user-select: none;
  -webkit-user-select: none;
}

.ct-flipbook * {
  box-sizing: border-box;
}

/* ---------- Toolbar ---------- */
.ct-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(
    135deg,
    var(--ct-navy) 0%,
    var(--ct-navy-deep) 100%
  );
  border-radius: 14px 14px 0 0;
  padding: 12px 18px;
  flex-wrap: wrap;
}

.ct-toolbar-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
  color: #fff;
  text-transform: uppercase;
  white-space: nowrap;
}

.ct-toolbar-title span {
  color: var(--ct-orange-light);
}

.ct-toolbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ct-pagecount {
  color: #dbe3f2;
  font-size: 13px;
  font-weight: 600;
  min-width: 58px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ct-toolbar-right {
  display: flex;
  gap: 8px;
}

.ct-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.1s ease,
    border-color 0.15s ease;
}

.ct-btn:hover {
  background: var(--ct-orange);
  border-color: var(--ct-orange);
}

.ct-btn:active {
  transform: scale(0.92);
}

.ct-btn:focus-visible {
  outline: 2px solid var(--ct-orange-light);
  outline-offset: 2px;
}

.ct-btn[disabled] {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ---------- Stage ---------- */
.ct-stage {
  position: relative;
  background: var(--ct-mist);
  padding: 28px clamp(10px, 4vw, 48px) 34px;
  border-radius: 0 0 14px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.ct-book-shadow {
  position: relative;
  filter: drop-shadow(0 18px 30px rgba(7, 28, 64, 0.28));
}

.ct-perspective {
  perspective: 2400px;
  width: 100%;
}

.ct-book {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--ct-navy-deep);
  touch-action: pan-y;
  cursor: grab;
}

.ct-book.is-dragging {
  cursor: grabbing;
}

.ct-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0));
  z-index: 5000;
  border-radius: 6px 0 0 6px;
  pointer-events: none;
}

.ct-page {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  transform-style: preserve-3d;
  transform-origin: 0% 50%;
  transform: rotateY(0deg);
  will-change: transform;
  overflow: hidden;
}

.ct-page.ct-anim {
  transition: transform 0.68s cubic-bezier(0.45, 0.05, 0.18, 1);
}

.ct-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 6px;
  overflow: hidden;
}

.ct-face-front img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.ct-face-back {
  transform: rotateY(180deg);
  background: var(--ct-paper);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(12, 47, 99, 0.035) 0 2px,
    transparent 2px 14px
  );
  border: 1px solid var(--ct-paper-edge);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ct-face-back::after {
  content: "SVIT";
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.35em;
  color: rgba(12, 47, 99, 0.18);
}

/* shading overlay during a flip, simulates the fold/curl */
.ct-fold-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.68s ease;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

/* page numbers, subtle, bottom corner */
.ct-pagenum {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(7, 28, 64, 0.55);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  pointer-events: none;
}

/* click zones */
.ct-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 6000;
}

.ct-zone-prev {
  left: 0;
  width: 16%;
  cursor: w-resize;
}

.ct-zone-next {
  right: 0;
  width: 84%;
  cursor: e-resize;
}

/* corner-peel drag affordance */
.ct-corner {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 46px;
  height: 46px;
  z-index: 6500;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    transparent 50%,
    rgba(244, 121, 32, 0.9) 50%
  );
  border-radius: 0 0 6px 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  animation: ct-corner-breathe 2.6s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes ct-corner-breathe {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(-5px, -5px) scale(1.12);
  }
}

.ct-book.has-interacted .ct-corner {
  animation: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ct-hint {
  text-align: center;
  font-size: 12.5px;
  color: #5a6478;
  margin-top: 14px;
  letter-spacing: 0.01em;
}

.ct-hint b {
  color: var(--ct-navy);
}

/* ---------- Thumbnail rail ---------- */
.ct-thumbrail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 16px clamp(10px, 4vw, 48px) 6px;
  background: var(--ct-mist);
  border-radius: 0 0 14px 14px;
  scrollbar-width: thin;
}

.ct-thumbrail[hidden] {
  display: none;
}

.ct-thumb {
  flex: 0 0 auto;
  width: 96px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.65;
  transition:
    opacity 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
  position: relative;
}

.ct-thumb img {
  width: 100%;
  display: block;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.ct-thumb:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.ct-thumb.is-active {
  opacity: 1;
  border-color: var(--ct-orange);
}

.ct-thumb-num {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: rgba(7, 28, 64, 0.65);
  border-radius: 8px;
  padding: 1px 5px;
}

/* ---------- Progress bar ---------- */
.ct-progress {
  height: 3px;
  background: rgba(7, 28, 64, 0.08);
}

.ct-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ct-orange), var(--ct-orange-light));
  width: 4.3%;
  transition: width 0.5s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .ct-toolbar {
    padding: 10px 12px;
  }

  .ct-toolbar-title {
    font-size: 12.5px;
  }

  .ct-thumb {
    width: 74px;
  }

  .ct-stage {
    padding: 18px 14px 24px;
  }

  .ct-corner {
    width: 32px;
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ct-page.ct-anim {
    transition: none;
  }

  .ct-corner {
    animation: none;
  }
}
