/* KI² PENG.Archive — Cargo Basic Grid 邏輯 */
:root {
  --text: rgba(0, 0, 0, 0.85);
  --text-2: rgba(0, 0, 0, 0.6);
  --accent: #FF0000;
  --pad: 0.8rem;
  --gutter: 1rem;
}

* { box-sizing: border-box; }

html {
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: none;
}

html, body { margin: 0; padding: 0; }

body {
  background: #fff;
  color: var(--text);
  font-family: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.2;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.caption { font-size: 0.8rem; font-weight: 450; }

/* 左側固定導覽欄 */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 25%;
  height: 100vh;
  padding: var(--pad);
  overflow-y: auto;
}
.site-title {
  display: block;
  color: var(--text);
  font-size: clamp(1.7rem, 2vw + 0.7rem, 2.8rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
}
.site-title:hover { color: var(--accent); }
.site-title sup {
  /* 頂端切齊 KI 的大寫頂線（vertical-align 的 em 相對上標自身字級） */
  font-size: 0.5em;
  line-height: 0;
  vertical-align: 0.72em;
  letter-spacing: 0;
}
.tagline { margin: 0.5em 0 0; }
.work-list { margin-top: 4.8em; }
.work-list a, .info-links a { display: block; }
.work-list .cat { display: block; margin-top: 1.2em; }
.work-list .cat:first-child { margin-top: 0; }
.work-list .cat.current { text-decoration: underline; text-underline-offset: 0.15em; }
.work-list a.work { padding-left: 1.5em; }
.work-list a.work.active { padding-left: 0; }
.work-list a.work.active::before { content: "↪ "; }
.info-links { margin-top: 1.2em; }

/* 右側內容 */
.main {
  margin-left: 25%;
  padding: var(--pad);
  padding-bottom: 4.5rem;
}

/* 首頁格線 */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gutter);
}
.grid-item { display: block; }
.grid-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: opacity 150ms ease;
}
.grid-item:hover img { opacity: 0.82; }

/* 作品內頁 */
.work-header {
  display: grid;
  grid-template-columns: 6fr 4fr 2fr;
  gap: var(--gutter);
  margin-bottom: var(--gutter);
}
.wh-index { text-align: right; }
.work-images { display: flex; flex-direction: column; gap: var(--gutter); }
.work-images img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}
.work-images video {
  display: block;
  width: 100%;
  height: auto;
}
.work-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
  margin-top: 2rem;
}
.work-notes a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Information */
.information { max-width: 40em; }
.information p { margin: 0 0 1em; }
.info-portrait {
  display: block;
  width: 20rem;
  height: 20rem;
  max-width: 100%;
  object-fit: cover;
  margin-bottom: 2rem;
}
.info-name { margin-bottom: 1.2em; }
.info-bio { max-width: 30em; }
.info-bio p { margin: 0; }
.info-timeline { margin-top: 2.5rem; }
.info-timeline-title { margin-bottom: 1em; }
.info-timeline ul { list-style: none; margin: 0; padding: 0; }
.info-timeline li {
  display: grid;
  grid-template-columns: 3.2em 1fr;
  column-gap: 0.4em;
  margin-bottom: 0.35em;
}
.info-timeline .yr {
  font-size: 0.72em;
  align-self: start;
  padding-top: 0.12em;
}

/* 底部固定頁尾 */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem var(--pad);
  pointer-events: none;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  z-index: 10;
  animation: lightbox-in 120ms ease;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.no-scroll { overflow: hidden; }

@keyframes lightbox-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .grid-item img { transition: none; }
  .lightbox { animation: none; }
}

/* 手機版 */
@media (max-width: 768px) {
  .sidebar { position: static; width: auto; height: auto; }
  .main { margin-left: 0; padding-top: 0; }
  .grid { grid-template-columns: 1fr; }
  .work-header { grid-template-columns: 1fr; gap: 0.2rem; }
  .wh-index { text-align: left; }
  .work-notes { grid-template-columns: 1fr; }
  .footer { position: static; padding: 2rem var(--pad); }
}
