/* === Design Tokens — Dark Elegance === */
:root {
  --bg-color: #FAFAFA;
  --primary-color: #D4AF37;
  --primary-hover: #C49B30;
  --text-main: #1A1A1A;
  --text-muted: #666666;
  --card-bg: #FFFFFF;
  --card-border: #EAEAEA;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.04);
  --shadow-lifted: 0 8px 30px rgba(0, 0, 0, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.45s;
  --success-color: #4CAF50;
}

/* === Reset === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  background: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
}

/* === App Container === */
#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  height: 100vh;
}

/* === Screen Base === */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.98);
  transition: opacity var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              visibility 0s var(--duration);
  z-index: 1;
}
.screen.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              visibility 0s 0s;
  z-index: 2;
}
.screen.exit {
  opacity: 0;
  transform: translateY(-16px) scale(0.98);
  z-index: 1;
  transition: opacity 0.25s ease-in,
              transform 0.25s ease-in,
              visibility 0s 0.25s;
}

/* Screen content */
.screen-inner {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem 1.25rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.screen-inner.scrollable {
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: calc(env(safe-area-inset-top, 20px) + 2rem);
}
.screen-inner.scrollable::-webkit-scrollbar { width: 4px; }
.screen-inner.scrollable::-webkit-scrollbar-track { background: transparent; }
.screen-inner.scrollable::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* === Landing === */
#screen-landing {
  background: radial-gradient(ellipse at 50% 30%, rgba(212, 175, 55, 0.08) 0%, #FDF8F0 50%, var(--bg-color) 80%);
}
#screen-landing .screen-inner { max-width: 380px; }
.landing-ornament {
  margin-bottom: 1.8rem;
  width: 44px;
  height: 44px;
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.6; }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Landing entrance stagger */
#screen-landing.active .landing-ornament {
  animation: pulse 2.5s ease-in-out infinite, fadeSlideUp 0.6s ease-out both;
}
#screen-landing.active .landing-text {
  animation: fadeSlideUp 0.6s ease-out 0.1s both;
}
#screen-landing.active .landing-sub {
  animation: fadeSlideUp 0.6s ease-out 0.2s both;
}
#screen-landing.active .btn-primary {
  animation: fadeSlideUp 0.6s ease-out 0.35s both;
}
.landing-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}
.landing-sub {
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 0.5rem;
  max-width: 320px;
}

/* === Screen Titles === */
.screen-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  font-weight: 600;
  color: var(--primary-color);
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}
.screen-sub {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

/* Stagger entrance: ticket cards */
.voucher-grid .ticket-card {
  opacity: 0;
  transform: translateY(16px);
}
.voucher-grid.stagger-in .ticket-card {
  animation: fadeSlideUp 0.45s ease-out both;
}
.voucher-grid.stagger-in .ticket-card:nth-child(1) { animation-delay: 0.05s; }
.voucher-grid.stagger-in .ticket-card:nth-child(2) { animation-delay: 0.12s; }
.voucher-grid.stagger-in .ticket-card:nth-child(3) { animation-delay: 0.19s; }
.voucher-grid.stagger-in .ticket-card:nth-child(4) { animation-delay: 0.26s; }

/* Stagger entrance: gallery items */
.gallery-item {
  opacity: 0;
  transform: scale(0.94);
}
.gallery-scroll.stagger-in .gallery-item {
  animation: galleryPopIn 0.4s ease-out both;
}
.gallery-scroll.stagger-in .gallery-item:nth-child(1) { animation-delay: 0.08s; }
.gallery-scroll.stagger-in .gallery-item:nth-child(2) { animation-delay: 0.14s; }
.gallery-scroll.stagger-in .gallery-item:nth-child(3) { animation-delay: 0.20s; }
.gallery-scroll.stagger-in .gallery-item:nth-child(4) { animation-delay: 0.26s; }
.gallery-scroll.stagger-in .gallery-item:nth-child(5) { animation-delay: 0.32s; }
@keyframes galleryPopIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* Gallery screen title entrance */
#screen-gallery.active .screen-title {
  animation: fadeSlideUp 0.5s ease-out 0.05s both;
}
#screen-gallery.active .gallery-caption {
  animation: fadeSlideUp 0.5s ease-out 0.3s both;
}

/* Voucher screen title entrance */
#screen-vouchers.active .screen-title,
#screen-vouchers.active .screen-sub {
  animation: fadeSlideUp 0.5s ease-out 0.05s both;
}

/* Reduced motion — kill all non-essential animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .screen { transition: none; }
  .screen.active { transform: none; }
  .screen.exit { transform: none; }
  .gallery-scroll { scroll-behavior: auto !important; }
}

/* === Gallery === */
#screen-gallery .screen-inner { max-width: 380px; }
.gallery-scroll {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0.3rem 0 0.8rem;
  width: 100%;
  scrollbar-width: none;
}
.gallery-scroll::-webkit-scrollbar { display: none; }
.gallery-item {
  flex: 0 0 auto;
  width: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  aspect-ratio: 3 / 4;
  border: 1px solid var(--card-border);
  scroll-snap-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.2s ease;
  background: #F0F0F0;
  position: relative;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s var(--ease), opacity 0.4s ease;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0;
}
.gallery-item.loaded img {
  opacity: 1;
}
.gallery-item.load-error::after {
  content: '📷';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0.3;
}
.gallery-item:active img { transform: scale(1.06); }
@media (hover: hover) {
  .gallery-item:hover img { transform: scale(1.08); }
}
.gallery-caption {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--text-muted);
  max-width: 300px;
  margin-bottom: 0.5rem;
}

/* === Vouchers — Glassmorphism === */
#screen-vouchers {
  background: radial-gradient(ellipse at 50% 80%, rgba(212, 175, 55, 0.06) 0%, #FDF8F0 40%, var(--bg-color) 70%);
}
#screen-vouchers .screen-inner { align-items: stretch; max-width: 480px; }
.voucher-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 1rem;
}
/* --- Ticket Card (e-ticket / boarding pass style) --- */
.ticket-card {
  display: flex;
  align-items: stretch;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: visible;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s;
  position: relative;
}
.ticket-card:active:not(.disabled) { transform: scale(0.985); }
@media (hover: hover) {
  .ticket-card:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lifted);
    border-color: rgba(212, 175, 55, 0.2);
  }
}

.ticket-main {
  flex: 1;
  padding: 1rem 0.8rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  gap: 0.2rem;
}
.ticket-category {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 0.15rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ticket-category svg { vertical-align: middle; flex-shrink: 0; }
.ticket-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.ticket-snippet {
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ticket-meta {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.2rem;
}
.ticket-meta span {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.65;
}

/* Perforated divider with semi-circle notches */
.ticket-divider {
  width: 1px;
  flex-shrink: 0;
  position: relative;
  margin: -8px 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.12) 0px,
    rgba(0,0,0,0.12) 5px,
    transparent 5px,
    transparent 10px
  );
}
.ticket-divider::before,
.ticket-divider::after {
  content: '';
  position: absolute;
  left: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  z-index: 1;
}
.ticket-divider::before { top: -8px; }
.ticket-divider::after { bottom: -8px; }

/* Stub (right side) */
.ticket-stub {
  width: 90px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 0.5rem;
  gap: 0.3rem;
  position: relative;
}
.ticket-price {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--primary-color);
  background: linear-gradient(90deg, var(--primary-color) 40%, var(--primary-hover) 50%, var(--primary-color) 60%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s linear infinite;
}
.ticket-price.gold {
  color: #FFD700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.15);
}
.ticket-id {
  font-family: 'Inter', sans-serif;
  font-size: 0.52rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.5;
  letter-spacing: 0.5px;
}
.stub-arrow {
  font-size: 1.3rem;
  color: var(--text-muted);
  opacity: 0.3;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
@media (hover: hover) {
  .ticket-card:hover:not(.disabled) .stub-arrow { opacity: 0.7; transform: translateX(2px); }
}

/* Claimed card */
.ticket-card.claimed-card {
  border-color: rgba(76, 175, 80, 0.3);
  background: rgba(76, 175, 80, 0.04);
}
.ticket-card.claimed-card .ticket-category { color: var(--success-color); }
.ticket-card.claimed-card .ticket-price { color: var(--success-color); }
.ticket-card.claimed-card .stub-arrow { color: var(--success-color); opacity: 0.5; }

/* Download button inside card stub */

/* Disabled card */
.ticket-card.disabled {
  opacity: 0.3;
  filter: grayscale(0.7) brightness(0.8);
  pointer-events: none;
}

/* Detail modal extras */
.detail-box { text-align: left; }
.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.detail-category {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary-color);
}
.detail-ticket-id {
  font-size: 0.55rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.6;
}
.detail-desc {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.75;
  margin: 0.8rem 0 1.2rem;
}
.detail-info-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.3rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.detail-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--card-border);
}
.detail-info-item:last-child { border-bottom: none; }
.info-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.6;
}
.info-value {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-main);
  text-align: right;
  word-break: break-word;
  line-height: 1.3;
  max-width: 60%;
}
.info-sub {
  display: block;
  font-size: 0.55rem;
  font-weight: 300;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 1px;
}
.ticket-class {
  color: var(--primary-color) !important;
  font-weight: 600 !important;
}

.btn-download-detail {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.7rem 2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-color);
  background: transparent;
  color: var(--primary-color);
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  min-height: 44px;
}
.btn-download-detail:active {
  background: var(--primary-hover);
  color: #1A1A1A;
  transform: scale(0.97);
}
@media (hover: hover) {
  .btn-download-detail:hover { background: var(--primary-color); color: #1A1A1A; }
}

.btn-back {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 0.8rem;
  padding: 0.5rem 1rem;
  min-height: 40px;
  text-decoration: underline;
  text-underline-offset: 2px;
  -webkit-appearance: none;
  touch-action: manipulation;
  display: block;
  width: 100%;
}
.btn-back:active { color: var(--text-main); }

/* Reset (test) */
.btn-reset {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: rgba(0, 0, 0, 0.3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  min-height: 40px;
  text-decoration: underline;
  text-underline-offset: 2px;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.btn-reset:active { color: var(--text-muted); }

/* === Shared Button === */
.btn-screen-back {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0;
  margin-bottom: 0.6rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  -webkit-appearance: none;
  touch-action: manipulation;
  min-height: 36px;
  display: inline-block;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.btn-screen-back:active { opacity: 1; }
@media (hover: hover) { .btn-screen-back:hover { opacity: 1; } }
/* === Button Row === */
.btn-row {
  display: flex;
  gap: 1rem;
  margin-top: 1.2rem;
  width: 100%;
}
.btn-secondary {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  min-height: 48px;
  padding: 0.85rem 1.2rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex: 1;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.btn-secondary:active {
  transform: scale(0.97);
  border-color: var(--primary-color);
  color: var(--text-main);
}
@media (hover: hover) {
  .btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--text-main);
  }
}
.btn-row .btn-primary {
  flex: 2;
}
.btn-primary {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 48px;
  padding: 0.85rem 2rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary-color);
  color: #1A1A1A;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.15);
  -webkit-appearance: none;
  touch-action: manipulation;
}
.btn-primary.claimed {
  background: var(--success-color);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
  pointer-events: none;
}
.btn-primary:active {
  transform: scale(0.97);
  background: var(--primary-hover);
}
@media (hover: hover) {
  .btn-primary:hover {
    background: var(--primary-hover);
    color: var(--bg-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2);
  }
}

/* === Modal — Glassmorphism === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 1rem;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-box {
  background: #FFFFFF;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem 1.5rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  max-width: 320px;
  width: 100%;
  text-align: center;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-lifted);
}
.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}
.modal-icon { margin-bottom: 0.7rem; width: 48px; height: 48px; }
.modal-box h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}
.modal-box p {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}
.modal-hint {
  font-size: 0.75rem !important;
  font-style: italic;
  color: var(--primary-color) !important;
  margin-top: -0.4rem;
  margin-bottom: 0.8rem !important;
}
.btn-modal-close {
  margin-top: 0;
  font-size: 0.8rem;
  padding: 0.7rem 1.8rem;
  border-radius: var(--radius-sm);
}
.btn-download {
  font-size: 0.78rem;
  padding: 0.65rem 1.5rem;
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  box-shadow: none;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
}
.btn-download:active {
  background: var(--primary-color);
  color: #1A1A1A;
}
@media (hover: hover) {
  .btn-download:hover {
    background: var(--primary-color);
    color: #1A1A1A;
  }
}

/* === Desktop tweaks === */
@media (min-width: 640px) {
  .screen-inner { max-width: 500px; }
  #screen-vouchers .screen-inner { max-width: 560px; }
  .gallery-scroll { gap: 0.9rem; }
  .voucher-grid { gap: 0.9rem; }
}
/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
