/* ==========================================================================
   JOZEF MARTINIK — INTERIOR VISUALIZATIONS PORTFOLIO
   Minimalist Architectural Editorial Design System + Security Shield
   ========================================================================== */

:root {
  --bg-primary: #0a0a0c;
  --bg-secondary: #121216;
  --bg-card: #16161b;
  --bg-mat: #18181e;
  --text-primary: #f2f2f4;
  --text-muted: #8a8a95;
  --text-dim: #5c5c66;
  --text-info: #c4c4cb;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.2);
  --accent: #d8d8de;
  --accent-glow: rgba(255, 255, 255, 0.04);
  
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --header-height: 76px;
  --grid-gap: 14px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Anti-Theft / Protection Rules */
.protected-content,
.protected-content * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  line-height: 1.5;
}

/* ==========================================================================
   SITE HEADER & LOGO
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(10, 10, 12, 0.85) 0%, rgba(10, 10, 12, 0.4) 75%, transparent 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.3s ease, border-color 0.3s ease;
  /* Safe area for notch devices */
  padding-left: max(32px, env(safe-area-inset-left));
  padding-right: max(32px, env(safe-area-inset-right));
}

.brand-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: inherit;
  transition: opacity 0.25s ease;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--text-primary);
  line-height: 0.95;
}

.brand-sub {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s var(--ease-smooth);
}

.nav-btn svg {
  opacity: 0.8;
}

/* ==========================================================================
   FULLSCREEN COLLAGE GRID
   ========================================================================== */
.gallery-wrapper {
  padding-top: calc(var(--header-height) + 16px);
  padding-left: var(--grid-gap);
  padding-right: var(--grid-gap);
  padding-bottom: 64px;
  min-height: 100vh;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 240px;
  grid-auto-flow: dense;
  gap: var(--grid-gap);
}

/* Media Item Cards */
.gallery-item {
  position: relative;
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: transform 0.4s var(--ease-smooth), box-shadow 0.4s var(--ease-smooth), border-color 0.3s ease;
  opacity: 0;
  transform: translateY(8px);
  animation: fadeInItem 0.25s ease-out forwards;
}

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

/* Smart Grid Spans for Dynamic Composition */
.span-normal {
  grid-column: span 1;
  grid-row: span 1;
}

.span-tall {
  grid-column: span 1;
  grid-row: span 2;
}

.span-wide {
  grid-column: span 2;
  grid-row: span 1;
}

.span-large {
  grid-column: span 2;
  grid-row: span 2;
}

/* Media Elements inside Card with Luminous Architectural Grading */
.gallery-item-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none; /* Image is untouchable directly */
  filter: saturate(1.04) contrast(1.03) brightness(1.01);
  transition: transform 0.5s var(--ease-smooth), filter 0.4s ease;
  background-color: var(--bg-card);
  position: relative;
  z-index: 1;
}

/* Luminous, warm architectural ambient overlay (standard alpha blending - 100% reliable paint) */
.gallery-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(245, 205, 145, 0.08) 0%, rgba(220, 180, 130, 0.02) 50%, rgba(10, 10, 14, 0.12) 100%);
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-smooth);
}

/* Hover effects only for devices that support hover (fixes sticky hover on mobile) */
@media (hover: hover) {
  .brand-link:hover {
    opacity: 0.85;
  }

  .nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-hover);
    transform: translateY(-1px);
  }

  .gallery-item:hover {
    transform: translateY(-4px) scale(1.012);
    border-color: var(--border-hover);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    z-index: 2;
  }

  /* On hover, subtle additional vibrancy and illumination */
  .gallery-item:hover .gallery-item-media {
    transform: scale(1.045);
    filter: saturate(1.08) contrast(1.05) brightness(1.04);
  }

  .gallery-item:hover::before {
    opacity: 0.15;
  }
}

/* Video Indicator Badge */
.video-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  pointer-events: none;
  z-index: 3;
}

.video-badge svg {
  fill: var(--text-primary);
}

/* Infinite Scroll Sentinel & Loader */
.gallery-sentinel {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
}

.loader-dots {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.loader-dots.visible {
  opacity: 1;
}

.loader-dots span {
  width: 7px;
  height: 7px;
  background-color: var(--text-dim);
  border-radius: 50%;
  animation: bounceDot 1.2s infinite ease-in-out both;
}

.loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.loader-dots span:nth-child(2) { animation-delay: -0.16s; }
.loader-dots span:nth-child(3) { animation-delay: 0; }

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   ARTISTIC PASSE-PARTOUT LIGHTBOX
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease-smooth), visibility 0.35s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(6, 6, 8, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: zoom-out;
}

/* The Passe-Partout Matting Frame */
.passepartout-container {
  position: relative;
  z-index: 10;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: scale(0.96);
  transition: transform 0.45s var(--ease-smooth), opacity 0.35s var(--ease-smooth);
}

.lightbox.active .passepartout-container {
  opacity: 1;
  transform: scale(1);
}

/* The Physical Mat Board (Pasparta) */
.passepartout-mat {
  background: var(--bg-mat);
  padding: 36px;
  border-radius: var(--radius-md);
  box-shadow: 
    0 24px 70px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  max-width: 100%;
  max-height: calc(88vh - 48px);
  box-sizing: border-box;
}

/* Bevelled window cut for artwork */
.artwork-frame {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: 
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    0 2px 10px rgba(0, 0, 0, 0.4);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Transparent Protective Shield over the Artwork */
.artwork-shield {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: transparent;
  pointer-events: auto;
  cursor: default;
}

.artwork-frame img,
.artwork-frame canvas,
.artwork-frame video {
  max-width: calc(84vw - 72px);
  max-height: calc(82vh - 120px);
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Luminous tone carries through into the lightbox */
.artwork-frame img {
  filter: saturate(1.05) contrast(1.04) brightness(1.02);
}

/* Soft-light warm atmosphere inside the passe-partout */
.artwork-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(245, 205, 145, 0.06) 0%, transparent 50%, rgba(10, 10, 14, 0.1) 100%);
  z-index: 5;
  pointer-events: none;
}

.artwork-frame video {
  outline: none;
  background: #000;
  pointer-events: auto; /* Allow play/pause */
  position: relative;
  z-index: 10;
}

/* Lightbox UI Controls */
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s var(--ease-smooth);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s var(--ease-smooth);
}

.lightbox-nav.prev { left: 24px; }
.lightbox-nav.next { right: 24px; }

@media (hover: hover) {
  .lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-hover);
    transform: rotate(90deg);
  }

  .lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-hover);
    transform: translateY(-50%) scale(1.08);
  }
}

/* ==========================================================================
   INFO / CONTACT DRAWER
   ========================================================================== */
.info-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.35s ease, opacity 0.35s ease;
}

.info-drawer.active {
  visibility: visible;
  opacity: 1;
}

.info-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.info-drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 460px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease-smooth);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.5);
  /* Safe area for notch devices */
  padding-right: max(36px, env(safe-area-inset-right));
}

.info-drawer.active .info-drawer-content {
  transform: translateX(0);
}

.info-drawer-close {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 32px;
}

@media (hover: hover) {
  .info-drawer-close:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
  }

  .contact-button:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(255, 255, 255, 0.15);
  }
}

.info-name {
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.1em;
  font-weight: 400;
  margin-bottom: 2px;
}

.info-role {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 24px;
}

.info-separator {
  width: 40px;
  height: 1px;
  background: var(--border-hover);
  margin-bottom: 24px;
}

.info-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-info);
  margin-bottom: 32px;
}

.info-contact-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 36px;
  background: rgba(255, 255, 255, 0.02);
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.info-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
}

.info-val {
  color: var(--text-primary);
  font-weight: 500;
}

.contact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: var(--text-primary);
  color: var(--bg-primary);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease-smooth);
}

/* ==========================================================================
   LANDING TEASER BACKDROP (1-PAGE BLURRED COLLAGE)
   ========================================================================== */
body.page-landing {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

.landing-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  width: 108vw;
  height: 108vh;
  margin-top: -4vh;
  margin-left: -4vw;
  filter: blur(2px) brightness(0.85) saturate(1.06);
  transform: scale(1.01);
}

.landing-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.landing-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.landing-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(10, 10, 12, 0.15) 0%, rgba(10, 10, 12, 0.7) 100%),
              linear-gradient(135deg, rgba(245, 205, 145, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

@media (max-width: 768px) {
  .landing-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
    width: 106vw;
    height: 106vh;
    margin-top: -3vh;
    margin-left: -3vw;
    filter: blur(2px) brightness(0.85) saturate(1.06);
  }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    grid-auto-rows: 200px;
  }

  .passepartout-mat {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 0 16px;
    height: 60px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .brand-title {
    font-size: 1.25rem;
    letter-spacing: 0.12em;
  }

  .brand-sub {
    font-size: 0.55rem;
    letter-spacing: 0.22em;
  }

  .gallery-wrapper {
    padding-top: calc(60px + 8px);
    padding-left: 6px;
    padding-right: 6px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 155px;
    gap: 6px;
  }

  .span-wide, .span-large {
    grid-column: span 2;
  }

  .passepartout-container {
    max-width: 96vw;
  }

  .passepartout-mat {
    padding: 10px;
    border-radius: var(--radius-sm);
  }

  .artwork-frame img,
  .artwork-frame canvas,
  .artwork-frame video {
    max-width: calc(96vw - 20px);
    max-height: 72vh;
  }

  /* Larger tap targets on mobile (min 44px for accessibility) */
  .lightbox-nav {
    width: 44px;
    height: 44px;
    background: rgba(10, 10, 12, 0.6);
  }
  .lightbox-nav.prev { left: 6px; }
  .lightbox-nav.next { right: 6px; }

  .lightbox-close {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    background: rgba(10, 10, 12, 0.6);
  }

  .info-drawer-content {
    padding: 32px 20px;
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  .nav-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    justify-content: center;
  }

  .nav-btn span {
    display: none;
  }

  .nav-btn svg {
    opacity: 0.9;
  }

  /* Bottom safe area for home indicator */
  .gallery-wrapper {
    padding-bottom: max(48px, calc(48px + env(safe-area-inset-bottom)));
  }
}
