/*
 * Public pages a visitor sees after scanning: landing pages and access pages.
 * Colours come from base.css tokens, which the organization's brand drives.
 */

.qr-page {
  width: 100%; max-width: 480px; min-height: 100dvh; margin-inline: auto;
  display: flex; flex-direction: column;
  padding: var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom));
}
.qr-main { flex: 1; display: flex; flex-direction: column; gap: var(--space-5); }

.brand-header { display: flex; justify-content: center; }
.brand-header img { max-height: 48px; max-width: 170px; object-fit: contain; }

/* Profile header (links, social, gallery, menu) ------------------------------ */
.profile { display: grid; justify-items: center; gap: var(--space-2); text-align: center; padding-top: var(--space-2); }
.avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow);
  background: var(--surface-2);
}
.avatar-fallback { display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: var(--on-accent); background: var(--accent); }
.profile-name { font-size: var(--text-xl); }
.profile-sub { color: var(--text-muted); font-size: var(--text-sm); }
.profile-bio { color: var(--text-muted); font-size: var(--text-sm); max-width: 36ch; }

/* Link buttons --------------------------------------------------------------- */
.link-stack { display: grid; gap: var(--space-3); list-style: none; padding: 0; }
.link-btn {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 60px; padding: var(--space-2) var(--space-3);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); font-weight: 600; text-decoration: none;
  transition: border-color var(--duration) var(--ease), transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.link-btn:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.link-btn:active { transform: scale(0.99); }
.link-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink);
}
.link-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.link-label small { display: block; font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); }
.link-chevron { color: var(--text-muted); }

/* Menu ----------------------------------------------------------------------- */
.menu-logo { width: 80px; height: 80px; border-radius: var(--radius-lg); object-fit: cover; box-shadow: 0 0 0 1px var(--border); }
.menu-nav {
  position: sticky; top: 0; z-index: var(--z-sticky); margin-inline: calc(var(--space-4) * -1);
  padding: var(--space-2) var(--space-4); background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.chips { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; min-height: var(--control-sm); padding: 0 var(--space-4); scroll-snap-align: start;
  display: inline-flex; align-items: center;
  border-radius: var(--radius-full); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: var(--text-sm); font-weight: 600; text-decoration: none;
  transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.menu-section { display: grid; gap: var(--space-3); scroll-margin-top: 72px; }
.menu-section h2 { font-size: var(--text-lg); }
.menu-items { display: grid; list-style: none; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.menu-item { display: flex; gap: var(--space-3); padding: var(--space-4); }
.menu-item + .menu-item { border-top: 1px solid var(--border); }
.menu-item-body { flex: 1; min-width: 0; display: grid; gap: var(--space-1); align-content: start; }
.menu-item-name { font-weight: 600; }
.menu-item-desc { font-size: var(--text-sm); color: var(--text-muted); }
.menu-item-price { font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.menu-item-img { width: 84px; height: 84px; border-radius: var(--radius); object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
/* SFDA labels (docs/saudi-market.md): calories beside the price, same size. */
.menu-item-kcal { margin-inline-start: var(--space-3); font-weight: 600; color: var(--text-muted); }
.menu-item-facts, .menu-item-allergens { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }
.menu-item-facts > span { display: inline-flex; align-items: center; gap: var(--space-1); }
.allergens-title { font-weight: 600; color: var(--text); }
.allergen { padding: 0 var(--space-2); border-radius: var(--radius-full); background: var(--warning-soft); color: var(--text); }
.salt-label { display: inline-flex; vertical-align: middle; color: var(--text); }
.menu-notes { display: grid; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.menu-note { display: flex; gap: var(--space-2); align-items: flex-start; }
.menu-note .icon-sm { flex-shrink: 0; margin-top: 3px; color: var(--text); }
.visit-place { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: var(--text-sm); }
/* Real-estate listing (REGA): the advertisement licence first and prominent. */
.licence-box {
  display: grid; justify-items: center; gap: 2px; padding: var(--space-3) var(--space-4); text-align: center;
  border: 2px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); color: var(--text);
}
.licence-label { font-size: var(--text-sm); font-weight: 600; }
.licence-number { font-size: var(--text-xl); font-weight: 700; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.licence-expiry { font-size: var(--text-sm); color: var(--text-muted); }
.listing-offer { font-size: var(--text-sm); font-weight: 600; color: var(--accent-ink); }
.listing-price { font-size: var(--text-xl); font-weight: 700; color: var(--accent-ink); }
.listing-price span { font-size: var(--text-base); font-weight: 600; color: var(--text-muted); }
.listing-contact { padding: var(--space-4); }
.listing-text { color: var(--text); overflow-wrap: anywhere; }
/* A price in riyals: the sign left of the number in every language (SAMA). */
.sar-price { display: inline-block; white-space: nowrap; unicode-bidi: isolate; }

/* Business card (vCard+) ----------------------------------------------------- */
.contact-card { padding: var(--space-6) var(--space-5) var(--space-5); display: grid; gap: var(--space-4); text-align: center; justify-items: center; }
.contact-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: var(--space-2); width: 100%; }
.contact-action {
  display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-3) var(--space-2);
  border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-ink);
  font-size: var(--text-xs); font-weight: 600; text-decoration: none;
}
.contact-action:hover { background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.info-list { list-style: none; padding: 0; }
.info-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); min-height: 56px; }
.info-row + .info-row { border-top: 1px solid var(--border); }
.info-row .icon { color: var(--text-muted); }
.info-row a, .info-row span { overflow-wrap: anywhere; }
/* The whole row is the link's target, at least the tap size (UX-N24). */
.info-row a { flex: 1; display: flex; align-items: center; min-height: var(--tap); }
.section-stack { display: grid; gap: var(--space-2); }
.section-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); padding: 0 var(--space-1); }
.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); list-style: none; padding: 0; }
.social-tile {
  display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: var(--text-xs); font-weight: 600; text-decoration: none;
}
.social-tile:hover { border-color: var(--accent); }
.save-bar { position: sticky; bottom: 0; padding: var(--space-3) 0 calc(var(--space-2) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--page) 70%, transparent); }

/* Gallery --------------------------------------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); list-style: none; padding: 0; }
.gallery-item { display: grid; gap: var(--space-1); }
.gallery-btn { padding: 0; border: 0; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; aspect-ratio: 1; }
.gallery-btn img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease); }
.gallery-btn:hover img { transform: scale(1.03); }
.gallery-caption { font-size: var(--text-xs); color: var(--text-muted); text-align: center; }
.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; }
.lightbox::backdrop { background: var(--overlay-strong); }
.lightbox-inner { position: relative; width: 100%; height: 100%; display: grid; place-items: center; padding: var(--space-7) var(--space-3); }
.lightbox-img { max-width: 100%; max-height: 100%; border-radius: var(--radius); object-fit: contain; }
.lightbox-close, .lightbox-nav {
  position: absolute; display: grid; place-items: center; width: var(--tap); height: var(--tap);
  border-radius: 50%; border: 0; background: var(--on-overlay-soft); color: var(--on-overlay); cursor: pointer;
}
.lightbox-close { top: var(--space-3); inset-inline-end: var(--space-3); }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-prev { inset-inline-start: var(--space-2); }
.lightbox-next { inset-inline-end: var(--space-2); }

/* Access pages ------------------------------------------------------------------ */
.message { margin-block: auto; display: grid; justify-items: center; gap: var(--space-3); text-align: center; padding: var(--space-6) var(--space-2); }
.message-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: var(--space-2); }
.message-icon .icon { width: 32px; height: 32px; }
.message h1 { font-size: var(--text-xl); }
.message p { color: var(--text-muted); max-width: 34ch; }
.message form { width: 100%; max-width: 340px; display: grid; gap: var(--space-3); margin-top: var(--space-3); text-align: start; }
/* The abuse report (TS-4): a longer form than the password page, with a group of reasons. */
.abuse-report fieldset { border: 0; padding: 0; margin: 0; }
.abuse-report .check { align-items: flex-start; min-height: 0; padding-block: var(--space-1); }
.abuse-report .check input { margin-top: 2px; flex-shrink: 0; }
/* The destination named by the warning page (TS-2): shown whole, wrapped anywhere. */

.message .destination-url {
  max-width: 100%; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-weight: 600; overflow-wrap: anywhere; text-align: start;
}


/* Footer ------------------------------------------------------------------------ */
.qr-footer { padding-top: var(--space-6); text-align: center; font-size: var(--text-xs); color: var(--text-muted); display: grid; gap: var(--space-1); }
.qr-footer .attribution { opacity: 0.8; }

@media (min-width: 560px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
}

/* Location and event pages ---------------------------------------------------- */
.place-card { display: grid; justify-items: center; gap: var(--space-2); text-align: center; padding: var(--space-6) var(--space-5); }
.place-coords { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.event-when { font-weight: 600; line-height: 1.7; }
/* A date, with the Hijri date under it when the page shows one (KSA-8). */
.date-pair { display: grid; justify-items: center; }
.hijri-date { font-weight: 500; color: var(--text-muted); }
.save-bar .btn + .btn { margin-top: var(--space-2); }

/* Page templates ------------------------------------------------------------------
 * classic: the content on the brand background.
 * cover:   a band in the brand colour (or a cover image) behind the header.
 * card:    the content on a card over a tinted brand background.
 * On wide screens every template sits on a tinted background, so the page
 * does not look like a narrow strip on an empty screen.
 */
@media (min-width: 720px) {
  body { background: color-mix(in srgb, var(--accent) 7%, var(--page)); }
  .qr-page { padding-top: var(--space-7); }
}
.page-cover .cover-band {
  position: absolute; inset-inline: 0; top: 0; height: 190px; z-index: var(--z-base);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--text)));
}
.page-cover .cover-band[style] { background: var(--cover) center / cover no-repeat, var(--accent); }
.page-cover .cover-band::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, color-mix(in srgb, var(--text) 35%, transparent)); }
.page-cover .qr-page { position: relative; z-index: var(--z-raised); }
.page-cover .brand-header img { background: var(--surface); padding: 6px 10px; border-radius: var(--radius); box-shadow: var(--shadow); }
.page-cover .qr-main > :first-child { margin-top: 56px; }
.page-cover .qr-main > .profile { background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-4); box-shadow: var(--shadow); }
.page-card .qr-main { flex: 0 0 auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--space-5) var(--space-4); }
.page-card .qr-main > .card { box-shadow: none; }
@media (max-width: 719px) {
  .page-card { background: color-mix(in srgb, var(--accent) 9%, var(--page)); }
}

/* Form pages: feedback, rating, lead capture (MKT-5) ----------------------------- */
.form-card { display: grid; gap: var(--space-4); padding: var(--space-5) var(--space-4); }
.form-card > h1, .form-card > .profile-bio { text-align: center; justify-self: center; }
.public-form { display: grid; gap: var(--space-4); }
.public-form .optional { font-weight: 400; color: var(--text-muted); }
.public-form fieldset { border: 0; padding: 0; min-width: 0; }
.form-note { text-align: center; }
.consent-field .check { align-items: flex-start; line-height: var(--leading); }
.consent-field .check input { margin-top: 3px; flex-shrink: 0; }
/* The honeypot: out of sight and out of the tab order, but still in the form. */
.hp-field { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }
.rating { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-1); }
.rating-option {
  display: grid; justify-items: center; gap: var(--space-1); min-height: var(--tap); padding: var(--space-2) 0;
  border-radius: var(--radius); cursor: pointer; color: var(--text-muted); text-align: center;
}
.rating-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating-star { width: 32px; height: 32px; }
.rating-word { font-size: var(--text-xs); font-weight: 600; overflow-wrap: anywhere; }
.rating-option:hover { background: var(--surface-2); }
.rating-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
/* The chosen star and the ones before it light up. */
.rating-option:has(input:checked), .rating-option:has(~ .rating-option input:checked) { color: var(--accent-ink); }
.rating-option:has(input:checked) .rating-star, .rating-option:has(~ .rating-option input:checked) .rating-star { fill: currentColor; }
.form-received { display: grid; justify-items: center; gap: var(--space-1); }

/* Share ------------------------------------------------------------------------ */
.share-btn { justify-self: center; display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-sm); padding: 0 var(--space-4);
  border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.share-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.share-done { color: var(--success); font-weight: 600; }
.error-en { display: grid; gap: var(--space-2); justify-items: center; padding-top: var(--space-4); border-top: 1px solid var(--border); width: 100%; max-width: 360px; }
.error-en h2 { font-size: var(--text-lg); }

/* Site pages: privacy notice and help (qrme/article.html) ------------------------ */
.qr-page:has(.article) { max-width: 720px; }
.article { display: grid; gap: var(--space-5); }
.article-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.article-brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap); font-weight: 700; color: var(--text); text-decoration: none; }
.article-head { display: grid; gap: var(--space-2); }
.article-head h1 { font-size: var(--text-2xl); }
.article-lede { font-size: var(--text-lg); color: var(--text-muted); }
.article-meta { font-size: var(--text-xs); color: var(--text-muted); }
.article-body { display: grid; gap: var(--space-6); }
.article-body section { display: grid; gap: var(--space-3); }
.article-body h2 { font-size: var(--text-lg); }
.article-body section ul, .article-body section ol { display: grid; gap: var(--space-2); padding-inline-start: var(--space-5); }
.article-body p, .article-body li { max-width: 68ch; overflow-wrap: anywhere; }
.size-list { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-1); }

/* Coupon ------------------------------------------------------------------------ */
.coupon-image { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.coupon-code {
  display: grid; justify-items: center; gap: var(--space-2); width: 100%;
  padding: var(--space-4); border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft);
}
.coupon-code-label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.coupon-code-value { font-size: var(--text-xl); letter-spacing: 0.08em; color: var(--accent-ink); overflow-wrap: anywhere; user-select: all; }
.coupon-ended { font-weight: 600; color: var(--danger); }
.coupon-terms { width: 100%; text-align: start; font-size: var(--text-sm); color: var(--text-muted); }
.coupon-terms summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.coupon-terms summary::-webkit-details-marker { display: none; }
