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

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

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

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

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

.ps-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}
.ps-opts label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
}
.ps-opts select,
.ps-opts input[type='number'] {
  font: inherit;
  font-size: 0.98rem;
  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%;
}
.ps-opts select:focus,
.ps-opts input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.ps-opts label.ps-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text);
  padding-top: 1.35rem;
}
.ps-opts .ps-check input {
  accent-color: var(--primary);
  width: 1.05rem;
  height: 1.05rem;
}
.ps-maxhint {
  font-weight: 500;
  color: var(--text-dim);
}

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

.ps-status {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  min-height: 1.2em;
}
.ps-warn {
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: #b45309;
  border: 1px solid color-mix(in srgb, #d97706 45%, var(--border));
  background: color-mix(in srgb, #d97706 8%, var(--bg));
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

/* ---- stage: sheet preview + actions ---- */

.ps-stage {
  margin-top: 1rem;
}
.ps-canvaswrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    repeating-conic-gradient(var(--surface-2) 0% 25%, var(--bg) 0% 50%) 0 0 / 18px
    18px;
  padding: 0.8rem;
  display: flex;
  justify-content: center;
}
.ps-canvas {
  display: block;
  max-width: 100%;
  max-height: 32rem;
  width: auto;
  height: auto;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  background: #fff;
}
.ps-info {
  margin-top: 0.7rem;
  font-size: 0.86rem;
  color: var(--text-dim);
}
.ps-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}
.ps-actions button {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  cursor: pointer;
}
.ps-actions button:hover {
  filter: brightness(1.08);
}
.ps-actions button[name='print'] {
  color: var(--primary);
  background: var(--bg);
  border: 1.5px solid var(--primary);
}

/* ---- small content helpers ---- */

.privnote {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
}

.prose table.fmt td:first-child,
.prose table.fmt th:first-child {
  min-width: 6rem;
}

/* ---- print: only the generated sheet image ---- */

img.ps-print {
  display: none;
}
@media print {
  @page {
    margin: 0;
  }
  body > *:not(.ps-print) {
    display: none !important;
  }
  img.ps-print {
    display: block !important;
    height: auto;
    margin: 0 auto;
  }
}

@media (max-width: 560px) {
  .ps {
    padding: 0.9rem;
  }
  .ps-canvas {
    max-height: 24rem;
  }
  .ps-actions button {
    flex: 1 1 auto;
    text-align: center;
  }
}
