/* ===== KAUNG KAUNG — STYLE SYSTEM v4 ===== */

/* --- DARK MODE — Cyan Neon / Dark Steel --- */
:root {
  --bg: #0c0e13;
  --surface: #12151b;
  --elevated: #1a1d25;
  --border: #252830;
  --text: #e6e8ec;
  --muted: #7a7e8a;
  --accent: #00e0ff;
  --accent-rgb: 0, 224, 255;
  --accent-warm: #ff6b35;
  --nav-bg: rgba(12, 14, 19, 0.92);
  --grain-opacity: 0.025;
  --img-grayscale: 25%;
  --img-contrast: 1.1;
  --img-brightness: 0.88;
  --scrollbar-track: #0c0e13;
  --scrollbar-thumb: #252830;
  --timeline-dot-bg: #0c0e13;
  --stroke-color: #00e0ff;
}

/* --- LIGHT MODE — Warm Sand / Terracotta Film --- */
html.light {
  --bg: #f5f1eb;
  --surface: #ece7de;
  --elevated: #e1dbd0;
  --border: #cdc5b6;
  --text: #231f1a;
  --muted: #7d7469;
  --accent: #c2552d;
  --accent-rgb: 194, 85, 45;
  --accent-warm: #b91c1c;
  --nav-bg: rgba(245, 241, 235, 0.93);
  --grain-opacity: 0.018;
  --img-grayscale: 5%;
  --img-contrast: 1.06;
  --img-brightness: 0.97;
  --scrollbar-track: #f5f1eb;
  --scrollbar-thumb: #cdc5b6;
  --timeline-dot-bg: #f5f1eb;
  --stroke-color: #c2552d;
}

/* --- THEME TRANSITION (only when toggling) --- */
html.theme-transition body,
html.theme-transition nav,
html.theme-transition section,
html.theme-transition footer,
html.theme-transition .filter-btn,
html.theme-transition .timeline-dot,
html.theme-transition #mobile-menu {
  transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease !important;
}

/* --- GRAIN --- */
#grain-overlay {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 256px;
  opacity: var(--grain-opacity);
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

::selection { background: var(--accent); color: var(--bg); }

/* --- STROKE TEXT --- */
.stroke-text { -webkit-text-stroke: 2px var(--stroke-color); }
.stroke-text-sm { -webkit-text-stroke: 1.5px var(--stroke-color); }

/* --- BODY --- */
body { background-color: var(--bg); color: var(--text); }

/* --- CURSOR GLOW --- */
#cursor-glow {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.08) 0%, transparent 70%);
  border-radius: 50%; pointer-events: none;
  position: fixed; z-index: 1;
  transform: translate(-50%, -50%);
  transition: transform 0.08s linear;
  will-change: transform;
}

/* --- THEME TOGGLE --- */
.theme-toggle {
  position: relative; width: 50px; height: 26px; border-radius: 13px;
  background: var(--elevated); border: 1px solid var(--border);
  cursor: pointer; padding: 0;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle-knob {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent);
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1;
}
html.light .theme-toggle-knob { transform: translateX(24px); }

/* --- NAV --- */
#main-nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
#main-nav.scrolled > div { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.nav-link { position: relative; }
.nav-link::after {
  content: ''; position: absolute; bottom: -3px; left: 0;
  width: 0; height: 1px; background: var(--accent);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link.active { color: var(--accent) !important; }
#nav-toggle.active span:first-child { transform: rotate(45deg) translate(5px, 5px); }
#nav-toggle.active span:nth-child(2) { opacity: 0; }
#nav-toggle.active span:nth-child(3) { width: 24px; transform: rotate(-45deg) translate(5px, -5px); }
#mobile-menu.active { opacity: 1; pointer-events: all; }

/* --- SCROLL CUE --- */
.scroll-cue { animation: scrollCue 2.4s ease-in-out infinite; }
@keyframes scrollCue {
  0%,100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0.25; transform: scaleY(0.4); }
}

/* --- MARQUEE --- */
.hero-marquee {
  display: flex; width: max-content;
  animation: marqueeScroll 60s linear infinite;
}
.hero-marquee:hover { animation-play-state: paused; }
@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- MASONRY --- */
.masonry-grid { columns: 3; column-gap: 10px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 1024px) { .masonry-grid { columns: 2; column-gap: 8px; } }
@media (max-width: 640px) { .masonry-grid { columns: 1; max-width: 500px; column-gap: 0; } }

/* --- GRID ITEMS (Film-frame) --- */
.grid-item {
  break-inside: avoid; margin-bottom: 10px;
  position: relative; overflow: hidden; cursor: pointer;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--elevated);
  padding: 5px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.4s ease,
              border-color 0.3s ease;
  opacity: 1;
}
.grid-item.grid-entering {
  opacity: 0; transform: translateY(20px) scale(0.97);
}
.grid-item.grid-visible {
  opacity: 1; transform: translateY(0) scale(1);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.4s ease, border-color 0.3s ease;
}
.grid-item:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.12), 0 2px 8px rgba(0,0,0,0.1);
}
.grid-item img {
  width: 100%; display: block; border-radius: 2px;
  filter: grayscale(var(--img-grayscale)) contrast(var(--img-contrast)) brightness(var(--img-brightness));
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.5s;
}
.grid-item:hover img { filter: grayscale(0%) contrast(1) brightness(1); transform: scale(1.04); }
.grid-item-overlay {
  position: absolute; inset: 5px;
  background: linear-gradient(transparent 30%, rgba(0,0,0,0.75) 100%);
  display: flex; align-items: flex-end; padding: 0.9rem;
  opacity: 0; transition: opacity 0.35s;
  border-radius: 2px;
}
.grid-item:hover .grid-item-overlay { opacity: 1; }
.grid-item-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: #fff; letter-spacing: 0.12em; text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* --- FILTER BUTTONS (bouncy) --- */
.filter-btn {
  border-color: var(--border) !important; color: var(--muted) !important;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  border-radius: 4px;
}
.filter-btn:hover {
  border-color: var(--accent) !important; color: var(--accent) !important;
  transform: translateY(-2px);
}
.filter-btn.active {
  background: var(--accent) !important; color: var(--bg) !important;
  border-color: var(--accent) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.25);
}

/* --- LIGHTBOX --- */
#lightbox { backdrop-filter: blur(8px); }
#lightbox.active { opacity: 1; pointer-events: all; }
#lightbox.active #lightbox-img { opacity: 1; transform: scale(1) rotate(0deg); }
#lightbox-img {
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lb-nav-area {
  position: absolute; top: 0; bottom: 80px; width: 50%;
  z-index: 201; display: flex; align-items: center;
  cursor: pointer; background: transparent; border: none; padding: 0;
}
.lb-nav-area.nav-prev { left: 0; justify-content: flex-start; padding-left: 20px; }
.lb-nav-area.nav-next { right: 0; justify-content: flex-end; padding-right: 20px; }
.lb-nav-icon {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.4); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: rgba(255,255,255,0.6);
  transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  opacity: 0;
}
.lb-nav-area:hover .lb-nav-icon {
  opacity: 1; border-color: var(--accent); color: var(--accent); transform: scale(1.15);
}
.lb-bottom-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 70px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 16px; gap: 20px; z-index: 201;
}
.lb-filmstrip { display: flex; gap: 4px; align-items: center; }
.lb-filmstrip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.lb-filmstrip-dot.active { background: var(--accent); width: 20px; border-radius: 3px; }

/* --- SCROLL-REVEAL --- */
.obs-animate {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.obs-animate.visible { opacity: 1; transform: translateY(0); }

/* --- PROFILE FRAME --- */
.profile-frame { position: relative; z-index: 1; }
.profile-frame::before {
  content: ''; position: absolute; inset: 0;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  transform: translate(6px, -6px);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none; z-index: -1;
}
.profile-frame:hover::before { transform: translate(3px, -3px); }
.profile-frame:hover img { filter: grayscale(0%) contrast(1) brightness(1) !important; }

/* --- TIMELINE --- */
.timeline-line {
  position: absolute; left: 7px; top: 0; bottom: 0;
  width: 1px; background: linear-gradient(to bottom, var(--accent), transparent);
}
.timeline-dot {
  width: 15px; height: 15px; border: 2px solid var(--accent); border-radius: 50%;
  background: var(--timeline-dot-bg); flex-shrink: 0; position: relative; z-index: 2;
}

/* --- HOVER --- */
a, button { transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); }

/* --- DIVIDER --- */
.section-divider {
  height: 1px; margin: 0 auto; max-width: 600px;
  background: linear-gradient(to right, transparent, rgba(var(--accent-rgb), 0.2), transparent);
}

/* --- RESPONSIVE & MOBILE PERFORMANCE --- */
@media (max-width: 640px) {
  .masonry-grid { column-gap: 4px; }
  .grid-item { margin-bottom: 6px; padding: 3px; }
  #cursor-glow { display: none; }
  .hero-marquee { animation-duration: 30s; }
  .lb-nav-icon { width: 40px; height: 40px; font-size: 18px; opacity: 0.8; }
  .grid-item img { transition: none; }
  .grid-item { transition: opacity 0.4s ease, transform 0.4s ease; }
  .grid-item:hover img { transform: none; }
  .grid-item:hover { transform: none; box-shadow: 0 1px 6px rgba(0,0,0,0.08); border-color: var(--border); }
  .obs-animate { transition-duration: 0.4s; }
  #grain-overlay { display: none; }
}
@media (max-width: 1024px) {
  .grid-item { margin-bottom: 8px; }
}

/* --- BOUNCY CONTACT CARDS --- */
.contact-card {
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.4s ease,
              border-color 0.3s ease !important;
}
.contact-card:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.12) !important;
  border-color: var(--accent) !important;
}

/* Hardware acceleration */
.hero-marquee { will-change: transform; }
#lightbox-img { will-change: transform, opacity; }
