/* Contact: a postcard on a dark canvas, with the panels and toolbar of a small design tool. */

body.pg { --rule: 0px; height: 100svh; overflow: hidden; overscroll-behavior: none; }
.pg-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the canvas */
.pg-view { position: fixed; inset: 0; overflow: hidden; background-color: var(--bg); background-image: radial-gradient(circle, rgba(239, 233, 221, 0.13) 1px, transparent 1.3px); background-size: 24px 24px; touch-action: none; cursor: default; opacity: 0; transition: opacity 300ms ease; }
.is-ready .pg-view { opacity: 1; }
.pg-view.is-space, .pg-view.is-space .pg-it { cursor: grab; }
.pg-view.is-grabbing, .pg-view.is-grabbing .pg-it { cursor: grabbing; }
.pg-view[data-tool='rect'], .pg-view[data-tool='ellipse'], .pg-view[data-tool='pen'] { cursor: crosshair; }
.pg-view[data-tool='text'] { cursor: text; }
.pg-view:not([data-tool='move']) .pg-it { pointer-events: none; }
.pg-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; --iz: 1; }

/* the poster: its content is clipped to it, like a frame in Figma */
.pg-board { position: absolute; left: 0; top: 0; width: 1080px; height: 1350px; box-shadow: 0 0 0 calc(1px * var(--iz)) rgba(239, 233, 221, 0.12), 0 40px 90px -40px rgba(0, 0, 0, 0.8); }
.pg-items { position: absolute; inset: 0; overflow: hidden; }
.pg-label { position: absolute; left: 0; bottom: 100%; display: flex; gap: 10px; padding-bottom: 8px; font-size: 13px; line-height: 16px; color: var(--text-2); white-space: nowrap; transform: scale(var(--iz)); transform-origin: 0 100%; pointer-events: none; }
.pg-label b { color: var(--sel); font-weight: 600; }
.pg-label span { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }

/* the layers on the poster */
.pg-it { position: absolute; left: 0; top: 0; display: block; transform-origin: 0 0; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; cursor: default; }
.pg-text { font-family: var(--font); line-height: 1.02; letter-spacing: -0.045em; white-space: pre; outline: none; }
.pg-text.is-edit { cursor: text; user-select: text; -webkit-user-select: text; box-shadow: 0 0 0 calc(2px * var(--iz)) var(--sel); caret-color: var(--sel); }
.pg-ellipse { border-radius: 50%; }
img.pg-it { max-width: none; }
svg.pg-it { overflow: visible; }
.pg-view[data-tool='move'] .pg-text.is-edit { cursor: text; }

/* selection, hover and guides: screen sized, on top of the canvas */
.pg-hov { position: absolute; left: 0; top: 0; display: none; border: 1.5px solid var(--sel); pointer-events: none; }
.pg-sel { position: absolute; left: 0; top: 0; display: none; border: 1.5px solid var(--sel); pointer-events: none; }
.pg-sel i { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border: 1.5px solid var(--sel); background: var(--bg); pointer-events: auto; touch-action: none; }
.pg-sel i::after { content: ''; position: absolute; inset: -12px; }
.pg-sel i[data-h='0'] { left: 0; top: 0; cursor: nwse-resize; }
.pg-sel i[data-h='1'] { left: 100%; top: 0; cursor: nesw-resize; }
.pg-sel i[data-h='2'] { left: 0; top: 100%; cursor: nesw-resize; }
.pg-sel i[data-h='3'] { left: 100%; top: 100%; cursor: nwse-resize; }
.pg-sel.is-small i[data-h='0'], .pg-sel.is-small i[data-h='1'], .pg-sel.is-small i[data-h='2'] { display: none; }
.pg-size { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); padding: 2px 7px; border-radius: 4px; background: var(--sky-deep); color: #fff; font: 600 11px/18px var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pg-guide { position: absolute; left: 0; top: 0; display: none; background: #e07a7f; pointer-events: none; }
.pg-guide-x { width: 1px; }
.pg-guide-y { height: 1px; }

/* panels */
.pg .panel { position: fixed; z-index: 5; }
.pg-layers { left: var(--pad); top: var(--pad); transform: none; max-height: calc(100svh - var(--pad) * 2); overflow: auto; scrollbar-width: none; }
.pg-layers::-webkit-scrollbar { display: none; }
.pg-inspect { right: var(--pad); top: var(--pad); width: 264px; transform: none; max-height: calc(100svh - var(--pad) * 2 - 64px); overflow: auto; scrollbar-width: none; }
.pg-inspect::-webkit-scrollbar { display: none; }
.pg-inspect .panel-h { color: var(--text); font-size: 13px; }
.pg-list { padding-bottom: 4px; }
.pg-list .layer-row { color: var(--text); cursor: pointer; }
.pg-list .layer-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pg-list .layer-row.is-sel { background: var(--sky-soft); font-weight: 600; }
.pg-phone-acts { display: none; }

.pg-sec { padding: 8px 8px 10px; border-top: 1px solid var(--line); }
.pg-inspect .panel-h + .pg-sec { border-top: 0; padding-top: 0; }
.pg-h { padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--text-2); }
.pg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.pg-f { position: relative; display: block; }
.pg-f span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-2); pointer-events: none; }
.pg-f input { width: 100%; height: 34px; padding: 0 8px 0 calc(18px + var(--lw, 12px)); border: 1px solid transparent; border-radius: 8px; background: var(--bg-2); color: var(--text); font: 500 13px/20px var(--mono); font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; transition: border-color 150ms ease; }
.pg-f input::-webkit-inner-spin-button, .pg-f input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pg-f input:hover { border-color: var(--line); }
.pg-f input:focus-visible { outline: none; border-color: var(--sel); }
.pg-f input[readonly] { color: var(--text-2); background: transparent; border-color: var(--line); }
.pg-sws { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 4px; }
.pg-sw { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px rgba(239, 233, 221, 0.22); cursor: pointer; transition: transform 160ms var(--ease), box-shadow 150ms ease; }
.pg-sw[aria-checked='true'] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--cream); }
.pg-sw:active { transform: scale(0.92); }
@media (hover: hover) { .pg-sw:hover { transform: scale(1.08); } }
.pg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(239, 233, 221, 0.08); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color 150ms ease, transform 160ms var(--ease); }
.pg-btn:active { transform: scale(0.97); }
@media (hover: hover) { .pg-btn:hover { background: rgba(239, 233, 221, 0.14); } }
.pg-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pg-ib { padding: 0; height: 40px; }
.pg-cta { display: flex; justify-content: center; gap: 8px; width: 100%; margin: 4px 0 8px; }
.pg-sec .pg-btn[data-reset] { width: 100%; }
.pg-small { padding-top: 8px; font-size: 12px; line-height: 16px; color: var(--text-2); text-wrap: pretty; }

/* zoom */
.pg-zoom { position: fixed; z-index: 5; right: var(--pad); bottom: 20px; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 12px 30px -16px rgba(0, 0, 0, 0.6); }
.pg-icon { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 18px; cursor: pointer; transition: background-color 150ms ease, transform 160ms var(--ease); }
.pg-icon:active { transform: scale(0.94); }
@media (hover: hover) { .pg-icon:hover { background: rgba(239, 233, 221, 0.1); } }
.pg-zval { width: 52px; text-align: center; font: 600 12px/20px var(--mono); font-variant-numeric: tabular-nums; }
.pg-zfit { height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: rgba(239, 233, 221, 0.08); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }

/* the toolbar: dark, at the bottom, like in Figma */
.pg-tools { position: fixed; z-index: 6; left: 50%; bottom: 20px; transform: translateX(-50%); }
.pg-tools .dr-btn:disabled { opacity: 0.35; cursor: default; }
.pg-tools .dr-btn:disabled:hover { background: none; }

/* Wilson's tip */
.pg-tip { position: fixed; z-index: 6; left: 50%; bottom: 92px; display: flex; align-items: flex-start; gap: 10px; width: min(420px, calc(100vw - 32px)); padding: 12px 12px 12px 14px; border-radius: 14px; background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 18px 40px -20px rgba(0, 0, 0, 0.7); transform: translateX(-50%); animation: tip-in 500ms var(--ease) both 300ms; }
.pg-tip[hidden] { display: none; }
.pg-tip b { flex: none; padding: 2px 8px; border-radius: 4px 10px 10px 10px; background: var(--wine); color: var(--cream); font-size: 12px; line-height: 18px; }
.pg-tip p { flex: 1; font-size: 14px; line-height: 20px; text-wrap: pretty; }
.pg-tip-x { display: grid; place-items: center; flex: none; width: 32px; height: 32px; margin: -6px -4px 0 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; }
@media (hover: hover) { .pg-tip-x:hover { background: rgba(239, 233, 221, 0.1); color: var(--text); } }
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* phones and narrow windows: a top bar, the toolbar at the bottom, pinch to zoom */
@media (max-width: 1023px) {
  body.pg .pg-layers { top: 0; left: 0; right: 0; width: auto; max-height: none; display: flex; align-items: center; gap: 4px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); border-radius: 0; overflow: visible; }
  body.pg .pg-layers .brand { display: flex; padding: 0 8px; }
  body.pg .pg-layers .brand span, body.pg .pg-layers .panel-sub, body.pg .pg-layers .pages, body.pg .pg-list { display: none; }
  .pg-phone-acts { display: flex; gap: 2px; margin-left: auto; }
  .pg-phone-acts .pg-icon { width: 44px; height: 44px; }
  .pg-dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(239, 233, 221, 0.3); }
  .pc-back { margin: 0; padding: 10px 8px; border: 0; min-height: 44px; }
  body.pg .pg-inspect, .pg-zoom { display: none; }
  .pg-tools { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 16px); }
  .pg-tools .dr-btn { width: 36px; height: 38px; }
  .pg-tools .dr-color { width: 20px; height: 20px; }
  .pg-tools .dr-sep { margin: 0 3px; }
  .pg-tools .dr-colors { gap: 5px; padding: 0 2px; }
  .pg-tools [data-redo] { display: none; }
  .pg-tip { top: calc(72px + env(safe-area-inset-top, 0px)); bottom: auto; }
}
@media (max-width: 420px) {
  .pg-tools .dr-color[data-c='#4b6f97'] { display: none; }
  .pg-tools .dr-btn { width: 34px; }
}

/* pieces shared with the other pages, kept right on this one */
.pc-back { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 10px 8px; border-top: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; }
.pc-back svg { transition: transform 300ms var(--ease); }
@media (hover: hover) { .pc-back:hover svg { transform: translateX(-3px); } }
@media (min-width: 1024px) {
  body.pg .brand { display: flex; }
  body.pg .panel-sub, body.pg .pages { display: block; }
}
.pg-tools .dr-btn[data-tool='ellipse'] { display: grid; }
@media (max-width: 1023px) {
  body.pg .pg-layers { bottom: auto; transform: none; }
  body.pg .pc-back { margin: 0; border: 0; }
  .pg-tools .dr-btn[data-add-me] { display: none; }
}

/* contact links */
.pg-contact { margin: 0 0 10px; padding: 0; list-style: none; }
.pg-contact a { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 13px; }
.pg-contact span { color: var(--text-2); }
.pg-contact b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
@media (hover: hover) { .pg-contact a:hover b { text-decoration: underline; text-underline-offset: 3px; } }
.pg-sec .pg-btn { width: 100%; }
.pg-grid .pg-btn { width: auto; }
.pg-acts .pg-btn { width: auto; }
.pg-links { display: none; }
@media (max-width: 1023px) {
  .pg-links { position: fixed; z-index: 6; left: 8px; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 6px; justify-content: center; }
  .pg-links .cta { gap: 6px; height: 40px; padding: 0 14px; }
  .pg-links .pg-btn { height: 40px; padding: 0 10px; background: var(--panel-2); text-decoration: none; font-size: 12px; }
  .pg-links .cta { padding: 0 12px; font-size: 13px; }
  .pg-links { gap: 4px; }
}

/* the stamp variants, and Wilson's comment pins */
.pg-hc { display: flex; align-items: center; gap: 6px; color: var(--sel); }
.pg-hc span { margin-left: auto; font-weight: 400; color: var(--text-2); }
.pg-stamps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.pg-stamps button { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: var(--bg-2); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; transition: border-color 150ms ease, transform 160ms var(--ease); }
.pg-stamps button i { flex: none; width: 12px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(239, 233, 221, 0.3); }
.pg-stamps button[aria-checked='true'] { border-color: var(--sel); font-weight: 600; }
.pg-stamps button:active { transform: scale(0.97); }
@media (hover: hover) { .pg-stamps button:hover { border-color: var(--line); } .pg-stamps button[aria-checked='true']:hover { border-color: var(--sel); } }
.pg-stamp svg { display: block; width: 100%; height: 100%; }
.pg-n, .pg-pin b { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; font: 700 12px/1 var(--mono); }
.pg-n { margin-right: 8px; background: var(--bg); color: var(--text); }
.pg-pin { position: absolute; left: 0; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 0; border-radius: 16px 16px 16px 4px; background: var(--sky); color: #181818; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.7); animation: pin-in 500ms var(--ease) both 600ms; }
.pg-pin[hidden] { display: none; }
.pg-pin b { background: #181818; color: var(--sky); }
@keyframes pin-in { from { opacity: 0; scale: 0.9; } }
@media (prefers-reduced-motion: reduce) { .pg-pin { animation: none; } }
@media (max-width: 1023px) {
  body.pg .pg-inspect { display: block; position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 52svh; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); border-radius: 16px 16px 0 0; transform: none; overflow: auto; }
  body.pg .pg-inspect { max-height: 40svh; }
  .pg-tools { bottom: calc(40svh + 8px); }
  .pg-tip { display: none; }
}

/* who the postcard is from */
.pg-from { display: block; margin-bottom: 8px; }
.pg-from span { display: block; padding: 0 2px 4px; font-size: 12px; line-height: 16px; color: var(--text-2); }
.pg-in { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); color: var(--text); font: 500 14px/20px var(--font); }
.pg-in:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }
.pg-in.is-bad { border-color: var(--wine); }
.pg-from span::after { content: ' *'; color: var(--text-2); }
