/* ============================================
   dila.web.id — Design System & Global Styles
   Nur Fadlilah's 20th Birthday
   ============================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,700;1,400;1,500&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Dancing+Script:wght@400;500;600;700&display=swap');

/* ============================================
   1. CSS VARIABLES / DESIGN TOKENS
   ============================================ */
:root {
  /* Core Brand */
  --color-rose:        #E8829A;
  --color-rose-deep:   #C2547A;
  --color-rose-light:  #F7D6E0;
  --color-rose-muted:  #F0B5C5;

  /* Accent */
  --color-gold:        #D4AF37;
  --color-gold-light:  #F5E6A3;
  --color-gold-glow:   #FFD700;
  --color-gold-deep:   #B8860B;

  /* Dark Base */
  --color-navy:        #0D1B2A;
  --color-navy-mid:    #1A2E42;
  --color-charcoal:    #2C3E50;
  --color-dark:        #0A0F1A;

  /* Neutral */
  --color-ivory:       #FAF7F2;
  --color-cream:       #F0E6D3;
  --color-gray-warm:   #8B7E74;
  --color-gray-light:  #D1CBC3;

  /* Semantic */
  --color-text-primary:   #1A1A2E;
  --color-text-secondary: #6B6B8A;
  --color-text-light:     #FAF7F2;
  --color-text-gold:      #D4AF37;
  --color-text-rose:      #E8829A;

  /* Section-specific backgrounds */
  --color-letter-bg:     #FDF8F0;
  --color-wiki-bg:       #F8F9FA;
  --color-arduino-bg:    #0D1117;
  --color-booth-bg:      #1A1A2E;
  --color-rsvp-bg:       #FDF5E4;
  --color-secret-bg:     #0A0F1A;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
  --font-script:  'Dancing Script', cursive;

  /* Spacing Scale */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   40px;
  --space-2xl:  64px;
  --space-3xl:  96px;
  --space-4xl:  128px;

  /* Border Radius */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   32px;
  --radius-full: 9999px;

  /* Layout */
  --max-width:     1200px;
  --content-width: 720px;
  --sidebar-width: 300px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.12);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.16);
  --shadow-xl:   0 16px 60px rgba(0,0,0,0.2);
  --shadow-glow-rose: 0 0 40px rgba(232,130,154,0.3);
  --shadow-glow-gold: 0 0 40px rgba(212,175,55,0.3);

  /* Easing */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.68, -0.55, 0.27, 1.55);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);

  /* Z-index scale */
  --z-base:     1;
  --z-card:     10;
  --z-overlay:  100;
  --z-modal:    200;
  --z-toast:    300;
  --z-cursor:   9999;
}

/* ============================================
   2. CSS RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-primary);
  background: var(--color-navy);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

::selection {
  background: var(--color-rose-light);
  color: var(--color-text-primary);
}

/* ============================================
   3. TYPOGRAPHY
   ============================================ */
.text-display {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.text-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 500;
  line-height: 1.2;
}

.text-h2 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.3;
}

.text-body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.125rem);
  font-weight: 400;
  line-height: 1.75;
}

.text-small {
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.5;
}

.text-mono {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
}

.text-script {
  font-family: var(--font-script);
  font-weight: 500;
}

.text-gold {
  color: var(--color-text-gold);
}

.text-rose {
  color: var(--color-text-rose);
}

.text-light {
  color: var(--color-text-light);
}

.text-center {
  text-align: center;
}

/* ============================================
   4. LAYOUT UTILITIES
   ============================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.grid-center {
  display: grid;
  place-items: center;
}

.full-viewport {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============================================
   5. AUDIO TOGGLE (Global — all pages)
   ============================================ */
.audio-toggle {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: var(--z-toast);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  opacity: 0;
  transition: all 0.3s ease;
  cursor: pointer;
}

.audio-toggle:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

.audio-toggle.visible {
  opacity: 1;
}

/* Light page variant */
.audio-toggle--light {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.1);
}
.audio-toggle--light:hover {
  background: rgba(0,0,0,0.1);
}

/* ============================================
   6. BUTTONS
   ============================================ */
.btn-primary {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--color-rose), var(--color-rose-deep));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s var(--ease-bounce);
  box-shadow: 0 4px 20px rgba(232,130,154,0.4);
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2));
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(232,130,154,0.5);
}

.btn-primary:hover::after {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 28px;
  background: transparent;
  color: var(--color-rose);
  border: 1.5px solid var(--color-rose);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: var(--color-rose-light);
  border-color: var(--color-rose-deep);
  transform: translateY(-2px);
}

.btn-gold {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-deep));
  color: var(--color-dark);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s var(--ease-bounce);
  box-shadow: 0 4px 20px rgba(212,175,55,0.4);
  position: relative;
  overflow: hidden;
}

.btn-gold:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(212,175,55,0.5);
}

.btn-ghost {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 20px;
  background: transparent;
  color: var(--color-text-light);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
}

/* ============================================
   7. BOOTH CARD (Portal)
   ============================================ */
.booth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg);
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.booth-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all 0.35s var(--ease-bounce);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.booth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(232,130,154,0.08), rgba(212,175,55,0.08));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.booth-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.booth-card:hover {
  transform: translateY(-10px) scale(1.03);
  border-color: rgba(212,175,55,0.6);
  box-shadow: 0 20px 60px rgba(232,130,154,0.2), 0 0 30px rgba(212,175,55,0.1);
}

.booth-card:hover::before {
  opacity: 1;
}

.booth-card:hover::after {
  opacity: 1;
}

.booth-card__emoji {
  font-size: 2.5rem;
  display: block;
  filter: drop-shadow(0 0 8px rgba(212,175,55,0.4));
  transition: transform 0.3s var(--ease-bounce);
  position: relative;
  z-index: 1;
}

.booth-card:hover .booth-card__emoji {
  transform: scale(1.2) rotate(5deg);
}

.booth-card__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--color-text-light);
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* ============================================
   8. PAGE NAV BAR (all pages)
   ============================================ */
.page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  flex-wrap: wrap;
}

.page-nav__link {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.25s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.page-nav__link--light {
  background: rgba(0,0,0,0.04);
  color: var(--color-text-secondary);
  border: 1px solid rgba(0,0,0,0.08);
}

.page-nav__link--light:hover {
  background: var(--color-rose-light);
  color: var(--color-rose-deep);
  border-color: var(--color-rose);
}

.page-nav__link--light.page-nav__link--active {
  background: var(--color-rose);
  color: white;
  border-color: var(--color-rose);
}

.page-nav__link--dark {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.1);
}

.page-nav__link--dark:hover {
  background: rgba(255,255,255,0.12);
  color: white;
  border-color: rgba(255,255,255,0.3);
}

.page-nav__link--dark.page-nav__link--active {
  background: rgba(212,175,55,0.2);
  color: var(--color-gold);
  border-color: var(--color-gold);
}

.page-nav__separator {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.1);
  margin: 0 var(--space-xs);
}

.page-nav__separator--light {
  background: rgba(0,0,0,0.08);
}

/* ============================================
   9. WAX SEAL (Letter)
   ============================================ */
.wax-seal {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at 35% 35%, var(--color-rose), #8B1A4A);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow:
    0 4px 15px rgba(139,26,74,0.4),
    inset 0 2px 4px rgba(255,255,255,0.2);
  transition: transform 0.4s var(--ease-bounce);
}

.wax-seal::before {
  content: '\2726';
  font-size: 1.8rem;
  color: rgba(255,255,255,0.9);
}

.wax-seal:hover {
  transform: rotate(15deg) scale(1.1);
  box-shadow:
    0 6px 20px rgba(139,26,74,0.5),
    inset 0 2px 4px rgba(255,255,255,0.3);
}

.wax-seal.broken {
  animation: sealBreak 0.5s ease forwards;
}

@keyframes sealBreak {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.3) rotate(20deg); }
  100% { transform: scale(0) rotate(45deg); opacity: 0; }
}

/* ============================================
   9. POLAROID (Letter)
   ============================================ */
.polaroid {
  background: white;
  padding: 10px 10px 36px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border-radius: 2px;
  transform: rotate(var(--rotate, -3deg));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  max-width: 180px;
  cursor: pointer;
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.08);
  box-shadow: 0 10px 35px rgba(0,0,0,0.2);
  z-index: 10;
}

.polaroid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.polaroid__caption {
  font-family: var(--font-script);
  font-size: 0.8rem;
  color: var(--color-charcoal);
  text-align: center;
  margin-top: 8px;
  line-height: 1.3;
}

/* ============================================
   10. KEYFRAME ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes ledPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #00FF41; }
  50%      { opacity: 0.3; box-shadow: none; }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%      { transform: translateY(-15px) rotate(3deg); }
  66%      { transform: translateY(-8px) rotate(-2deg); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@keyframes trailFade {
  from { opacity: 0.8; transform: scale(1) translate(-50%, -50%); }
  to   { opacity: 0; transform: scale(0.3) translate(-50%, -50%); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes pageFlipOut {
  0%   { transform: perspective(1200px) rotateY(0deg); }
  100% { transform: perspective(1200px) rotateY(-90deg); opacity: 0; }
}

@keyframes pageFlipIn {
  0%   { transform: perspective(1200px) rotateY(90deg); opacity: 0; }
  100% { transform: perspective(1200px) rotateY(0deg); opacity: 1; }
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1) rotate(180deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(212,175,55,0.3); }
  50%      { box-shadow: 0 0 40px rgba(212,175,55,0.6); }
}

@keyframes typewriter-cursor {
  0%, 100% { border-color: var(--color-rose); }
  50%      { border-color: transparent; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(20px) scale(0.5); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes gentleBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ============================================
   11. CURSOR TRAIL (Desktop only)
   ============================================ */
.cursor-trail {
  position: fixed;
  width: 12px;
  height: 12px;
  pointer-events: none;
  z-index: var(--z-cursor);
  animation: trailFade 0.6s ease forwards;
  background: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 0 L7.2 4.2 L12 4.2 L8.4 6.8 L9.6 11 L6 8.4 L2.4 11 L3.6 6.8 L0 4.2 L4.8 4.2 Z' fill='%23D4AF37' opacity='0.8'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ============================================
   12. PAGE TRANSITION OVERLAY
   ============================================ */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--color-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page-transition.active {
  opacity: 1;
  pointer-events: all;
}

/* ============================================
   13. SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(212,175,55,0.3);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212,175,55,0.5);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,0.3) transparent;
}

/* ============================================
   14. UTILITY CLASSES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.no-scroll {
  overflow: hidden !important;
}

.gradient-text-rose {
  background: linear-gradient(135deg, var(--color-rose), var(--color-rose-deep));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-gold {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--color-gold) 0%,
    var(--color-gold-glow) 25%,
    var(--color-gold) 50%,
    var(--color-gold-glow) 75%,
    var(--color-gold) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* ============================================
   15. RESPONSIVE — Mobile First
   ============================================ */
@media (max-width: 640px) {
  .booth-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-md);
  }

  .booth-card {
    padding: var(--space-lg) var(--space-md);
  }

  .booth-card__emoji {
    font-size: 2rem;
  }

  .booth-card__title {
    font-size: 0.9rem;
  }

  .text-display {
    font-size: 2rem;
  }

  .container {
    padding: 0 var(--space-md);
  }
}

@media (max-width: 400px) {
  .booth-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .booth-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 769px) {
  .booth-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1025px) {
  .booth-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================
   16. REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
