/* Home project roles */
.home-projects {
  max-width: 860px;
  margin-top: 27px;
  scroll-margin-top: calc(var(--nav-h) + 12px);
}
.home-projects__list {
  display: grid;
  gap: 13px;
}
.home-projects__list a {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: baseline;
  gap: 5px 16px;
  padding: 1px 0;
}
.home-projects__list strong { color: white; font-size: 15px; font-weight: 680; }
.home-projects__list span { color: #f0f4fa; font-size: 14px; line-height: 1.55; }
.home-projects__list a:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.home-projects__list a:focus-visible { outline: 2px solid white; }

/* Project and stage fragments open the containing project. */
.project-history { padding-top: 42px; padding-bottom: 72px; }
.project-catalog,
.project-history__project,
.work-timeline__item { scroll-margin-top: calc(var(--nav-h) + 18px); }
.project-history__project { display: none; }
.project-history__project:is(:target, :has(.work-timeline__item:target)) { display: block; }
.project-history__project:is(:target, :has(.work-timeline__item:target)) ~ .project-catalog { display: none; }
.project-catalog__heading .h1 { margin-top: 7px; }
.project-catalog__heading .lead { margin-top: 12px; }
.project-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 30px;
}
.project-card-link {
  display: flex;
  flex-direction: column;
  gap: 9px;
  height: 100%;
  padding: 23px;
  border: 1px solid var(--cloud);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.project-card-link:hover { border-color: var(--accent); background: var(--accent-wash); }
.project-card-link__role { color: var(--accent); font-size: 13px; font-weight: 650; }
.project-card-link p { color: var(--muted); font-size: 14px; line-height: 1.65; }
.project-card-link__action {
  margin-top: auto;
  padding-top: 7px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}
.project-back {
  display: inline-block;
  margin-bottom: 23px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}
.project-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.project-history__heading .lead { margin-top: 10px; max-width: 760px; }
.project-history__role { margin-top: 9px; color: var(--accent); font-size: 14px; font-weight: 600; }
.project-history__source { margin-top: 10px; color: var(--accent); font-size: 14px; }
.project-history__source a:hover { text-decoration: underline; }
.project-stages { margin-top: 18px; }
.project-stages ul { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.project-stages a {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  color: var(--accent);
  font-size: 13px;
}
.project-stages a:hover { background: var(--accent-wash); text-decoration: underline; }
.work-timeline {
  margin-top: 26px;
  display: grid;
  gap: 14px;
}
.work-timeline__item {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 14px;
}
.work-timeline__stage {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: start;
  margin-top: 17px;
  color: #475a72;
  font-size: 13px;
  font-weight: 650;
}
.work-timeline__stage > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 11px;
}
.work-entry {
  padding: 20px 22px;
  border: 1px solid var(--cloud);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: white;
}
.work-timeline__item:target .work-entry { border-color: var(--accent); }
.work-entry__steps {
  display: grid;
  gap: 10px;
  margin-top: 15px;
}
.work-entry__steps > div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 4px 10px;
  border-top: 1px solid var(--mist);
  padding-top: 10px;
}
.work-entry__steps dt { color: var(--accent); font-size: 13px; font-weight: 700; line-height: 1.83; }
.work-entry__steps dd { color: #303840; font-size: 14px; line-height: 1.7; }
.work-entry__steps dd p + p { margin-top: 8px; }

.work-sample {
  min-width: 0;
  margin-top: 18px;
  padding: 15px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: #f6f9fd;
  color: #303840;
  font-size: 14px;
  line-height: 1.6;
}
.work-sample__type {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.work-sample h3 { color: var(--ink); font-size: 16px; line-height: 1.45; }
.work-sample > p,
.work-sample figure,
.work-sample pre,
.work-sample__table { margin-top: 9px; }
.work-sample figure a { display: block; }
.work-sample img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--cloud);
  border-radius: 5px;
  background: white;
}
.work-sample__gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.work-sample figcaption,
.work-sample .work-sample__source { color: var(--muted); font-size: 12px; }
.work-sample figcaption { margin-top: 7px; }
.work-sample .work-sample__source a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.work-sample__table { overflow-x: auto; border: 1px solid var(--cloud); border-radius: 5px; }
.work-sample table { width: 100%; border-collapse: collapse; background: white; font-size: 13px; }
.work-sample th,
.work-sample td { padding: 7px 9px; text-align: left; vertical-align: top; }
.work-sample thead th { background: #eaf1fa; color: #294a76; }
.work-sample tbody tr { border-top: 1px solid var(--mist); }
.work-sample tbody th { font-weight: 600; }
.work-sample td[data-number] { white-space: nowrap; font-variant-numeric: tabular-nums; }
.work-sample pre {
  padding: 10px;
  border: 1px solid var(--cloud);
  border-radius: 5px;
  background: white;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.work-sample code { font-size: 13px; overflow-wrap: anywhere; }

.project-verification {
  margin-top: 20px;
  margin-left: 170px;
  padding: 14px 18px;
  border: 1px solid var(--cloud);
  border-radius: 8px;
}
.project-verification summary { color: var(--accent); cursor: pointer; font-size: 14px; font-weight: 700; }
.project-verification dl { display: grid; gap: 9px; margin-top: 12px; font-size: 13px; line-height: 1.65; }
.project-verification dt { color: var(--ink); font-weight: 650; }
.project-verification dd { color: var(--muted); }

@media (max-width: 767px) {
  .hero.has-photos { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .home-projects { margin-top: 20px; }
  .home-projects__list a { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .home-projects__list span { font-size: 13px; }
  .project-history { padding-top: 28px; padding-bottom: 52px; }
  .project-cards { grid-template-columns: minmax(0, 1fr); }
  .project-card-link { padding: 17px; }
  .work-timeline__item { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .work-timeline__stage { margin-top: 0; }
  .work-entry { padding: 16px; }
  .work-entry__steps > div, .work-sample__gallery { grid-template-columns: minmax(0, 1fr); }
  .work-sample { padding: 11px; }
  .project-verification { margin-left: 0; }
}
@media print {
  .project-back { display: none; }
  .work-timeline__item { break-inside: avoid; }
}

/* ══════════════ 포트폴리오 목록 — 분류 필터 + 썸네일 위 / 본문 아래 카드 (한 줄 최대 4개) ══════════════ */
.pf-filters { margin-top: 24px; margin-bottom: 22px; }
.pf-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
@media (min-width: 560px)  { .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 860px)  { .pf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1100px) { .pf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.pf-card {
  display: flex; flex-direction: column; height: 100%;
  border: 1px solid var(--cloud); border-radius: 14px; overflow: hidden;
  background: var(--white);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.pf-card:hover { border-color: var(--accent); box-shadow: 0 8px 22px rgba(8,9,10,.08); transform: translateY(-2px); }

.pf-card__thumb {
  position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--mist); border-bottom: 1px solid var(--mist);
}
.pf-card__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.pf-card:hover .pf-card__thumb img { transform: scale(1.03); }
.pf-card__thumb--contain { background: var(--white); }
.pf-card__thumb--contain img { object-fit: contain; padding: 14%; }
.pf-card__thumb--top img { object-position: top center; }
.pf-card__thumb--type { display: flex; align-items: center; justify-content: center; background: var(--accent-wash); }
.pf-card__thumb--type b { font-size: clamp(24px, 2.4vw, 32px); font-weight: 800; letter-spacing: -.8px; color: var(--accent); }

.pf-card__body { display: flex; flex-direction: column; gap: 7px; flex: 1; padding: 16px 18px 18px; }
.pf-card__role { color: var(--accent); font-size: 12.5px; font-weight: 650; line-height: 1.4; }
.pf-card__title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; line-height: 1.35; color: var(--ink); }
.pf-card__body p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.pf-card__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.pf-card__tags span {
  padding: 2px 8px; border-radius: var(--r-tag);
  background: var(--mist); color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.pf-card__action { margin-top: auto; padding-top: 6px; color: var(--accent); font-size: 13px; font-weight: 650; }

/* 카드 호버 시연 영상 — 썸네일 위에 겹쳐 페이드인 */
.pf-card__thumb video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .3s ease;
}
.pf-card.is-playing .pf-card__thumb video { opacity: 1; }

/* ══════════════ 프로젝트 상세 — PV(대문 첫 화면 크기) + 출시 링크 ══════════════ */
.pv {
  margin: 0 auto;
  /* 16:9 를 유지하면서 화면 높이 안에 들어오도록 폭을 제한 → 대문 첫 화면만큼 크게 보임 */
  width: min(100%, calc((100svh - var(--nav-h) - 150px) * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: 16px; overflow: hidden;
  background: #000; box-shadow: 0 14px 40px rgba(8,9,10,.16);
}
.pv__video { display: block; width: 100%; height: 100%; object-fit: cover; background: #000; }
.pv-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin: 22px 0 40px;
}
.pv-links__btn { min-width: 200px; min-height: 46px; font-size: 15px; }
.pv-links__btn.is-soon { color: var(--muted); border-style: dashed; cursor: default; pointer-events: none; }
.pv + .project-history__heading { margin-top: 36px; }
@media (max-width: 767px) {
  .pv { width: 100%; border-radius: 12px; }
  .pv-links__btn { min-width: 0; flex: 1 1 100%; }
}
