/* ══════════════════════════════
   Portfolio Page — Redesigned
   ══════════════════════════════ */

.nav-active { color: var(--ink) !important; font-weight: 600; }

/* ── Page Header ── */
.port-header {
  padding: 130px 2rem 2rem;
  text-align: center;
}
.port-eyebrow {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.port-title {
  font-family: var(--font-d);
  font-size: clamp(5rem, 16vw, 14rem);
  line-height: 0.87;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin-bottom: 1.5rem;
}
.port-sub {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Tabs ── */
.tabs-wrap {
  display: flex;
  justify-content: center;
  padding: 2rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 60px;
  background: var(--bg);
  z-index: 100;
}
.tabs {
  position: relative;
  display: inline-flex;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 5px;
  gap: 2px;
}
.tab {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.5rem;
  border-radius: 100px;
  font-family: var(--font-b); font-size: 0.85rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  transition: color 0.25s;
  white-space: nowrap; background: none; border: none;
}
.tab.active { color: var(--ink); }
.tab-count {
  font-size: 0.68rem; font-weight: 700;
  background: var(--line); color: var(--muted);
  padding: 0.1rem 0.45rem; border-radius: 100px;
  min-width: 22px; text-align: center;
  transition: background .3s, color .3s;
}
.tab.active .tab-count { background: var(--ink); color: var(--bg); }
.tab-ink {
  position: absolute; top: 5px;
  height: calc(100% - 10px);
  background: #fff; border-radius: 100px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  transition: left .4s cubic-bezier(0.16,1,0.3,1), width .4s cubic-bezier(0.16,1,0.3,1);
  z-index: 0; pointer-events: none;
}

/* ── Grid ── */
.port-main {
  padding: 3rem 2rem 8rem;
  max-width: 1400px;
  margin: 0 auto;
}
.port-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
}
.port-grid.grid-books  { grid-template-columns: repeat(5, 1fr); gap: 0.75rem; }
.port-grid.grid-social { grid-template-columns: repeat(3, 1fr); }

/* ── Card ── */
.port-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: #e4e4e0;
  /* entry */
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
  /* 3d tilt */
  transform-style: preserve-3d;
  will-change: transform;
}
.port-card.vis { opacity: 1; transform: translateY(0) rotateX(0) rotateY(0); }

/* Image wrapper keeps aspect ratio */
.card-img-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
}
.port-grid:not(.grid-books):not(.grid-social) .card-img-wrap { aspect-ratio: 16/10; }
.port-grid.grid-books  .card-img-wrap { aspect-ratio: 3/4; background: #f5f2ed; }
.port-grid.grid-social .card-img-wrap { aspect-ratio: 1/1; }

/* Skeleton shimmer while image loads */
.card-img-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, #e4e4e0 25%, #d8d8d4 50%, #e4e4e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  z-index: 0;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Default image (books + social) ── */
.port-card-img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  position: relative; z-index: 1;
  transition: transform .6s cubic-bezier(0.16,1,0.3,1);
  transform-origin: center top;
}
.port-grid.grid-books .port-card-img {
  object-fit: contain;
  padding: 10px;
}

/* ── Website scroll image — natural height, top-aligned ── */
.port-grid:not(.grid-books):not(.grid-social) .port-card-img {
  height: auto;          /* natural full height */
  min-height: 100%;
  object-fit: unset;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  transform: translateY(0);
  /* transition is set dynamically by JS */
}

/* ── HOVER EFFECT ── */
.card-overlay {
  position: absolute; inset: 0; z-index: 2;
  background: rgba(10,10,10,0.0);
  transition: background .4s;
  border-radius: 12px;
}
.port-card:hover .card-overlay { background: rgba(10,10,10,0.48); }

/* Clip-path reveal stripe from bottom */
.card-hover-content {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  clip-path: inset(100% 0 0 0);
  transition: clip-path .45s cubic-bezier(0.16,1,0.3,1);
}
.port-card:hover .card-hover-content { clip-path: inset(0% 0 0 0); }

.card-hover-tag {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(255,255,255,0.55); margin-bottom: 0.3rem;
}
.card-hover-title {
  font-family: var(--font-d);
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1.2;
}

/* View pill — appears center */
.card-view-pill {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.75);
  z-index: 4;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff;
  font-family: var(--font-d);
  font-size: 0.8rem; letter-spacing: 0.1em;
  padding: 0.45rem 1rem;
  border-radius: 100px;
  opacity: 0;
  transition: opacity .3s, transform .4s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
  white-space: nowrap;
}
.port-card:hover .card-view-pill {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Image zoom on hover */
.port-card:hover .port-card-img { transform: scale(1.07); }

/* ════════════════════════════════════
   LIGHTBOX — Full redesign
   ════════════════════════════════════ */

.lb-backdrop {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(6,6,6,0);
  backdrop-filter: blur(0px) saturate(100%);
  transition: background .45s, backdrop-filter .45s;
  pointer-events: none; visibility: hidden;
}
.lb-backdrop.open {
  background: rgba(6,6,6,0.92);
  backdrop-filter: blur(20px) saturate(140%);
  pointer-events: all; visibility: visible;
}

.lightbox {
  position: fixed; inset: 0; z-index: 3001;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; visibility: hidden;
}
.lightbox.open { pointer-events: all; visibility: visible; }

/* ── Lightbox box ── */
.lb-box {
  position: relative;
  display: flex; flex-direction: column;
  max-width: min(90vw, 1000px);
  width: 100%;
  max-height: 92vh;
  opacity: 0;
  transform: translateY(32px) scale(0.95);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.lightbox.open .lb-box { opacity: 1; transform: translateY(0) scale(1); }

/* Top bar */
.lb-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 0.9rem;
  margin-bottom: 0;
}
.lb-topbar-left { display: flex; flex-direction: column; gap: 0.15rem; }
.lb-cat   { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(255,255,255,0.4); }
.lb-title { font-family: var(--font-d); font-size: 1rem; letter-spacing: 0.02em; color: #fff; max-width: 600px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-topbar-right { display: flex; align-items: center; gap: 1rem; }
.lb-counter { font-size: 0.72rem; color: rgba(255,255,255,0.4); font-family: var(--font-d); letter-spacing: 0.06em; }
.lb-close-btn,
.lb-expand-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s, transform .3s var(--ease);
  font-size: 0.85rem; line-height: 1;
}
.lb-close-btn:hover  { background: rgba(255,255,255,0.18); transform: rotate(90deg); }
.lb-expand-btn:hover { background: rgba(255,255,255,0.18); transform: scale(1.1); }

/* ── Full-view / expanded mode ── */
.lb-box.expanded {
  max-width: 96vw;
  max-height: 96vh;
}
.lb-box.expanded .lb-img-area {
  overflow-y: auto;
  scroll-behavior: smooth;
  cursor: ns-resize;
  align-items: flex-start;
  justify-content: flex-start;
}
.lb-box.expanded .lb-img-area::-webkit-scrollbar { width: 4px; }
.lb-box.expanded .lb-img-area::-webkit-scrollbar-track { background: transparent; }
.lb-box.expanded .lb-img-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 2px; }
.lb-box.expanded .lb-img {
  max-height: none;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Image area */
.lb-img-area {
  position: relative;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
}
.lb-img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 100px);
  object-fit: contain;
  border-radius: 10px;
  transition: opacity .35s;
  user-select: none;
  -webkit-user-drag: none;
}
.lb-img.fading { opacity: 0; }

/* Prev / Next inside image area */
.lb-arr {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 2;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  border-radius: 50%; color: #fff; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .25s var(--ease);
}
.lb-arr:hover { background: rgba(255,255,255,0.22); }
.lb-prev { left: 0.75rem; }
.lb-next { right: 0.75rem; }
.lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.lb-next:hover { transform: translateY(-50%) translateX(2px); }
.lb-arr:disabled { opacity: .2; cursor: default; pointer-events: none; }

/* Dots strip at bottom */
.lb-dots {
  display: flex; justify-content: center; align-items: center;
  gap: 6px; padding-top: 0.9rem;
  overflow: hidden; max-width: 100%;
  flex-wrap: nowrap;
}
.lb-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: background .3s, transform .3s;
}
.lb-dot.active {
  background: #fff;
  transform: scale(1.4);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .port-grid.grid-books { grid-template-columns: repeat(4,1fr); }
}
@media (max-width: 860px) {
  .port-grid, .port-grid.grid-social { grid-template-columns: repeat(2,1fr); }
  .port-grid.grid-books { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 540px) {
  .port-grid, .port-grid.grid-books, .port-grid.grid-social { grid-template-columns: repeat(2,1fr); gap:.6rem; }
  .port-title { font-size: clamp(3.5rem,18vw,7rem); }
  .tabs { flex-wrap: wrap; border-radius: 16px; }
  .lb-arr { width: 36px; height: 36px; font-size: 0.85rem; }
}
