/* The Grand Printworks — Algeria catalogue landing page.
   Mobile-first, light and fast. Logical properties throughout so the whole
   layout mirrors for Arabic on dir="rtl" with no extra rules. */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #16202b;
  --muted: #667180;
  --line: #e3e7ec;
  --brand: #0f7a4d;
  --brand-dark: #0b5c3a;
  --accent: #f0a020;
  --danger: #b23b3b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 6px 20px rgba(20, 30, 45, .06);
  --maxw: 1040px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.55 system-ui, "Segoe UI", Roboto, Arial, "Noto Sans Arabic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: 84px; /* room for the sticky order bar */
}

img { max-width: 100%; display: block; }

a { color: var(--brand); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* Header ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand span { font-size: 16px; letter-spacing: .2px; }
.langs { margin-inline-start: auto; display: flex; gap: 2px; }
.langs a {
  text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 11px 12px; border-radius: 9px; line-height: 1;
}
.langs a.on { background: var(--brand); color: #fff; }

/* Hero -------------------------------------------------------------------- */
.hero { padding: 22px 0 8px; }
.hero h1 { margin: 0 0 4px; font-size: 24px; line-height: 1.2; }
.hero p { margin: 0; color: var(--muted); }

/* Catalogue grid ---------------------------------------------------------- */
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 20px 0 10px; }
.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  cursor: pointer; transition: transform .08s ease, box-shadow .12s ease;
}
.card:active { transform: scale(.99); }
.card .ph { aspect-ratio: 1 / 1; background: #eef1f4; overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.card .price { font-weight: 700; color: var(--ink); }
.card .bulk { font-size: 12px; color: var(--brand-dark); font-weight: 600; }
.card .add {
  margin-top: auto; border: 0; border-radius: 10px; background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; font-size: 14px; padding: 9px; cursor: pointer;
}
.card .add:active { background: var(--brand-dark); }

.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }

/* Modal ------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.open { display: block; }
.modal .veil { position: absolute; inset: 0; background: rgba(15, 22, 30, .55); }
.modal .sheet {
  position: absolute; inset-inline: 0; bottom: 0;
  background: #fff; border-radius: 18px 18px 0 0; padding: 16px; max-height: 90vh; overflow: auto;
  max-width: var(--maxw); margin: 0 auto;
}
@media (min-width: 620px) {
  .modal .sheet { position: relative; inset: auto; margin: 6vh auto; border-radius: 18px; max-width: 520px; }
  .modal { display: none; }
  .modal.open { display: flex; align-items: flex-start; }
}
.modal .close { float: inline-end; border: 0; background: #eef1f4; border-radius: 50%; width: 44px; height: 44px; font-size: 20px; cursor: pointer; color: var(--ink); }
.modal .mimg { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; background: #eef1f4; }
.modal h3 { margin: 12px 0 4px; font-size: 20px; }
.modal .desc { color: var(--muted); white-space: pre-line; }
.modal .mprice { font-weight: 700; font-size: 18px; margin-top: 8px; }
.modal .mbulk { color: var(--brand-dark); font-weight: 600; font-size: 14px; }

/* Quantity stepper -------------------------------------------------------- */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border: 0; background: #f1f4f7; width: 38px; height: 38px; font-size: 20px; cursor: pointer; color: var(--ink); }
.stepper input { width: 46px; height: 38px; border: 0; text-align: center; font: inherit; font-weight: 600; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn-primary {
  border: 0; border-radius: 12px; background: var(--brand); color: #fff;
  font: inherit; font-weight: 700; padding: 13px 18px; cursor: pointer; width: 100%;
}
.btn-primary:active { background: var(--brand-dark); }
.btn-primary[disabled] { background: #9db3a9; cursor: default; }

/* Basket + checkout ------------------------------------------------------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 16px 0; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }

.blines { display: flex; flex-direction: column; gap: 10px; }
.bline { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.bline:last-child { border-bottom: 0; padding-bottom: 0; }
.bline .bn { font-weight: 600; font-size: 14px; }
.bline .bp { color: var(--muted); font-size: 13px; }
.bline .bt { font-weight: 700; text-align: end; white-space: nowrap; }
.bline .brm { border: 0; background: none; color: var(--danger); font-size: 13px; cursor: pointer; padding: 8px 0; text-align: start; }
.bline .bctl { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

.totals { margin-top: 14px; border-top: 2px solid var(--line); padding-top: 12px; }
.totrow { display: flex; justify-content: space-between; margin: 4px 0; }
.totrow.grand { font-weight: 800; font-size: 18px; margin-top: 8px; }
.tbd { color: var(--accent); font-weight: 600; font-size: 14px; }

/* Form -------------------------------------------------------------------- */
.field { margin: 0 0 12px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 70px; resize: vertical; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.field.bad input, .field.bad select { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: 13px; margin-top: 4px; display: none; }
.field.bad .err { display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 460px) { .two { grid-template-columns: 1fr; } }

/* honeypot — never shown to a person */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.formerr { background: #fbeaea; border: 1px solid #eecbcb; color: var(--danger); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; display: none; }
.formerr.show { display: block; }
.formerr ul { margin: 6px 0 0; padding-inline-start: 18px; }

/* Sticky order bar -------------------------------------------------------- */
.orderbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(20, 30, 45, .08);
  transform: translateY(110%); transition: transform .18s ease;
}
.orderbar.show { transform: translateY(0); }
.orderbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.orderbar .sum { display: flex; flex-direction: column; }
.orderbar .sum b { font-size: 17px; }
.orderbar .sum span { color: var(--muted); font-size: 13px; }
.orderbar .go { margin-inline-start: auto; width: auto; padding-inline: 22px; }

/* Thank-you --------------------------------------------------------------- */
.thanks { display: none; text-align: center; padding: 8px 0 12px; }
.thanks.show { display: block; }
.thanks .tick { width: 64px; height: 64px; border-radius: 50%; background: #e6f4ec; color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 34px; margin: 0 auto 12px; }
.thanks h2 { margin: 0 0 6px; }
.thanks .ref { font: 700 22px/1.4 ui-monospace, Consolas, monospace; color: var(--brand-dark); margin: 10px 0; }
.thanks .wa { display: inline-block; margin-top: 8px; background: #25d366; color: #fff; text-decoration: none; padding: 12px 18px; border-radius: 12px; font-weight: 700; }
.thanks .again { display: inline-block; margin-top: 12px; color: var(--muted); }

.footer { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 0 8px; }

[hidden] { display: none !important; }
