/* ID Photo App — maker widget + capture checklist + content polish.
   Theme colors come from site.config.json (--primary violet / --accent teal). */

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

/* ---- guided capture checklist ---- */

.idp-guide {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.5rem;
  counter-reset: idpstep;
}
.idp-guide li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.idp-guide li::before {
  counter-increment: idpstep;
  content: counter(idpstep);
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  margin-top: 0.05rem;
}
.idp-guide strong {
  color: var(--text);
}

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

.idp-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;
}
.idp-drop strong {
  font-size: 1.1rem;
}
.idp-drop span {
  font-size: 0.92rem;
  color: var(--text-dim);
}
.idp-drop u {
  color: var(--primary);
  text-decoration: none;
  font-weight: 650;
}
.idp-drop:hover,
.idp-drop:focus-visible,
.idp-drop-hot {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--bg));
  outline: none;
}
.idp-drop-hot {
  transform: scale(1.005);
}

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

.idp-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
  align-items: end;
}
.idp-opts label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
}
.idp-opts select,
.idp-opts input {
  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%;
}
.idp-opts select:focus,
.idp-opts input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.idp-custom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.idp-custom[hidden] {
  display: none;
}
.idp-ratio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.idp-ratio input {
  width: 3.4rem;
  text-align: center;
}
.idp-ratio span {
  font-weight: 800;
  color: var(--text-dim);
}

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

.idp-status {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  /* darker teal than --accent (#0d9488 = 3.5:1) — #0f766e ≈ 5.1:1 on --bg */
  color: #0f766e;
  min-height: 1.2em;
}

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

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

.idp-editwrap {
  min-width: 0;
}
.idp-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);
}
.idp-cropimg {
  display: block;
  width: 100%;
  height: 100%;
}
.idp-cropstage.idp-marking {
  cursor: crosshair;
}
.idp-shade {
  position: absolute;
  background: rgba(15, 23, 42, 0.55);
  pointer-events: none;
}
.idp-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;
}
.idp-cropbox:focus-visible {
  outline: 3px solid var(--primary);
}
.idp-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 → ~36px touch target. The
   pseudo box hit-tests as the <i> itself, so drags still fire on .idp-hd. */
.idp-hd::after {
  content: '';
  position: absolute;
  inset: -11px;
}
.idp-hd[data-hd='nw'] { left: -8px; top: -8px; cursor: nwse-resize; }
.idp-hd[data-hd='ne'] { right: -8px; top: -8px; cursor: nesw-resize; }
.idp-hd[data-hd='sw'] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.idp-hd[data-hd='se'] { right: -8px; bottom: -8px; cursor: nwse-resize; }

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

.idp-g-band {
  position: absolute;
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  pointer-events: none;
}
.idp-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;
}
.idp-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;
}
.idp-g-crown .idp-g-tag {
  top: auto;
  bottom: -0.95rem;
}
.idp-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;
}
.idp-mark {
  position: absolute;
  height: 0;
  border-top: 2px solid var(--accent);
  pointer-events: none;
  z-index: 2;
}
.idp-mark::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.idp-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  min-height: 1.2em;
  margin: 0.45rem 0 0.3rem;
}
.idp-editbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.idp-cropinfo {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
}
.idp-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;
}
.idp-mini:hover {
  border-color: var(--primary);
}

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

.idp-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);
}
.idp-verdict[data-verdict='pass'] {
  border-color: #15803d;
  background: color-mix(in srgb, #16a34a 10%, var(--bg));
  color: #15803d;
}
.idp-verdict[data-verdict='warn'] {
  border-color: #b45309;
  background: color-mix(in srgb, #d97706 10%, var(--bg));
  color: #b45309;
}
.idp-verdict[data-verdict='fail'] {
  border-color: #b91c1c;
  background: color-mix(in srgb, #dc2626 10%, var(--bg));
  color: #b91c1c;
}

.idp-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.idp-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;
}
.idp-check[data-status='pass'] {
  border-left-color: #16a34a;
}
.idp-check[data-status='warn'] {
  border-left-color: #d97706;
}
.idp-check[data-status='fail'] {
  border-left-color: #dc2626;
}
.idp-check[data-status='pending'] {
  border-left-color: var(--border);
}
.idp-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;
}
.idp-check[data-status='pass'] .idp-ico {
  background: #dcfce7;
  color: #15803d;
}
.idp-check[data-status='warn'] .idp-ico {
  background: #fef3c7;
  color: #b45309;
}
.idp-check[data-status='fail'] .idp-ico {
  background: #fee2e2;
  color: #b91c1c;
}
.idp-check-body strong {
  font-size: 0.92rem;
}
.idp-detail {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

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

.idp-outs {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.idp-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;
}
.idp-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;
}
.idp-outmeta {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--text);
}
.idp-sheetwrap {
  grid-column: 1 / -1;
  max-width: 15rem;
}
.idp-sheet {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-sm) * 0.7);
  background: #fff;
}
.idp-sheetmeta {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.idp-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;
}
.idp-dl:hover {
  filter: brightness(1.08);
}

.idp-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) {
  .idp-cols {
    grid-template-columns: 1fr;
  }
  .idp-editwrap {
    max-width: 24rem;
  }
}

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