/* ===================================================
   style.css — Photo Gallery Cloud | mochrks.my.id
   =================================================== */

/* ===== CSS Custom Properties ===== */
:root {
  --bg-primary: #030104;
  --bg-secondary: #0b070f;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-muted: #55556a;
  --accent-1: #0d6efd;
  --accent-2: #0056b3;
  --accent-3: #0dcaf0;
  --accent-glow: rgba(13, 110, 253, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family:
    "Plus Jakarta Sans",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===== DotField Background ===== */
.dot-field-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

#dotFieldCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#dotFieldSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* bg-gradient no longer used */
.bg-gradient {
  display: none;
}

/* ===== Noise Overlay ===== */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== Container ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ===== Header ===== */
.header {
  padding: 40px 0 20px;
  text-align: center;
  position: relative;
}

/* ===== Header Badge (FoldText wrapper) ===== */
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeInDown 0.8s ease-out;
  cursor: default;
  overflow: hidden;
}

.header-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-1);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.header h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
  animation: fadeInUp 0.8s ease-out 0.1s both;
}

.header h1 .gradient-text {
  color: var(--accent-1);
}

/* ===== TechText Canvas ===== */
.tech-text {
  position: relative;
  width: 100%;
  height: 160px;
  touch-action: pan-y;
  user-select: none;
  margin-bottom: 8px;
  animation: fadeInUp 0.8s ease-out 0.1s both;
}

.tech-text-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== Screen-reader only ===== */
.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;
}

.header-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
  font-weight: 300;
  animation: fadeInUp 0.8s ease-out 0.2s both;
  line-height: 1.7;
}

.header-subtitle a {
  color: var(--accent-1);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.header-subtitle a:hover {
  color: var(--accent-3);
}

.header-line {
  width: 60px;
  height: 3px;
  background: var(--accent-1);
  border-radius: 2px;
  margin: 28px auto 0;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 24px 0;
  margin-bottom: 8px;
  animation: fadeInUp 0.8s ease-out 0.35s both;
}

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

.stat-number {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-1);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* ===== Filter Tabs ===== */
.filter-section {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 0 32px;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  border-radius: 100px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: -1;
  border-radius: inherit;
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: rgba(13, 110, 253, 0.3);
  transform: translateY(-1px);
}

.filter-btn.active {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.filter-btn.active::before {
  opacity: 1;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ===== Gallery Grid ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

/* ===== Gallery Item ===== */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  cursor: pointer;
  aspect-ratio: 1 / 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  transition: all var(--transition-smooth);
  contain: layout style paint;
}

/* Shimmer placeholder */
.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg,
      var(--bg-secondary) 8%,
      rgba(255, 255, 255, 0.04) 18%,
      var(--bg-secondary) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
  z-index: 1;
  border-radius: inherit;
  transition: opacity 0.4s ease;
}

.gallery-item.loaded::before {
  opacity: 0;
  pointer-events: none;
}

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

  100% {
    background-position: -200% 0;
  }
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.6s ease;
  filter: brightness(0.85) saturate(0.9);
  opacity: 0;
  will-change: transform;
  z-index: 2;
  position: relative;
}

.gallery-item img.visible {
  opacity: 1;
  animation: imgFadeIn 0.5s ease-out;
}

@keyframes imgFadeIn {
  from {
    opacity: 0;
    transform: scale(1.02);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Hover overlay */
.gallery-item .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 60%);
  opacity: 0;
  transition: opacity var(--transition-smooth);
  z-index: 3;
  display: flex;
  align-items: flex-end;
  padding: 20px;
}

.gallery-item .overlay-content {
  transform: translateY(10px);
  transition: transform var(--transition-smooth);
}

.gallery-item .overlay-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gallery-item .overlay-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: rgba(108, 99, 255, 0.2);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(108, 99, 255, 0.1);
}

.gallery-item:hover img {
  transform: scale(1.08);
  filter: brightness(1) saturate(1.05);
}

.gallery-item:hover .overlay {
  opacity: 1;
}

.gallery-item:hover .overlay-content {
  transform: translateY(0);
}

/* ===== Stagger Animation ===== */
.gallery-item.animate-in {
  animation: cardIn 0.5s ease-out both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Loader ===== */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 40px 0;
  padding: 20px;
}

.loader .bar {
  width: 4px;
  height: 24px;
  border-radius: 2px;
  background: var(--accent-1);
  animation: barPulse 1.2s ease-in-out infinite;
}

.loader .bar:nth-child(1) {
  animation-delay: 0s;
}

.loader .bar:nth-child(2) {
  animation-delay: 0.15s;
  height: 32px;
}

.loader .bar:nth-child(3) {
  animation-delay: 0.3s;
  height: 20px;
}

.loader .bar:nth-child(4) {
  animation-delay: 0.45s;
  height: 28px;
}

.loader .bar:nth-child(5) {
  animation-delay: 0.6s;
}

@keyframes barPulse {

  0%,
  100% {
    transform: scaleY(0.5);
    opacity: 0.4;
  }

  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.loader-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: -10px;
  margin-bottom: 30px;
  letter-spacing: 1px;
}

/* ===== End Message ===== */
.end-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: none;
}

.end-message .end-line {
  width: 40px;
  height: 2px;
  background: var(--border-glass);
  margin: 0 auto 12px;
  border-radius: 1px;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  animation: lightboxIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lightboxIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.lightbox-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1001;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1001;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1001;
}

/* ===== Scroll To Top ===== */
.scroll-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-smooth);
  z-index: 100;
  pointer-events: none;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.scroll-top svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 40px 20px 30px;
  border-top: 1px solid var(--border-glass);
  margin-top: 20px;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.footer a {
  color: var(--accent-1);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: var(--accent-2);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ===== FoldText Component ===== */
.fold-text {
  display: inline-block;
  color: var(--fold-text-color, currentColor);
  font-size: var(--fold-text-font-size, inherit);
  font-weight: var(--fold-text-font-weight, inherit);
  line-height: 0.95;
  letter-spacing: -0.04em;
  white-space: pre-wrap;
  user-select: text;
}

.fold-text-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;
}

.fold-text-visual {
  display: inline;
}

.fold-text-line {
  display: block;
}

.fold-text-whitespace {
  display: inline;
}

.fold-text-segment {
  display: inline-block;
  line-height: inherit;
  perspective: var(--fold-perspective, 700px);
  transform-style: preserve-3d;
  vertical-align: baseline;
}

.fold-text-segment[data-fold-split='line'] {
  display: block;
}

.fold-text-piece {
  position: relative;
  display: inline-block;
  color: inherit;
  line-height: inherit;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.fold-text-piece::after {
  content: '';
  position: absolute;
  inset: -0.08em -0.02em;
  pointer-events: none;
  opacity: var(--fold-crease, 0);
  mix-blend-mode: multiply;
  border-radius: 0.08em;
}

.fold-text-piece[data-fold-hinge='top']::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge='bottom']::after {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge='left']::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge='right']::after {
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .gallery-item {
    border-radius: var(--radius-md);
  }

  .header {
    padding: 30px 0 16px;
  }

  .tech-text {
    height: 110px;
  }

  .stats-bar {
    gap: 24px;
  }

  .stat-number {
    font-size: 1.4rem;
  }

  .filter-section {
    gap: 8px;
    padding: 16px 0 24px;
  }

  .filter-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  .lightbox-nav {
    width: 40px;
    height: 40px;
  }

  .lightbox-prev {
    left: 12px;
  }

  .lightbox-next {
    right: 12px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .gallery-item {
    border-radius: var(--radius-sm);
  }

  .tech-text {
    height: 80px;
  }

  .stats-bar {
    gap: 16px;
  }

  .scroll-top {
    bottom: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fold-text-piece {
    transform: none !important;
  }

  .fold-text-piece::after {
    opacity: 0 !important;
  }
}