/* =========================================================
   SANGHO JIN — Portfolio
   Static HTML5 / CSS3 only. No JavaScript.
   ========================================================= */

:root {
  --color-background: #ffffff;
  --color-text: #111111;
  --color-muted: #777777;
  --color-line: #dddddd;
  --color-hover: #555555;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 96px;
  --space-8: 128px;

  --font-en: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-kr: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-en);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img { display: block; width: 100%; height: auto; }
figure { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--color-hover); }

a:focus-visible,
:focus-visible {
  outline: 1px solid var(--color-text);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Layout ---------- */

.page-container {
  width: min(100% - 64px, 1600px);
  margin-inline: auto;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  border-bottom: 1px solid var(--color-line);
}

.site-logo {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

.site-nav {
  display: flex;
  gap: var(--space-3);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav a { color: var(--color-muted); }
.site-nav a:hover { color: var(--color-hover); }
.site-nav a[aria-current="page"] {
  color: var(--color-text);
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 2px;
}

/* ---------- Page head ---------- */

.page-head {
  padding-top: var(--space-6);
  padding-bottom: var(--space-5);
}

.page-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 var(--space-4);
}

.project-categories {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.project-categories a { color: var(--color-muted); }
.project-categories a:hover { color: var(--color-hover); }
.project-categories a[aria-current="true"] {
  color: var(--color-text);
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 2px;
}

/* ---------- Project grid ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--space-3);
  row-gap: var(--space-6);
  margin: 0;
  padding: 0 0 var(--space-8);
  list-style: none;
}

.project-card { margin: 0; }

.project-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #f4f4f4;
}

.project-image picture {
  position: absolute;
  inset: 0;
  display: block;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
}

/* 대표 이미지 자동 전환 — CSS 크로스페이드 (JavaScript 미사용) */
@keyframes card-cycle {
  0%   { opacity: 1; }
  27%  { opacity: 1; }
  33%  { opacity: 0; }
  94%  { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes card-cycle-2 {
  0%   { opacity: 1; }
  42%  { opacity: 1; }
  50%  { opacity: 0; }
  92%  { opacity: 0; }
  100% { opacity: 1; }
}

.project-image--3 picture {
  animation: card-cycle 13.5s ease-in-out infinite;
}
.project-image--3 picture:nth-child(1) { animation-delay: 0s; }
.project-image--3 picture:nth-child(2) { animation-delay: -4.5s; }
.project-image--3 picture:nth-child(3) { animation-delay: -9s; }

.project-image--2 picture {
  animation: card-cycle-2 9s ease-in-out infinite;
}
.project-image--2 picture:nth-child(1) { animation-delay: 0s; }
.project-image--2 picture:nth-child(2) { animation-delay: -4.5s; }

@media (prefers-reduced-motion: reduce) {
  .project-image picture { animation: none; opacity: 0; }
  .project-image picture:first-child { opacity: 1; }
}

.project-card a:hover .project-image img { transform: scale(1.02); }
.project-card a:hover .project-title { color: var(--color-hover); }

.project-info { padding-top: var(--space-2); }

.project-title {
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
  margin: 0 0 5px;
  transition: color 0.2s ease;
}

.project-meta {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-muted);
  margin: 0;
}

/* ---------- Index (list) page ---------- */

.index-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-8);
  font-size: 12px;
}

.index-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 0 var(--space-3) var(--space-2) 0;
  border-bottom: 1px solid var(--color-line);
}

.index-table td {
  padding: var(--space-3) var(--space-3) var(--space-3) 0;
  border-bottom: 1px solid var(--color-line);
  vertical-align: top;
  color: var(--color-muted);
  line-height: 1.4;
}

.index-table td:first-child { color: var(--color-text); width: 40%; }
.index-table tr:hover td:first-child a { color: var(--color-hover); text-decoration: underline; }

.index-year-inline { display: none; }

.index-thumb-link {
  display: block;
  width: 140px;
  margin-top: var(--space-2);
}
.index-thumb {
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #f4f4f4;
}
.index-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: opacity 0.3s ease;
}
.index-table tr:hover .index-thumb img { opacity: 0.82; }

/* ---------- Detail page ---------- */

.project-detail-head {
  padding-top: var(--space-6);
  padding-bottom: var(--space-5);
}

.project-detail-title {
  font-family: var(--font-en);
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 var(--space-4);
}

.detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.detail-facts span { display: block; }

.section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
  margin: 0 0 var(--space-2);
}

.detail-section {
  padding: var(--space-6) 0;
  max-width: 760px;
}

.body-text {
  font-family: var(--font-kr);
  font-size: clamp(14px, 1.2vw, 17px);
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2);
  max-width: 760px;
}

.body-text:last-child { margin-bottom: 0; }

.meta-list {
  font-family: var(--font-en);
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text);
  margin: 0;
  padding: 0;
  list-style: none;
}
.meta-list li { padding: 2px 0; }

/* Gallery */

.gallery-block { margin: 0 0 var(--space-3); }

.gallery-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
}

.gallery-note {
  padding: var(--space-4) 0 var(--space-5);
}

.video-link {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: var(--space-3) 0;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
}
.video-link a { color: var(--color-muted); }
.video-link a:hover { color: var(--color-text); }

.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 0 0 var(--space-3);
  background: #f4f4f4;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.detail-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-6) 0 var(--space-8);
  border-top: 1px solid var(--color-line);
  margin-top: var(--space-6);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.detail-foot a { color: var(--color-muted); }
.detail-foot a:hover { color: var(--color-text); }

/* ---------- Text pages (About / Contact) ---------- */

.text-page {
  max-width: 760px;
  padding-top: var(--space-6);
  padding-bottom: var(--space-8);
}

.text-page .section-label { margin-top: var(--space-6); }
.text-page .section-label:first-of-type { margin-top: var(--space-5); }
.section-label.contact-first { margin-top: var(--space-5); }

.contact-list {
  font-family: var(--font-en);
  font-size: 15px;
  line-height: 1.9;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--color-line);
  padding: var(--space-4) 0 var(--space-6);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}

/* ---------- Responsive ---------- */

@media (max-width: 1023px) {
  .page-container { width: min(100% - 40px, 1600px); }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .page-container { width: calc(100% - 40px); }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: var(--space-1);
    height: auto;
    padding: var(--space-3) 0;
  }
  .site-nav { gap: var(--space-2); }

  .page-head { padding-top: var(--space-5); padding-bottom: var(--space-4); }

  .project-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-5);
    padding-bottom: var(--space-7);
  }

  .gallery-pair { grid-template-columns: minmax(0, 1fr); }

  .detail-section { padding: var(--space-5) 0; }

  /* Index table → 2줄 구성 */
  .index-table thead { display: none; }
  .index-table,
  .index-table tbody,
  .index-table tr,
  .index-table td { display: block; width: 100%; }
  .index-table tr {
    border-bottom: 1px solid var(--color-line);
    padding: var(--space-3) 0;
  }
  .index-table td {
    border: 0;
    padding: 0;
  }
  .index-table td:first-child {
    width: 100%;
    font-size: 13px;
  }
  .index-table td:first-child > a:first-child { display: inline; }
  .index-thumb-link { width: 120px; }
  .index-table td.index-year { display: none; }
  .index-year-inline {
    display: inline;
    color: var(--color-muted);
    font-size: 11px;
    white-space: nowrap;
  }
  .index-table td.index-sub {
    color: var(--color-muted);
    font-size: 11px;
    padding-top: 4px;
  }
  .site-footer { flex-direction: column; }
}

/* Index — 카테고리 그룹 */
.index-group {
  margin: var(--space-6) 0 var(--space-3);
  scroll-margin-top: var(--space-4);
}

/* Index — 프로젝트명 하단 썸네일 */
.index-thumb-link {
  display: block;
  width: 160px;
  margin-top: var(--space-2);
}

.index-thumb {
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #f4f4f4;
}

.index-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: opacity 0.2s ease;
}

.index-table tr:hover .index-thumb img { opacity: 0.85; }

@media (max-width: 639px) {
  .index-thumb-link { width: 120px; }
}
