/* ============================================================
   SQUAREI — Lifang-inspired Clean Design System
   ============================================================ */

/* Google Fonts loaded non-blocking via <link> in HTML <head> */

/* ── Tokens ── */
:root {
  --white:    #ffffff;
  --black:    #000000;
  --ink:      #111111;
  --gray-1:   #333333;
  --gray-2:   #666666;
  --gray-3:   #999999;
  --gray-4:   #cccccc;
  --gray-5:   #eeeeee;
  --orange:   #e65d38;
  --navy:     #0c2a52;

  --font-sans: 'DM Sans', system-ui, sans-serif;
  --nav-h: 60px;
  --max-w: 1520px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--ink);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; object-fit: cover; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }
::selection { background: var(--ink); color: var(--white); }

/* ── Accessibility & SEO Screen-Reader Only ── */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── Disable custom cursor ── */
#cursor-dot, #cursor-circle { display: none !important; }

/* ── Scroll progress ── */
#scroll-bar { display: none; }

/* ── Loader ── */
/* Spinner ring — defined here once; removed from per-page inline <style> */
#loader .spin-ring {
  width: 42px; height: 42px;
  border: 2px solid #e0e0e0;
  border-top-color: #000000;
  border-radius: 50%;
  animation: loader-spin 0.75s linear infinite;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }

#loader {
  position: fixed; inset: 0;
  background: var(--white);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s;
}
#loader.out { opacity: 0; visibility: hidden; pointer-events: none; }

/* ── Skeleton / Image Loading Placeholders ── */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #e8e8e8 25%,
    #f4f4f4 50%,
    #e8e8e8 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  display: block;
}

/* Skeleton for waterfall gallery items */
.skel-li {
  width: 100%;
  margin-bottom: 4px;
  overflow: hidden;
}
.skel-li .skeleton {
  width: 100%;
  /* height set inline per item */
}

/* Skeleton for static <img> tags (about, films, etc.) */
.img-skeleton-wrap {
  position: relative;
  display: block;
  overflow: hidden;
}
.img-skeleton-wrap .skeleton-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    90deg,
    #e8e8e8 25%,
    #f4f4f4 50%,
    #e8e8e8 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.img-skeleton-wrap .skeleton-overlay.loaded {
  opacity: 0;
}

/* ══════════════════════════════════════════
   NAV — Lifang Style
   Mobile: fixed white bar, centered logo, hamburger right
   Desktop: fixed, logo left, links right with dividers
   ══════════════════════════════════════════ */

.nav-bar {
  position: relative;
  z-index: 999;
}

/* Mobile: top white bar */
.nav-bar .m-nav-box {
  position: fixed;
  width: 100%;
  background: var(--white);
  height: var(--nav-h);
  z-index: 1000;
  top: 0;
  border-bottom: 1px solid var(--gray-5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-bar .m-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}
.nav-bar .m-menu-btn {
  position: fixed;
  right: 12px;
  top: 0;
  height: var(--nav-h);
  width: 44px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.nav-bar .m-menu-btn span {
  display: block;
  width: 26px;
  height: 2px;
  background: #000000;
  border-radius: 2px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
  transform-origin: center;
}
.nav-bar .m-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-bar .m-menu-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-bar .m-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-bar .m-nav-height { height: var(--nav-h); }

/* Mobile nav: full-screen smooth overlay */
.nav-bar .nav-bar-tab {
  display: block;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  height: calc(100vh - var(--nav-h));
  width: 100%;
  background: var(--white);
  z-index: 999;
  overflow-y: auto;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -16px, 0);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s step-end;
  pointer-events: none;
  will-change: transform, opacity;
}
.nav-bar .nav-bar-tab.open {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s linear;
  pointer-events: auto;
}
.nav-bar .nav-bar-tab-li {
  height: 54px;
  line-height: 54px;
  font-size: 16px;
  text-align: center;
  border-bottom: 1px solid var(--gray-5);
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}
.nav-bar .nav-bar-tab.open .nav-bar-tab-li {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
.nav-bar .nav-bar-tab.open .nav-bar-tab-li:nth-child(1) { transition-delay: 0.04s; }
.nav-bar .nav-bar-tab.open .nav-bar-tab-li:nth-child(2) { transition-delay: 0.07s; }
.nav-bar .nav-bar-tab.open .nav-bar-tab-li:nth-child(3) { transition-delay: 0.10s; }
.nav-bar .nav-bar-tab.open .nav-bar-tab-li:nth-child(4) { transition-delay: 0.13s; }
.nav-bar .nav-bar-tab.open .nav-bar-tab-li:nth-child(5) { transition-delay: 0.16s; }
.nav-bar .nav-bar-tab.open .nav-bar-tab-li:nth-child(6) { transition-delay: 0.19s; }
.nav-bar .nav-bar-tab.open .nav-bar-tab-li:nth-child(7) { transition-delay: 0.22s; }

.nav-bar .nav-bar-tab-li a {
  display: block;
  color: var(--black);
  width: 100%;
  height: 100%;
}
.nav-bar .nav-bar-tab-li a.active { font-weight: 600; }

/* Desktop logo — hidden on mobile */
.nav-bar .logo { display: none; }

/* Original Logo Image */
.logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  transition: opacity 0.2s;
  display: block;
}
.logo-img:hover {
  opacity: 0.8;
}

/* Mobile logo sizing */
.nav-bar .m-logo {
  height: 54px;
  width: auto;
  display: block;
}

/* Footer logo */
.footer-logo img, .footer-brand-logo img {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* ── Desktop nav (960px+) ── */
@media screen and (min-width: 960px) {
  .nav-bar .m-nav-box { display: none; }
  .nav-bar .m-nav-height { display: none; }
  .nav-bar .m-menu-btn { display: none; }

  .nav-bar {
    height: var(--nav-h);
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-5);
    z-index: 1000;
  }

  .nav-bar-tab-box {
    width: 100%;
    padding: 0 48px;
    height: var(--nav-h);
    display: flex;
    align-items: center;
  }

  .nav-bar .logo { display: flex; align-items: center; flex-shrink: 0; }

  .nav-bar .nav-bar-tab {
    display: flex !important;
    position: static;
    height: var(--nav-h);
    width: auto;
    background: transparent;
    margin-left: auto;
    align-items: center;
    list-style: none;
    overflow: visible;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    transition: none !important;
  }

  .nav-bar .nav-bar-tab-li {
    line-height: var(--nav-h);
    font-size: 16px;
    text-align: left;
    border-bottom: none;
    position: relative;
    white-space: nowrap;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Vertical dividers between items */
  .nav-bar .nav-bar-tab-li::after {
    content: '';
    position: absolute;
    right: 0; top: 22px;
    width: 1px; height: 15px;
    background: var(--black);
    z-index: 9;
  }
  .nav-bar .nav-bar-tab-li:last-child::after { display: none; }

  .nav-bar .nav-bar-tab-li a {
    color: var(--black);
    padding: 0 20px;
    display: block;
    font-size: 16px;
    height: var(--nav-h);
    line-height: var(--nav-h);
    position: relative;
  }
  .nav-bar .nav-bar-tab-li a::after {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--black);
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .nav-bar .nav-bar-tab-li a:hover::after,
  .nav-bar .nav-bar-tab-li a.active::after {
    opacity: 1;
  }

  /* Top offset for content below nav */
  .nav-bar + * { margin-top: var(--nav-h); }
}

/* ── Scroll to top ── */
#top {
  position: fixed;
  right: 15px;
  bottom: 40px;
  width: 36px;
  height: 36px;
  z-index: 99999;
  cursor: pointer;
  display: none;
  background: var(--black);
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}
#top:hover { opacity: 1; }
#top svg { display: block; }

/* ── Footer nav (hidden by default) ── */
#footNav { display: none; }

/* ── Waterfall masonry (Lifang exact) ── */
.content {
  margin: 0;
  padding-top: var(--nav-h); /* push below fixed nav */
}
.waterfull { width: 100%; }
.waterfull .photo {
  display: flex;
  gap: 0;
  align-items: flex-start;
}
.waterfull ul.col {
  list-style: none;
  flex: 1;
  margin-right: 4px;
}
.waterfull ul.col:last-child { margin-right: 0; }
.waterfull ul li {
  width: 100%;
  margin-bottom: 4px;
  overflow: hidden;
  cursor: pointer;
}
.waterfull ul li img {
  width: 100%;
  vertical-align: middle;
  display: block;
  transition: transform 0.5s ease;
  will-change: transform;
}
.waterfull ul li:hover img { transform: scale(1.05); }

/* Layout containment: isolate masonry reflows */
.waterfull ul.col {
  contain: layout style;
}

@media screen and (min-width: 960px) {
  .content {
    width: 100%;
    padding: var(--nav-h) 44px 0 44px;
    margin: 0;
    box-sizing: border-box;
  }
}

/* Mobile: 1 column, edge-to-edge like Lifang */
@media (max-width: 959px) {
  .content {
    margin: 0;
    padding-top: 0; /* m-nav-height spacer div already handles the offset */
  }
  .waterfull ul.col:nth-child(2),
  .waterfull ul.col:nth-child(3),
  .waterfull ul.col:nth-child(4) {
    display: none;
  }
  .waterfull ul.col:nth-child(1) {
    margin-right: 0;
  }
  .waterfull ul li {
    margin-bottom: 4px;
  }
  .waterfull ul li img {
    width: 100%;
    height: auto;
  }
}

/* Wrapper */
#wrapper {
  min-height: 80vh;
}

/* ── Lightbox ── */
#lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
}
#lightbox.open { display: flex; }
#lightbox-img-wrap {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}
#lightbox-close {
  position: fixed; top: 16px; right: 20px;
  color: rgba(255,255,255,0.85); font-size: 1.6rem;
  cursor: pointer; background: none; border: none;
  line-height: 1; padding: 6px; z-index: 100000;
  transition: color 0.2s;
}
#lightbox-close:hover { color: #fff; }
#lightbox-prev, #lightbox-next {
  position: fixed; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,0.75); font-size: 2.5rem;
  cursor: pointer; background: none; border: none;
  line-height: 1; padding: 16px; z-index: 100000;
  transition: color 0.2s;
}
#lightbox-prev:hover, #lightbox-next:hover { color: #fff; }
#lightbox-prev { left: 10px; }
#lightbox-next { right: 10px; }
#lightbox-caption { display: none; }

/* ── Typography helpers ── */
.label {
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gray-3);
  display: flex; align-items: center; gap: 12px;
}
.label::before {
  content: '';
  display: block;
  width: 24px; height: 1px;
  background: var(--gray-4);
}
.t-display {
  font-size: clamp(2.4rem, 6vw, 5.5rem);
  font-weight: 700; line-height: 0.97;
  letter-spacing: -0.03em; color: var(--ink);
}
.t-title { font-size: clamp(1.4rem, 2.5vw, 2rem); font-weight: 600; color: var(--ink); line-height: 1.15; }
.t-body { font-size: 0.95rem; line-height: 1.8; color: var(--gray-1); font-weight: 300; }
.t-small { font-size: 0.72rem; letter-spacing: 0.06em; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px;
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid var(--ink); color: var(--ink);
  background: transparent; cursor: pointer;
  transition: all 0.25s;
}
.btn:hover { background: var(--ink); color: var(--white); }
.btn-dark { background: var(--ink); color: var(--white); }
.btn-dark:hover { opacity: 0.85; }
.btn-outline { border: 1px solid var(--gray-4); color: var(--gray-2); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost { background: none; color: var(--ink); border: 1px solid var(--gray-4); }
.btn-ghost:hover { background: var(--gray-5); }

/* ── Reveal animations ── */
.reveal, .reveal-left {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-left { transform: translateX(-24px); }
.reveal.in, .reveal-left.in { opacity: 1; transform: translate(0); }
.d1 { transition-delay: 0.12s; }
.d2 { transition-delay: 0.24s; }
.d3 { transition-delay: 0.36s; }
.d4 { transition-delay: 0.48s; }
.d5 { transition-delay: 0.60s; }
.d6 { transition-delay: 0.72s; }
.d7 { transition-delay: 0.84s; }

/* ── Contact ── */
.contact-section {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 80px;
  padding: 60px 40px clamp(80px, 10vw, 140px);
  max-width: 1100px; margin: 0 auto;
}
.contact-info { display: flex; flex-direction: column; gap: 40px; }
.contact-info-item h5 {
  font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gray-3); margin-bottom: 6px;
}
.contact-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gray-2); }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px 16px; border: 1px solid var(--gray-5);
  font-family: inherit; font-size: 0.9rem; color: var(--ink);
  background: var(--white); outline: none; border-radius: 0;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--gray-3); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group select { -webkit-appearance: none; appearance: none; }

/* ── Footer ── */
#footer {
  background: var(--white);
  border-top: 1px solid var(--gray-5);
  padding: clamp(48px, 6vw, 72px) 40px clamp(32px, 4vw, 48px);
  position: relative;
}
.footer-bg { display: none; } /* remove dark bg image */
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-row-container { display: grid; grid-template-columns: 1fr 2fr; gap: 80px; }
.footer-logo img { height: 40px; width: auto; object-fit: contain; margin-bottom: 20px; filter: none; }
.footer-tagline { font-size: 0.82rem; color: var(--gray-2); line-height: 1.7; max-width: 300px; }
.footer-social-icons { display: flex; gap: 16px; margin-top: 24px; }
.footer-social-icons a { color: var(--gray-3); transition: color 0.2s; }
.footer-social-icons a:hover { color: var(--ink); }
.footer-bottom-bar {
  margin-top: 48px; padding-top: 20px;
  border-top: 1px solid var(--gray-5);
  display: flex; justify-content: space-between;
}
.footer-copyright { font-size: 0.65rem; color: var(--gray-4); letter-spacing: 0.1em; }

/* ── Admin panel ── */
.admin-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--white);
}
.admin-login-box {
  width: 100%; max-width: 400px;
  padding: 48px 40px;
  border: 1px solid var(--gray-5);
  text-align: center;
}
.admin-login-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 8px; }
.admin-login-sub { font-size: 0.78rem; color: var(--gray-3); margin-bottom: 32px; }
.admin-login-form { display: flex; flex-direction: column; gap: 12px; }
.admin-login-form input {
  padding: 12px 16px; border: 1px solid var(--gray-5);
  font-family: inherit; font-size: 0.9rem; outline: none;
  text-align: center;
}
.admin-login-err { font-size: 0.72rem; color: #e74c3c; min-height: 1.2em; }
.admin-dash { max-width: 900px; margin: 0 auto; padding: 48px 32px; }
.admin-dash-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 32px; margin-bottom: 32px;
  border-bottom: 1px solid var(--gray-5);
}
.admin-dash-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -0.03em; }
.section-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 24px; }
.stab {
  padding: 8px 18px; font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 500; border: 1px solid var(--gray-5); color: var(--gray-2);
  cursor: pointer; background: var(--white); transition: all 0.2s;
}
.stab:hover { border-color: var(--gray-3); color: var(--ink); }
.stab.active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.drop-zone {
  border: 2px dashed var(--gray-4);
  padding: 48px 32px; text-align: center;
  cursor: pointer; background: var(--white);
  transition: border-color 0.2s, background 0.2s; position: relative;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--ink); background: var(--gray-5); }
.drop-icon { font-size: 2rem; margin-bottom: 12px; }
.drop-text { font-size: 0.82rem; color: var(--gray-2); }
.drop-file-input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.admin-imgs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-top: 24px;
}
.admin-img-wrap {
  position: relative;
  border: 1px solid var(--gray-5);
}
.admin-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.admin-img-del {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.7); color: #fff;
  border: none; width: 24px; height: 24px; border-radius: 50%;
  font-size: 0.8rem; cursor: pointer; opacity: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s;
}
.admin-img-wrap:hover .admin-img-del { opacity: 1; }

/* Mobile responsive */
@media (max-width: 768px) {
  .contact-section { grid-template-columns: 1fr; gap: 48px; }
  .footer-row-container { grid-template-columns: 1fr; gap: 40px; }
  .admin-dash { padding: 32px 20px; }
}
@media (max-width: 560px) {
  .contact-section { padding: 40px 20px 80px; }
  #footer { padding: 40px 20px 32px; }
}

/* Admin Save Bar (Toast Alert) */
.admin-save-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: #111;
  color: #fff;
  padding: 12px 24px;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.15);
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}
.admin-save-bar.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.admin-save-bar button {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 0.6rem;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.admin-save-bar button:hover {
  background: #fff;
  color: #111;
  border-color: #fff;
}
