/* ============================================
   PERFORMANCE-OPTIMIZED CELEBRATION PAGE
   ============================================ */

/* CSS Custom Properties for better performance */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-gradient: linear-gradient(
    45deg,
    #ff6b6b,
    #4ecdc4,
    #45b7d1,
    #96ceb4,
    #feca57
  );
  --gold-gradient: linear-gradient(45deg, #d4af37, #ffd700, #ffed4e, #d4af37);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --border-radius: 20px;
  --animation-timing: cubic-bezier(0.4, 0, 0.2, 1);
  --fast-animation: 0.3s;
  --medium-animation: 0.6s;
  --slow-animation: 1s;
}

/* Performance optimizations for reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .particles::before,
  .photo-shine,
  .name::after {
    animation: none !important;
  }
}

/* Performance optimizations for low battery */
.low-battery * {
  animation: none !important;
  transition: none !important;
}

.low-battery .particles::before {
  display: none;
}

/* Reset and base styles with performance focus */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: var(--primary-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  width: 100%;
  max-width: 100vw;
  font-display: swap;
}

/* Hardware acceleration for better performance */
.particles,
.fireworks-container,
.confetti-container {
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Optimized animated background particles */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.particles::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 90px 40px, #fff, transparent),
    radial-gradient(
      1px 1px at 130px 80px,
      rgba(255, 255, 255, 0.6),
      transparent
    ),
    radial-gradient(2px 2px at 160px 30px, #fff, transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: sparkle 3s linear infinite;
  will-change: transform;
}

@keyframes sparkle {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-100px);
  }
}

/* Container with optimized layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
  contain: layout style;
}

/* Hero section */
.hero-section {
  text-align: center;
  padding: 60px 0 10px;
  position: relative;
  contain: layout style;
}

.graduation-cap {
  width: 120px;
  height: 120px;
  margin: 0 auto 40px;
  position: relative;
  animation: bounce 2s ease-in-out infinite;
}

.cap-top {
  width: 100px;
  height: 100px;
  background: #2c3e50;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.cap-top::before {
  content: "";
  width: 120px;
  height: 8px;
  background: #34495e;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 4px;
}

.cap-bottom {
  width: 80px;
  height: 20px;
  background: #34495e;
  border-radius: 10px;
  margin: -10px auto 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.tassel {
  width: 4px;
  height: 30px;
  background: #f39c12;
  position: absolute;
  right: 10px;
  top: 40px;
  border-radius: 2px;
  animation: swing 2s ease-in-out infinite;
}

.tassel::after {
  content: "";
  width: 12px;
  height: 12px;
  background: #f39c12;
  border-radius: 50%;
  position: absolute;
  bottom: -6px;
  left: -4px;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

@keyframes swing {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(15deg);
  }
  75% {
    transform: rotate(-15deg);
  }
}

/* Main title with optimized animations */
.main-title {
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 800;
  margin-bottom: 20px;
  line-height: 1.2;
  contain: layout style;
}

.word {
  display: block;
  background: var(--accent-gradient);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rainbow 3s ease-in-out infinite,
    slideInLeft var(--slow-animation) var(--animation-timing);
  will-change: background-position, transform;
}

.name {
  display: block;
  color: #fff;
  text-shadow: var(--text-shadow);
  animation: slideInRight var(--slow-animation) var(--animation-timing) 0.5s
    both;
  position: relative;
  will-change: transform;
}

.name::after {
  content: "✨";
  position: absolute;
  right: -60px;
  top: -10px;
  font-size: 2rem;
  animation: sparkleRotate 2s linear infinite;
  will-change: transform;
}

/* Optimized keyframes */
@keyframes rainbow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes sparkleRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Photo section */
.photo-section {
  margin: 0 auto 40px;
  display: flex;
  justify-content: center;
  animation: bounce 2s ease-in-out infinite;
  will-change: transform;
}

.photo-frame {
  position: relative;
  text-align: center;
}

.photo-border {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  padding: 8px;
  background: linear-gradient(45deg, #d4af37, #ffd700, #ffed4e, #d4af37);
  background-size: 300% 300%;
  animation: goldenShimmer 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.5), 0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
  will-change: background-position;
}

.barbara-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
}

.photo-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 70%
  );
  animation: shine 2s ease-in-out infinite 2s;
  z-index: 3;
  pointer-events: none;
}

@keyframes photoFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(30px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes goldenShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes photoFloat {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-8px) rotate(1deg);
  }
  50% {
    transform: translateY(0px) rotate(0deg);
  }
  75% {
    transform: translateY(-4px) rotate(-1deg);
  }
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

/* Achievement section */
.achievement-section {
  display: flex;
  align-items: center;
  gap: 60px;
  margin: 20px 0;
  padding: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  animation: fadeInUp 1s ease-out 2s both;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.diploma-container {
  flex: 0 0 auto;
  perspective: 1000px;
}

.diploma {
  width: 250px;
  height: 320px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 15px;
  position: relative;
  transform-style: preserve-3d;
  animation: float 3s ease-in-out infinite;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border: 8px solid #d4af37;
  will-change: transform;
}

.diploma-ribbon {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 60px;
  height: 100px;
  background: linear-gradient(45deg, #ff6b6b, #ee5a52);
  border-radius: 0 0 10px 10px;
  z-index: 2;
}

.diploma-ribbon::before {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 0;
  height: 0;
  border: 15px solid transparent;
  border-top-color: #c44569;
  border-right-color: #c44569;
}

.diploma-content {
  padding: 30px 20px;
  text-align: center;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
}

.seal {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #d4af37, #b8941f);
  border-radius: 50%;
  margin: 0 auto 20px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.seal::before {
  content: "🏆";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  line-height: 1;
}

.diploma-text h3 {
  font-size: 2rem;
  color: #2c3e50;
  margin-bottom: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.diploma-text p {
  font-size: 1.2rem;
  color: #34495e;
  margin-bottom: 5px;
  font-style: italic;
  line-height: 1.3;
}

.signature-line {
  width: 150px;
  height: 2px;
  background: #2c3e50;
  margin: 0 auto;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotateY(0deg);
  }
  25% {
    transform: translateY(-10px) rotateY(5deg);
  }
  50% {
    transform: translateY(0px) rotateY(0deg);
  }
  75% {
    transform: translateY(-5px) rotateY(-5deg);
  }
}

.achievement-text {
  flex: 1;
  color: #fff;
  min-width: 0;
  text-align: center;
}

.section-title {
  font-size: 3rem;
  margin-bottom: 15px;
  font-weight: 700;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.achievement-description {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 25px;
  opacity: 0.9;
}

/* Stats container */
.stats-container {
  display: flex;
  gap: 30px;
  margin-top: 40px;
}

.stat-item {
  text-align: center;
  background: rgba(255, 255, 255, 0.15);
  padding: 25px;
  border-radius: 15px;
  backdrop-filter: blur(5px);
  flex: 1;
  animation: slideInUp 0.8s ease-out;
}

.stat-number {
  font-size: 3rem;
  font-weight: 800;
  color: #feca57;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  animation: countUp 2s ease-out 3s both;
}

.stat-label {
  font-size: 1rem;
  margin-top: 10px;
  opacity: 0.9;
}

@keyframes fadeInUp {
  0% {
    transform: translateY(50px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInUp {
  0% {
    transform: translateY(30px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Celebration section */
.celebration-section {
  text-align: center;
  padding: 40px 0;
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 40px;
}

.celebration-title {
  font-size: 3rem;
  color: #fff;
  margin-bottom: 50px;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Celebration message */
.celebration-message {
  margin-top: 50px;
}

.celebration-message p {
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 30px;
  line-height: 1.8;
  opacity: 0.9;
}

.celebration-btn {
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  color: #fff;
  border: none;
  padding: 20px 40px;
  font-size: 1.3rem;
  font-weight: 600;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: buttonGlow 2s ease-in-out infinite;
}

.celebration-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

@keyframes buttonGlow {
  0%,
  100% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2),
      0 0 20px rgba(255, 107, 107, 0.3);
  }
  50% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 30px rgba(78, 205, 196, 0.5);
  }
}

/* Footer */
.footer {
  text-align: center;
  padding: 60px 0 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 40px;
}

.hearts-container {
  margin-bottom: 20px;
}

.heart {
  font-size: 2rem;
  margin: 0 10px;
  animation: heartbeat 1.5s ease-in-out infinite;
}

.heart:nth-child(2) {
  animation-delay: 0.3s;
}
.heart:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.footer-text {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 10px;
  opacity: 0.9;
}

.footer-signature {
  font-size: 1.3rem;
  color: #feca57;
  margin-bottom: 15px;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  text-align: right;
  margin-right: 30%;
}

.footer-date {
  font-size: 1rem;
  color: #fff;
  opacity: 0.7;
}

/* Fireworks */
.fireworks-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

.firework {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ff6b6b;
}

/* Responsive design - Tablet and Mobile */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    width: 100%;
  }

  .container {
    padding: 10px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .main-title {
    font-size: 2.5rem;
    line-height: 1.1;
  }

  .achievement-section {
    flex-direction: column !important;
    gap: 40px !important;
    padding: 20px 10px !important;
  }

  .diploma-container {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
  }

  .name::after {
    right: -30px;
    font-size: 1.5rem;
  }

  /* Fix for mobile */

  .achievement-section {
    flex-direction: column;
    gap: 40px;
    padding: 20px 10px;
    margin: 20px 0;
  }

  .diploma-container {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
  }

  .diploma {
    width: 300px;
    height: 380px;
    margin: 0 auto;
    border: 6px solid #d4af37;
    font-size: 14px;
  }

  .diploma-content {
    padding: 30px 20px;
  }

  .seal {
    width: 70px;
    height: 70px;
    margin-bottom: 20px;
  }

  .seal::before {
    font-size: 1.8rem;
  }

  .diploma-text h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
  }

  .diploma-text p {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }

  .balloons-container {
    gap: 15px;
  }

  .balloon {
    width: 60px;
    height: 80px;
  }

  .stats-container {
    flex-direction: column;
    gap: 20px;
    width: 100%;
  }

  .stat-item {
    padding: 20px 10px;
  }

  .celebration-title {
    font-size: 2rem;
    line-height: 1.2;
  }

  .celebration-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    margin: 0 10px;
  }

  .photo-border {
    width: 140px;
    height: 140px;
  }

  .footer-signature {
    margin-right: -82%;
    text-align: center;
  }

  .footer {
    padding: 40px 10px 20px;
  }

  /* Performance optimizations for mobile */
  .particles::before {
    animation: none;
  }

  .photo-section {
    animation: none;
  }

  .diploma {
    animation: none;
    transform: none;
  }

  .celebration-title {
    animation: none;
  }

  .celebration-btn {
    animation: none;
  }

  .heart {
    animation: none;
  }

  .photo-shine {
    animation: none;
    display: none;
  }

  .name::after {
    animation: none;
  }

  /* Ensure no horizontal overflow */
  * {
    max-width: 100%;
    box-sizing: border-box;
  }

  .fireworks-container,
  .confetti-container {
    overflow: hidden;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .container {
    padding: 5px;
  }

  .main-title {
    font-size: 2rem;
  }

  .achievement-section {
    padding: 15px 5px;
  }

  .diploma-container {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  .diploma {
    width: 260px;
    height: 340px;
    border: 5px solid #d4af37;
    font-size: 13px;
  }

  .diploma-content {
    padding: 25px 15px;
  }

  .seal {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
  }

  .seal::before {
    font-size: 1.5rem;
  }

  .diploma-text h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
  }

  .diploma-text p {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .celebration-title {
    font-size: 1.5rem;
  }

  .celebration-btn {
    padding: 12px 25px;
    font-size: 1rem;
  }

  .photo-border {
    width: 120px;
    height: 120px;
  }

  .stat-number {
    font-size: 2.5rem;
  }

  .section-title {
    font-size: 1rem;
  }
}

/* Extra mobile diploma optimizations */
@media (max-width: 480px) {
  .diploma-container {
    padding: 20px 10px;
  }

  .diploma {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    transform: none; /* Disable 3D transforms on small screens */
  }

  .diploma-ribbon {
    width: 50px;
    height: 80px;
    top: -10px;
    right: -10px;
  }

  .diploma-ribbon::before {
    border-width: 12px;
    bottom: -8px;
  }
}

@media (max-width: 320px) {
  .diploma-container {
    padding: 15px 5px;
  }

  .diploma {
    width: 240px;
    height: 310px;
    border: 4px solid #d4af37;
  }

  .diploma-content {
    padding: 20px 12px;
  }

  .seal {
    width: 50px;
    height: 50px;
    margin-bottom: 12px;
  }

  .seal::before {
    font-size: 1.3rem;
  }

  .diploma-text h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
  }

  .diploma-text p {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }

  .diploma-ribbon {
    width: 40px;
    height: 70px;
  }
}

/* Desktop and tablet optimizations (768px and above) */
@media (min-width: 768px) {
  .achievement-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 60px;
    padding: 40px;
  }

  .diploma-container {
    flex: 0 0 auto;
    perspective: 1000px;
    width: auto;
    display: block;
  }

  .diploma {
    width: 250px;
    height: 320px;
    border: 8px solid #d4af37;
  }

  .diploma-content {
    padding: 30px 20px;
  }

  .seal {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
  }

  .seal::before {
    font-size: 2rem;
  }

  .diploma-text h3 {
    font-size: 2rem;
    margin-bottom: 15px;
  }

  .diploma-text p {
    font-size: 1.2rem;
    margin-bottom: 5px;
  }
}

/* Large desktop optimizations */
@media (min-width: 1200px) {
  .achievement-section {
    gap: 80px;
    padding: 50px;
  }

  .diploma {
    width: 280px;
    height: 350px;
  }
}
