/* design.css — the designer (Phase A) + counter QR.
 *
 * Only loaded on /design. Kept out of style.css so the shop's pages do not
 * carry a tool they never open.
 *
 * Canon (DESIGN.md): cream ground, pine as the single UI accent, Meskel gold
 * only for the fold band and ornaments. No new palette invented here.
 * Motion (Emil): transform/opacity only, custom easing, under 300ms, press
 * feedback at 0.97, and everything respects prefers-reduced-motion.
 */

/* ── the picker ─────────────────────────────────────────────────────── */

.dsn {
  --dsn-radius: 16px;
  margin-top: 8px;
}

.dsn-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 20px;
  align-items: end;
  margin-bottom: 18px;
}

.dsn-field { min-width: 0; }

.dsn-label {
  display: block;
  font-size: .78rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}

.dsn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dsn-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  font-size: .9rem;
  line-height: 1.1;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  transition: transform 160ms cubic-bezier(.2,.7,.3,1), background-color 160ms, border-color 160ms;
}

.dsn-chip:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.dsn-chip:active { transform: scale(.97); }
.dsn-chip.is-on {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--btn-fg);
}
.dsn-chip-am { font-size: .72rem; opacity: .62; }
.dsn-chip.is-on .dsn-chip-am { opacity: .82; }

.dsn-field-size { display: flex; flex-direction: column; align-items: flex-end; }
.dsn-field-size .dsn-label { align-self: flex-end; }

#dsnSize {
  font: inherit;
  font-size: .95rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  min-width: 15rem;
  max-width: 100%;
}

.dsn-price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-top: 6px;
  color: var(--pine-deep);
}

/* ── the work area ──────────────────────────────────────────────────── */

.dsn-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: 22px;
  align-items: start;
}

.dsn-stage-wrap { min-width: 0; }

.dsn-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52vh;
  padding: 10px;
  border-radius: var(--dsn-radius);
  background:
    linear-gradient(0deg, rgba(36,31,24,.035), rgba(36,31,24,.035)),
    var(--paper-2);
  border: 1px solid var(--line);
  touch-action: none;          /* we do the pinching, not the browser */
  overscroll-behavior: contain;
  cursor: grab;
  overflow: hidden;
}

.dsn-stage.is-dragging { cursor: grabbing; }
.dsn-stage:focus-visible { outline: 2px solid var(--pine); outline-offset: 3px; }
.dsn-stage canvas { display: block; max-width: 100%; height: auto; border-radius: 2px; }
.dsn-stage canvas[hidden] { display: none; }

.dsn-empty {
  text-align: center;
  padding: 28px 20px;
  max-width: 30rem;
}
.dsn-empty-title { font-size: 1.15rem; font-weight: 600; margin: 0 0 6px; }
.dsn-empty-sub { color: var(--text-soft); margin: 0 0 16px; font-size: .93rem; }
.dsn-empty[hidden] { display: none; }

/* the readout: dpi is the whole point of this tool, so it is not a tooltip */
.dsn-readout {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 4px 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: .9rem;
  min-height: 3.2rem;
}
.dsn-readout:empty { display: none; }
.dsn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot-idle); }
.dsn-verdict { display: flex; gap: 8px; align-items: baseline; }
.dsn-verdict b { font-weight: 600; }
.dsn-verdict span { font-size: .78rem; color: var(--text-mute); }
.dsn-dpi { font-variant-numeric: tabular-nums; color: var(--text-soft); white-space: nowrap; }
.dsn-dpi b { font-size: 1.05rem; color: var(--ink); }
.dsn-detail { color: var(--text-soft); font-size: .84rem; line-height: 1.45; }

.dsn-good .dsn-dot { background: var(--flag-green); }
.dsn-warn .dsn-dot { background: var(--gold); }
.dsn-bad  .dsn-dot { background: var(--danger-line); }
.dsn-bad  { border-color: var(--danger-line); }
.dsn-bad .dsn-verdict b { color: var(--danger); }

.dsn-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.dsn-tools button,
.dsn-tools .btn {
  font-size: .85rem;
}

.dsn-tools button {
  appearance: none;
  font: inherit;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: transform 140ms cubic-bezier(.2,.7,.3,1), background-color 140ms;
}
.dsn-tools button:hover { background: var(--surface-hover); }
.dsn-tools button:active { transform: scale(.97); }
.dsn-tools button:disabled { opacity: .45; cursor: not-allowed; }
.dsn-tools button.is-on {
  border-color: var(--pine);
  color: var(--pine);
  background: var(--pine-soft);
}

#dsnZoom {
  flex: 1 1 8rem;
  min-width: 6rem;
  accent-color: var(--pine);
}

.dsn-legend {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 2px 0;
  font-size: .8rem;
  color: var(--text-soft);
  line-height: 1.4;
}
.dsn-legend-band {
  width: 26px;
  height: 12px;
  flex: none;
  border-radius: 3px;
  background: rgba(193,146,43,.35);
  border: 1px dashed rgba(193,146,43,.95);
}

.dsn-hint {
  margin: 8px 2px 0;
  font-size: .82rem;
  color: var(--text-soft);
  line-height: 1.45;
}
.dsn-hint[hidden] { display: none; }

/* ── the save panel ─────────────────────────────────────────────────── */

.dsn-save {
  position: sticky;
  top: 92px;
  padding: 20px;
  border-radius: var(--dsn-radius);
  border: 1px solid var(--line);
  background: var(--white);
}
.dsn-save h2 { font-size: 1.1rem; margin: 0 0 6px; }
.dsn-save p { color: var(--text-soft); font-size: .88rem; line-height: 1.5; margin: 0 0 14px; }
.dsn-save .btn { width: 100%; }
.dsn-save .btn[disabled] { opacity: .5; cursor: not-allowed; }
.dsn-fine { font-size: .76rem !important; color: var(--text-mute) !important; margin-top: 14px !important; }

.dsn-save-state { font-size: .85rem; margin-top: 10px; }
.dsn-save-state.is-bad { color: var(--danger); }
.dsn-save-state.is-good { color: var(--pine-deep); }

.dsn-result {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.dsn-result-kicker {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 0 4px;
}
.dsn-result-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.35rem; letter-spacing: .06em; color: var(--ink); margin: 0 0 6px;
}
.dsn-result-note { margin-bottom: 12px; }
.dsn-result-actions { display: grid; gap: 8px; }
.dsn-result-small { font-size: .74rem; color: var(--text-mute); margin-top: 12px; }

/* ── counter mode ───────────────────────────────────────────────────── */

.dsn-counter {
  margin-top: 26px;
  padding: 20px;
  border-radius: var(--dsn-radius);
  border: 1px solid var(--line);
  background: var(--white);
}
.dsn-counter[hidden] { display: none; }

.dsn-qr-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}
.dsn-qr {
  width: 190px;
  height: 190px;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.dsn-qr svg { width: 100%; height: 100%; display: block; }
.dsn-qr-copy h2 { font-size: 1.15rem; margin: 0 0 6px; }
.dsn-qr-copy p { color: var(--text-soft); font-size: .9rem; margin: 0 0 8px; line-height: 1.5; }
.dsn-session-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem; letter-spacing: .14em; color: var(--ink);
}
.dsn-session-note { font-size: .78rem; color: var(--text-mute); }

.dsn-arrivals {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
}
.dsn-arrivals-empty {
  color: var(--text-mute);
  font-size: .88rem;
  padding: 14px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}
.dsn-arrival {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: .88rem;
  transition: border-color 160ms, background-color 160ms;
}
.dsn-arrival.is-on { border-color: var(--pine); background: var(--pine-soft); }
.dsn-arrival.is-loading { opacity: .6; }
.dsn-arrival.is-failed { border-color: var(--danger-line); }
.dsn-arrival-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsn-arrival-size { color: var(--text-mute); font-size: .78rem; font-variant-numeric: tabular-nums; }

/* ── customer join screen (?join=…) ─────────────────────────────────── */

.dsn-join { display: none; }
body.dsn-joining .dsn-top,
body.dsn-joining .dsn-work { display: none; }
body.dsn-joining .dsn-join {
  display: block;
  padding: 24px;
  border-radius: var(--dsn-radius);
  border: 1px solid var(--line);
  background: var(--white);
}
.dsn-join h2 { margin: 0 0 8px; font-size: 1.25rem; }
.dsn-join p { color: var(--text-soft); font-size: .93rem; line-height: 1.55; }
.dsn-join .btn { width: 100%; margin-top: 6px; }
#dsnJoinState { margin-top: 12px; font-size: .9rem; }
#dsnJoinState.is-bad { color: var(--danger); }
#dsnJoinState.is-good { color: var(--pine-deep); }
#dsnJoinList { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
#dsnJoinList li { font-size: .84rem; color: var(--text-soft); }

/* ── responsive ─────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .dsn-work { grid-template-columns: 1fr; }
  .dsn-save { position: static; }
  .dsn-top { grid-template-columns: 1fr; }
  .dsn-field-size { align-items: flex-start; }
  .dsn-field-size .dsn-label { align-self: flex-start; }
  #dsnSize { width: 100%; }
  .dsn-stage { min-height: 46vh; }
}

@media (max-width: 560px) {
  .dsn-chip { padding: 8px 11px; font-size: .84rem; }
  .dsn-readout { grid-template-columns: auto 1fr; }
  .dsn-detail { grid-column: 1 / -1; }
  .dsn-qr-wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .dsn-arrival { grid-template-columns: 1fr auto; }
  .dsn-arrival .dsn-arrival-use { grid-column: 1 / -1; }
}

/* ── reduced motion ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .dsn-chip, .dsn-tools button, .dsn-arrival { transition: none; }
  .dsn-chip:active, .dsn-tools button:active { transform: none; }
}

/* ── saved-design viewer (/design-view) ─────────────────────────────── */

.dv-state {
  padding: 18px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  color: var(--text-soft);
  font-size: .92rem;
}
.dv-state.is-bad { border-color: var(--danger-line); color: var(--danger); border-style: solid; }

.dv-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 22px;
  align-items: start;
}
.dv-shot {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.dv-shot img { display: block; width: 100%; height: auto; }
.dv-facts {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--white);
}
.dv-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.3rem;
  letter-spacing: .06em;
  margin: 0 0 12px;
}
.dv-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0 0 16px;
  font-size: .88rem;
}
.dv-list dt { color: var(--text-mute); }
.dv-list dd { margin: 0; color: var(--ink); }
.dv-facts .btn { width: 100%; margin-top: 8px; }

@media (max-width: 860px) {
  .dv-body { grid-template-columns: 1fr; }
}

.dsn-noscript {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--gold-rule);
  background: var(--yellow-soft);
  color: var(--ink);
  font-size: .9rem;
  margin-bottom: 16px;
}

.dsn-provisional {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--gold-rule);
  background: var(--yellow-soft);
  color: var(--ink);
  font-size: .82rem;
  line-height: 1.45;
}
.dsn-provisional[hidden] { display: none; }

/* ── Phase B: frames and text ───────────────────────────────────────── */

/* The designer's own Ethiopic face: the full block, not the 167-glyph subset
   the site pages ship. A customer's mother's name must have every glyph. */
@font-face {
  font-family: 'Norcha Ethiopic';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/noto-ethiopic-full.woff2') format('woff2');
  unicode-range: U+030E, U+1200-1399, U+2D80-2DDE, U+AB01-AB2E, U+1E7E0-1E7E6, U+1E7E8-1E7EB, U+1E7ED-1E7EE, U+1E7F0-1E7FE;
}

.dsn-tplbar {
  display: grid;
  gap: 10px;
  margin: 4px 0 20px;
}

.dsn-chips-tpl { gap: 6px; }

.dsn-chip-tpl {
  padding: 7px 12px;
  font-size: .85rem;
  gap: 6px;
}

.dsn-tpl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.dsn-text {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dsn-text[hidden] { display: none; }

.dsn-text-field {
  display: grid;
  gap: 6px;
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--text-mute);
}

.dsn-text-field input {
  font: inherit;
  font-size: .95rem;
  letter-spacing: normal;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
.dsn-text-field input:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 1px;
}

@media (max-width: 560px) {
  .dsn-text { grid-template-columns: 1fr; }
}

/* ── product mockup toggle (mug / book / calendar) ─────────────────── */

.dsn-view {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
}
.dsn-view[hidden] { display: none; }

.dsn-view button {
  appearance: none;
  font: inherit;
  font-size: .82rem;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 160ms, color 160ms, transform 140ms cubic-bezier(.2,.7,.3,1);
}
.dsn-view button:hover { color: var(--ink); }
.dsn-view button:active { transform: scale(.97); }
.dsn-view button.is-on {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(46,37,26,.10);
}

.dsn-mock-note {
  margin: 6px 2px 0;
  font-size: .78rem;
  color: var(--text-mute);
  line-height: 1.45;
}
.dsn-mock-note[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .dsn-view button { transition: none; }
  .dsn-view button:active { transform: none; }
}

/* fill / fit */
.dsn-mode {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin: 10px 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  vertical-align: middle;
}
.dsn-mode[hidden] { display: none; }
.dsn-mode button {
  appearance: none;
  font: inherit;
  font-size: .8rem;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}
.dsn-mode button.is-on { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(46,37,26,.10); }
.dsn-mode button:active { transform: scale(.97); }

/* ── book strip (Phase B1) ─────────────────────────────────────────────
   Sits INSIDE the existing designer, above the work area, and only when the
   chosen product is a book. The designer below it edits one page at a time;
   the strip is the navigation. Same canon: cream, pine, gold untouched. */

.bk { margin: 0 0 20px; }
.bk[hidden] { display: none; }

.bk-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.bk-head .dsn-label { margin: 0; }
.bk-meta {
  flex: 1 1 auto;
  font-size: .8rem;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.bk-head .btn { margin-left: auto; }

.bk-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 2px 2px 6px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.bk-item { margin: 0; flex: 0 0 96px; scroll-snap-align: start; }

.bk-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 140ms, box-shadow 140ms, transform 140ms cubic-bezier(.2,.8,.2,1);
}
.bk-thumb:hover { border-color: var(--line-strong); }
.bk-thumb:active { transform: scale(.97); }
.bk-thumb canvas { display: block; width: 100%; height: auto; }
.bk-item.is-on .bk-thumb {
  border-color: var(--pine);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pine) 24%, transparent);
}
.bk-num {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: .6rem;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.bk-item.is-on .bk-num { background: var(--pine); color: #fff; }

.bk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bk-add { border-color: var(--pine); color: var(--pine); }

.bk-tool {
  appearance: none;
  font: inherit;
  font-size: .78rem;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 140ms, color 140ms, transform 140ms;
}
.bk-tool:hover { border-color: var(--line-strong); color: var(--ink); }
.bk-tool:active { transform: scale(.97); }
.bk-tool:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.bk-hint { margin: 10px 0 0; font-size: .82rem; color: var(--text-soft); min-height: 1.3em; }
.bk-state { margin: 6px 0 0; font-size: .78rem; color: var(--text-mute); min-height: 1.1em; }
.bk-state:empty { display: none; }
.bk-fine { margin: 8px 0 0; font-size: .72rem; color: var(--text-mute); max-width: 60em; }

/* in a book there is no single "save this design": the book is the artefact */
body.book-mode .dsn-save { display: none; }
body.book-mode .dsn-work { grid-template-columns: minmax(0, 1fr); }

@media (prefers-reduced-motion: reduce) {
  .bk-thumb, .bk-tool { transition: none; }
  .bk-thumb:active, .bk-tool:active { transform: none; }
}

/* ── B2: multi-photo pages ─────────────────────────────────────────────
   In book mode the customer must see the PAGE, not one photo stretched over
   it. The designer's own stage is hidden and this composite is the preview;
   its controls (zoom, rotate, fit/fill, the frame chips) still drive the
   active box, and every change repaints this canvas. */

body.book-mode .dsn-stage { display: none; }
body.book-mode .dsn-legend { display: none; }

.bk-page {
  margin: 12px 0 0;
  display: flex;
  justify-content: center;
  padding: 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.bk-page canvas {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  background: #EFE9DF;
  border-radius: 3px;
}

.bk-layouts { margin-top: 14px; }
.bk-apply-frame { margin-top: 8px; }
.bk-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.bk-slot {
  appearance: none;
  font: inherit;
  font-size: .74rem;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--text-mute);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.bk-slot.is-filled { color: var(--ink); border-color: var(--line-strong); }
.bk-slot.is-on { border-color: var(--pine); color: var(--pine); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pine) 20%, transparent); }
.bk-slot:active { transform: scale(.97); }

.bk-upload { margin-top: 10px; }

/* the designer's dpi readout measures the whole surface; in a book the photo
   sits in a box, so the strip's own per-box verdict is the honest number */
body.book-mode .dsn-readout { display: none; }

.bk-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.bk-upload .bk-up { padding-inline: 18px; }
.bk-up-note { font-size: .74rem; color: var(--text-mute); }
.bk-upload + .bk-page { margin-top: 12px; }

/* fill panel */
.bk-fill-open { border-style: dashed; }
.bk-fill-panel {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
}
.bk-fill-panel[hidden] { display: none; }
.bk-fill-lead { margin: 0 0 10px; font-size: .82rem; color: var(--text-soft); max-width: 60em; }
.bk-fill-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bk-fill-count { font-size: .78rem; color: var(--text-mute); }
.bk-fill-block { margin-top: 14px; }
.bk-fill-block .dsn-chips { flex-wrap: wrap; }
.dsn-chip-sm { font-size: .74rem; padding: 5px 10px; }
#bkFillGo { margin-top: 14px; }
#bkFillGo:disabled { opacity: .5; cursor: not-allowed; }

/* which build am I looking at? The one question a stale cache makes impossible
   to answer over the phone. */
.bk-build { margin: 6px 0 0; font-size: .68rem; letter-spacing: .04em; color: var(--text-mute); opacity: .75; }

/* the one line I can ask a customer to read aloud when a phone misbehaves */
.bk-diag {
  margin: 10px 0 0;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .86rem;
  line-height: 1.45;
  color: #6B4614;
  background: #FBF3DF;
  border-left: 4px solid var(--gold, #C1922B);
  border-radius: 6px;
  word-break: break-word;
}
.bk-diag:empty { display: none; }


/* The picker is the input itself, stretched invisibly over the button. A
   label pointing at a hidden input failed on this phone; an input under the
   thumb cannot fail, because there is nothing to forward. */
.bk-up-wrap { position: relative; display: inline-flex; }
.bk-up-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.bk-up-wrap:focus-within .bk-up { outline: 2px solid var(--pine); outline-offset: 2px; }

/* ── the month strip (calendars) ─────────────────────────────────────────────
   Same visual language as the book strip: a quiet card, a label, then the
   controls. The month chips are two-line because a Ge'ez month is not
   recognisable to every customer from its transliteration alone. */
.cm {
  margin-top: 16px;
  padding: 16px 16px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.cm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cm-meta { font-size: .74rem; color: var(--text-mute); }
.cm-yearrow { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.cm-step {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--pine-deep); font-size: 18px; line-height: 1;
  cursor: pointer;
}
.cm-step:active { transform: scale(0.97); }
.cm-year { font-weight: 700; font-size: .95rem; color: var(--ink); min-width: 84px; text-align: center; }
.cm-sys { margin-inline-start: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cm-sysb {
  border: 0; background: #fff; padding: 7px 12px; font: inherit; font-size: .78rem;
  color: var(--text-mute); cursor: pointer;
}
.cm-sysb.is-on { background: var(--pine); color: var(--btn-fg); font-weight: 700; }
.cm-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-top: 12px; }
.cm-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; font: inherit;
}
.cm-chip-am { font-size: .86rem; font-weight: 700; color: var(--ink); }
.cm-chip-en { font-size: .64rem; color: var(--text-mute); letter-spacing: .02em; }
.cm-chip.is-on { border-color: var(--pine); box-shadow: 0 0 0 2px var(--pine-soft); }
.cm-chip.is-on .cm-chip-am { color: var(--pine-deep); }
.cm-state { margin: 10px 0 0; font-size: .74rem; color: var(--text-mute); }

/* ── the print proof ─────────────────────────────────────────────────────────
   A sheet for the shop, not for the customer: every page, labelled, in order.
   Print rules matter more than screen rules here — this page exists to be
   printed, and a proof that scales pages to fit a sheet would misreport the
   crop it is supposed to prove. */
.pf { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.pf-state { color: var(--text-mute); }
.pf-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.pf-code { margin: 0; font-weight: 800; font-size: 1.25rem; letter-spacing: .04em; color: var(--ink); }
.pf-sub { margin: 4px 0 0; font-size: .82rem; color: var(--text-mute); }
.pf-warn {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 8px;
  background: #FBEFE2; border-left: 4px solid #C1922B; color: #5A4A2E; font-size: .84rem;
}
.pf-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.pf-page { margin: 0; }
.pf-canvas {
  width: 100%; height: auto; display: block; border-radius: 4px;
  box-shadow: 0 2px 10px -6px rgba(20,30,26,.45); background: #fff;
}
.pf-cap { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; font-size: .78rem; }
.pf-num { color: var(--text-mute); font-variant-numeric: tabular-nums; }
.pf-name { font-weight: 700; color: var(--pine-deep); }
.pf-note { margin-top: 26px; font-size: .76rem; color: var(--text-mute); }

@media print {
  .site-head, .site-foot, .pf-note, .pf-head .btn, #pfWarn, nav, footer { display: none !important; }
  .pf { max-width: none; padding: 0; }
  .pf-head { border-bottom: 1px solid #000; margin-bottom: 8mm; }
  .pf-body { grid-template-columns: repeat(2, 1fr); gap: 10mm; }
  .pf-page { break-inside: avoid; page-break-inside: avoid; }
  .pf-canvas { box-shadow: none; border: 1px solid #ddd; }
  .pf-cap { font-size: 9pt; }
}
.bk-proof {
  display: inline-block; margin-top: 10px; padding: 10px 16px; border-radius: 8px;
  background: var(--pine-soft); color: var(--pine-deep); font-weight: 700; font-size: .84rem;
  text-decoration: none;
}
.bk-proof:hover { background: var(--pine); color: var(--btn-fg); }

/* ── the free note ─────────────────────────────────────────────────────── */
.dsn-note {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}
.dsn-note-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.dsn-note-x {
  appearance: none;
  font: inherit;
  font-size: .74rem;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--text-mute);
  cursor: pointer;
}
.dsn-note-x:hover { border-color: var(--line-strong); color: var(--ink); }
.dsn-note input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}
.dsn-note-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.dsn-note-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .76rem;
  color: var(--text-mute);
}
.dsn-note-size input { width: 6.5rem; accent-color: var(--pine); }
.dsn-note-chips { gap: 4px; }
.dsn-note-chips button {
  appearance: none;
  font: inherit;
  font-size: .72rem;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 140ms, color 140ms, background 140ms, transform 140ms;
}
.dsn-note-chips button:hover { border-color: var(--line-strong); }
.dsn-note-chips button:active { transform: scale(.97); }
.dsn-note-chips button.is-on {
  border-color: var(--pine);
  color: var(--pine);
  background: var(--pine-soft);
}
.dsn-note-hint { margin: 8px 0 0; font-size: .72rem; color: var(--text-mute); }

/* paper swatches: a dot of the actual ground, not a colour name */
.dsn-bg-dot {
  display: inline-block;
  width: .85em;
  height: .85em;
  margin-right: .35em;
  border-radius: 50%;
  border: 1px solid currentColor;
  vertical-align: -1px;
}
.dsn-field-bg, .dsn-field-pack { min-width: 0; }

/* The paper and the free note are PAGE features: they live on a book or a
   calendar page, which the proof and the strip both render. On a single print
   the saved design is a server-rendered preview that knows nothing about them,
   so offering the control there would be a promise the product cannot keep. */
body:not(.book-mode):not(.cal-mode) .dsn-field-pack,
body:not(.book-mode):not(.cal-mode) .dsn-field-bg,
body:not(.book-mode):not(.cal-mode) #dsnNoteAdd,
body:not(.book-mode):not(.cal-mode) .dsn-note { display: none; }

/* what the picture under the pages is, in words: an unlabelled spread reads as
   a photo, and the point is that this is the book */
.bk-page-cap {
  margin: 8px 0 0;
  font-size: .76rem;
  letter-spacing: .02em;
  color: var(--text-mute);
  text-align: center;
}
.bk-page { flex-direction: column; align-items: center; }
