/* PassportPhoto — maker widget + content polish.
   Theme colors come from site.config.json (--primary teal / --accent amber). */

.pp {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem;
  margin: 1.4rem 0 2rem;
}

/* ---- dropzone ---- */

.pp-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  padding: 2rem 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.pp-drop strong {
  font-size: 1.1rem;
}
.pp-drop span {
  font-size: 0.92rem;
  color: var(--text-dim);
}
.pp-drop u {
  color: var(--primary);
  text-decoration: none;
  font-weight: 650;
}
.pp-drop:hover,
.pp-drop:focus-visible,
.pp-drop-hot {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--bg));
  outline: none;
}
.pp-drop-hot {
  transform: scale(1.005);
}

/* ---- options ---- */

.pp-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}
.pp-opts label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
}
.pp-opts select {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  width: 100%;
}
.pp-opts select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* ---- status ---- */

.pp-status {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  min-height: 1.2em;
}

/* ---- stage: editor + report ---- */

.pp-stage {
  margin-top: 1rem;
}
.pp-cols {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}

.pp-editwrap {
  min-width: 0;
}
.pp-cropstage {
  position: relative;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background: var(--bg);
}
.pp-cropimg {
  display: block;
  width: 100%;
  height: 100%;
}
.pp-cropstage.pp-marking {
  cursor: crosshair;
}
.pp-shade {
  position: absolute;
  background: rgba(15, 23, 42, 0.55);
  pointer-events: none;
}
.pp-cropbox {
  position: absolute;
  border: 2px solid #fff;
  outline: 1px solid color-mix(in srgb, var(--primary) 90%, black);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
  cursor: move;
  box-sizing: border-box;
}
.pp-cropbox:focus-visible {
  outline: 3px solid var(--primary);
}
.pp-hd {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 3px;
  z-index: 3;
}
/* Invisible ring around the 14px visual handle → ~32px touch target. */
.pp-hd::after {
  content: '';
  position: absolute;
  inset: -9px;
}
.pp-hd[data-hd='nw'] { left: -8px; top: -8px; cursor: nwse-resize; }
.pp-hd[data-hd='ne'] { right: -8px; top: -8px; cursor: nesw-resize; }
.pp-hd[data-hd='sw'] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.pp-hd[data-hd='se'] { right: -8px; bottom: -8px; cursor: nwse-resize; }

/* ---- head-size guide overlay (inside the crop box) ---- */

.pp-g-band {
  position: absolute;
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  pointer-events: none;
}
.pp-g-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px dashed color-mix(in srgb, var(--primary) 85%, #fff);
  pointer-events: none;
}
.pp-g-tag {
  position: absolute;
  right: 3px;
  top: -0.95rem;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: color-mix(in srgb, var(--primary) 90%, black);
  padding: 0.14rem 0.3rem;
  border-radius: 3px;
  white-space: nowrap;
}
.pp-g-crown .pp-g-tag {
  top: auto;
  bottom: -0.95rem;
}
.pp-g-vline {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 1px dashed rgba(255, 255, 255, 0.65);
  pointer-events: none;
}
.pp-mark {
  position: absolute;
  height: 0;
  border-top: 2px solid var(--accent);
  pointer-events: none;
  z-index: 2;
}
.pp-mark::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.pp-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  min-height: 1.2em;
  margin: 0.45rem 0 0.3rem;
}
.pp-editbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.pp-cropinfo {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
}
.pp-mini {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}
.pp-mini:hover {
  border-color: var(--primary);
}

/* ---- report ---- */

.pp-verdict {
  margin: 0 0 0.8rem;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}
.pp-verdict[data-verdict='pass'] {
  border-color: #15803d;
  background: color-mix(in srgb, #16a34a 10%, var(--bg));
  color: #15803d;
}
.pp-verdict[data-verdict='warn'] {
  border-color: #b45309;
  background: color-mix(in srgb, #d97706 10%, var(--bg));
  color: #b45309;
}
.pp-verdict[data-verdict='fail'] {
  border-color: #b91c1c;
  background: color-mix(in srgb, #dc2626 10%, var(--bg));
  color: #b91c1c;
}

.pp-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pp-check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.6rem 0.8rem;
}
.pp-check[data-status='pass'] {
  border-left-color: #16a34a;
}
.pp-check[data-status='warn'] {
  border-left-color: #d97706;
}
.pp-check[data-status='fail'] {
  border-left-color: #dc2626;
}
.pp-check[data-status='pending'] {
  border-left-color: var(--border);
}
.pp-ico {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--text-dim);
  margin-top: 0.1rem;
}
.pp-check[data-status='pass'] .pp-ico {
  background: #dcfce7;
  color: #15803d;
}
.pp-check[data-status='warn'] .pp-ico {
  background: #fef3c7;
  color: #b45309;
}
.pp-check[data-status='fail'] .pp-ico {
  background: #fee2e2;
  color: #b91c1c;
}
.pp-check-body strong {
  font-size: 0.92rem;
}
.pp-detail {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ---- outputs ---- */

.pp-outs {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.pp-outrow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.1rem 0.8rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.7rem 0.9rem;
}
.pp-thumb {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: calc(var(--radius-sm) * 0.7);
  border: 1px solid var(--border);
  background: #fff;
  grid-row: span 2;
}
.pp-outmeta {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--text);
}
.pp-sheetwrap {
  grid-column: 1 / -1;
  max-width: 15rem;
}
.pp-sheet {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-sm) * 0.7);
  background: #fff;
}
.pp-sheetmeta {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.pp-dl {
  display: inline-block;
  justify-self: start;
  font-size: 0.88rem;
  font-weight: 650;
  color: #fff;
  background: var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  text-decoration: none;
}
.pp-dl:hover {
  filter: brightness(1.08);
}

.pp-note {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  background: color-mix(in srgb, var(--surface) 60%, var(--bg));
}

/* ---- spec table on content pages ---- */

.prose table.specs td:first-child,
.prose table.specs th:first-child {
  min-width: 7rem;
  font-weight: 650;
}

@media (max-width: 820px) {
  .pp-cols {
    grid-template-columns: 1fr;
  }
  .pp-editwrap {
    max-width: 24rem;
  }
}

@media (max-width: 560px) {
  .pp {
    padding: 0.9rem;
  }
  .pp-outrow {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .pp-thumb {
    grid-row: auto;
  }
}
