/* Print shop: brand palette (charcoal / cream / sand / leaf), flat rectangles, thin lines, no effects. */
@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(/shop/fonts/poppins-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/shop/fonts/poppins-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url(/shop/fonts/poppins-latin-600-normal.woff2) format('woff2'); }
:root {
  --cream: #fffcf0; --charcoal: #232323; --panel: #2b2b2b; --panel-2: #333; --panel-3: #3d3d3d;
  --sand: #c6af99; --leaf: #b6d376; --clay: #e08263;
  --muted: rgba(255, 252, 240, 0.68); --faint: rgba(255, 252, 240, 0.42);
  --line: rgba(198, 175, 153, 0.42); --line-soft: rgba(255, 252, 240, 0.13);
  --a4-h: 0px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--charcoal); color: var(--cream); font: 15px/1.5 Poppins, system-ui, -apple-system, 'Segoe UI', sans-serif; }
[dir='rtl'] body { font-family: Poppins, 'Geeza Pro', 'Segoe UI', 'Noto Naskh Arabic', Tahoma, sans-serif; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }
svg { display: block; flex: none; }

/* ---- buttons, fields ---- */
button {
  appearance: none; font: inherit; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px;
  min-height: 46px; padding: 0 20px; border: 1px solid var(--cream); background: var(--cream); color: var(--charcoal); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover { background: #fff; }
button:active { background: var(--sand); border-color: var(--sand); }
button:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: transparent; color: var(--cream); border-color: var(--line); }
button.ghost:hover { border-color: var(--cream); }
button.small { min-height: 36px; padding: 0 14px; font-size: 11.5px; }
button.icon { min-height: 40px; width: 40px; padding: 0; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-transform: none; letter-spacing: 0; min-height: 36px; padding: 0 6px; font-weight: 400; font-size: 14px; }
button.link:hover { color: var(--cream); }
button.danger { color: var(--clay); border-color: rgba(224, 130, 99, 0.5); }
button.link.danger { color: var(--clay); }
button.danger-fill { background: var(--clay); border-color: var(--clay); color: var(--charcoal); }
[dir='rtl'] button { letter-spacing: 0; font-size: 15px; }
[dir='rtl'] button.small { font-size: 13.5px; }
input, select { font: inherit; color: var(--cream); background: var(--panel-2); border: 1px solid var(--line); border-radius: 0; }
input { padding: 12px 14px; min-height: 50px; width: 100%; }
select { min-height: 36px; padding: 0 30px 0 10px; appearance: none; cursor: pointer; font-size: 13.5px;
  background-image: linear-gradient(45deg, transparent 50%, var(--sand) 50%), linear-gradient(135deg, var(--sand) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
[dir='rtl'] select { padding: 0 10px 0 30px; background-position: 10px 15px, 15px 15px; }
input:focus, select:focus { outline: 1px solid var(--cream); outline-offset: 1px; }
.muted { color: var(--muted); }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--sand); }
[dir='rtl'] .eyebrow { letter-spacing: 0; font-size: 13px; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 22px; min-height: 62px; background: var(--charcoal); border-bottom: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 14px; margin-inline-end: auto; }
.brand b { letter-spacing: 0.24em; font-weight: 600; font-size: 14px; direction: ltr; }
.brand i { width: 1px; height: 20px; background: var(--line); }
.brand span { color: var(--sand); font-size: 15px; font-weight: 500; letter-spacing: 0.04em; }
.live { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; color: var(--muted); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); }
.live.is-off .dot { background: var(--clay); }
.live.is-off { color: var(--clay); }
.top-act { display: flex; gap: 8px; align-items: center; }
#sound.is-on { color: var(--leaf); border-color: var(--leaf); }

/* ---- sign in ---- */
.login { display: grid; place-items: center; min-height: calc(100vh - 62px); padding: 20px; }
.card { width: min(100%, 400px); display: flex; flex-direction: column; gap: 14px; padding: 30px 26px; border: 1px solid var(--line-soft); background: var(--panel); }
.card h1 { margin: 0; font-weight: 500; font-size: 28px; line-height: 1.2; }
.card p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--sand); }
#password { font-size: 22px; letter-spacing: 0.2em; }
.err { color: var(--clay); }

/* ---- the screen ---- */
#app { padding: 20px 22px calc(40px + var(--a4-h)); max-width: 1500px; margin: 0 auto; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 0; padding: 14px 16px; text-align: start; background: var(--panel); border: 1px solid var(--line-soft); color: var(--cream); text-transform: none; letter-spacing: 0; font-weight: 400; }
.stat:hover { background: var(--panel-2); border-color: var(--line); }
.stat:active { background: var(--panel-3); }
.stat.is-on { border-color: var(--sand); box-shadow: inset 0 0 0 1px var(--sand); }
.stat b { font-size: 34px; line-height: 1.1; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat.is-waiting b { color: var(--sand); }
.stat.is-printed b { color: var(--leaf); }
.stat.is-expiring b { color: var(--clay); }
.stat.is-zero b { color: var(--faint); }

.finder { display: grid; grid-template-columns: minmax(260px, 380px) auto 1fr; align-items: end; gap: 12px 14px; margin-bottom: 16px; }
.code-box { display: flex; flex-direction: column; gap: 6px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sand); }
[dir='rtl'] .code-box { letter-spacing: 0; font-size: 14px; }
#code { font-size: 34px; font-weight: 500; letter-spacing: 0.32em; text-align: center; padding: 4px 10px; min-height: 64px; direction: ltr; background: var(--panel); border-color: var(--line); }
#code-clear { min-height: 64px; width: 52px; }
.finder p { margin: 0 0 4px; font-size: 13.5px; }
.finder p.is-alert { color: var(--clay); }

.filters { display: flex; flex-wrap: wrap; gap: 12px 18px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line-soft); margin-bottom: 12px; }
.filters.is-off { opacity: 0.4; }
.f-group { display: flex; flex-direction: column; gap: 6px; }
.f-k { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sand); }
[dir='rtl'] .f-k { letter-spacing: 0; font-size: 12.5px; }
.seg { display: inline-flex; }
.seg button { min-height: 36px; padding: 0 12px; background: transparent; color: var(--muted); border-color: var(--line-soft); font-size: 12px; letter-spacing: 0.04em; text-transform: none; font-weight: 400; }
.seg button + button { margin-inline-start: -1px; }
.seg button:hover { color: var(--cream); border-color: var(--line); position: relative; }
.seg button.is-on { background: var(--cream); color: var(--charcoal); border-color: var(--cream); font-weight: 500; position: relative; }
.seg button em { font-style: normal; opacity: 0.6; margin-inline-start: 4px; font-variant-numeric: tabular-nums; }
[dir='rtl'] .seg button { font-size: 14px; }

.listbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; margin-bottom: 8px; }
.listbar p { margin: 0; font-size: 13.5px; }
.listbar-act { display: flex; align-items: center; gap: 10px; }
.seg.size button { min-width: 34px; padding: 0 10px; }
#filters-toggle { display: none; }
.bulk { position: sticky; top: 62px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; background: var(--panel-2); border: 1px solid var(--sand); }
.bulk b { font-weight: 500; margin-inline-end: 6px; }
.bulk-gap { flex: 1; }

/* ---- the photos ---- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(var(--card), 1fr)); }
.grid.size-s { --card: 150px; }
.grid.size-m { --card: 220px; }
.grid.size-l { --card: 320px; }
.ph { position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: start; min-height: 0; padding: 0; gap: 0;
  border: 1px solid var(--line-soft); background: var(--panel); color: var(--cream); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; }
.ph:hover { background: var(--panel); border-color: var(--line); }
.ph:active { background: var(--panel-2); }
.ph.is-match { border-color: var(--leaf); box-shadow: inset 0 0 0 1px var(--leaf); }
.ph.is-sel { border-color: var(--sand); box-shadow: inset 0 0 0 2px var(--sand); }
.ph-img { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--panel-3); overflow: hidden; }
.ph-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.ph.is-printed .ph-img img { opacity: 0.72; }
.ph-info { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.ph-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ph-code { font-size: 26px; font-weight: 600; letter-spacing: 0.1em; line-height: 1.15; direction: ltr; font-variant-numeric: tabular-nums; }
.size-s .ph-code { font-size: 20px; }
.size-l .ph-code { font-size: 30px; }
.ph-meta { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.size-s .ph-meta.second { display: none; }
.ph-exp { color: var(--clay); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid currentColor; white-space: nowrap; }
[dir='rtl'] .tag { letter-spacing: 0; font-size: 12.5px; }
.tag.waiting { color: var(--sand); }
.tag.printed { color: var(--leaf); }
.ph-new { position: absolute; top: 8px; inset-inline-start: 8px; padding: 2px 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; background: var(--leaf); color: var(--charcoal); }
.ph-a4 { position: absolute; top: 8px; inset-inline-end: 8px; padding: 2px 8px; font-size: 11px; font-weight: 500; background: var(--charcoal); color: var(--cream); border: 1px solid var(--line); }
.ph-check { position: absolute; top: 8px; inset-inline-end: 8px; width: 26px; height: 26px; border: 1px solid var(--cream); background: rgba(35, 35, 35, 0.75); display: none; place-items: center; }
.is-selecting .ph-check { display: grid; }
.is-selecting .ph-a4 { display: none; }
.ph.is-sel .ph-check { background: var(--sand); border-color: var(--sand); color: var(--charcoal); }
.ph:not(.is-sel) .ph-check svg { display: none; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty p { margin: 0 0 14px; font-size: 16px; }

/* ---- the A4 sheet, docked ---- */
.a4 { position: fixed; inset-inline: 0; bottom: 0; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 22px; background: var(--panel-2); border-top: 1px solid var(--line); }
.a4.is-full { border-top-color: var(--leaf); box-shadow: inset 0 2px 0 var(--leaf); }
.a4-head { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.a4-head b { letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; font-weight: 600; }
[dir='rtl'] .a4-head b { letter-spacing: 0; font-size: 16px; }
.a4-head span { font-size: 13px; color: var(--muted); }
.a4-slots { display: grid; grid-template-columns: repeat(4, 120px); gap: 8px; }
.a4-slot { position: relative; aspect-ratio: 3 / 2; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--faint); font-size: 12px; overflow: hidden; }
.a4-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.a4-slot b { position: absolute; inset-inline-start: 4px; bottom: 4px; padding: 0 5px; background: var(--charcoal); font-size: 12px; letter-spacing: 0.08em; direction: ltr; }
.a4-slot button { position: absolute; top: 3px; inset-inline-end: 3px; min-height: 22px; width: 22px; padding: 0; background: var(--charcoal); color: var(--cream); border-color: var(--line); }
.a4-go { display: flex; flex-direction: column; gap: 4px; flex: 1 1 260px; max-width: 420px; }
.a4-more { display: flex; gap: 6px; }
.a4-go p { margin: 0; font-size: 12px; line-height: 1.4; }

/* ---- one photo ---- */
.detail { position: fixed; inset: 0; z-index: 10; display: grid; grid-template-columns: 1fr 360px; background: var(--charcoal); }
.detail-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 24px 76px; }
.detail-img { margin: 0; display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; }
.detail-img img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; box-shadow: 0 0 0 1px var(--line); }
.nav { position: absolute; top: 50%; translate: 0 -50%; width: 52px; min-height: 52px; padding: 0; background: transparent; color: var(--cream); border-color: var(--line); }
.nav.prev { inset-inline-start: 14px; }
.nav.next { inset-inline-end: 14px; }
[dir='rtl'] .nav svg { transform: scaleX(-1); }
.flip { position: absolute; bottom: 22px; left: 50%; translate: -50% 0; background: var(--charcoal); }
.detail-side { display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 26px; border-inline-start: 1px solid var(--line-soft); background: var(--panel); overflow-y: auto; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-head h2 { margin: 0; font-weight: 500; font-size: 22px; }
.detail-code { margin: 0; font-size: 60px; font-weight: 600; letter-spacing: 0.12em; line-height: 1.05; direction: ltr; text-align: start; font-variant-numeric: tabular-nums; }
.state { margin: 0; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 8px 0 12px; padding: 12px 0; border-block: 1px solid var(--line-soft); font-size: 13.5px; }
.meta dt { color: var(--sand); }
.meta dd { margin: 0; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.keys { margin: auto 0 0; padding-top: 14px; font-size: 12px; line-height: 1.6; }

/* ---- small windows ---- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(20, 20, 20, 0.78); }
.modal-card { width: min(100%, 420px); display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--panel); border: 1px solid var(--line); }
.modal-card.wide { width: min(100%, 860px); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-card h2 { margin: 0; font-weight: 500; font-size: 22px; }
.modal-card p { margin: 0; }
.modal-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.help-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 10px 0 0; font-size: 13.5px; }
.help-list dt { color: var(--cream); font-weight: 500; }
.help-list dd { margin: 0; color: var(--muted); }
.keys-list dt kbd { display: inline-block; min-width: 26px; padding: 1px 7px; border: 1px solid var(--line); font: 500 12px/1.6 Poppins, system-ui, sans-serif; text-align: center; direction: ltr; }

.toasts { position: fixed; z-index: 30; inset-inline-end: 20px; bottom: calc(20px + var(--a4-h)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; background: var(--cream); color: var(--charcoal); font-size: 14px; border: 1px solid var(--cream); max-width: 380px; animation: toast-in 0.18s ease-out; }
.toast.is-new { background: var(--leaf); border-color: var(--leaf); }
.toast button { min-height: 32px; padding: 0 12px; font-size: 11.5px; background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

@media (max-width: 1100px) {
  .finder { grid-template-columns: 1fr auto; }
  .finder p { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .top { padding: 8px 14px; gap: 10px; }
  .live #live-txt { display: none; }
  #app { padding: 14px 14px calc(30px + var(--a4-h)); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat b { font-size: 26px; }
  .help-cols { grid-template-columns: 1fr; }
  /* the filters fold away behind a button */
  #filters-toggle { display: inline-flex; grid-column: 1 / -1; justify-self: start; }
  .filters:not(.is-open) { display: none; }
  /* the A4 sheet stays small: a row of slots and the print button */
  .a4 { padding: 8px 14px; gap: 8px 12px; }
  .a4-head { min-width: 0; flex-direction: row; align-items: baseline; gap: 10px; flex: 1 1 100%; }
  .a4-slots { grid-template-columns: repeat(4, 1fr); flex: 1 1 100%; }
  .a4-slot b { font-size: 10.5px; }
  .a4-go { flex: 1 1 100%; max-width: none; flex-direction: row; flex-wrap: wrap; align-items: center; }
  #a4-print { flex: 1; min-height: 42px; }
  .a4-go p { display: none; }
  /* a phone or a small tablet: the photo, then the buttons below it, scrolling */
  .detail { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .detail-stage { padding: 14px 14px 64px; }
  .detail-img img { max-height: 58vh; }
  .nav { top: auto; bottom: 10px; translate: none; width: 44px; min-height: 44px; }
  .flip { bottom: 10px; }
  .detail-side { border-inline-start: 0; border-top: 1px solid var(--line-soft); }
  .keys { display: none; }
}
@media (max-width: 520px) {
  .brand b { display: none; }
  .brand i { display: none; }
  .seg.size { display: none; }
  .grid.size-m { --card: 160px; }
  .grid.size-l { --card: 260px; }
}

/* Printing: only the photo, filling a 10 × 15 cm sheet; or four travel posters on an A4 sheet (landscape, 2 × 2,
   each 143.5 × 95.7 mm, inside a 5 mm printer margin, with grey marks to cut along). The page size (@page) is set by
   the script per print; the printer's paper setting must match. */
#sheet, #sheet4 { display: none; }
@media print {
  html, body { background: #fff; }
  body > *:not(#sheet):not(#sheet4) { display: none !important; }
  body.print-a4 #sheet { display: none !important; }
  body:not(.print-a4) #sheet4 { display: none !important; }
  body.print-a4 #sheet4 { display: block; }
  #sheet4 .page { position: relative; width: 297mm; height: 210mm; overflow: hidden; break-after: page; }
  #sheet4 .page:last-child, #sheet .page:last-child { break-after: auto; }
  #sheet4 .slot { position: absolute; width: 143.5mm; height: 95.667mm; }
  #sheet4 .slot:nth-child(1) { left: 5mm; top: 9.333mm; }
  #sheet4 .slot:nth-child(2) { left: 148.5mm; top: 9.333mm; }
  #sheet4 .slot:nth-child(3) { left: 5mm; top: 105mm; }
  #sheet4 .slot:nth-child(4) { left: 148.5mm; top: 105mm; }
  #sheet4 .slot img { display: block; width: 100%; height: 100%; object-fit: cover; }
  #sheet4 .slot img:not([src]) { display: none; }
  #sheet4 .mark { position: absolute; display: block; background: #9a9a9a; }
  #sheet4 .mark.v { width: 0.2mm; height: 5.3mm; margin-left: -0.1mm; }
  #sheet4 .mark.h { height: 0.2mm; width: 4mm; margin-top: -0.1mm; }
  /* the cut lines: x = 5, 148.5, 292 mm (marks above and below the posters), y = 9.33, 105, 200.67 mm (marks left
     and right of them) */
  #sheet4 .c1 { left: 5mm; } #sheet4 .c2 { left: 148.5mm; } #sheet4 .c3 { left: 292mm; }
  #sheet4 .above { top: 2mm; } #sheet4 .below { top: 202.67mm; }
  #sheet4 .r1 { top: 9.333mm; } #sheet4 .r2 { top: 105mm; } #sheet4 .r3 { top: 200.667mm; }
  #sheet4 .before { left: 0.5mm; } #sheet4 .after { left: 292.5mm; }
  body:not(.print-a4) #sheet { display: block; }
  #sheet .page { position: relative; display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; overflow: hidden; break-after: page; }
  #sheet:not(.has-back) .page.back { display: none; }
  #sheet img { max-width: 100%; max-height: 100%; object-fit: contain; }
  /* a landscape picture turned a quarter to fill the portrait sheet */
  #sheet.is-landscape img { position: absolute; left: 50%; top: 50%; width: 100vh; height: 100vw; max-width: none; max-height: none; transform: translate(-50%, -50%) rotate(90deg); }
}
