*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.65);
  --accent: rgba(255, 255, 255, 0.9);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --transition: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --view-duration: 1.08s;
  --view-duration-exit: 0.92s;
  --view-enter-delay: 0.14s;
  --view-ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --view-ease-exit: cubic-bezier(0.55, 0.06, 0.25, 1);
  --content-duration: 0.95s;
  --content-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --content-stagger: 0.055s;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  background: #0f172a;
}

/* Animated gradient background — full spectrum, very smooth */
.gradient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    125deg,
    #ff6b6b 0%,
    #7c6431 12%,
    #2e6572 24%,
    #125241 36%,
    #5f27cd 48%,
    #661c5c 60%,
    #54a0ff 72%,
    #ff6348 84%,
    #ff6b6b 100%
  );
  background-size: 600% 600%;
  animation: gradientShift 45s ease-in-out infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  25% { background-position: 50% 100%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 0%; }
  100% { background-position: 0% 50%; }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  mix-blend-mode: screen;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: #ff6b6b;
  top: -8%;
  left: -4%;
}

.orb-2 {
  width: 380px;
  height: 380px;
  background: #48dbfb;
  bottom: -6%;
  right: -4%;
  animation-delay: -7s;
}

.orb-3 {
  width: 320px;
  height: 320px;
  background: #feca57;
  top: 45%;
  left: 55%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(24px, -28px) scale(1.04); }
  66% { transform: translate(-18px, 22px) scale(0.96); }
}

/* Glass components */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}

.glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.glass-btn:active {
  transform: translateY(0);
}

.glass-btn.primary {
  background: rgba(255, 255, 255, 0.22);
  padding: 1rem 2.5rem;
  font-size: 1.05rem;
}

.glass-btn.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
}

.page-header .back-btn {
  position: absolute;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px 0 0;
  text-align: center;
}

.glass-btn.hidden {
  visibility: hidden;
  pointer-events: none;
}

.btn-arrow {
  transition: transform 0.2s;
}

.glass-btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* Views / pages */
#app {
  min-height: 100vh;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.992);
  transition:
    opacity var(--view-duration) var(--view-ease-enter),
    transform var(--view-duration) var(--view-ease-enter),
    visibility 0s linear var(--view-duration);
  pointer-events: none;
  will-change: opacity, transform;
}

.view-active,
.view-exit,
.view-enter,
.view-enter-active {
  display: flex;
}

.view-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  position: relative;
  width: 100%;
  min-height: 100vh;
  transition:
    opacity var(--view-duration) var(--view-ease-enter),
    transform var(--view-duration) var(--view-ease-enter),
    visibility 0s;
}

.view-exit {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100vh;
  opacity: 0;
  visibility: visible;
  transform: translateY(-8px) scale(0.996);
  pointer-events: none;
  transition:
    opacity var(--view-duration-exit) var(--view-ease-exit),
    transform var(--view-duration-exit) var(--view-ease-exit),
    visibility 0s linear var(--view-duration-exit);
}

.view-enter {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100vh;
  opacity: 0;
  visibility: visible;
  transform: translateY(18px) scale(0.992);
  pointer-events: none;
}

.view-enter-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity var(--view-duration) var(--view-ease-enter) var(--view-enter-delay),
    transform var(--view-duration) var(--view-ease-enter) var(--view-enter-delay),
    visibility 0s;
}

@keyframes contentFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#categories.view-enter-active .category-card {
  animation: contentFadeUp var(--content-duration) var(--content-ease) backwards;
}

#categories.view-enter-active .category-card:nth-child(1) {
  animation-delay: calc(var(--view-enter-delay) + var(--content-stagger) * 1);
}

#categories.view-enter-active .category-card:nth-child(2) {
  animation-delay: calc(var(--view-enter-delay) + var(--content-stagger) * 2);
}

#categories.view-enter-active .category-card:nth-child(3) {
  animation-delay: calc(var(--view-enter-delay) + var(--content-stagger) * 3);
}

#gallery.view-enter-active .page-header,
#gallery.view-enter-active .gallery-item,
#gallery.view-enter-active .empty-state {
  animation: contentFadeUp var(--content-duration) var(--content-ease) backwards;
}

#gallery.view-enter-active .page-header {
  animation-delay: calc(var(--view-enter-delay) + 0.04s);
}

#gallery.view-enter-active .gallery-item {
  animation-delay: calc(var(--view-enter-delay) + 0.1s + var(--stagger, 0) * var(--content-stagger));
}

#gallery.view-enter-active .empty-state {
  animation-delay: calc(var(--view-enter-delay) + 0.12s);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --view-duration: 0.01s;
    --view-duration-exit: 0.01s;
    --view-enter-delay: 0s;
    --content-duration: 0.01s;
  }

  .view {
    will-change: auto;
  }

  #categories.view-enter-active .category-card,
  #gallery.view-enter-active .page-header,
  #gallery.view-enter-active .gallery-item,
  #gallery.view-enter-active .empty-state {
    animation: none;
  }
}

dialog:not([open]) {
  display: none !important;
  pointer-events: none !important;
}

/* Welcome page */
.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: fadeUp 0.8s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portrait-frame {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0.1));
  margin-bottom: 1.75rem;
}

.portrait-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(145deg, #c084fc, #818cf8);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portrait-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.welcome-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-weight: 300;
  margin-bottom: 2rem;
}

/* Categories page */
#categories {
  justify-content: center;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

#gallery {
  justify-content: center;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin-bottom: 2.5rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  transition: opacity 0.55s var(--content-ease), transform 0.55s var(--content-ease);
}

.page-header h2.is-updating {
  opacity: 0;
  transform: translateY(6px);
}

.page-header--centered h2 {
  width: 100%;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 980px;
  justify-content: center;
}

.category-card {
  padding: 2rem 1.75rem;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition:
    transform 0.65s var(--view-ease-enter),
    background 0.55s ease,
    box-shadow 0.65s var(--view-ease-enter);
}

.category-card:active {
  transform: translateY(-2px) scale(0.995);
  transition-duration: 0.2s;
}

.category-card:hover {
  transform: translateY(-5px) scale(1.015);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.category-card h3 {
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  line-height: 1.35;
  max-width: 100%;
}

.category-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.5;
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  max-width: 1080px;
  padding-bottom: 1rem;
}

.gallery-item {
  width: 100%;
  min-width: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.55s var(--content-ease),
    box-shadow 0.55s var(--content-ease);
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
}

.gallery-thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb.pdf-thumb {
  background: linear-gradient(145deg, #ef4444aa, #f97316aa);
}

.gallery-thumb.video-thumb {
  background: linear-gradient(145deg, #3b82f6aa, #8b5cf6aa);
}

.gallery-info {
  padding: 1rem 1.25rem;
  text-align: center;
}

.gallery-info h4 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.gallery-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Modals */
.glass-modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(920px, 92vw);
  width: 100%;
  border-radius: var(--radius-lg);
  margin: auto;
  position: fixed;
  inset: 0;
  height: fit-content;
  max-height: 90vh;
  overflow: visible;
}

.glass-modal::backdrop {
  background: rgba(15, 10, 30, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-inner {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-inner h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  text-align: center;
  width: 100%;
  padding: 0 2.5rem;
}

.glass-modal.media-modal {
  width: fit-content;
  max-width: 95vw;
}

.video-wrapper,
.image-wrapper {
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: width 0.25s ease, height 0.25s ease;
}

.video-wrapper {
  background: #000;
}

.image-wrapper {
  background: rgba(0, 0, 0, 0.2);
}

#video-player,
#image-viewer {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.pdf-modal {
  max-width: min(1000px, 95vw);
}

.pdf-wrapper {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  height: 75vh;
  width: 100%;
}

#pdf-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

/* Empty state */
.empty-state {
  width: 100%;
  max-width: 480px;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state p {
  font-weight: 300;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .categories-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
}

@media (max-width: 600px) {
  .welcome-card {
    padding: 2rem 1.5rem;
  }

  .portrait-frame {
    width: 140px;
    height: 140px;
  }

  .welcome-title {
    font-size: 1.6rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .view {
    padding: 1.25rem;
  }
}
