/* Part 4 — "gallery wall": the docent (live face) beside a framed picture with a museum label. */

.p4-set { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.p4-set h2 { margin: 0; font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.p4-set .count { font-size: var(--t-sm); font-weight: 500; color: var(--text-sub); font-variant-numeric: tabular-nums; }

/* the wall */
.p4-wall { position: relative; display: grid; grid-template-columns: 47fr 53fr; gap: 0; align-items: end;
  padding: 18px 16px 0; border-radius: var(--radius-card); background: var(--card);
  box-shadow: inset 0 -26px 0 -2px var(--border); overflow: hidden; }
.p4-wall::before { /* soft picture light on the wall */
  content: ""; position: absolute; right: 6%; top: -30%; width: 62%; height: 90%; border-radius: 50%;
  background: radial-gradient(closest-side, var(--white), transparent); opacity: .7; pointer-events: none; }

/* docent: the live face, cropped like a person standing beside the frame */
.p4-docent { position: relative; align-self: end; margin: 0 -10px 0 -14px; }
/* the close-up has its own paper behind it: fade its edges into the wall so it reads as a person, not a box */
.p4-docent .face-rig { border-radius: 0; background: transparent; box-shadow: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, var(--text) 16%, var(--text) 84%, transparent 100%), linear-gradient(to bottom, transparent 0, var(--text) 20%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent 0, var(--text) 16%, var(--text) 84%, transparent 100%), linear-gradient(to bottom, transparent 0, var(--text) 20%);
  mask-composite: intersect; }
.p4-docent .repeat-prompt { position: absolute; left: 8%; top: 4%; margin: 0; padding: 6px 10px; border-radius: var(--r-md) 12px 12px 4px;
  background: var(--blue-dark); color: var(--white); font-size: 14px; font-weight: 500; white-space: nowrap; z-index: 2;
  box-shadow: 0 4px 12px var(--border); animation: p4-pop .32s cubic-bezier(.2,.8,.2,1); }
@keyframes p4-pop { from { opacity: 0; transform: translateY(6px) scale(.9); } }

/* the frame: wood edge, white mat, light from above */
.p4-frame { position: relative; margin: 0 0 30px 4px; padding: 10px; border-radius: var(--r-sm);
  background: var(--terracotta); box-shadow: 0 2px 0 var(--terracotta), 0 14px 22px -8px var(--text), inset 0 0 0 2px var(--terracotta-light); }
.p4-mat { position: relative; aspect-ratio: 4 / 5; padding: 10%; background: var(--white); overflow: hidden; display: grid; place-items: center; }
.p4-mat img { display: block; width: 100%; height: 100%; object-fit: contain; }
.p4-mat img.photo { object-fit: cover; }
.p4-mat img.in { animation: p4-hang .5s cubic-bezier(.16,1,.3,1); }
@keyframes p4-hang { from { opacity: 0; transform: translateY(-10px); filter: blur(3px); } }
.p4-mat .p4-hint { font-family: var(--font-serif); font-size: var(--t-sm); color: var(--text-sub); text-align: center; }

/* museum label */
.p4-label { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); min-width: 72%; max-width: 96%;
  padding: 8px 14px 9px; background: var(--white); border-radius: 3px; box-shadow: 0 6px 14px -6px var(--text); text-align: center; }
.p4-label .en { display: block; font-size: clamp(17px, 4.6vw, 22px); font-weight: 500; color: var(--text); line-height: 1.15; }
.p4-label .ko { display: block; margin-top: 2px; font-family: var(--font-serif); font-size: var(--t-sm); color: var(--text-sub); }
.p4-label.in { animation: p4-pop .32s cubic-bezier(.2,.8,.2,1); }

.p4-credit { min-height: 1.3em; margin: 34px 2px 0; font-size: var(--t-xs); color: var(--text-sub); text-align: right; }

/* names: a quiet two-column index, not a stack of cards */
.p4-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px;
  border-top: 1px solid var(--border); }
.p4-item { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; width: 100%; min-height: var(--tap);
  padding: 8px 2px; border: 0; border-bottom: 1px solid var(--border); background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.p4-item .en { font-size: var(--t-md); font-weight: 500; line-height: 1.2; }
.p4-item .ko { font-family: var(--font-serif); font-size: var(--t-sm); color: var(--text-sub); }
.p4-item .p4-note { font-family: var(--font-serif); font-size: var(--t-xs); color: var(--text-sub); }
.p4-item:hover .en { color: var(--blue-dark); }
.p4-item.on .en { color: var(--blue-dark); }
.p4-item.on .en { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--blue); }
.p4-item:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: var(--r-sm); }

.p4-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 20px; }

@media (min-width: 720px) {
  .p4-wall { padding: 26px 28px 0; }
  .p4-frame { margin-right: 6%; }
}
/* PC: the names sit on the right of the wall so a choice is one glance away */
@media (min-width: 900px) {
  #app:has(.p4-learn) { max-width: 1040px; }
  .p4-learn { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .p4-learn .p4-stage { grid-column: 1; }
  .p4-learn .p4-side { grid-column: 2; position: sticky; top: 16px; }
  .p4-side .p4-list { grid-template-columns: 1fr; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .p4-mat img.in, .p4-label.in, .p4-docent .repeat-prompt { animation: none; }
}
/* phones: keep the wall (face + frame) in view while the names scroll underneath */
@media (max-width: 899px) {
  .p4-stage { position: sticky; top: var(--nav-h, 0px); z-index: 2; padding-top: 6px; background: var(--bg); }
  .p4-credit { margin: 30px 2px 0; padding-bottom: 6px; }
  .p4-mat { aspect-ratio: 1; }
}

/* One item at a time (2026-11-27): wall picture + one card (shared .p5-card styles in part5.css). */
.p4-one .p4-side { display: flex; flex-direction: column; gap: 16px; }
.p4-one .p4-actions { margin-top: 0; }
.p4-one .p5-card .p5-en { font-size: clamp(30px, 8vw, 50px); }
@media (max-width: 899px) { .p4-one .p4-stage { position: static; background: transparent; } .p4-one .p4-side { margin-top: 14px; } }
@media (min-width: 900px) { .p4-one { align-items: center; } }
.p4-one .p4-credit { margin-top: 10px; }
.p4-one .p4-credit:empty { display: none; }
