/*
 * WORQ brand theme -- owned by the platform, loaded last on every
 * client-facing page (see render_brand_head() in shared/branding.php).
 *
 * Colours come from worq.co.tz's own theme (teal #09AEB8, sunny yellow
 * #FFD763 / #F0CF14, charcoal #3A3A3A, #231F20, cool off-white #F2F5F7);
 * type is theirs too (Josefin Sans Bold headings, Open Sans body).
 * The brand teal is 2.5:1 on the off-white, so text uses --wq-teal-ink
 * (4.8:1); the bright teal is kept for borders, icons and fills.
 *
 * The first half retints the shared pages (check-in, privacy, terms). The
 * second half styles landing.php, WORQ's own landing page.
 */
@import url("https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@600;700&family=Open+Sans:wght@400;600;700&display=swap");

:root {
  --wq-teal: #09AEB8;
  --wq-teal-ink: #067880;
  --wq-yellow: #FFD763;
  --wq-yellow-press: #F0CF14;
  --wq-charcoal: #3A3A3A;
  --wq-dark: #231F20;
  --wq-bg: #F2F5F7;
  --wq-white: #FFFFFF;
  --wq-head: "Josefin Sans", "Open Sans", ui-sans-serif, system-ui, sans-serif;
  --wq-body: "Open Sans", ui-sans-serif, system-ui, "Segoe UI", Arial, sans-serif;

  /* Tokens every client page already reads. */
  --ink: var(--wq-charcoal);
  --paper: var(--wq-bg);
  --panel: #E4EBEE;
  --card: var(--wq-white);
  --muted: rgba(58, 58, 58, 0.74);
  --border-soft: #6B6F73;
  --border: #C5D0D5;
  --accent: var(--wq-teal-ink);
  --error: #B3261E;

  --panel-dark: var(--wq-dark);
  --panel-dark-mid: #3A3536;
  --panel-dark-accent: var(--wq-teal);
  --on-dark-ink: #FFFFFF;
  --on-dark-muted: rgba(255, 255, 255, 0.78);
  --on-dark-hairline: rgba(255, 255, 255, 0.18);
  --shadow-rgb: 35, 31, 32;
  --glow-rgb: 9, 174, 184;
  --card-frame: rgba(9, 174, 184, 0.3);
}

::selection {
  background: var(--wq-teal);
  color: var(--wq-white);
}

/* ---- Shared pages (check-in, privacy, terms) ----------------------------- */

body {
  font-family: var(--wq-body);
}

body .serif {
  font-family: var(--wq-head);
  font-weight: 700;
  letter-spacing: 0.01em;
}

body .btn-primary {
  background: var(--wq-yellow);
  color: var(--wq-charcoal);
  border-radius: 999px;
}

body .btn-primary:hover {
  background: var(--wq-yellow-press);
}

body .btn-secondary {
  border-color: var(--border-soft);
  border-radius: 999px;
}

body .btn-secondary:hover {
  background: var(--wq-white);
}

body .content-brand-mark {
  background: var(--wq-dark);
  color: var(--wq-yellow);
}

body .purpose-pill.selected {
  background: var(--wq-teal-ink);
  border-color: var(--wq-teal-ink);
  color: var(--wq-white);
}

body a:not([class]) {
  color: var(--wq-teal-ink);
}

/* Check-in form: the same pill buttons, white reason chips and teal edge as
   the landing page, so it reads as one flow. */
body .site-header .org-name {
  font-family: var(--wq-head);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body form button[type="submit"] {
  background: var(--wq-yellow);
  border-color: var(--wq-yellow);
  border-radius: 999px;
  color: var(--wq-charcoal);
  font-weight: 700;
}

body form button[type="submit"]:hover {
  background: var(--wq-yellow-press);
  filter: none;
}

body .purpose-pill {
  border-radius: 999px;
  border-color: var(--border);
  background: var(--wq-white);
  color: var(--wq-charcoal);
}

body .purpose-pill:not(.selected):hover {
  border-color: var(--wq-teal);
  background: var(--wq-white);
}

body input[type]::placeholder,
body textarea::placeholder {
  color: rgba(58, 58, 58, 0.5);
}

body > footer {
  border-top: 4px solid var(--wq-teal);
}

/* ---- Landing page (landing.php) ------------------------------------------ */

body[data-brand-landing] {
  min-height: 100vh;
  margin: 0;
  background: var(--wq-bg);
  color: var(--wq-charcoal);
  font-family: var(--wq-body);
  -webkit-font-smoothing: antialiased;
}

.wq-page {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.wq-page :focus-visible {
  outline: 3px solid var(--wq-dark);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--wq-white);
}

.wq-footer :focus-visible {
  outline-color: var(--wq-yellow);
  box-shadow: none;
}

/* base.css darkens every button on hover; these have their own states. */
.wq-page button:hover {
  filter: none;
}

/* Wordmark over the photo. */
.wq-top {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  padding: 24px;
  pointer-events: none;
}

.wq-wordmark {
  font-family: var(--wq-head);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--wq-white);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

/* ---- Hero ---- */

.wq-hero {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* Short enough on a phone that the yellow button is on the first screen. */
  min-height: max(40vh, 300px);
  min-height: max(40svh, 300px);
  padding: 88px 24px 52px;
  overflow: hidden;
  background: var(--wq-dark);
}

.wq-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.05);
  animation: wq-pan 22s ease-in-out infinite;
}

/* Teal multiply over the photo, then a dark fade so the headline reads. */
.wq-hero-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(35, 31, 32, 0.92) 0%, rgba(35, 31, 32, 0.35) 55%, rgba(35, 31, 32, 0.1) 100%),
    rgba(9, 174, 184, 0.42);
  background-blend-mode: normal, multiply;
}

.wq-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 28rem;
}

.wq-title {
  margin: 0 0 12px;
  font-family: var(--wq-head);
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wq-white);
}

/* WORQ's sun-yellow swash behind its name. */
.wq-title-mark {
  position: relative;
  display: inline-block;
  z-index: 0;
}

.wq-title-mark::after {
  content: "";
  position: absolute;
  z-index: -1;
  /* Under the letters, not over them: white on yellow is 1.4:1. */
  left: -2%;
  right: -6%;
  bottom: -0.16em;
  height: 0.2em;
  background: var(--wq-yellow);
  border-radius: 2px;
  transform: skewX(-12deg);
}

.wq-hero-sub {
  margin: 0;
  max-width: 19rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
}

/* ---- Panel ---- */

.wq-panel {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: -24px 0 0;
  background: var(--wq-bg);
  border-radius: 24px 24px 0 0;
}

.wq-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 28px 24px 32px;
}

.wq-stage {
  display: flex;
  flex-direction: column;
}

.wq-question {
  margin: 0 0 20px;
  text-wrap: balance;
  font-family: var(--wq-head);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--wq-charcoal);
}

.wq-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.wq-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  aspect-ratio: 5 / 4;
  min-height: 124px;
  padding: 18px 14px;
  background: var(--wq-white);
  border: 2px solid #E4EBEE;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(35, 31, 32, 0.05);
  font: inherit;
  color: var(--wq-charcoal);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.wq-tile-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--wq-bg);
  color: rgba(58, 58, 58, 0.62);
  transition: background-color 200ms ease, color 200ms ease, transform 150ms ease;
}

.wq-tile-icon svg {
  width: 24px;
  height: 24px;
}

.wq-tile-label > span {
  white-space: nowrap;
}

.wq-tile-label {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
}

.wq-tile-check {
  position: absolute;
  top: -10px;
  right: -10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--wq-yellow);
  color: var(--wq-dark);
  box-shadow: 0 4px 10px rgba(35, 31, 32, 0.18);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 160ms ease, transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wq-tile-check svg {
  width: 15px;
  height: 15px;
}

.wq-tile[aria-checked="true"] {
  background: #F4FBFC;
  border-color: var(--wq-teal);
  box-shadow: 0 8px 24px rgba(9, 174, 184, 0.18);
}

.wq-tile[aria-checked="true"] .wq-tile-icon {
  background: rgba(9, 174, 184, 0.12);
  color: var(--wq-teal-ink);
}

.wq-tile[aria-checked="true"] .wq-tile-label {
  font-weight: 700;
}

.wq-tile[aria-checked="true"] .wq-tile-check {
  opacity: 1;
  transform: scale(1);
}

.wq-tile:active .wq-tile-icon {
  transform: scale(0.94);
}

@media (hover: hover) {
  .wq-tile:hover {
    transform: translateY(-3px);
    border-color: rgba(9, 174, 184, 0.35);
  }
  .wq-tile:hover .wq-tile-icon {
    color: var(--wq-teal-ink);
  }
}

/* ---- Actions ---- */

.wq-actions {
  margin: 0;
}

.wq-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  background: var(--wq-yellow);
  box-shadow: 0 10px 24px rgba(240, 207, 20, 0.32);
  font: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--wq-charcoal);
  cursor: pointer;
  transition: background-color 150ms ease, transform 120ms ease;
}

.wq-cta svg {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.wq-cta:hover {
  background: var(--wq-yellow-press);
}

.wq-cta:active {
  transform: scale(0.98);
  box-shadow: inset 0 -3px 0 var(--wq-yellow-press), 0 6px 16px rgba(240, 207, 20, 0.28);
}

.wq-cta.is-dragover {
  outline: 3px dashed var(--wq-teal-ink);
  outline-offset: 4px;
}

.wq-scan-note {
  margin: 12px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
  color: var(--wq-charcoal);
}

.wq-manual {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.wq-manual-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--wq-teal-ink);
  text-decoration: underline;
  text-decoration-color: rgba(6, 120, 128, 0.35);
  text-underline-offset: 4px;
}

.wq-manual-link:hover {
  text-decoration-color: currentColor;
}

/* ---- Scan-failed notice ---- */

.wq-notice {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding: 14px 16px;
  background: var(--wq-white);
  border-left: 4px solid var(--wq-yellow-press);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(35, 31, 32, 0.05);
}

.wq-notice svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--wq-charcoal);
}

.wq-notice-title {
  margin: 0 0 2px;
  font-weight: 700;
  font-size: 0.92rem;
}

.wq-notice-body {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- Reading the ID ---- */

.wq-reading {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wq-field {
  padding: 16px 18px;
  background: var(--wq-white);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(35, 31, 32, 0.05);
}

.wq-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.wq-field-value {
  min-height: 1.6em;
  font-size: 1.1rem;
  font-weight: 700;
  transition: opacity 150ms ease;
}

.wq-mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.wq-field-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--wq-teal-ink);
}

.wq-field-hint:empty {
  display: none;
}

.wq-skeleton {
  display: block;
  width: 72%;
  height: 1em;
  margin-top: 0.3em;
  border-radius: 6px;
  background: linear-gradient(90deg, #E4EBEE 0%, #F2F5F7 50%, #E4EBEE 100%);
  background-size: 200% 100%;
  animation: wq-shimmer 1.2s linear infinite;
}

.wq-skeleton-short {
  width: 45%;
}

.wq-match {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: var(--wq-yellow);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--wq-dark);
}

.wq-match svg {
  width: 14px;
  height: 14px;
}

.wq-status {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---- Privacy line ---- */

.wq-privacy {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  margin: 32px auto 0;
  max-width: 22rem;
  font-size: 0.78rem;
  line-height: 1.6;
  text-align: center;
  color: var(--muted);
}

.wq-privacy svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  opacity: 0.6;
}

/* ---- Footer ---- */

.wq-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 24px 20px;
  background: var(--wq-dark);
  border-top: 4px solid var(--wq-teal);
  text-align: center;
}

.wq-hours {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.wq-hours svg {
  width: 14px;
  height: 14px;
  color: var(--wq-yellow);
}

.wq-address {
  font-style: normal;
  font-size: 0.75rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
}

.wq-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 4px;
  margin-top: 6px;
}

body .wq-legal a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
}

body .wq-legal a:hover {
  color: var(--wq-white);
  text-decoration: underline;
}

/* The Kete credit: present, never competing with WORQ. */
.wq-kete {
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #8C8A8A;
}

.wq-kete span {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.04em;
}

/* ---- Tablet and desktop: photo on the left, check-in on the right ---- */

@media (min-width: 768px) {
  .wq-page {
    flex-direction: row;
    height: 100vh;
    min-height: 0;
  }

  .wq-top {
    width: 41.666%;
    padding: 32px 40px;
  }

  .wq-hero {
    width: 41.666%;
    height: 100vh;
    padding: 40px 40px 96px;
  }

  .wq-title {
    font-size: clamp(2rem, 4vw, 4.4rem);
  }

  .wq-hero-sub {
    max-width: 21rem;
    font-size: 1.02rem;
  }

  .wq-panel {
    width: 58.333%;
    height: 100vh;
    margin-top: 0;
    border-radius: 0;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .wq-panel-inner {
    justify-content: center;
    padding: 56px 48px 40px;
  }

  .wq-tiles {
    gap: 20px;
    margin-bottom: 40px;
  }

  .wq-tile {
    aspect-ratio: 16 / 11;
    /* With an aspect ratio, the phone's min-height would force a min width
       and push the right-hand column over the left one at 768px. */
    min-height: 0;
    min-width: 0;
  }

  .wq-tile-label {
    font-size: 0.9rem;
  }
}

/* Laptop screens: keep the footer in view without scrolling the panel. */
@media (min-width: 768px) and (max-height: 920px) {
  .wq-panel-inner {
    padding-top: 40px;
    padding-bottom: 24px;
  }
  .wq-tiles {
    margin-bottom: 28px;
  }
  .wq-privacy {
    margin-top: 20px;
  }
  .wq-tile {
    aspect-ratio: 2 / 1;
  }
}

@media (min-width: 1100px) {
  .wq-top,
  .wq-hero,
  .wq-panel {
    width: 50%;
  }

  .wq-panel-inner {
    padding-left: 64px;
    padding-right: 64px;
  }
}

/* ---- Motion ---- */

@keyframes wq-pan {
  0%, 100% { transform: scale(1.05) translate(0, 0); }
  50% { transform: scale(1.09) translate(-1%, 1%); }
}

@keyframes wq-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wq-hero-img,
  .wq-skeleton {
    animation: none;
  }
  .wq-tile,
  .wq-tile-check,
  .wq-tile-icon,
  .wq-cta {
    transition: none;
  }
  .wq-tile:hover {
    transform: none;
  }
}
