/* -------------------------------------------------------------
 * DESIGN SYSTEM TOKENS — artic.
 * -------------------------------------------------------------
 * Typography, colors, spacing, layout.
 * Dark mode via .dark-mode class (time-based + manual toggle).
 */

/* 1. Font-Face Declarations */
@font-face {
  font-family: 'ITCGaramond';
  src: url('../fonts/ITCGaramondStd-Book.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'KakaoBig';
  src: url('../fonts/KakaoBigSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'KakaoSmall';
  src: url('../fonts/KakaoSmallSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ── Typography ── */
  --font-logo: 'ITCGaramond', 'Georgia', serif;
  --font-serif: 'KakaoBig', -apple-system, sans-serif;
  --font-sans: 'KakaoSmall', system-ui, sans-serif;

  /* ── Light Mode (Default) ── */
  --bg-primary: #FFFFFF;
  --bg-secondary: #FAFAFA;
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #999999;
  --accent: #000000;
  --accent-light: #F0F0F0;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(0, 0, 0, 0.3);
  --glass-bg: rgba(255, 255, 255, 0.88);

  /* ── Spacing — Gallery Whitespace ── */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-xxl: 8rem;
  --gutter: clamp(24px, 5vw, 80px);

  /* ── Motion ── */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.25s ease;
  --transition-theme: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, fill 0.5s ease;

  /* ── Layout ── */
  --max-width: 1400px;
  --header-height: 72px;
}

/* ── Dark Mode (via class) ── */
.dark-mode {
  --bg-primary: #1A1A1A;
  --bg-secondary: #242424;
  --text-primary: #F0F0F0;
  --text-secondary: #BBBBBB;
  --text-muted: #707070;
  --accent: #F0F0F0;
  --accent-light: #2A2A2A;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.25);
  --glass-bg: rgba(26, 26, 26, 0.88);
}

/* ── Global Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition-theme);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Dark Mode Image Inversion ── */
.dark-mode .nav-logo,
.dark-mode .logo-split img {
  filter: invert(1);
}

/* ── Shared Floating Nav ── */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  padding: 0.55rem var(--gutter);
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background-color: var(--glass-bg);
  transition: var(--transition-theme);
}

/* Subpage delayed reveal ??hides nav + content until transition overlay covers screen */
.delayed-reveal {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.delayed-reveal.revealed {
  opacity: 1 !important;
  pointer-events: auto;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 1.4rem;
  transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

/* "artic." home link — ITC Garamond, visually height-matched to uppercase items */
.nav-home {
  font-family: var(--font-logo);
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 1.4rem;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  transition: max-width 0.6s var(--ease-out-expo),
              opacity 0.5s ease,
              padding 0.6s var(--ease-out-expo),
              color 0.3s ease;
}

.nav-home:hover {
  color: var(--text-primary);
}

.nav-home.visible {
  max-width: 100px;
  opacity: 1;
  padding: 4px 1.4rem;
}

/* ── Theme Toggle (Bottom-Left, fixed position) ── */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: var(--transition-theme), transform 0.3s ease;
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--border-focus);
  transform: scale(1.08);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s ease, transform 0.5s var(--ease-out-expo);
}

.theme-toggle:hover svg {
  stroke: var(--text-primary);
}

/* Sun visible in dark mode, moon visible in light mode */
.icon-sun { display: none; }
.icon-moon { display: block; }
.dark-mode .icon-sun { display: block; }
.dark-mode .icon-moon { display: none; }

/* ── Utility ── */
.animate-fade-in {
  animation: pageReveal 1.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes pageReveal {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
    transition-duration: 0.01s !important;
  }
}

/* ── 6. Responsive Mobile Navigation (Hamburger & Sidebar) ── */
.hamburger-btn {
  display: none;
}

.nav-overlay {
  display: none;
}

.mobile-header-bar {
  display: none;
}

@media (max-width: 767px) {
  /* Mobile Top Header Bar with Gradient Blur Boundary */
  .mobile-header-bar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 84px; /* Covers top 84px scroll range under hamburger */
    z-index: 997; /* Under hamburger (1000) and overlay (998) */
    pointer-events: none; /* Let clicks pass through the blur area */
    
    /* Elegant gradient blur mask */
    background: linear-gradient(to bottom, var(--bg-primary) 50%, transparent 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    transition: background-color 0.5s ease, opacity 0.4s ease;
  }

  /* Dynamic Backdrop Overlay with deep blur and darkness */
  .nav-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 998; /* Under overlay container, above page content */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
  }

  .nav-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* Hamburger Button */
  .hamburger-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background-color: rgba(0, 0, 0, 0); /* Safari hit-test fix */
    border: none;
    cursor: pointer;
    z-index: 1000; /* Float over everything */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    transition: transform 0.3s ease;
    touch-action: manipulation;
    pointer-events: auto;
  }

  .burger-line {
    display: block;
    width: 20px;
    height: 1.5px;
    background-color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Hamburger transition when open: morphs into X and turns white */
  .nav-open .line-1 {
    transform: translateY(6.5px) rotate(45deg);
  }
  .nav-open .line-2 {
    opacity: 0;
    transform: scaleX(0);
  }
  .nav-open .line-3 {
    transform: translateY(-6.5px) rotate(-45deg);
  }
  .nav-open .burger-line {
    background-color: #FFFFFF;
  }

  /* Full-screen Transparent Menu Overlay */
  .nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    padding: 100px 32px var(--space-md) var(--space-md);
    gap: var(--space-md);
    background-color: transparent;
    border-left: none;
    box-shadow: none;
    z-index: 999;
    /* Fade transition ??!important to override .delayed-reveal.revealed */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: none;
    transition: opacity 0.5s ease;
  }

  .nav-open .nav-bar {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Sidebar Links stack vertically and right-aligned */
  .nav-link {
    position: relative !important;
    width: auto;
    padding: var(--space-xs) 0 !important;
    font-size: 1.15rem;
    border-bottom: none;
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
    
    /* Fade and slide down transition */
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo), color 0.3s ease;
  }

  .nav-link:hover,
  .nav-link.active {
    color: #FFFFFF !important;
  }

  .nav-home {
    position: relative !important;
    width: auto;
    max-width: none !important;
    opacity: 0 !important;
    padding: var(--space-xs) 0 !important;
    font-size: 1.7rem;
    border-bottom: none;
    margin-bottom: var(--space-sm);
    overflow: visible;
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
    
    /* Fade and slide down transition */
    transform: translateY(-20px);
    transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo), color 0.3s ease;
  }
  
  .nav-home.visible {
    padding: var(--space-xs) 0 !important;
  }

  /* Sequencing for Fade & Slide Down using dynamic --nav-idx variables */
  .nav-open .nav-bar .nav-home,
  .nav-open .nav-bar .nav-link {
    opacity: 1 !important;
    transform: translateY(0);
    transition-delay: calc(0.1s + var(--nav-idx) * 0.08s);
  }

  /* Active Menu Link Shift Offset & Dot Indicator (Mobile viewports only) */
  .nav-open .nav-bar .nav-link.active,
  .nav-open .nav-bar .nav-home.active {
    transform: translateX(-16px) !important;
    color: #FFFFFF !important;
  }

  .nav-open .nav-bar .nav-link.active::after,
  .nav-open .nav-bar .nav-home.active::after {
    content: '•';
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8px;
    color: #FFFFFF;
  }
}

/* ── 7. Premium Sub-page Landing Transition Overlay ── */
.subpage-transition-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Dynamic Viewport Height for perfect mobile centering */
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.6s var(--ease-out-expo);
  pointer-events: auto;
}

.subpage-transition-title {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
  text-align: center;
}

.subpage-transition-overlay.active .subpage-transition-title {
  opacity: 1;
  transform: translateY(0);
}

.subpage-transition-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.subpage-transition-overlay.fade-out .subpage-transition-title {
  opacity: 0;
  transform: translateY(-16px);
}

/* ── Cascading Page Content Reveal ── */
.reveal-item {
  opacity: 0 !important;
  transform: translateY(20px) !important;
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal-active .reveal-item,
.reveal-item.revealed {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* ── Global Flexbox Sticky Footer (Option B — Pinned to Bottom of Page) ── */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
  width: 100% !important;
}

body {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
  padding-bottom: 0 !important; /* Reset padding since footer is now in standard flow */
}

/* Ensure all page containers expand to fill height and push footer down */
.page-container,
.container,
.contact-wrap,
.about-content {
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
  width: 100% !important;
}

footer,
.site-footer,
.about-footer,
.gallery-footer,
.contact-footer {
  position: relative !important;
  margin-top: auto !important; /* Key push-to-bottom rule */
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: var(--max-width) !important;
  margin: 0 auto !important; /* Horizontally center footer on all pages */
  height: auto !important;
  z-index: 10 !important;
  background-color: transparent !important;
  border-top: 1px solid var(--border-color) !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  padding: var(--space-lg) var(--gutter) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.55rem !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  color: var(--text-muted) !important;
  transition: var(--transition-theme) !important;
}

footer span,
.site-footer span,
.about-footer span,
.gallery-footer span,
.contact-footer span {
  color: var(--text-muted) !important;
}

