/* Lenscoder Portfolio Stylesheet */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #767676;
  --soft: #f5f5f3;
  --line: #e8e8e5;
  --max: 1680px;
  --side: clamp(20px, 4vw, 72px);
  --accent: #111111;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.site-header {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--side);
  position: relative;
  z-index: 10;
  background: #ffffff;
}

.brand {
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.brand span { font-weight: 400; color: #8b8b87; }

.nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 13px;
  color: #5f5f5c;
}
.nav a { transition: opacity 0.2s; }
.nav a:hover { opacity: 0.5; }

/* Intro */
.intro {
  padding: 68px var(--side) 96px;
  max-width: var(--max);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: clamp(32px, 6vw, 96px);
}

.intro-left {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 860px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8e8e89;
  margin-bottom: 22px;
}

.intro h1 {
  margin: 0;
  font-size: clamp(40px, 5.8vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.065em;
  font-weight: 500;
}

.intro-right {
  flex: 0 0 clamp(280px, 34vw, 460px);
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 6px;
}

.intro-right p {
  margin: 0;
  font-size: 15px;
  line-height: 1.8;
  color: #6f6f6b;
}

.intro-links {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #5f5f5c;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.intro-links a {
  transition: color 0.2s, opacity 0.2s;
}
.intro-links a:hover {
  color: #111111;
  opacity: 0.7;
}

/* Gallery Header */
.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 var(--side) 22px;
  border-bottom: 1px solid var(--line);
}
.gallery-title {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.filters {
  display: flex;
  gap: 20px;
  color: #8b8b87;
  font-size: 12px;
  flex-wrap: wrap;
}
.filters button {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-transform: capitalize;
  transition: color 0.2s;
}
.filters button.active, .filters button:hover { color: #111111; font-weight: 500; }

/* Masonry Waterfall */
.gallery {
  padding: 26px var(--side) 100px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: 300px;
}

.gallery-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.work {
  width: 100%;
  margin: 0;
  cursor: zoom-in;
  position: relative;
  overflow: hidden;
  background: #f3f3f1;
  border-radius: 2px;
}
.work img {
  width: 100%;
  height: auto;
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.35s ease-out;
  display: block;
}
.work img.loaded {
  opacity: 1;
}
.work:hover img { transform: scale(1.018); }
.work::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s;
  pointer-events: none;
}
.work:hover::after { background: rgba(0, 0, 0, 0.04); }
.work.hidden { display: none !important; }

/* Empty state */
.empty-gallery {
  text-align: center;
  padding: 80px 20px;
  color: #999;
  font-size: 14px;
  width: 100%;
}

.gallery-sentinel {
  width: 100%;
  height: 20px;
  pointer-events: none;
  visibility: hidden;
}

/* Footer */
footer {
  border-top: 1px solid var(--line);
  margin: 0 var(--side);
  padding: 32px 0 48px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 12px;
  color: #858581;
}
footer .right { display: flex; gap: 20px; flex-wrap: wrap; }
footer .right a:hover { color: #111; }

/* Lightbox / Detail */
.detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.985);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.detail.open { opacity: 1; visibility: visible; }

.detail-top {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: 72px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  pointer-events: none;
}
.detail-top-left {
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}
.detail-index {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #888;
}
.detail-spinner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 20px;
  background: rgba(245, 245, 243, 0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  font-size: 11px;
  color: #666;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.detail-spinner.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.detail-spinner .spinner-svg {
  width: 13px;
  height: 13px;
  animation: spin 0.8s linear infinite;
  color: #222;
}
.detail-spinner .spinner-text {
  font-size: 11px;
  color: #666;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.icon-btn {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(245, 245, 243, 0.92);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  color: #222;
}
.icon-btn:hover { background: #ececea; transform: scale(1.04); }
.icon-btn svg { width: 17px; height: 17px; }

/* Lightbox Detail Layout (Image left, Meta right for both portrait & landscape) */
.detail-body {
  width: min(1560px, calc(100% - 64px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 86px 0 54px;
  display: flex;
  align-items: center;
}
.detail-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(36px, 4.5vw, 84px);
  align-items: center;
  min-height: calc(100vh - 140px);
}
.detail-layout.portrait,
.detail-layout.landscape {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(36px, 4.5vw, 84px);
  align-items: center;
  min-height: calc(100vh - 140px);
}

.detail-layout .media {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  width: 100%;
}
.detail-layout .media-inner {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  max-height: calc(100vh - 140px);
  max-width: 100%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  border-radius: 2px;
  background: #f3f3f1;
}
.detail-layout .detail-thumb {
  max-height: calc(100vh - 140px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}
.detail-layout .detail-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.detail-layout .detail-preview.loaded {
  opacity: 1;
  pointer-events: auto;
}

.detail-layout .meta {
  align-self: center;
  padding-right: 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.meta-kicker {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #969691;
}
.meta h2 {
  margin: 0;
  font-weight: 500;
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.035em;
  color: #111;
}
.meta-desc {
  margin: 0;
  color: #656560;
  font-size: 13px;
  line-height: 1.85;
  white-space: pre-line;
}
.meta-desc:empty {
  display: none;
}
.meta-list {
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.meta-row {
  min-height: 38px;
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.meta-row .k { color: #9a9a95; }
.meta-row .v { text-align: right; color: #343432; word-break: break-word; }

.meta-note {
  margin-top: 0;
  color: #9a9a95;
  font-size: 10px;
  line-height: 1.7;
}

/* Toast alert */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111;
  color: #fff;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 999;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Responsive adjustments */
@media (max-width: 900px) {
  .gallery { gap: 10px; padding-top: 10px; }
  .gallery-column { gap: 10px; }
  .site-header { height: 76px; }
  .intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
    padding-top: 42px;
    padding-bottom: 56px;
  }
  .intro-right {
    max-width: 100%;
    width: 100%;
    flex: 1 1 auto;
  }
  .detail-body {
    width: calc(100% - 32px);
    display: block;
    min-height: auto;
    padding: 76px 0 40px;
  }
  .detail-layout,
  .detail-layout.portrait,
  .detail-layout.landscape {
    grid-template-columns: 1fr;
    gap: 30px;
    min-height: auto;
  }
  .detail-layout .media-inner,
  .detail-layout .detail-thumb {
    max-height: 68vh;
  }
  .detail-layout .meta { padding: 0 4px 28px; gap: 18px; }
}
@media (max-width: 600px) {
  .site-header { height: 64px; }
  .intro h1 { font-size: 38px; }
  .intro-right p { font-size: 13px; }
  .intro-links { gap: 16px; font-size: 12px; }
  .gallery-head { align-items: flex-start; gap: 16px; flex-direction: column; }
  .filters { gap: 12px; }
  .gallery { padding-left: 12px; padding-right: 12px; }
  .detail-top { height: 60px; padding: 0 16px; }
  .detail-top-left { gap: 10px; }
  .detail-spinner .spinner-text { display: none; }
  .detail-spinner { padding: 4px 6px; }
  .detail-body { padding-top: 70px; }
  footer { flex-direction: column; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.work { animation: rise 0.5s both; }

/* Filter Favorite Button (Star) */
.filters button.filter-fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8b8b87;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  padding: 0 2px;
}
.filters button.filter-fav-btn svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.filters button.filter-fav-btn:hover {
  color: #111111;
  transform: scale(1.15);
}
.filters button.filter-fav-btn.active {
  color: #111111;
  transform: scale(1.15);
}

/* Filter Lock Button & Locked Tags */
.filter-lock-btn {
  border: 0;
  background: none;
  padding: 0 4px;
  color: #999;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  margin-left: 6px;
}
.filter-lock-btn:hover { color: #111; transform: scale(1.1); }
.filter-lock-btn.unlocked {
  color: #ca8a04;
  font-weight: 500;
}
.filters button.locked-tag {
  color: #b45309;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.filters button.locked-tag.active {
  color: #111;
  font-weight: 600;
}

/* More Tags Dropdown */
.filter-dropdown-wrap {
  position: relative;
  display: inline-block;
}
.filter-dropdown-toggle {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}
.filter-dropdown-toggle:hover, .filter-dropdown-toggle.active {
  color: #111;
  font-weight: 500;
}
.filter-dropdown-toggle .arrow-icon {
  font-size: 10px;
  transition: transform 0.2s ease;
}
.filter-dropdown-wrap.open .filter-dropdown-toggle .arrow-icon {
  transform: rotate(180deg);
}
.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  padding: 6px 0;
  min-width: 140px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  flex-direction: column;
  animation: dropdownFade 0.15s ease-out;
}
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.filter-dropdown-wrap.open .filter-dropdown-menu {
  display: flex;
}
.filter-dropdown-menu button.dropdown-item {
  text-align: left;
  padding: 8px 14px;
  font-size: 12px;
  color: #555;
  background: none;
  border: 0;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-dropdown-menu button.dropdown-item:hover {
  background: #f5f5f4;
  color: #111;
}
.filter-dropdown-menu button.dropdown-item.active {
  color: #111;
  font-weight: 600;
  background: #f5f5f4;
}

/* Detail Tag Badges */
#detailTags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.detail-tag-pill {
  display: inline-block;
  background: #f4f4f5;
  color: #3f3f46;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: normal;
}


/* Unlock Password Modal */
.unlock-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 20px;
}
.unlock-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.unlock-modal-card {
  background: #ffffff;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  transform: translateY(15px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.unlock-modal-backdrop.open .unlock-modal-card {
  transform: translateY(0) scale(1);
}
.unlock-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.unlock-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fef3c7;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.unlock-modal-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: #111;
}
.unlock-modal-header p {
  margin: 0;
  font-size: 12px;
  color: #777;
}
.unlock-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.unlock-input-wrap input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  color: #111;
  outline: none;
  transition: border-color 0.2s;
}
.unlock-input-wrap input:focus {
  border-color: #111;
}
.btn-unlock-submit {
  padding: 10px 18px;
  background: #111;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-unlock-submit:hover { background: #333; }
.unlock-error {
  min-height: 18px;
  font-size: 12px;
  color: #dc2626;
  margin-bottom: 12px;
}
.unlock-modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.btn-unlock-cancel {
  border: 0;
  background: none;
  color: #777;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 12px;
}
.btn-unlock-cancel:hover { color: #111; }

