/* ==========================================================================
   posters.css — the offer poster library (posters.js)
   Kept in its own file so the poster screen can change without touching the
   11,000 lines of index.css the till depends on.
   ========================================================================== */

.gkp { max-width: 1180px; margin: 0 auto; }
.gkp-card { padding-bottom: 24px; }
.gkp-lead { color: var(--text-muted); font-size: 0.9rem; margin: 6px 0 16px; line-height: 1.45; }
.gkp-h {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin: 22px 0 10px;
}
.gkp-help { font-size: 0.78rem; color: var(--text-muted); margin: 4px 0 0; line-height: 1.4; }

/* Size picker: Status / Reel (9:16) or Post (1:1) */
.gkp-size { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.gkp-size__btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: var(--radius-btn);
  border: 1.5px solid var(--ink-300); background: #fff; color: var(--text-dark);
  cursor: pointer; font: inherit; text-align: left; min-height: 44px;
}
.gkp-size__btn strong { display: block; font-size: 0.84rem; }
.gkp-size__btn em { display: block; font-style: normal; font-size: 0.72rem; color: var(--text-muted); }
.gkp-size__btn.is-on { border-color: var(--magenta-600); background: var(--magenta-50); }
.gkp-size__shape { display: block; border: 2px solid currentColor; border-radius: 3px; opacity: 0.7; }
.gkp-size__shape--status { width: 12px; height: 20px; }
.gkp-size__shape--post { width: 18px; height: 18px; }
.gkp-size__shape--a4 { width: 22px; height: 16px; }
.gkp-size__shape--a4p { width: 15px; height: 21px; }
.gkp-size__shape--card { width: 22px; height: 13px; }

/* Thumbnails */
.gkp-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.gkp-thumb {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 0; border: 0; background: none; cursor: pointer; font: inherit; text-align: left;
  color: var(--text-dark);
}
.gkp-thumb canvas {
  display: block; width: 100%; height: auto; border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(13, 15, 28, 0.08), 0 6px 18px rgba(13, 15, 28, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gkp-thumb:hover canvas, .gkp-thumb__open:hover canvas { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(13, 15, 28, 0.16); }
.gkp-thumb:focus-visible canvas, .gkp-thumb__open:focus-visible canvas { outline: 3px solid var(--magenta-600); outline-offset: 3px; }
.gkp-thumb__slot {
  display: block; width: 100%; border-radius: var(--radius-md); background: var(--ink-100);
}
.gkp-thumb__slot[data-size="status"] { aspect-ratio: 9 / 16; }
.gkp-thumb__slot[data-size="post"] { aspect-ratio: 1 / 1; }
.gkp-thumb__slot[data-size="a4"] { aspect-ratio: 1414 / 1000; }
.gkp-thumb__slot[data-size="card"] { aspect-ratio: 1050 / 600; }
/* A4 landscape posters are wide; two grid cells keep them readable. */
.gkp-thumb--wide { grid-column: span 2; }
.gkp-cats { margin: 0 0 14px; }
.gkp-chip__n { font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.gkp-chip.is-on .gkp-chip__n { color: inherit; opacity: 0.75; }
.gkp-thumb__name { font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gkp-thumb__open {
  display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; background: none;
  cursor: pointer; font: inherit; text-align: left; color: inherit; outline: none;
}
.gkp-thumb__del {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, 0.92); color: var(--ink-800); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(13, 15, 28, 0.2);
}
.gkp-thumb__del:hover { color: var(--danger, #B42318); }

/* Editor */
.gkp-editor__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.gkp-editor__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 24px; align-items: start; }
.gkp-preview { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.gkp-preview__frame { width: 100%; display: flex; justify-content: center; }
.gkp-preview__frame canvas {
  display: block; height: auto; max-width: 100%; border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(13, 15, 28, 0.08), 0 10px 30px rgba(13, 15, 28, 0.14);
}
.gkp-preview__frame[data-size="status"] canvas { width: min(100%, calc((100vh - 220px) * 9 / 16)); }
.gkp-preview__frame[data-size="post"] canvas { width: min(100%, calc(100vh - 220px)); }
.gkp-preview__frame[data-size="a4"] canvas,
.gkp-preview__frame[data-size="card"] canvas { width: 100%; }
.gkp-preview__frame[data-size="a4p"] canvas { width: min(100%, calc((100vh - 220px) * 1000 / 1414)); }
.gkp-actions { display: flex; gap: 10px; width: 100%; max-width: 420px; }
.gkp-actions .btn { flex: 1; min-height: 48px; justify-content: center; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.gkp-saved-note { font-size: 0.76rem; color: var(--text-muted); margin: 0; min-height: 1em; }

.gkp-form { display: flex; flex-direction: column; gap: 14px; }
.gkp-set {
  border: 1px solid var(--ink-200); border-radius: var(--radius-card); padding: 14px 16px 16px;
  margin: 0; background: #fff; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.gkp-set legend { font-size: 0.84rem; font-weight: 700; color: var(--primary-green); padding: 0 6px; }
.gkp-set .input-group { margin: 0; }
.gkp-set textarea { resize: vertical; min-height: 120px; font: inherit; }

.gkp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gkp-chip {
  border: 1.5px solid var(--ink-300); background: #fff; color: var(--text-dark);
  border-radius: var(--radius-pill); padding: 8px 14px; font: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; min-height: 40px;
}
.gkp-chip.is-on { border-color: var(--magenta-600); background: var(--magenta-50); color: var(--magenta-700); }

.gkp-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.gkp-swatch {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--ink-300);
  background:
    radial-gradient(circle at 70% 30%, var(--c) 0 22%, transparent 23%),
    linear-gradient(135deg, var(--a), var(--b));
}
.gkp-swatch.is-on { box-shadow: 0 0 0 3px var(--magenta-600); }

.gkp-colors { display: flex; flex-wrap: wrap; gap: 14px; }
.gkp-colors label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.gkp-colors input[type="color"] {
  width: 40px; height: 40px; padding: 0; border: 1.5px solid var(--ink-300); border-radius: var(--radius-sm);
  background: none; cursor: pointer;
}

.gkp-photo-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gkp-file { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.gkp-link {
  background: none; border: 0; color: var(--magenta-700); text-decoration: underline;
  font-weight: 600; cursor: pointer; padding: 6px 4px;
}
.gkp-range { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; font-size: 0.8rem; font-weight: 600; }
.gkp-range input { width: 100%; accent-color: var(--magenta-600); }
.gkp-check { display: flex; align-items: center; gap: 10px; font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.gkp-check input { width: 18px; height: 18px; accent-color: var(--magenta-600); }

@media (max-width: 860px) {
  .gkp-editor__body { grid-template-columns: 1fr; }
  .gkp-preview { position: static; }
  .gkp-preview__frame[data-size="status"] canvas { width: min(100%, calc(62vh * 9 / 16)); }
  .gkp-preview__frame[data-size="post"] canvas { width: min(100%, 62vh); }
  .gkp-preview__frame[data-size="a4p"] canvas { width: min(100%, calc(62vh * 1000 / 1414)); }
}
@media (max-width: 480px) {
  .gkp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .gkp-size { width: 100%; }
  .gkp-size__btn { flex: 1; }
  .gkp-size--bar { width: auto; }
  .gkp-size--bar .gkp-size__btn { padding: 6px 10px; }
  .gkp-range { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 680px) {
  /* Eight groups wrapped into four rows and pushed the designs off the
     screen; on a phone they scroll sideways in one row instead. */
  .gkp-cats { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 6px; scrollbar-width: none; }
  .gkp-cats::-webkit-scrollbar { display: none; }
  .gkp-cats .gkp-chip { flex: none; }
}

/* Printing an A4 poster. posterStudio.print() adds the sheet and the class,
   and takes both away when printing ends; the @page size is set there too,
   because it has to match the poster's orientation. */
#gkp-print-sheet { display: none; }
@media print {
  html.gkp-printing, html.gkp-printing body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  html.gkp-printing body > *:not(#gkp-print-sheet) { display: none !important; }
  html.gkp-printing #gkp-print-sheet { display: block !important; visibility: visible !important; }
  html.gkp-printing #gkp-print-sheet img { display: block; visibility: visible !important; width: 296mm; height: 209mm; }
  html.gkp-printing #gkp-print-sheet[data-orient="portrait"] img { width: 209mm; height: 296mm; }
}

/* One card or a sheet of ten, under the buttons when a card is open. */
.gkp-cardmode { justify-content: center; max-width: 420px; }
.gkp-cardmode[hidden] { display: none; }
