/* ==========================================================================
   Printable puzzle template (template-print.php)
   Uses the shared design tokens defined in sudoku.css.
   ========================================================================== */

.psp__wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 6px 0 44px;
}

.psp__head { text-align: center; margin-bottom: 20px; }
.psp__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  color: var(--ink);
  letter-spacing: -.02em;
  margin: 0 0 6px;
}
.psp__intro {
  color: var(--ink-soft);
  font-size: .95rem;
  max-width: 46ch;
  margin: 0 auto;
}

.psp__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}
.psp__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: left;
}
.psp__field select {
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 34px 9px 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6478' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .15s, box-shadow .15s;
}
.psp__field select:hover { border-color: var(--ink-faint); }
.psp__field select:focus-visible {
  outline: none;
  border-color: var(--pen);
  box-shadow: 0 0 0 3px var(--pen-wash);
}
.psp__check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .88rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.psp__check input { width: 16px; height: 16px; accent-color: var(--pen); cursor: pointer; }

.psp__meta {
  text-align: center;
  font-family: var(--font-display);
  font-size: .9rem;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

/* --- The grid --- */
.psp-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(100%, 512px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
}
.psp-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.05rem, 5vw, 1.7rem);
  color: var(--ink);
}
.psp-cell:nth-child(9n) { border-right: 0; }
.psp-cell:nth-child(n+73) { border-bottom: 0; }
.psp-cell--rborder { border-right: 2px solid var(--ink); }
.psp-cell--bborder { border-bottom: 2px solid var(--ink); }

/* --- Answer key (hidden until toggled) --- */
.psp__answer { display: none; margin-top: 30px; }
#print-sudoku.psp-show-answer .psp__answer { display: block; }
.psp__answer-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  margin: 0 0 12px;
}
.psp-grid--solution { width: min(72%, 340px); border-width: 2px; }
.psp-grid--solution .psp-cell {
  font-size: clamp(.7rem, 3vw, 1rem);
  font-weight: 400;
  color: var(--ink-soft);
}

.psp__hint {
  text-align: center;
  font-size: .82rem;
  color: var(--ink-faint);
  margin: 22px auto 0;
  max-width: 52ch;
}

/* ==========================================================================
   Print — strip the site chrome, leave only the puzzle (and key if enabled).
   ========================================================================== */
@media print {
  .site-header,
  .site-footer,
  .psp__controls,
  .psp__hint,
  .psp__intro,
  .no-print { display: none !important; }

  body { background: #fff !important; color: #000 !important; }
  .play, .psp { padding: 0 !important; }
  .psp__wrap { max-width: 100%; padding: 0; }
  .psp__head { margin-bottom: 14px; }
  .psp__title { color: #000; }
  .psp__meta { color: #333; margin-bottom: 12px; }

  .psp-grid {
    width: 5.4in;
    max-width: 92%;
    border-color: #000;
  }
  .psp-cell { color: #000; border-color: #999; }
  .psp-cell--rborder,
  .psp-cell--bborder { border-color: #000; }

  /* Answer key prints only when the visitor ticked the box. */
  #print-sudoku:not(.psp-show-answer) .psp__answer { display: none !important; }
  .psp__answer { page-break-inside: avoid; break-inside: avoid; }
  .psp__answer-title { color: #000; }
  .psp-grid--solution .psp-cell { color: #222; }

  @page { margin: 0.6in; }
}
