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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Manrope', sans-serif;
  background: #ffffff;
  color: #111;
  /* 그리드 마진 30px 적용 */
  padding: 0 30px;
}

.portfolio {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 900px;
  overflow: hidden;
}

/* ── 데스크탑 Nav (12컬럼 그리드 적용) ── */
.nav {
  display: flex;
  align-items: center;
  height: 42px;
  flex-shrink: 0;
  border-bottom: 1px solid #111;
  background: #ffffff;
}

/* 1~2컬럼: 로고 (약 16.6%) */
.nav-left-logo {
  flex: 0 0 calc(((100% - (11 * 30px)) / 12) * 2 + (1 * 30px));
}

.nav-left-logo a {
  font-size: 24px;
  font-weight: 400;
  color: #111;
  text-decoration: none;
}

/* 3~6컬럼: Works, Pieces (약 33.3%) */
.nav-center-menu {
  flex: 0 0 calc(((100% - (11 * 30px)) / 12) * 4 + (3 * 30px));
  display: flex;
  gap: 40px;
}

/* 7~11컬럼: Email, About (약 41.6%) */
.nav-right-info {
  flex: 0 0 calc(((100% - (11 * 30px)) / 12) * 5 + (4 * 30px));
  display: flex;
  justify-content: flex-end;
  gap: 40px;
}

/* 12컬럼: EN/KR (약 8.3%) */
.nav-lang {
  flex: 1; /* 남은 마지막 컬럼 전체 차지 */
  display: flex;
  justify-content: flex-end;
}

.nav a {
  font-size: 18px;
  color: #313131;
  text-decoration: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}

.nav a:hover { color: #111; }
.nav a.active {
  color: #111;
  font-weight: 600;
}

/* ── Main layout ── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar ── */
.sidebar {
  width: 440px;
  flex-shrink: 0;
  border-right: 1px solid #111;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 16px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.5s ease;
}

.sidebar.collapsed {
  width: 0;
  opacity: 0;
  border-color: transparent;
}

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 0 14px 0;
  flex-shrink: 0;
}

.filter-btn {
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.01em;
  transition: color 0.15s;
  white-space: nowrap;
}

.filter-btn:hover { color: #111; }
.filter-btn.active { color: #111; }

.project-list {
  overflow-y: auto;
  flex: 1;
  padding-bottom: 50px;
}

.project-list::-webkit-scrollbar { display: none; }

/* ── Project item ── */
.project-item {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  cursor: pointer;
  transition: opacity 0.12s;
}

.project-item:hover,
.project-item.active { opacity: 0.6; }

.project-thumb {
  width: 205px;
  height: 115px;
  flex-shrink: 0;
  background: #e0e0e0;
  overflow: hidden;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-name {
  font-size: 16px;
  font-weight: 500;
  color: #313131;
}

.project-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tag {
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 20px;
  white-space: nowrap;
  color: #313131;
}

.tag[data-tag="Identity"]    { background-color: #ffb9a1; }
.tag[data-tag="UXUI"]        { background-color: #c1daff; }
.tag[data-tag="Motion"]      { background-color: #99ff99; }
.tag[data-tag="Illustration"]{ background-color: #caa4ff; }
.tag[data-tag="Graphic"]     { background-color: #ffb3d7; }
.tag[data-tag="Typography"]  { background-color: #ffd9a6; }

/* ── Content panel ── */
.content {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  display: none;
  position: relative;
}

.content::-webkit-scrollbar { display: none; }

/* ── Expand 버튼 ── */
.expand-btn {
  position: sticky;
  top: 16px;
  float: right;
  margin: 16px 0 0 0;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10;
  flex-shrink: 0;
}

.expand-btn:hover { background: #d4d4d4; }

.expand-btn .material-symbols-outlined {
  font-size: 22px;
  color: #111;
}

/* ── content-inner ── */
.content-inner {
  padding: 0 0 60px 30px;
  transition: padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .content .content-inner {
  padding: 0 120px 40px 120px;
}

.content-title {
  font-size: 20px;
  font-weight: 500;
  color: #313131;
  margin: 16px 0 0 0;
}

.content-desc {
  font-size: 14px;
  color: #313131;
  line-height: 1.5;
  padding: 16px 0 30px 0;
}

.content-desc br {
  display: block;
  margin-bottom: 12px;
  content: '';
}

/* ── 이미지 세로 스택 ── */
.content-images {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content-image {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #e0e0e0;
  transition: max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .content .content-image {
  max-width: 1280px;
}

.content-image img {
  width: 100%;
  height: auto;
  display: block;
}

.content-image--empty {
  aspect-ratio: 16 / 9;
}

/* ── Hero ── */
.hero {
  position: absolute;
  top: 0;
  left: 440px;
  right: -30px;
  bottom: 0;
  display: none;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ══════════════════════════════════
   모바일 (768px 이하)
══════════════════════════════════ */
.nav-mobile { display: none; }
.mobile-menu { display: none; }
.mobile-main { display: none; }

@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
  }

  body {
    padding: 0;
  }

  .portfolio {
    min-width: unset;
    height: auto;
    overflow: visible;
  }

  .nav { display: none; }
  .main { display: none; }

  .nav-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 20px;
    border-bottom: 1px solid #111;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .nav-mobile-title {
    font-size: 15px;
    font-weight: 400;
    color: #111;
    text-decoration: none;
    letter-spacing: 0.08em;
  }

  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
  }

  .hamburger span {
    display: block;
    width: 22px;
    height: 1px;
    background: #111;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .hamburger.open span:first-child {
    transform: translateY(6px) rotate(45deg);
  }

  .hamburger.open span:last-child {
    transform: translateY(-6px) rotate(-45deg);
  }

  .mobile-menu {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #111;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    z-index: 99;
    transform: translateY(-110%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
  }

  .mobile-menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu a {
    font-size: 16px;
    color: #313131;
    text-decoration: none;
  }

  .mobile-menu a.active {
    color: #111;
    font-weight: 600;
  }

  .mobile-main {
    display: block;
    position: relative;
    overflow: hidden;
  }

  .mobile-hero {
    padding: 40px 20px 32px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-hero-name {
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: #111;
  }

  .mobile-hero-desc {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    max-width: 280px;
  }

  .mobile-hero-email {
    font-size: 13px;
    color: #aaa;
    text-decoration: none;
    margin-top: 8px;
  }

  .mobile-list {
    padding: 0;
  }

  .mobile-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
  }

  .mobile-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #e0e0e0;
    overflow: hidden;
  }

  .mobile-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .mobile-card-info {
    padding: 12px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-card-name {
    font-size: 15px;
    font-weight: 500;
    color: #111;
  }

  .mobile-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }

  .mobile-detail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    z-index: 200;
  }

  .mobile-detail.open {
    transform: translateX(0);
  }

  .mobile-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 16px 20px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: #111;
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
    z-index: 10;
  }

  .mobile-back .material-symbols-outlined {
    font-size: 20px;
  }

  .mobile-detail-inner {
    padding: 24px 20px 80px;
  }

  .mobile-detail-title {
    font-size: 18px;
    font-weight: 500;
    color: #111;
    margin-bottom: 10px;
  }

  .mobile-detail-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }

  .mobile-detail-desc {
    font-size: 14px;
    color: #313131;
    line-height: 1.6;
    margin-bottom: 24px;
  }

  .mobile-detail-desc br {
    display: block;
    margin-bottom: 12px;
    content: '';
  }

  .mobile-detail-images {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-detail-images img {
    width: 100%;
    height: auto;
    display: block;
  }
}

/* ── Page transitions ── */
@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pageOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}