/* 이미지 인쇄 페이지 (photo.html): 파일 상자는 hwpx.css를 함께 쓴다 */
.photo-page .hx-filebar #ph-name { font-weight: 600; overflow-wrap: anywhere; }
.photo-page .mobile-bar [data-ph="open"] { display: inline-flex; }

/* ---------- 편집 칸: 예시 사진이나 내 사진이 놓이면 보인다 ---------- */
.ph-editor { display: none; margin-top: 14px; max-width: 820px; }
body.ph-on .ph-editor { display: grid; gap: 10px; }
.ph-sample-note { display: none; margin: 0; font-size: 14px; color: var(--fg); }
.ph-sample-note small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
body.ph-on:not(.hx-loaded) .ph-sample-note { display: block; }
.ph-editor { scroll-margin-top: calc(var(--header-h) + 8px); }

.ph-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.ph-seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }
.ph-seg button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.ph-seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.ph-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ph-size { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--fg); white-space: nowrap; }
.ph-size input {
  width: 4.6em; height: 34px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--surface); color: var(--fg); font: inherit; font-size: 15px; font-weight: 600; text-align: right;
}
.ph-size input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.ph-size output { font-weight: 600; min-width: 2.6em; text-align: right; }
.ph-hint { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ---------- 작업대: 책상 위에 A4 한 장 ---------- */
.ph-stage {
  display: grid; place-items: center; padding: 16px; border-radius: 12px; background: var(--desk);
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
.ph-stage.is-dragging { cursor: grabbing; }
.ph-sheet { position: relative; }
.ph-page { position: relative; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 6px 18px rgba(0,0,0,.08); }
.ph-page img { position: absolute; max-width: none; max-height: none; transform-origin: 50% 50%; pointer-events: none; }
/* 가운데 안내선: 사진 가운데가 종이 가운데에 맞으면 나타난다(인쇄되지 않음) */
.ph-guide { position: absolute; display: none; z-index: 2; pointer-events: none; }
.ph-guide.v { top: 0; bottom: 0; left: 50%; width: 0; border-left: 1px dashed rgba(60, 60, 60, 0.6); }
.ph-guide.h { left: 0; right: 0; top: 50%; height: 0; border-top: 1px dashed rgba(60, 60, 60, 0.6); }
.ph-guide.on { display: block; }
/* 선택 테두리와 모서리 점: 종이 밖으로 나가도 잡을 수 있도록 종이와 따로 둔다 */
.ph-box { position: absolute; outline: 1.5px solid var(--accent); outline-offset: 0; pointer-events: none; }
.ph-h {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); box-sizing: border-box; pointer-events: auto; touch-action: none;
}
.ph-h[data-c="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.ph-h[data-c="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.ph-h[data-c="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.ph-h[data-c="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.ph-h::before { content: ''; position: absolute; inset: -10px; } /* 잡기 쉬운 범위 */
@media (pointer: coarse) {
  .ph-h { width: 20px; height: 20px; margin: -10px 0 0 -10px; }
}

/* ---------- 인쇄: A4 한 장에 사진만 ---------- */
#ph-print { display: none; }
@media print {
  body.ph-ready > :not(#ph-print) { display: none !important; }
  body.ph-ready #ph-print { display: block !important; position: relative; overflow: hidden; margin: 0; padding: 0; background: #fff; }
  #ph-print img { position: absolute; max-width: none; max-height: none; transform-origin: 50% 50%; }
}
