/* QuickGigs — shared polish (mobile, light mode, motion). Safe additive layer. */

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }

body {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: fadeIn 0.3s ease;
}

button, .task-card, .nav-item, .tab-item, .act-btn, .stat-card, .action-card, .sec, .mini-card, .chk, .skill-toggle, .cat-chip, .mpill {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:active, .task-card:active, .tab-item:active, .act-btn:active, .empty-btn:active, .save-btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
textarea,
select {
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

.tab-bar {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.task-card, .stat-card, .action-card, .sec, .mini-card, .review-card, .notif-item {
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.task-card:hover, .stat-card:hover, .action-card:hover {
  border-color: var(--border-hover);
}

.modal-overlay { animation: fadeIn 0.2s ease; }
.modal, .bottom-sheet { animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* --surface is fully opaque in both themes (#16131F / #FFFFFF), so these can
   use it directly — the translucent surface this block was written to avoid
   no longer exists. */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  position: relative;
  z-index: 401;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.tc-badge, .status-pill, .role-pill, .skill, .tag, .wbadge, .badge, .cat-chip, .mpill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.btn-primary, .save-btn, .empty-btn, .submit-btn, .accept-btn, .modal-confirm.purple {
  background: var(--primary);
  color: var(--primary-text);
  border: none;
  box-shadow: none;
  transition: background 0.2s ease;
}

.btn-primary:hover, .save-btn:hover, .empty-btn:hover {
  background: color-mix(in srgb, var(--primary) 88%, var(--text));
}

/* The body.light card and hover overrides that sat here are gone: the base
   rules above now use --surface and --border, which already flip with the
   theme, so the overrides only restored the pre-rebrand purple-tinted
   shadows. */

img[loading="lazy"] {
  content-visibility: auto;
}

/* Nav link underline (scaleX) */
.nav a:not(.nav-logo):not(.back-btn),
.tab-item,
.legal-footer a,
.app-legal-footer a,
.site-footer a {
  position: relative;
}
.nav a:not(.nav-logo):not(.back-btn)::after,
.legal-footer a::after,
.app-legal-footer a::after,
.site-footer a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease;
  opacity: 0.85;
}
.nav a:not(.nav-logo):not(.back-btn):hover::after,
.legal-footer a:hover::after,
.app-legal-footer a:hover::after,
.site-footer a:hover::after {
  transform: scaleX(1);
}

/* Card stagger on first paint */
.qg-stagger-in {
  animation: qgCardIn 0.32s ease both;
}
@keyframes qgCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Help FAB — above bottom nav; never cover card text */
.qg-help-root,
.help-fab {
  position: fixed;
  left: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
}
/* Profile: lift FAB fully above tab bar; left:16px; z-index:40 */
body.page-profile .qg-help-root,
body.page-profile .help-fab,
body[data-qg-page="profile"] .qg-help-root,
body[data-qg-page="profile"] .help-fab,
html[data-qg-page="profile"] .qg-help-root,
html[data-qg-page="profile"] .help-fab {
  left: 16px !important;
  /* nav height (~76) + gap so "?" never sits on card text */
  bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 40 !important;
}
/* Chat: sit above composer so "?" never covers the last bubble */
body.page-chat .qg-help-root,
html[data-qg-page="chat"] .qg-help-root,
body.page-chat .help-fab {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 140px);
  z-index: 40;
}
/* Messages inbox: clear the fixed tab bar (not the chat composer) */
body.page-messages .qg-help-root,
html[data-qg-page="messages"] .qg-help-root,
body.page-messages .help-fab,
html[data-qg-page="messages"] .help-fab {
  left: 16px !important;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 40 !important;
}

/* Task title capitalization safety net (existing lowercase rows) */
.task-title::first-letter,
.tc-title::first-letter {
  text-transform: uppercase;
}
.qg-help-root.is-composer-focused {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.qg-help-fab {
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: var(--primary-text);
  font: 600 18px/1 'DM Sans', sans-serif;
  transition: background 0.2s ease;
}
.qg-help-fab:hover { background: color-mix(in srgb, var(--primary) 88%, var(--text)); }
.qg-help-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qg-help-panel {
  position: absolute; left: 0; bottom: 54px; width: min(320px, calc(100vw - 32px));
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 14px 12px;
  animation: qgCardIn 0.28s ease both;
}
.qg-help-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qg-help-title { font-size: 15px; font-weight: 500; }
.qg-help-close {
  border: none; background: transparent; color: inherit; font-size: 22px; line-height: 1;
  cursor: pointer; opacity: 0.7; width: 32px; height: 32px;
}
.qg-help-q {
  width: 100%; text-align: left; border: none; background: transparent; color: inherit;
  font: 500 13px/1.4 'DM Sans', sans-serif; padding: 10px 4px; cursor: pointer;
  border-top: 1px solid var(--border);
}
.qg-help-q[aria-expanded="true"] { color: var(--accent); }
.qg-help-a {
  font-size: 12px; line-height: 1.55; color: var(--text-muted);
  padding: 0 4px 10px;
}
.qg-help-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.qg-help-link {
  font-size: 12px; font-weight: 500; color: var(--accent); text-decoration: none;
}

/* Playfair's italic "ft" ligature makes SwiftGigs read as SwieftGigs. */
.qg-brand-name,
.qg-auth-name,
.sg-wordmark,
.nav-brand .nav-logo {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0, "dlig" 0;
}

/* Signed-in landing nav: "Continue as poster/tasker" is too wide for one
   row next to the wordmark. Put the two links on their own row on phones.
   Keep .qg-topnav-end in the box tree — display:contents drops those
   children from Safari/iOS hit-testing, so Log in / Continue taps miss.
   After sign-in, qg-site.js marks the stored role .is-current and the other
   .is-other so the phone shows one pill, not both generic chips. */
body.page-landing.qg-landing-in #qgHeroLogin a.is-other,
body.page-landing.qg-landing-in #qgHeroLogin span[aria-hidden],
body.page-landing.qg-landing-in .qg-topnav-links a:not(.qg-nav-login),
body.page-landing.qg-landing-in #qgNavTasker,
body.page-landing.qg-landing-in #qgEarnTasker {
  display: none !important;
}
body.page-landing.qg-landing-in .qg-topnav-links a.qg-nav-login.is-current {
  font-weight: 600;
  color: var(--primary);
}
body.page-landing.qg-landing-mode-tasker .qg-topnav-links a.qg-nav-login.is-current {
  color: var(--teal);
}
@media (max-width: 719px) {
  body.page-landing .qg-topnav {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-right: 16px;
  }
  body.page-landing.qg-landing-in .qg-topnav {
    padding-right: 58px;
  }
  body.page-landing .qg-brand {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    z-index: 1;
  }
  body.page-landing .qg-topnav-end {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
  }
  body.page-landing .qg-topnav-menu {
    position: absolute;
    top: 10px;
    right: 12px;
    margin-left: 0;
    z-index: 3;
  }
  body.page-landing .qg-topnav-links {
    flex: 1 1 100%;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 8px;
    min-width: 0;
    position: relative;
    z-index: 2;
  }
  /* Browse was collapsing to 0 width next to the two login pills. */
  body.page-landing .qg-topnav-links a:not(.qg-nav-login) {
    flex: 1 1 100%;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
  }
  body.page-landing .qg-topnav-links a.qg-nav-login {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12.5px;
    padding: 8px 10px;
    border: 1px solid var(--qg-border, var(--border));
    border-radius: 100px;
    pointer-events: auto;
  }
  /* Signed out: Browse sits on the wordmark row, so the header is two rows, not three. */
  body.page-landing:not(.qg-landing-in) .qg-topnav-links a:not(.qg-nav-login) {
    position: absolute;
    top: -40px;
    right: 0;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 4px;
  }
  body.page-landing.qg-landing-in .qg-topnav-links a.qg-nav-login.is-other {
    display: none;
  }
  body.page-landing.qg-landing-in .qg-topnav-links a.qg-nav-login.is-current {
    flex: 1 1 100%;
    min-height: 44px;
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    background: var(--primary);
    color: var(--primary-text, #fff);
  }
  body.page-landing.qg-landing-mode-tasker .qg-topnav-links a.qg-nav-login.is-current {
    background: var(--teal);
    color: var(--teal-text, #062824);
  }
}

@media (prefers-reduced-motion: reduce) {
  body, .qg-stagger-in, .qg-help-panel, .modal, .bottom-sheet, .modal-overlay {
    animation: none !important;
    transition: none !important;
  }
  .nav a:not(.nav-logo):not(.back-btn)::after,
  .legal-footer a::after,
  .app-legal-footer a::after,
  .site-footer a::after {
    transition: none !important;
  }
  .task-card:hover, .stat-card:hover, .action-card:hover { transform: none; }
}
