/* ─────────────────────────────────────────
   ALIWAIH PORTFOLIO — style.css
   Palette: lavendar / brown
   Type: DM Sans (light / regular)
───────────────────────────────────────── */

:root {
  --lavendar:      #eff1f3;
  --lavendar-dark: #dbd3d8;
  --ink:        #22181c;
  --ink-mid:    #4A4540;
  --ink-light:  #BFB2BA;
  --accent:     #22181c;
  --nav-height: 50px;
  --font:       'DM Sans', sans-serif;
  --ease:       cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--lavendar);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }

/* ── NAV ── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--lavendar);
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

#nav.scrolled {
  border-bottom-color: rgba(26, 23, 20, 0.08);
}

.nav-name {
  font-family: 'Satoshi-Black', sans-serif;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 36px;
}

.nav-link {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
  transition: color 0.2s var(--ease);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--ink);
  transition: width 0.25s var(--ease);
}

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

.nav-link.active::after,
.nav-link:hover::after {
  width: 100%;
}

/* ── PAGE SHELL ── */
.page {
  padding-top: calc(var(--nav-height) + 48px);
  padding-bottom: 96px;
  min-height: 100vh;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.6s var(--ease) 0.1s forwards;
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── HOME GRID ── */
.home-grid {
  padding: 0 40px;
}

.asymmetric-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 80px;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Asymmetric placement for 3–5 images */
.asymmetric-grid .grid-item:nth-child(1) {
  grid-column: 1 / 6;
  grid-row: 1 / 8;
}
.asymmetric-grid .grid-item:nth-child(2) {
  grid-column: 6 / 9;
  grid-row: 2 / 6;
}
.asymmetric-grid .grid-item:nth-child(3) {
  grid-column: 9 / 13;
  grid-row: 1 / 7;
}
.asymmetric-grid .grid-item:nth-child(4) {
  grid-column: 6 / 10;
  grid-row: 6 / 10;
}
.asymmetric-grid .grid-item:nth-child(5) {
  grid-column: 10 / 13;
  grid-row: 7 / 11;
}

.grid-item {
  overflow: hidden;
  cursor: pointer;
  background: var(--lavendar-dark);
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), opacity 0.3s;
  opacity: 0;
}

.grid-item img.loaded { opacity: 1; }

.grid-item:hover img {
  transform: scale(1.03);
}

/* placeholder shimmer */
.grid-placeholder {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 80px;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}
.placeholder-block {
  background: var(--lavendar-dark);
  animation: shimmer 1.8s ease-in-out infinite;
}
.placeholder-block.tall   { grid-column: span 5; grid-row: span 7; }
.placeholder-block.short  { grid-column: span 3; grid-row: span 4; }
.placeholder-block.medium { grid-column: span 4; grid-row: span 6; }

@keyframes shimmer {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 28px;
  padding: 0 40px;
  margin-bottom: 40px;
  align-items: center;
}

.filter-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ── PHOTO / ART GRID ── */
.photo-grid {
  columns: 3;
  column-gap: 10px;
  padding: 0 40px;
}

.photo-grid .grid-item {
  break-inside: avoid;
  margin-bottom: 10px;
  cursor: pointer;
  overflow: hidden;
}

.photo-grid .grid-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s var(--ease), opacity 0.4s;
  opacity: 0;
}

.photo-grid .grid-item img.loaded { opacity: 1; }

.photo-grid .grid-item:hover img {
  transform: scale(1.02);
}

/* filter hide */
.grid-item.hidden {
  display: none;
}

/* ── CODE GRID ── */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2px;
  padding: 0 40px;
}

.code-card {
  background: var(--lavendar-dark);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background 0.2s var(--ease);
  opacity: 0;
  animation: fadeUp 0.5s var(--ease) forwards;
}

.code-card:hover {
  background: #ede7ee;
}

.code-card-title {
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
}

.code-card-desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--ink-mid);
  line-height: 1.7;
  flex: 1;
}

.code-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.code-tag {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light);
  border: 1px solid rgba(26,23,20,0.15);
  padding: 2px 8px;
  border-radius: 2px;
}

.code-card-links {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}

.code-card-link {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
  transition: opacity 0.2s;
}

.code-card-link:hover { opacity: 0.5; }

/* ── LIGHTBOX ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--lavendar);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  transform: scale(0.96);
  transition: transform 0.4s var(--ease);
}

.lightbox.open .lightbox-img {
  transform: scale(1);
}

.lightbox-caption {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
}

.lightbox-close {
  position: fixed;
  top: 28px; right: 36px;
  font-size: 28px;
  color: var(--ink-light);
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
  z-index: 201;
}

.lightbox-close:hover {
  color: var(--ink);
  transform: rotate(90deg);
}

/* ── EMPTY STATE ── */
.empty-state {
  padding: 80px 40px;
  font-size: 13px;
  color: var(--ink-light);
  letter-spacing: 0.05em;
}

/* ── LOADING SPINNER ── */
.loading {
  padding: 40px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  #nav { padding: 0 20px; }
  .nav-links { gap: 20px; }
  .nav-link { font-size: 11px; }

  .page { padding-top: calc(var(--nav-height) + 28px); }

  .home-grid { padding: 0 16px; }
  .asymmetric-grid {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 160px;
  }
  .asymmetric-grid .grid-item:nth-child(1) { grid-column: 1/3; grid-row: 1/3; }
  .asymmetric-grid .grid-item:nth-child(2) { grid-column: 1/2; grid-row: 3/5; }
  .asymmetric-grid .grid-item:nth-child(3) { grid-column: 2/3; grid-row: 3/5; }
  .asymmetric-grid .grid-item:nth-child(4) { grid-column: 1/2; grid-row: 5/7; }
  .asymmetric-grid .grid-item:nth-child(5) { grid-column: 2/3; grid-row: 5/7; }

  .photo-grid { columns: 2; padding: 0 16px; }
  .filter-bar { padding: 0 16px; gap: 16px; flex-wrap: wrap; }
  .code-grid  { padding: 0 16px; grid-template-columns: 1fr; }

  .lightbox-close { top: 20px; right: 20px; }
}

@media (max-width: 480px) {
  .photo-grid { columns: 1; }
  .nav-links { gap: 12px; }
}
