/* ==========================================================================
   ZINBO Design System — Base Core Styles (base.css)
   Theme variables, typography metrics, layout container, header, footer, & loader.
   ========================================================================== */

/* --- Theme Variables --- */
:root {
  --bg-primary: #fcfcfc;
  --bg-card: #ffffff;
  --bg-subtle: #f5f5f5;
  --border-light: #e2e2e2;
  --border-dark: #222222;
  --text-main: #141414;
  --text-muted: #737373;
  --accent: #111111;
  --accent-contrast: #ffffff;
  --card-radius: 20px;
  --btn-radius: 9999px;
  --max-width: 1280px;
  --page-gutter: clamp(16px, 3.5vw, 36px);
  --font-specimen: 'MyanSans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, 'MyanSansUI', 'MyanSans', sans-serif;
  --paper-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paperNoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paperNoise)' opacity='0.035'/%3E%3C/svg%3E");
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(20, 20, 20, 0.22);
  --scrollbar-thumb-hover: rgba(20, 20, 20, 0.45);
  --scrollbar-thumb-active: rgba(20, 20, 20, 0.65);
}

[data-theme="dark"] {
  --bg-primary: #0e0e10;
  --bg-card: #151518;
  --bg-subtle: #1c1c20;
  --border-light: #2c2c32;
  --border-dark: #e5e5e5;
  --text-main: #f0f0f2;
  --text-muted: #8e8e93;
  --accent: #f0f0f2;
  --accent-contrast: #0e0e10;
  --paper-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paperNoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paperNoise)' opacity='0.045'/%3E%3C/svg%3E");
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(255, 255, 255, 0.25);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.48);
  --scrollbar-thumb-active: rgba(255, 255, 255, 0.70);
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  overflow-y: auto;
  overflow-x: clip;
  max-width: 100%;
  background-color: var(--bg-primary);
  color: var(--text-main);
  transition: background-color 0.25s ease, color 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Custom Sleek Scrollbar (Cross-browser for user UI) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-thumb:active {
  background-color: var(--scrollbar-thumb-active);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  max-width: 100%;
  background-color: var(--bg-primary);
  background-image: var(--paper-grain);
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* --- Page Loading Screen (Typography Shield) --- */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
  opacity: 1;
  visibility: visible;
}

.page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-logo-img {
  height: 38px;
  width: auto;
  aspect-ratio: 935 / 242;
  display: block;
}

.loader-logo-svg {
  height: 38px;
  width: auto;
  max-width: 160px;
  display: block;
  color: var(--text-main);
}

[data-theme="dark"] .loader-logo-img {
  filter: invert(1);
}

.loader-bar {
  width: 44px;
  height: 2px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.loader-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 45%;
  background: var(--text-main);
  border-radius: 999px;
  animation: loaderPulse 0.9s infinite ease-in-out;
}

@keyframes loaderPulse {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(230%); }
}

/* --- App Bar (Header) --- */
.site-header {
  height: 72px;
  padding: 0;
  border-bottom: 1px solid var(--border-light);
  background-color: var(--bg-card);
  background-image: none;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-width);
  width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 1;
}

.brand-logo-svg {
  height: 19px;
  width: auto;
  max-width: 90px;
  display: block;
  color: var(--text-main);
  transition: opacity 0.15s ease;
}

.brand-logo:hover .brand-logo-svg {
  opacity: 0.8;
}

.brand-logo-img {
  height: 19px;
  width: auto;
  aspect-ratio: 935 / 242;
  display: block;
  transition: opacity 0.15s ease;
}

.brand-logo:hover .brand-logo-img {
  opacity: 0.8;
}

[data-theme="dark"] .brand-logo-img {
  filter: invert(1);
}

.header-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 44px;
}

.nav-link {
  background: none;
  border: none;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 0;
  position: relative;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

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

.nav-badge {
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --- Theme Toggle Button --- */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  padding: 0;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}

[data-theme="dark"] .theme-toggle {
  border-color: rgba(255, 255, 255, 0.38);
}

.theme-toggle:hover {
  border-color: var(--text-main);
  background-color: var(--bg-subtle);
}

[data-theme="dark"] .theme-toggle:hover {
  border-color: #ffffff;
}

.theme-toggle:active {
  transform: scale(0.92);
}

.sun-and-moon {
  width: 22px;
  height: 22px;
  transform-origin: center center;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sun-core {
  fill: currentColor;
  transform-origin: center center;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sun-beams {
  stroke: currentColor;
  transform-origin: center center;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease;
}

.moon-cutter {
  transform-origin: center center;
  transform: translate(14px, -14px);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] .sun-and-moon {
  transform: rotate(-15deg);
}

[data-theme="dark"] .sun-core {
  transform: scale(1.85);
}

[data-theme="dark"] .sun-beams {
  opacity: 0;
  transform: rotate(45deg) scale(0);
}

[data-theme="dark"] .moon-cutter {
  transform: translate(5px, -4px) scale(1.6);
}

/* --- Pill Buttons --- */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--btn-radius);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  box-sizing: border-box;
  white-space: nowrap;
}

.pill-btn.primary {
  background: var(--text-main);
  border: 1px solid var(--text-main);
  color: var(--accent-contrast);
}

.pill-btn.primary:hover {
  opacity: 0.88;
}

.buy-label-short {
  display: none;
}

.pill-btn.outline {
  border: 1px solid var(--border-light);
  color: var(--text-main);
  background: transparent;
}

.pill-btn.outline:hover {
  border-color: var(--text-main);
  background: var(--bg-subtle);
}

/* --- Mobile Menu Button & Drawer --- */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-light);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  color: var(--text-main);
  padding: 0;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}

[data-theme="dark"] .mobile-menu-btn {
  border-color: rgba(255, 255, 255, 0.38);
}

.mobile-menu-btn:hover {
  border-color: var(--text-main);
  background-color: var(--bg-subtle);
}

[data-theme="dark"] .mobile-menu-btn:hover {
  border-color: #ffffff;
}

.mobile-menu-btn:active {
  transform: scale(0.92);
}

.mobile-menu-btn .hamburger-bar {
  display: block;
  width: 16px;
  height: 1.5px;
  background-color: currentColor;
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.mobile-menu-btn.active .hamburger-bar:nth-child(1) {
  transform: translateY(3.25px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-bar:nth-child(2) {
  transform: translateY(-3.25px) rotate(-45deg);
}

.mobile-nav-drawer {
  display: none;
}

/* --- Main Layout Container --- */
.main-container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 36px var(--page-gutter) 80px;
  flex: 1;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

/* --- Scroll To Top Button --- */
.scroll-top-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-dark);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  opacity: 0.8;
  transition: all 0.2s;
  z-index: 80;
}

.scroll-top-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.scroll-top-btn:hover {
  opacity: 1;
  transform: translateY(-3px);
}

.scroll-top-btn:hover svg {
  transform: translateY(-2px);
}

/* --- Site Footer --- */
.site-footer {
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-card);
  background-image: none;
  margin-top: 80px;
  padding: 40px 0 32px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.footer-glyph-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 16px;
  user-select: none;
}

.footer-glyph {
  font-size: 1.85rem;
  line-height: 1;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  text-align: center;
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: 'MyanSans', sans-serif;
}

.footer-glyph:hover {
  transform: scale(1.22);
}

.footer-bottom-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  color: var(--text-main);
  background: transparent;
  text-decoration: none;
  transition: all 0.18s ease;
}

[data-theme="dark"] .social-btn {
  border-color: rgba(255, 255, 255, 0.28);
}

.social-btn:hover {
  border-color: var(--text-main);
  background: var(--text-main);
  color: var(--accent-contrast);
}

.credit-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.credit-link:hover {
  border-bottom-color: var(--text-main);
}

/* =========================================================================
   Base Responsive Breakpoints
   ========================================================================= */
@media (max-width: 768px) {
  html {
    scrollbar-gutter: auto;
  }
  .main-container {
    max-width: 100%;
    min-width: 0;
    padding: 16px var(--page-gutter) 80px;
  }
  #homeHeader {
    position: relative;
  }
  .header-nav {
    display: none;
  }
  .header-right #homeContactBtn {
    display: none;
  }
  .header-right {
    gap: 10px;
  }
  .mobile-menu-btn {
    display: flex;
  }
  .mobile-nav-drawer {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08);
    padding: 16px var(--page-gutter) 20px;
    gap: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.22s;
    pointer-events: none;
    z-index: 99;
  }
  .mobile-nav-drawer.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
  .mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .mobile-nav-link {
    background: none;
    border: none;
    text-align: left;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s ease;
    text-decoration: none;
  }
  .mobile-nav-link:hover, .mobile-nav-link.active {
    color: var(--text-main);
    background-color: var(--bg-subtle);
  }
  .mobile-nav-drawer .pill-btn.primary {
    width: 100%;
    height: 44px;
    font-size: 0.95rem;
  }

  /* Footer Mobile */
  .footer-inner {
    gap: 16px;
    padding-bottom: 24px;
    text-align: center;
  }
  .footer-glyph-row {
    order: 2;
  }
  .footer-glyph:nth-child(n + 7) {
    display: none;
  }
  .footer-bottom-row {
    display: contents;
  }
  .footer-social {
    order: 1;
  }
  .footer-copy {
    order: 3;
    font-size: 0.85rem;
  }
  .footer-credit {
    order: 4;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .footer-glyph:nth-child(n + 6) {
    display: none;
  }
  .scroll-top-btn {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  .brand-logo {
    font-size: 1.15rem;
  }
  .brand-logo-svg,
  .brand-logo-img {
    height: 16.5px;
  }
  .pill-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
  }
}
