*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  vertical-align: top;
}
:root {
  --black: #050505;
  --white: #e0e0e0;
  --gray: #666;
  --sans: Arial, Helvetica, sans-serif;
  --serif: var(--sans);
  --mono: var(--sans);
  --nav-h: 56px;
  --thumb-h: 220px;
  --thumb-max-w: calc(100vw - 48px);
  --triangle-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpolygon points='12,3 22,21 2,21' fill='black'/%3E%3C/svg%3E") 12 12, pointer;
}
html { font-size: 16px; }
body {
  background: var(--white);
  color: var(--black);
  font-family: var(--sans);
  font-weight: 300;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: crosshair;
}

/* NAV */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 200;
  background: transparent;
  border-bottom: none;
}
.nav-logo {
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--black);
  text-decoration: none;
  cursor: crosshair;
}
.nav-links { display: flex; gap: 2.5rem; list-style: none; }
.nav-links a {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.45);
  text-decoration: none;
  transition: color 0.2s;
  cursor: crosshair;
}
.nav-links a:hover, .nav-links a.active { color: var(--black); }

.nav-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  color: rgba(0,0,0,0.35);
  cursor: crosshair;
  transition: color 0.2s, transform 0.2s;
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.nav-back:hover { color: var(--black); transform: scale(1.1); }
.nav-back.visible { display: flex; }

/* SECTIONS */
.section { display: none; padding-top: var(--nav-h); min-height: 100vh; }
.section.visible { display: block; animation: fadeUp 0.3s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* PROJECTS LIST */
#projects { position: relative; padding-top: calc(var(--nav-h) + 5vh); }
/* 프로젝트 그리드 전체 여백 */
.project-list {
  padding: 24px 24px 6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  align-content: flex-start;
  column-gap: 24px;
  row-gap: 24px;
  min-height: calc(100vh - var(--nav-h) - 4rem);
  width: 100%;
  margin: 0;
}
.project-item {
  display: flex;
  flex-direction: column;
  position: relative;
  border: none;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  background: transparent;
  cursor: crosshair;
  transition: color 0.3s ease, opacity 0.55s ease, filter 0.55s ease;
  width: auto;
  height: auto;
}
.project-list.is-filtering .project-item {
  opacity: 0;
  filter: blur(8px);
  pointer-events: none;
}
.project-list.is-filtering .project-item.is-same-project {
  opacity: 1;
  filter: blur(0);
  pointer-events: auto;
}
.project-list.list-view.is-filtering .project-item {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}
.project-item:hover {

}
.project-item:hover .project-number {
  color: #ff4fa0;
  opacity: 1;
}
.project-item:hover .project-title {
  color: #ff4fa0;
}
.project-thumb {
  width: auto;
  max-width: var(--thumb-max-w);
  height: var(--thumb-h);
  object-fit: contain;
  object-position: left bottom;
  display: block;
}
/* 각 카드 내부 여백 */
.project-info {
  position: static;
  padding: 0.4rem 0 0; /* 썸네일 아래 텍스트 간격 */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  background: transparent;
  color: var(--black);
}
.project-number {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  opacity: 0.7;
}
.project-title {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
@media (max-width: 700px) {
  .project-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    align-content: flex-start;
    column-gap: 24px;
    row-gap: 24px;
    padding: 24px 24px 4rem;
    min-height: auto;
  }
  .project-item {
    grid-column: unset !important;
    grid-row: unset !important;
    margin-top: 0 !important;
    height: auto;
    width: calc((100% - 24px) / 2);
    flex: 0 0 calc((100% - 24px) / 2);
  }
  .project-thumb {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain;
    object-position: left bottom;
  }
  .project-info {
    position: relative;
    background: rgba(224,224,224,0.95);
    color: var(--black);
    padding-left: 1rem;
  }
  /* 모바일에서는 리스트뷰를 무시하고 항상 그리드(썸네일) 형태 */
  .project-list.list-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    flex-direction: unset;
  }
  .project-list.list-view .project-item {
    flex-direction: column;
    height: auto;
    border-bottom: none;
    padding: 0;
  }
  .project-list.list-view .project-thumb { display: block; }
  .project-list.list-view .project-info {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0 0;
    border-left: none;
    gap: 0;
  }
  .project-list.list-view .project-number { display: block; }
  .project-list.list-view .project-meta { display: block; }
}

.project-controls {
  position: fixed;
  top: calc(50vh - 16px);
  right: 7rem;
  width: 32px;
  margin: 0;
  padding: 0;
  display: block;
  z-index: 1000;
}
.view-toggle {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  position: relative;
  z-index: 2;
  transition: background 0.2s, border-radius 0.2s, opacity 0.2s, transform 0.2s;
}
.view-toggle::before {
  content: none;
}
.view-toggle.list-mode {
  border-radius: 0;
}
.view-toggle.list-mode::before {
  content: none;
}
.project-controls.is-open .view-toggle {
  background: transparent;
  border: none;
  border-radius: 50%;
  opacity: 0;
}
.home-info-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(340px, calc(100vw - 48px));
  min-height: 220px;
  max-height: min(420px, calc(100vh - 96px));
  padding: 18px;
  background: #111818;
  border: 1px solid #c7f3ff;
  color: #c7f3ff;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow: auto;
  opacity: 0;
  transform: scale(0.92);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.home-info-panel p {
  max-width: 100%;
}
.project-controls.is-open .home-info-panel {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

a,
button,
.project-item,
.writing-item,
[onclick],
[role="button"] {
  cursor: var(--triangle-cursor);
}
.project-item { cursor: none; }

#cursorTriangle {
  position: fixed;
  top: 0; left: 0;
  width: 24px; height: 24px;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.08s;
}
#cursorTriangle.visible { opacity: 1; }

.project-list.list-view {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.project-list.list-view .project-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 1rem;
  border: 1px solid rgba(0,0,0,0.08);
  background: var(--white);
  margin-top: 0 !important;
}
.project-list.list-view .project-item:hover {
  background: #d8d8d8;
}
.project-list.list-view .project-thumb {
  display: none;
}
.project-meta {
  display: none;
}
.project-list.list-view .project-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0;
  margin: 0;
}
.project-list.list-view .project-number {
  opacity: 0.8;
}
.project-list.list-view .project-title {
  white-space: normal;
  overflow: visible;
}
.project-list.list-view .project-meta {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--gray);
  letter-spacing: 0.12em;
}

/* ZOOM CONTROLS */

/* HOVER IMG */
.hover-img {
  display: none !important;
}

/* DETAIL */
#detail {
  display: none;
  padding-top: var(--nav-h);
  height: 100vh;
  overflow: hidden;
}
#detail.visible {
  display: flex;
  flex-direction: row;
  animation: fadeUp 0.35s ease both;
}

.detail-left {
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 3.5rem 3rem 6rem 2rem;
  scrollbar-width: none;
  flex-shrink: 0;
  width: 35%;
  min-width: 240px;
  max-width: calc(100% - 240px);
}
.detail-left::-webkit-scrollbar { display: none; }
.detail-inner { max-width: 35vw; }

/* RESIZER */
.detail-resizer {
  width: 13px;
  height: calc(100vh - var(--nav-h));
  flex-shrink: 0;
  cursor: col-resize;
  position: relative;
  z-index: 10;
  background: transparent;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.detail-resizer::before {
  content: '';
  width: 1px;
  background: var(--black);
  transition: background 0.15s, width 0.15s;
  flex-shrink: 0;
}
.detail-resizer:hover::before,
.detail-resizer.dragging::before {
  width: 3px;
  background: var(--black);
}

.detail-header { margin-bottom: 2.8rem; border-bottom: 1px solid var(--black); padding-bottom: 1.5rem; }
.detail-label {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.8rem;
}
.detail-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.05;
  margin-bottom: 1.2rem;
}
.detail-info {
  display: flex;
  gap: 2rem;
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  color: var(--gray);
  text-transform: uppercase;
}

.essay-block { margin-bottom: 1.8rem; }
.essay-block p {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.88;
  font-weight: 300;
}
.essay-block p + p { margin-top: 1rem; }

.essay-img {
  width: 100%;
  display: block;
  margin: 2.2rem 0 0.5rem;
}
.essay-img-caption {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--gray);
  margin-bottom: 2rem;
}
.essay-pull {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-style: italic;
  font-weight: 300;
  line-height: 1.45;
  border-left: 1.5px solid var(--black);
  padding-left: 1.2rem;
  margin: 2.5rem 0;
}

/* GALLERY (right col) */
.detail-right {
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 240px;
  padding: 2.5rem 3rem 8rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.8rem;
  box-sizing: border-box;
}
.detail-right::-webkit-scrollbar { display: none; }
.gallery-figure {
  display: flex;
  flex-direction: column;
}
.gallery-img-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.gallery-img {
  width: 85%;
  display: block;
  object-fit: cover;
  flex-shrink: 0;
}
.gallery-num {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: var(--gray);
  padding-top: 0.3rem;
  flex-shrink: 0;
}
.gallery-caption {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--gray);
  margin-top: 0.5rem;
}

/* ABOUT */
#about { padding: calc(var(--nav-h) + 8vh) 2rem 8vh; max-width: 680px; }
.about-label { font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gray); margin-bottom: 3rem; }
.about-text { font-family: var(--serif); font-size: clamp(1.45rem, 2.5vw, 2rem); font-weight: 300; line-height: 1.6; margin-bottom: 3.5rem; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; border-top: 1px solid var(--black); padding-top: 2rem; }
.about-col-label { font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gray); margin-bottom: 0.8rem; }
.about-col-content { font-size: 0.78rem; line-height: 2; letter-spacing: 0.02em; }
.contact-link {
  display: inline-block; margin-top: 2.5rem;
  font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--black); text-decoration: none;
  border-bottom: 1px solid var(--black); padding-bottom: 2px;
  transition: opacity 0.2s;
}
.contact-link:hover { opacity: 0.4; }

/* WRITINGS */
#writings {
  height: 100vh;
  overflow: hidden;
  min-height: unset;
  padding: 0 !important;
}
#writings.visible {
  display: flex !important;
  flex-direction: row;
}
.writings-left {
  height: calc(100vh - var(--nav-h));
  margin-top: var(--nav-h);
  overflow-y: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  width: 40%;
  min-width: 240px;
  max-width: calc(100% - 240px);
  padding: 2.5rem 2rem 6rem;
}
.writings-left::-webkit-scrollbar { display: none; }
.writings-resizer {
  width: 13px;
  height: calc(100vh - var(--nav-h));
  margin-top: var(--nav-h);
  flex-shrink: 0;
  cursor: col-resize;
  position: relative;
  z-index: 10;
  background: transparent;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.writings-resizer::before {
  content: '';
  width: 1px;
  background: var(--black);
  transition: background 0.15s, width 0.15s;
  flex-shrink: 0;
}
.writings-resizer:hover::before,
.writings-resizer.dragging::before { width: 3px; }
.writings-right {
  height: calc(100vh - var(--nav-h));
  margin-top: var(--nav-h);
  overflow-y: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 240px;
  padding: 2.5rem 3rem 8rem 2.5rem;
}
.writings-right::-webkit-scrollbar { display: none; }
.writings-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gray);
}
.writings-list { }
.writing-item {
  border-top: 1px solid var(--black);
  padding: 1.4rem 0;
  display: grid; grid-template-columns: 1fr auto;
  align-items: start; gap: 1.5rem;
  transition: opacity 0.2s;
  cursor: crosshair;
}
.writing-item:last-child { border-bottom: 1px solid var(--black); }
.writings-list:hover .writing-item { opacity: 0.2; }
.writings-list:hover .writing-item:hover { opacity: 1; }
.writing-item.active { opacity: 1 !important; }
.writing-item.active .writing-title { color: #ff4fa0; }
.writing-title { font-family: var(--sans); font-size: clamp(0.95rem, 1.5vw, 1.2rem); font-weight: 400; line-height: 1.25; margin-bottom: 0.3rem; }
.writing-desc { font-size: 0.65rem; color: var(--gray); letter-spacing: 0.04em; line-height: 1.7; }
.writing-date { font-size: 0.62rem; letter-spacing: 0.1em; color: var(--gray); white-space: nowrap; padding-top: 0.25rem; }
.writing-detail-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--black);
}
.writing-detail-title {
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.writing-detail-meta {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--gray);
  text-transform: uppercase;
}
.writing-detail-body p {
  font-size: 0.95rem;
  line-height: 1.9;
  max-width: 620px;
}
.writing-detail-body p + p { margin-top: 1.2rem; }

/* FOOTER */
footer { border-top: 1px solid var(--black); padding: 1.5rem 2rem; display: flex; justify-content: space-between; align-items: center; }
footer span { font-size: 0.62rem; letter-spacing: 0.1em; color: var(--gray); text-transform: uppercase; }

@media (max-width: 700px) {
  .project-controls {
    display: block;
    top: auto;
    right: 1.2rem;
    bottom: 1.2rem;
  }
  .home-info-panel {
    top: auto;
    right: 0;
    bottom: 0;
    width: min(320px, calc(100vw - 2.4rem));
    min-height: 200px;
    max-height: calc(100vh - 112px);
    padding-top: 18px;
    padding-bottom: 18px;
    transform-origin: bottom right;
  }
  #detail.visible { flex-direction: column; }
  .detail-right { display: none; }
  .detail-resizer { display: none; }
  .detail-left { border-right: none; padding-right: 1.2rem; width: 100% !important; max-width: 100%; }
  .detail-inner { max-width: 100%; }
  #writings.visible { flex-direction: column; }
  .writings-right { display: none; }
  .writings-resizer { display: none; }
  .writings-left { width: 100% !important; max-width: 100%; }
  #writings.writing-detail-open .writings-left { display: none; }
  #writings.writing-detail-open .writings-right {
    display: block;
    width: 100%;
    height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    padding: 3.5rem 1.2rem 6rem;
    box-sizing: border-box;
  }
  .hover-img { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  nav { padding: 0 1.2rem; }
  .nav-links { gap: 1.5rem; }
  #nav-projects { display: none; }
}
