/* =========================================================
   Catalogue / Link-hub page - mobile-first, phones only.
   Home hub + full-screen layers (work list, site detail, search,
   WhatsApp / Google review QR posters). Each layer is one browser
   history entry, so Android back closes it instead of leaving.
   Reuses tokens + thumb colors from style.css.
========================================================= */

body.catalogue-page {
  background: var(--dark);
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "calt" 0; /* Inter would draw the "x" in "210 x 297" as a multiplication sign */
}
html.has-layer,
html.has-layer body {
  overflow: hidden;
}
[data-icon] svg,
.icon-btn > svg,
.lrow-go > svg,
.promo > svg {
  width: 100%;
  height: 100%;
}

/* =================== Home =================== */
.hub {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(36px, env(safe-area-inset-top)) 16px 32px;
  background: var(--grad-dark);
}
.hub-inner {
  max-width: 460px;
  margin-inline: auto;
}

.link-profile {
  text-align: center;
  margin-bottom: 22px;
}
.link-avatar-link {
  display: inline-flex;
}
.link-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 14px;
}
.link-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.link-name {
  color: var(--on-dark);
  font-size: 1.4rem;
  margin-bottom: 6px;
}
.link-bio {
  color: var(--on-dark-soft);
  font-size: 0.88rem;
  max-width: 300px;
  margin-inline: auto;
}

.hub-search {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--dark-border);
  color: var(--on-dark-soft);
  font-size: 0.9rem;
  text-align: left;
}
.hub-search [data-icon] {
  width: 19px;
  height: 19px;
  flex: none;
}
.hub-search:active {
  background: rgba(255, 255, 255, 0.1);
}

.hub-cards {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.hub-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 116px;
  padding: 16px 14px 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.15s ease;
}
.hub-card:active,
.tool-tile:active,
.link-card:active {
  transform: scale(0.98);
}
.hub-card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hub-count {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-tint);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 4px;
}
.hub-card strong {
  font-family: "Sora", sans-serif;
  font-size: 1.08rem;
  color: var(--ink);
  line-height: 1.25;
}
.hub-card small {
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.hub-fan {
  position: relative;
  width: 104px;
  height: 84px;
  flex: none;
}
.hub-fan img {
  position: absolute;
  top: 12px;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-md);
  background: var(--bg-alt);
}
.hub-fan img:nth-child(1) {
  left: 0;
  transform: rotate(-10deg);
}
.hub-fan img:nth-child(2) {
  left: 23px;
  top: 4px;
  z-index: 1;
}
.hub-fan img:nth-child(3) {
  left: 46px;
  transform: rotate(10deg);
}

.hub-label {
  margin: 28px 0 12px;
}
.hub-label .eyebrow {
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.08); /* same as .section-dark .eyebrow */
  color: var(--primary-light);
}
.hub-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tool-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 136px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.15s ease;
}
/* Tool icons are .icon-badge (style.css), the same tile as the home page's service cards. */
.tool-tile .icon-badge {
  margin-bottom: auto;
}
.icon-badge[data-icon] svg {
  width: 26px;
  height: 26px;
}
.tool-icon-wa {
  background: var(--wa-green);
  color: var(--paper);
}
.tool-icon-g {
  background: var(--paper);
  border: 1px solid var(--g-line);
}
.tool-tile strong {
  margin-top: 14px;
  font-family: "Sora", sans-serif;
  font-size: 0.96rem;
  color: var(--ink);
  line-height: 1.25;
}
.tool-tile small {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}
.link-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.link-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.link-text strong {
  font-family: "Sora", sans-serif;
  font-size: 0.96rem;
  color: var(--ink);
  line-height: 1.3;
}
.link-text span {
  font-size: 0.8rem;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-chevron {
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.link-social {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}
.link-social a {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--dark-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-dark-soft);
}
.link-social svg {
  width: 17px;
  height: 17px;
}
.link-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
  color: var(--on-dark-soft);
  font-size: 0.85rem;
  font-weight: 600;
}
.link-back [data-icon] {
  width: 16px;
  height: 16px;
}
.link-hub-footer {
  text-align: center;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  background: var(--dark);
  color: var(--on-dark-soft);
  font-size: 0.76rem;
  border-top: 1px solid var(--dark-border);
}

/* =================== Layers =================== */
.layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  transform: translateX(100%);
  visibility: hidden;
  transition:
    transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 0s linear 0.3s;
}
.layer.open {
  transform: none;
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.layer-search {
  transform: translateY(16px);
  opacity: 0;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease,
    visibility 0s linear 0.22s;
}
.layer-search.open {
  transform: none;
  opacity: 1;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}
html.no-anim .layer {
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  .layer,
  .layer.open {
    transition: none;
  }
}

.bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 60px;
  padding: calc(8px + env(safe-area-inset-top)) 6px 8px;
  background: var(--dark);
  color: var(--on-dark);
}
.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: inherit;
  padding: 11px;
}
.icon-btn:active {
  background: rgba(255, 255, 255, 0.1);
}
.bar-title {
  flex: 1;
  min-width: 0;
  padding-left: 2px;
}
.bar-title strong {
  display: block;
  font-family: "Sora", sans-serif;
  font-size: 1.02rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-title small {
  display: block;
  font-size: 0.74rem;
  color: var(--on-dark-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Tabs + swipe pager ---------- */
.tabs {
  flex: none;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--dark);
  border-bottom: 1px solid var(--dark-border);
}
.tab {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--on-dark-soft);
  transition: color 0.2s ease;
}
.tab[aria-selected="true"] {
  color: var(--on-dark);
}
.tab-count {
  min-width: 24px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease;
}
.tab[aria-selected="true"] .tab-count {
  background: var(--accent);
}
.tab-ink {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 50%;
  height: 3px;
  padding-inline: 28px;
  transform: translateX(calc(var(--p, 0) * 100%));
  pointer-events: none;
}
.tab-ink::before {
  content: "";
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
}

.pager {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar,
.gallery::-webkit-scrollbar {
  display: none;
}
.pane {
  flex: 0 0 100%;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 14px 12px calc(28px + env(safe-area-inset-bottom));
}
.pane-note {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 2px 4px 12px;
}

/* ---------- Grid cards (swipeable previews) ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gcard {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.shot-wrap {
  position: relative;
}
/* Grid previews cross-fade through the screenshots on their own, so a sideways swipe
   anywhere in the list always switches tabs. The swipeable gallery is in the detail view. */
.shots {
  position: relative;
  overflow: hidden;
  aspect-ratio: 39 / 62;
  background: var(--bg-alt);
}
.shots img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.shots img.on {
  opacity: 1;
}
.dots {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  background: rgba(28, 33, 23, 0.55);
  pointer-events: none;
}
.dots i {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.5);
  transition: width 0.2s ease;
}
.dots i.on {
  width: 14px;
  background: var(--paper);
}
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--dark);
  color: var(--on-dark);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.gcard-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  text-align: left;
}
.gcard-text strong {
  font-family: "Sora", sans-serif;
  font-size: 0.88rem;
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.gcard-text small {
  font-size: 0.74rem;
  color: var(--ink-faint);
  line-height: 1.35;
}

/* ---------- List rows ---------- */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lrow {
  display: flex;
  align-items: center;
  min-height: 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.lrow-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 10px 10px;
  text-align: left;
}
.lrow-thumb {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-alt);
}
.lrow-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lrow-text strong {
  font-family: "Sora", sans-serif;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lrow-text small {
  font-size: 0.76rem;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lrow-text .mini-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--dark);
  color: var(--on-dark);
  font-family: "Inter", sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  vertical-align: 2px;
}
.lrow-go {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 13px;
  color: var(--ink-faint);
}

/* ---------- Pinned OneQR card (catalogs tab) ---------- */
.promo {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--on-dark);
  text-align: left;
}
.promo img {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.promo span {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.promo small {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-tint);
}
.promo strong {
  font-family: "Sora", sans-serif;
  font-size: 1rem;
}
.promo em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--primary-tint);
}
.promo > svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ---------- Site detail ---------- */
.gallery {
  --shot-w: min(64vw, 280px);
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  align-items: flex-start;
  overscroll-behavior-x: contain;
  padding: 18px calc(50% - var(--shot-w) / 2) 12px;
  background: var(--bg-alt);
}
.gallery img {
  flex: 0 0 var(--shot-w);
  width: var(--shot-w);
  height: auto;
  aspect-ratio: 480 / 1039;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  object-fit: cover;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 0 14px;
  background: var(--bg-alt);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.gallery-meta .dots {
  position: static;
  transform: none;
  padding: 0;
  background: none;
}
.gallery-meta .dots i {
  background: var(--border);
  box-shadow: none;
}
.gallery-meta .dots i.on {
  background: var(--accent);
}
.site-info {
  padding: 20px 18px 28px;
}
.site-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--primary-tint);
  color: var(--primary);
}
.pill-dark {
  background: var(--dark);
  color: var(--on-dark);
}
.pill-gold {
  background: var(--gold-tint);
  color: var(--ink);
}
.site-info h2 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.site-url {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
}
.site-desc {
  margin-top: 12px;
  font-size: 0.94rem;
  line-height: 1.6;
}
.site-h {
  margin: 22px 0 10px;
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.feature-list {
  display: grid;
  gap: 10px;
}
.feature-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--ink);
}
.feature-list [data-icon] {
  width: 26px;
  height: 26px;
  flex: none;
  padding: 6px;
  border-radius: 50%;
  background: var(--primary-tint);
  color: var(--primary);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.chip:active {
  background: var(--primary-tint);
  border-color: var(--primary-light);
}

.dock {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.dock-main {
  flex: 1;
  padding: 0 20px;
  height: 46px;
}
.dock-main [data-icon],
.qr-actions .btn [data-icon] {
  width: 18px;
  height: 18px;
}
.dock-btn {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.dock-btn:disabled {
  opacity: 0.4;
}
.dock-wa {
  color: var(--wa-teal);
}

/* ---------- Search ---------- */
.search-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin-right: 6px;
  padding: 0 4px 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-dark-soft);
}
.search-field > [data-icon] {
  width: 18px;
  height: 18px;
  flex: none;
}
.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  color: var(--on-dark);
  font-size: 16px;
}
.search-field input::placeholder {
  color: var(--on-dark-soft);
}
.search-field input::-webkit-search-cancel-button {
  display: none;
}
.search-clear {
  width: 36px;
  height: 36px;
  flex: none;
  padding: 9px;
  border-radius: 50%;
  color: var(--on-dark-soft);
}
.search-body {
  padding: 16px 12px calc(28px + env(safe-area-inset-bottom));
}
.search-label {
  margin: 0 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.search-label + .chips {
  margin-bottom: 22px;
}
.search-empty {
  padding: 20px 4px 16px;
}
.search-empty strong {
  display: block;
  font-family: "Sora", sans-serif;
  color: var(--ink);
  margin-bottom: 4px;
}
.lrow .group-tag {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- QR poster makers ---------- */
.qr-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 14px calc(32px + env(safe-area-inset-bottom));
}
.form-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.fld-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.fld-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.fld-row .fld-label {
  margin-bottom: 0;
}
.fld-label em {
  font-style: normal;
  font-weight: 500;
  color: var(--ink-faint);
}
.fld input,
.fld textarea,
.fld-phone {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 16px;
  color: var(--ink);
  transition: border-color 0.2s ease;
}
.fld input {
  height: 48px;
  padding: 0 16px;
}
.fld textarea {
  display: block;
  padding: 12px 14px;
  resize: none;
  line-height: 1.45;
  font-size: 14px;
}
.fld input:focus,
.fld textarea:focus,
.fld-phone:focus-within {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}
.fld-phone {
  display: flex;
  align-items: center;
  overflow: hidden;
}
.fld-phone input {
  border: 0;
  border-radius: 0;
  background: none;
  letter-spacing: 0.04em;
}
.fld-phone input:focus {
  border: 0;
  box-shadow: none;
}
.fld-cc {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 12px 0 14px;
  border-right: 1.5px solid var(--border);
  font-weight: 700;
  color: var(--ink-soft);
}
.fld-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-faint);
}
.fld.is-error input,
.fld.is-error textarea,
.fld.is-error .fld-phone {
  border-color: var(--accent);
}
.fld.is-error .fld-hint {
  color: var(--accent-dark);
}
.fld.is-ok .fld-hint {
  color: var(--primary);
  font-weight: 600;
}
.fld-paste {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}
.fld-paste [data-icon] {
  width: 14px;
  height: 14px;
}

.poster-stage {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
}
.poster-fit {
  position: relative;
  width: 100%;
  aspect-ratio: 408 / 616;
  margin-inline: auto;
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.poster-fit > .poster {
  position: absolute;
  top: 0;
  left: 0;
  transform: scale(var(--k, 0.8));
  transform-origin: 0 0;
}
.qr-actions {
  display: flex;
  gap: 10px;
}
.qr-actions .btn {
  flex: 1;
  height: 46px;
  padding: 0 20px;
}
.qr-actions .btn:disabled {
  opacity: 0.45;
  box-shadow: none;
}
.qr-print {
  flex: none; /* the scrolling column would otherwise squash it */
  height: 46px;
  margin-top: -6px;
  padding: 0 20px;
}
.qr-print [data-icon] {
  width: 18px;
  height: 18px;
}
.qr-print:disabled {
  opacity: 0.45;
}
.test-link {
  align-self: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
  text-align: center;
}

/* html2canvas finds each font's baseline with an inline 1x1 gif next to a span. style.css
   makes every img a block, which would draw all poster text half a line too low. */
body > div > span + img[src^="data:image/gif"] {
  display: inline;
}

/* Off-screen copy that html2canvas renders at full size (never visible) */
.export-host {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
}

/* =================== Posters (102 x 154 mm at 4 px/mm) ===================
   Fixed pixel sizes on purpose: the same box is scaled down for the preview
   and rendered at 300 dpi for the PNG. Solid backgrounds everywhere, so the
   PNG never comes out transparent. */
.poster {
  width: 408px;
  height: 616px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  background: var(--paper);
  font-family: "Inter", sans-serif;
  line-height: 1.25;
  text-align: center;
  -webkit-font-smoothing: antialiased;
}
/* Zero-specificity reset, so each text class's own margin still applies. */
:where(.poster) p {
  margin: 0;
}
.poster [data-icon] svg {
  display: block;
}
.qr-slot {
  width: 100%;
  height: 100%;
}
.qr-slot svg {
  display: block;
  width: 100%;
  height: 100%;
}
.qr-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 2px dashed var(--g-line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--g-muted);
}
.poster-name {
  max-width: 340px;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  line-height: 1.2;
}
.poster-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--wa-meta);
}
.poster-foot b {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  color: var(--primary);
}

/* ----- WhatsApp poster ----- */
.poster-wa {
  color: var(--wa-ink);
}
.pw-band {
  position: relative;
  flex: none;
  width: 100%;
  height: 226px;
  padding-top: 24px;
  background: var(--wa-dark);
  color: var(--paper);
  overflow: hidden;
}
.pw-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
}
.pw-ring-1 {
  width: 190px;
  height: 190px;
  top: -92px;
  right: -60px;
}
.pw-ring-2 {
  width: 150px;
  height: 150px;
  bottom: -70px;
  left: -50px;
}
.pw-logo {
  display: block;
  width: 62px;
  height: 62px;
  margin: 0 auto;
  padding: 13px;
  border-radius: 50%;
  background: var(--wa-green);
  color: var(--paper);
}
.pw-eyebrow {
  margin-top: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--wa-bubble);
}
.pw-title {
  margin-top: 2px;
  color: var(--paper);
  font-family: "Sora", sans-serif;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.pw-qr {
  position: relative;
  z-index: 1;
  flex: none;
  width: 226px;
  height: 226px;
  margin-top: -44px;
  padding: 12px;
  background: var(--paper);
  border: 4px solid var(--wa-green);
  border-radius: var(--radius-lg);
}
.pw-main {
  flex: 1;
  width: 100%;
  padding: 10px 24px 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
}
.poster-wa .poster-name {
  color: var(--wa-ink);
}
.pw-bubble {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 10px 6px 14px;
  border-radius: 12px 12px 2px 12px;
  background: var(--wa-bubble);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
}
.pw-bubble small {
  font-size: 10px;
  line-height: 15px;
  color: var(--wa-meta);
}
.pw-ticks {
  display: block;
  width: 16px;
  height: 15px;
  color: var(--wa-tick);
}
.pw-cta {
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  background: var(--wa-green);
  color: var(--wa-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.pw-num {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Sora", sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--wa-ink);
}
.pw-num-icon {
  display: block;
  width: 26px;
  height: 26px;
  padding: 5px;
  border-radius: 50%;
  background: var(--wa-teal);
  color: var(--paper);
}

/* ----- Google review poster ----- */
.poster-g {
  justify-content: space-between;
  padding: 36px 24px 28px;
  color: var(--g-ink);
}
.pg-top,
.pg-mid,
.pg-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pg-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  display: flex;
}
.pg-stripe-bottom {
  top: auto;
  bottom: 0;
}
.pg-stripe i {
  flex: 1;
}
.pg-stripe i:nth-child(1) {
  background: var(--g-blue);
}
.pg-stripe i:nth-child(2) {
  background: var(--g-red);
}
.pg-stripe i:nth-child(3) {
  background: var(--g-yellow);
}
.pg-stripe i:nth-child(4) {
  background: var(--g-green);
}
.pg-logo {
  display: block;
  width: 54px;
  height: 54px;
  padding: 10px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--g-line);
}
.pg-kicker {
  margin-top: 12px;
  font-family: "Sora", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--g-ink);
}
.pg-word {
  font-family: "Sora", sans-serif;
  font-size: 46px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
}
.pg-word b {
  font-weight: 800;
}
.pg-word b:nth-child(1),
.pg-word b:nth-child(4) {
  color: var(--g-blue);
}
.pg-word b:nth-child(2),
.pg-word b:nth-child(6) {
  color: var(--g-red);
}
.pg-word b:nth-child(3) {
  color: var(--g-yellow);
}
.pg-word b:nth-child(5) {
  color: var(--g-green);
}
.pg-stars {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}
.pg-stars span {
  display: block;
  width: 26px;
  height: 26px;
}
.poster-g .poster-name {
  margin-top: 12px;
  color: var(--g-ink);
}
.pg-sub {
  margin-top: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--g-muted);
}
.pg-qr {
  width: 200px;
  height: 200px;
  padding: 10px;
  background: var(--paper);
  border: 2px solid var(--g-line);
  border-radius: 20px;
}
.pg-cta {
  margin-top: 12px;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  background: var(--g-blue-dark);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}
.pg-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--g-muted);
}
.pg-steps i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--g-line);
}
.poster-g .poster-foot {
  position: static;
  margin-top: 6px;
  color: var(--g-muted);
}

/* =================== Print sheet =================== */
.tool-wide {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 0;
}
.tool-wide .icon-badge {
  margin-bottom: 0;
  flex: none;
}
.tool-wide .tool-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tool-wide strong {
  margin-top: 0;
}

.ps-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 14px 28px;
}
.dock-main:disabled {
  opacity: 0.45;
  box-shadow: none;
}
.ps-select {
  width: 100%;
  height: 48px;
  padding: 0 12px 0 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 16px;
  color: var(--ink);
}
.ps-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}
.ps-wh {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.ps-wh[hidden] {
  display: none;
}
.ps-unit {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 46px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}
.ps-unit:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}
.ps-unit input,
.fld .ps-unit input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 4px 0 16px;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.ps-unit input:focus {
  outline: none;
  box-shadow: none; /* the .ps-unit box draws the ring */
}
.ps-unit span {
  padding-right: 12px;
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.ps-times {
  color: var(--ink-faint);
  font-weight: 600;
}
.ps-lock {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  color: var(--ink-faint);
}
.ps-lock[aria-pressed="true"] {
  background: var(--primary-tint);
  border-color: var(--primary-light);
  color: var(--primary);
}

/* Segmented control */
.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg-alt);
}
.seg[hidden] {
  display: none;
}
.seg button {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seg button[aria-checked="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.seg-sm button {
  height: 32px;
  font-size: 0.76rem;
}

.ps-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-block: 0; /* style.css pads every <section> for the marketing pages */
}
.ps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px;
}
.ps-head h2 {
  font-family: "Sora", sans-serif;
  font-size: 1rem;
  color: var(--ink);
}
.ps-head small {
  font-size: 0.76rem;
  color: var(--ink-faint);
}
.ps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ps-list:empty {
  display: none;
}
.ps-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* a long file name must shrink, not widen the card */
  gap: 14px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.ps-item.is-error {
  border-color: var(--accent);
}
.ps-item-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ps-thumb {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.ps-item-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ps-item-title strong {
  font-family: "Sora", sans-serif;
  font-size: 0.94rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-item-title small {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--ink-faint);
}
.ps-item-title small.is-low {
  color: var(--accent-dark);
  font-weight: 600;
}
.ps-x {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 9px;
  margin: -6px -6px 0 0;
  align-self: flex-start;
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
}
.ps-x:active {
  background: var(--bg-alt);
}
.ps-copies {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ps-copies-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}
.stepper {
  display: flex;
  align-items: center;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  overflow: hidden;
}
.stepper button {
  width: 38px;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 11px;
  color: var(--ink);
}
.stepper button:active {
  background: var(--bg-alt);
}
.stepper input {
  width: 40px;
  height: 100%;
  border: 0;
  background: none;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.stepper input:focus {
  outline: none;
}
.ps-max {
  margin-left: auto;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.ps-item-err {
  margin-top: -2px;
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--accent-dark);
}
.ps-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}
.ps-drop:active {
  background: var(--bg-alt);
}
.ps-drop .icon-badge {
  margin-bottom: 8px;
}
.ps-drop strong {
  font-family: "Sora", sans-serif;
  font-size: 0.94rem;
  color: var(--ink);
}
.ps-drop small {
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.ps-drop.is-compact {
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
}
.ps-drop.is-compact .icon-badge {
  width: 34px;
  height: 34px;
  margin: 0;
  border-radius: var(--radius-sm);
}
.ps-drop.is-compact .icon-badge svg {
  width: 18px;
  height: 18px;
}
.ps-drop.is-compact small {
  display: none;
}
.ps-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ps-settings {
  gap: 0;
  padding: 0;
}
.ps-settings summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 24px;
  list-style: none;
  cursor: pointer;
}
.ps-settings summary::-webkit-details-marker {
  display: none;
}
.ps-settings summary > span:first-child {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ps-settings summary strong {
  font-family: "Sora", sans-serif;
  font-size: 0.96rem;
  color: var(--ink);
}
.ps-settings summary small {
  font-size: 0.76rem;
  color: var(--ink-faint);
}
.ps-summary-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--ink-faint);
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}
.ps-settings[open] .ps-summary-icon {
  transform: rotate(-90deg);
}
.ps-settings-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 0 24px 24px;
}
.ps-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ps-pair-hint {
  margin-top: -8px;
}
.ps-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ps-switch > span {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ps-switch strong {
  font-size: 0.86rem;
  color: var(--ink);
}
.ps-switch small {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--ink-faint);
}
.ps-switch input {
  position: relative;
  width: 44px;
  height: 26px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--border);
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.2s ease;
}
.ps-switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}
.ps-switch input:checked {
  background: var(--primary);
}
.ps-switch input:checked::after {
  transform: translateX(18px);
}

.ps-msgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ps-msgs:empty {
  display: none;
}
.ps-msg {
  display: flex;
  gap: 10px;
  overflow-wrap: anywhere; /* file names have no spaces to break at */
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
}
.ps-msg svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
}
.ps-msg.is-err {
  background: var(--accent-tint);
  color: var(--accent-dark);
}
.ps-msg.is-warn {
  background: var(--gold-tint);
  color: var(--ink-soft);
}
.ps-msg.is-warn svg {
  color: var(--gold);
}

.ps-stage {
  padding: 16px 0;
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
}
.ps-pages {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.ps-pages::-webkit-scrollbar {
  display: none;
}
.ps-page {
  flex: 0 0 100%;
  scroll-snap-align: start;
}
.ps-pages.multi .ps-page {
  flex-basis: 84%;
}
.ps-page canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper);
  border-radius: 0;
  box-shadow: var(--shadow-md);
}
.ps-page figcaption {
  margin-top: 10px;
  font-size: 0.76rem;
  text-align: center;
  color: var(--ink-faint);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100% - 32px);
  overflow-wrap: anywhere;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--on-dark);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
