:root { 
  --bg: #f5f5f5; --fg: #000000; --text-muted: #888888; 
  --glass-bg: rgba(245, 245, 245, 0.5); 
  --glass-border: rgba(255, 255, 255, 0.3);
}
body.dark-mode {
  --bg: #111111; --fg: #f5f5f5; --text-muted: #999999;
  --glass-bg: rgba(17, 17, 17, 0.5);
  --glass-border: rgba(255, 255, 255, 0.1);
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Work Sans',sans-serif; background:var(--bg); color:var(--fg); overflow-x:hidden; transition: background 0.8s, color 0.8s; }

/* Loader */
#page-loader {
  position: fixed; inset: 0; z-index: 999999; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#loader-logo-wrap { position: relative; margin-bottom: 40px; }
.loader-logo { width: 160px; fill: #fff; }
#loader-typewriter { color: #fff; font-size: 14px; font-weight: 300; letter-spacing: 0.3em; text-transform: uppercase; min-height: 1.5em; opacity: 0.8; }

/* Theme Tab */
#theme-tab {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%) translateX(calc(100% - 12px));
  width: 60px; height: 70px; background: var(--fg); color: var(--bg);
  display: flex; align-items: center; justify-content: flex-start; padding-left: 14px;
  border-radius: 16px 0 0 16px; cursor: pointer; z-index: 8000;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.8s ease, color 0.8s ease;
}
@media (max-width: 767px) {
  #theme-tab { display: none !important; }
}
#theme-tab:hover { transform: translateY(-50%) translateX(0); }
.theme-icon { width: 24px; height: 24px; fill: currentColor; }

/* Header Glassmorphism */
.glass { background: var(--glass-bg); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); border-bottom: 1px solid var(--glass-border); }

header { position: fixed; top: 0; left: 0; width: 100%; z-index: 7000; opacity: 0; transition: opacity 0.5s; visibility: hidden; }
.header-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 40px; }

.header-left { position: relative; width: 42px; height: 32px; cursor: pointer; }
#global-logo-header { width: 42px; fill: var(--fg); }
#logo-letters path { transition: opacity 0.3s; }
#burger-lines rect { transition: opacity 0.3s; opacity: 0; }
.is-burger #logo-letters path { opacity: 0; }
.is-burger #burger-lines rect { opacity: 1; }

#burger-menu {
  position: fixed; top: 68px; left: 40px; width: 280px; background: var(--bg);
  border: 1px solid var(--glass-border); padding: 30px; z-index: 6900; box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  opacity: 0; transform: translateY(-20px); pointer-events: none; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#burger-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.burger-link { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.2em; color: var(--text-muted); padding: 14px 0; border-bottom: 1px solid var(--glass-border); transition: color 0.3s; }
.burger-link:hover { color: var(--fg); }

.nav-link { font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); cursor: pointer; transition: color 0.3s; }
.nav-link:hover, .nav-link.active { color: var(--fg); }

/* Right Nav */
.header-right { display: flex; align-items: center; gap: 24px; font-size: 11px; font-weight: 700; }
.search-btn { cursor: pointer; color: var(--text-muted); transition: color 0.3s; display: flex; align-items: center; }
.lang-btn { cursor: pointer; color: var(--text-muted); transition: color 0.3s; border-bottom: 1px solid transparent; }
.lang-btn.active { color: var(--fg); border-bottom: 1px solid var(--fg); }

#search-overlay {
  position: fixed; top: 68px; right: 40px; width: 300px; background: var(--bg);
  border: 1px solid var(--glass-border); padding: 15px; z-index: 6900;
  opacity: 0; transform: translateY(-10px); pointer-events: none; transition: all 0.3s ease;
}
#search-overlay.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
#search-input { width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--text-muted); outline: none; font-size: 12px; color: var(--fg); padding: 5px 0; }

/* Submenu Bar */
#submenu-bar {
  position: fixed; top: 68px; left: 0; width: 100%; height: 0; opacity: 0; overflow: hidden;
  background: var(--glass-bg); backdrop-filter: blur(25px); border-bottom: 1px solid var(--glass-border);
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
  display: flex; gap: 28px; align-items: center; justify-content: center; z-index: 6500;
}
#submenu-bar.open { height: 48px; opacity: 1; }
.sub-link { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); cursor: pointer; transition: color 0.2s; white-space: nowrap; }
.sub-link:hover { color: var(--fg); }

/* Magazine */
#horizontal-detail {
  position: fixed; inset: 0; z-index: 9000; background: var(--bg);
  display: none; opacity: 0; overflow-x: auto; overflow-y: hidden;
  cursor: grab; -webkit-overflow-scrolling: touch;
}
#horizontal-detail:active { cursor: grabbing; }
#horizontal-detail::-webkit-scrollbar { display: none; }
#detail-track { display: flex; height: 100vh; width: max-content; align-items: center; padding: 0 8vw; gap: 8vw; }
.magazine-meta { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; height: 100%; }
.mag-title { font-size: 24px; font-weight: 400; margin-bottom: 4px; letter-spacing: -0.01em; }
.mag-loc { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 60px; }
.mag-field { margin-bottom: 24px; }
.mag-label { font-size: 9px; font-weight: 300; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.15em; display: block; margin-bottom: 4px; }
.mag-value { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: block; line-height: 1.2; }
.mag-img-wrap { height: 60vh; flex-shrink: 0; }
.mag-img { height: 100%; width: auto; object-fit: cover; box-shadow: 0 10px 40px rgba(0,0,0,0.05); }
.mag-text-col { width: 320px; flex-shrink: 0; font-size: 13px; line-height: 1.7; color: var(--fg); display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.mag-quote { font-size: 18px; line-height: 1.4; font-style: italic; margin-bottom: 12px; }
#close-magazine { position: fixed; top: 30px; right: 40px; z-index: 9500; cursor: pointer; font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--fg); padding: 8px 16px; border: 1px solid var(--fg); border-radius: 4px; transition: all 0.3s; }
#close-magazine:hover { background: var(--fg); color: var(--bg); }

/* Footer */
#main-footer {
  position: fixed; bottom: 0; left: 0; width: 100%; z-index: 50; height: 350px;
  background: var(--glass-bg); backdrop-filter: blur(30px); border-top: 1px solid var(--glass-border);
  transform: translateY(100%); transition: transform 0.8s cubic-bezier(0.2,0.8,0.2,1);
  padding: 50px 40px 30px; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  overflow: hidden;
}
@media (max-width: 767px) {
  #main-footer {
    padding-bottom: 110px;
    height: 460px;
  }
  #scroll-to-top.pushed-up {
    bottom: 480px !important;
  }
  
  /* Responsive Magazine View for Mobile */
  .magazine-meta { width: 75vw; }
  .mag-title { font-size: 20px; }
  .mag-img-wrap { height: 40vh; }
  .mag-text-col { width: 80vw; font-size: 11px; gap: 16px; line-height: 1.5; }
  .mag-quote { font-size: 15px; margin-bottom: 8px; }
  #close-magazine { top: 20px; right: 20px; font-size: 9px; padding: 6px 12px; }
}
#main-footer.visible { transform: translateY(0); }
#footer-spheres { position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.k-sphere { position: absolute; width: 60px; height: 60px; background: #000; border-radius: 50%; filter: blur(20px); opacity: 0.8; }
.k1 { animation: orbit1 4s infinite linear; left: 20%; top: 30%; }
.k2 { animation: orbit2 5s infinite linear; right: 25%; bottom: 20%; }
.k3 { animation: orbit3 6s infinite linear; left: 50%; top: 50%; }
@keyframes orbit1 { 0% { transform: rotate(0deg) translateX(80px); } 100% { transform: rotate(360deg) translateX(80px); } }
@keyframes orbit2 { 0% { transform: rotate(0deg) translateX(100px); } 100% { transform: rotate(-360deg) translateX(100px); } }
@keyframes orbit3 { 0% { transform: rotate(0deg) translateX(60px); } 100% { transform: rotate(360deg) translateX(60px); } }

/* Tunnel */
#webgl-canvas { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#scroll-proxy { width: 100%; height: 6000px; }
#scroll-to-top {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 8000;
  background: var(--fg); color: var(--bg); border: none; padding: 12px 24px; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  cursor: pointer; opacity: 0; transition: all 0.3s ease, bottom 0.8s ease; border-radius: 40px; pointer-events: none;
}
@media (max-width: 1023px) {
  #scroll-to-top { bottom: 100px; }
}
#scroll-to-top.visible { opacity: 1; pointer-events: auto; }
#scroll-to-top.pushed-up { bottom: 380px; }
#active-hud { position: fixed; top: 120px; left: 40px; z-index: 100; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.hud-title { font-size: 30px; font-weight: 900; color: var(--fg); text-transform: uppercase; letter-spacing: -0.03em; line-height: 0.9; }

/* Mobile Bottom Nav */
#mobile-bottom-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 400px;
  border-radius: 24px;
  background: rgba(245, 245, 245, 0.75);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  z-index: 99999;
  display: flex;
  flex-direction: column;
}
body.dark-mode #mobile-bottom-nav {
  background: rgba(17, 17, 17, 0.85);
}
.mobile-nav-tabs {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 64px;
}
.mobile-nav-btn {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s;
}
.mobile-nav-btn.active, .mobile-nav-btn:hover {
  color: var(--fg);
}
#mobile-subnav-panel {
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  padding: 15px;
  background: rgb(245, 245, 245);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
body.dark-mode #mobile-subnav-panel {
  background: rgb(17, 17, 17);
}
#mobile-subnav-panel.open {
  display: block !important;
}
#mobile-subnav-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: flex-start;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  overflow-y: auto;
  max-height: 40vh;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 10px 0;
}
#mobile-subnav-links::-webkit-scrollbar {
  display: none;
}
#mobile-subnav-links span {
  white-space: nowrap;
}
@media (min-width: 1024px) {
  #mobile-bottom-nav { display: none !important; }
}
