/* =========================================================
   Accord — shared styles (used by index.html and home.html)
   ========================================================= */

:root {
  --ink: #14201E;
  --ink-2: #26332F;
  --ink-line: #44524E;
  --primary: #0F766E;
  --primary-dark: #115E59;
  --primary-soft: #E6F2F0;
  --primary-text: #0F4F49;
  --primary-light: #2DD4BF;
  --coral: #F26B3A;
  --coral-soft: #FFF1EA;
  --coral-line: #FBD5C3;
  --coral-text: #9A3412;
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --line: #E7E5E4;
  --line-2: #D6D3D1;
  --muted: #57534E;
  --body: #44403C;
  --radius: 18px;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Sora', 'Plus Jakarta Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

img, svg { display: block; }

[hidden] { display: none !important; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3 { margin: 0; }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container { max-width: 1320px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo__word {
  font-family: var(--font-display); font-weight: 800; font-size: 25px; letter-spacing: -0.8px;
}
.logo--light, .logo--light:hover { color: #FFFFFF; }

/* ---------- Buttons (flat) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 0; border-radius: 999px;
  font-weight: 700; font-size: 15px; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--primary); color: #FFFFFF; }
.btn-primary:hover { background: var(--primary-dark); color: #FFFFFF; }
.btn-coral { background: var(--coral); color: var(--ink); }
.btn-coral:hover { background: #E85C29; color: var(--ink); }
.btn-dark { background: var(--ink); color: #FFFFFF; }
.btn-dark:hover { background: var(--ink-2); color: #FFFFFF; }
.btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--line-2); font-weight: 600; }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.btn-outline-light { background: transparent; color: #FFFFFF; border: 1px solid var(--ink-line); font-weight: 600; }
.btn-outline-light:hover { border-color: #FFFFFF; color: #FFFFFF; }
.btn-lg { min-height: 56px; padding: 0 26px; font-size: 16px; }

/* ---------- Post type tags ---------- */
.tag {
  display: inline-flex; align-items: center;
  font-weight: 800; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.tag-req   { background: #FDE7DD; color: #9A3412; }
.tag-sell  { background: var(--primary-soft); color: var(--primary-text); }
.tag-offer { background: #DCEFEA; color: #0B5A54; }
.tag-team  { background: #EDEBFA; color: #4338CA; }

/* ---------- Avatars (one soft colour per person) ---------- */
.avatar {
  width: 44px; height: 44px; border-radius: 999px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.avatar--sm { width: 34px; height: 34px; font-size: 12px; border: 2px solid #F7F5F1; }
.avatar--sm + .avatar--sm { margin-left: -6px; }
.avatar--more { background: var(--ink); color: #FFFFFF; }
.tone-a { background: #FDE7DD; color: #9A3412; }
.tone-b { background: #E6F2F0; color: #0B5A54; }
.tone-c { background: #EDEBFA; color: #4338CA; }
.tone-d { background: #FEF3C7; color: #92400E; }
.ico { display: inline-flex; flex: none; }
/* Round initials (chat header, admin) */
.post__avatar {
  width: 38px; height: 38px; border-radius: 999px; flex: none;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-text);
  font-weight: 800; font-size: 13px;
}

/* ---------- Post card (feed and profiles) ---------- */
.post {
  background: var(--surface); border: 1px solid #E8E5E0; border-radius: 20px;
  padding: 22px 24px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 1px 2px rgba(20, 32, 30, 0.04);
}
.post__head { display: flex; align-items: center; gap: 12px; }
.post__by { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.post__name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post__who { color: var(--ink); font-size: 15px; font-weight: 700; }
.post__verified { color: var(--primary); }
.post__trust { font-size: 13px; color: var(--muted); }
.trust__stars { color: #B45309; font-weight: 800; }
.trust__new { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #F2F0EC; color: #3F3A36; font-weight: 700; }

.post__price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; flex: none; max-width: 45%; }
.post__price-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.post__price-amount { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.02em; line-height: 1.15; }

.post__body { display: flex; flex-direction: column; gap: 8px; }
.post__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.post__cat { padding: 4px 10px; border-radius: 999px; background: #F2F0EC; color: #3F3A36; font-size: 12px; font-weight: 700; }
.post__title { font-family: var(--font-display); font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; }
.post__desc {
  font-size: 15px; line-height: 1.55; color: var(--body);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post__needs { align-self: flex-start; padding: 5px 10px; border-radius: 999px; background: #F2F0EC; font-size: 13px; font-weight: 700; color: #3F3A36; }

.post__info { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; font-weight: 600; color: var(--muted); }
.post__fact { display: inline-flex; align-items: center; gap: 6px; }
.post__fact .ico { color: #A8A29E; }
.post__fact.is-busy, .post__fact.is-busy .ico { color: var(--primary); }
.post__fact.is-urgent, .post__fact.is-urgent .ico { color: #B45309; }
.post__fact.is-passed { color: #78716C; text-decoration: line-through; }

.post__taken {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: #F2F0EC; color: #3F3A36; font-size: 14px; font-weight: 600; line-height: 1.45;
}
.post__taken .ico { color: var(--primary); }
.post--taken .post__title, .post--taken .post__price-amount { color: #57534E; }

.post__foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding-top: 14px; border-top: 1px solid #F0EEEA;
}
.post__safe { flex: 1; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #0B5A54; }
.post__safe .ico { color: var(--primary); }
.post__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.post__actions .btn { min-height: 44px; font-size: 14px; padding: 0 18px; }
.btn-ghost-danger { background: transparent; color: #B42318; border: 0; font-weight: 700; }
.btn-ghost-danger:hover { background: #FEF3F2; color: #912018; }

/* ---------- The owner's own post ---------- */
.post--own { border-color: #D6D3D1; }
.post--own.is-live { border: 1.5px solid var(--primary); }
.post__ownhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post__when { font-size: 13px; font-weight: 600; color: var(--muted); }
.post__ownhead .post__price { margin-left: auto; }
.own-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; background: var(--primary); color: #FFFFFF;
}
.own-badge__dot { width: 7px; height: 7px; border-radius: 999px; background: #5EEAD4; }
.is-agreed .own-badge, .is-protected .own-badge { background: var(--ink); }
.is-checking .own-badge { background: #FEF3C7; color: #92400E; }
.is-checking .own-badge__dot { background: #F59E0B; }
.is-closed .own-badge { background: #F2F0EC; color: #3F3A36; }
.is-closed .own-badge__dot { background: #A8A29E; }
.is-closed .post__title { color: #57534E; }

.own-note { font-size: 14px; line-height: 1.55; padding: 12px 16px; border-radius: 14px; }
.own-note--check { background: #FFFBEB; border: 1px solid #FDE68A; color: #78350F; }

.own-panel {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 16px; background: #F7F5F1;
}
.own-panel > .ico { color: var(--primary); }
.own-panel--deal { background: var(--primary-soft); }
.own-panel--closed { background: #F2F0EC; color: #3F3A36; }
.own-panel--closed > .ico { color: #78716C; }
.own-panel__faces { display: flex; flex: none; }
.own-panel__text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #3F4F4C; line-height: 1.45; }
.own-panel__text strong { font-size: 15px; color: var(--ink); }
.own-panel__count { display: flex; align-items: center; gap: 8px; }
.own-panel__new { padding: 2px 9px; border-radius: 999px; background: var(--coral); color: var(--ink); font-size: 12px; font-weight: 800; }
.own-panel__sub { font-size: 13px; color: var(--muted); }
.own-panel__sub strong { font-size: 13px; color: var(--ink); }
.post__trust--inline { font-size: 13px; }
.own-panel__btn { min-height: 44px; padding: 0 20px; font-size: 14px; flex: none; }
.post__foot--own .post__when { flex: 1; }

@media (max-width: 600px) {
  .post { padding: 16px; gap: 12px; border-radius: 18px; }
  .avatar { width: 38px; height: 38px; font-size: 13px; }
  .post__who { font-size: 14px; }
  .post__trust { font-size: 12px; }
  .post__price-amount { font-size: 18px; }
  .post__title { font-size: 17px; }
  .post__desc { font-size: 14px; }
  .post__info { gap: 6px 14px; font-size: 12px; }
  .post__actions { flex: 1 1 100%; }
  .post__actions .btn { flex: 1 1 0; padding: 0 12px; }
  .post__ownhead .post__price { margin-left: 0; flex-basis: 100%; flex-direction: row; align-items: baseline; gap: 8px; max-width: none; }
  .own-panel__btn { flex: 1 1 100%; }
  .post__foot--own .post__when { display: none; }
}

/* Compact card used in previews on the landing page */
.post--compact { gap: 10px; }
.post--compact .post__title { font-size: 18px; }
.post--compact .tag { align-self: flex-start; margin-left: 0; }
.post--compact .post__place { font-size: 14px; color: var(--muted); }
.post--compact .post__foot { margin-top: auto; padding-top: 10px; }
.post--compact .post__note { font-size: 13px; font-weight: 700; color: var(--primary-text); }

/* ---------- Pop-up questions (js/ui.js) ---------- */
.ask {
  border: 0; padding: 0; background: transparent; max-width: calc(100vw - 32px); width: 420px;
  overflow: visible; color: var(--ink);
}
.ask::backdrop { background: rgba(20, 32, 30, 0.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: ask-fade .18s ease; }
.ask__box {
  background: #FFFFFF; border-radius: 24px; padding: 26px 24px 20px;
  box-shadow: 0 30px 80px rgba(20, 32, 30, 0.28), 0 2px 6px rgba(20, 32, 30, 0.08);
  display: flex; flex-direction: column; gap: 10px;
  animation: ask-pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.ask.is-closing .ask__box { animation: ask-out .14s ease forwards; }
.ask__icon {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 4px;
  background: var(--primary-soft); color: var(--primary);
}
.ask--danger .ask__icon { background: #FEF3F2; color: #B42318; }
.ask--warning .ask__icon { background: #FFFAEB; color: #B54708; }
.ask__title { font-family: var(--font-display); font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; }
.ask__text { font-size: 15px; line-height: 1.55; color: var(--body); }
.ask__field { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.ask__label { font-size: 13px; font-weight: 700; color: var(--muted); }
.ask__input {
  width: 100%; min-height: 46px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 12px;
  font: inherit; font-size: 15px; background: #FFFFFF; color: var(--ink);
}
.ask__input:focus { outline: none; border-color: var(--primary); }
.ask__copy { display: flex; gap: 8px; margin-top: 4px; }
.ask__copy .ask__input { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.ask__copybtn { min-height: 46px; padding: 0 18px; flex: none; }
.ask__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.ask__actions .btn { min-height: 46px; padding: 0 22px; font-size: 15px; }
.btn-danger-solid { background: #B42318; color: #FFFFFF; }
.btn-danger-solid:hover { background: #912018; color: #FFFFFF; }
.btn-warning { background: #B54708; color: #FFFFFF; }
.btn-warning:hover { background: #93370D; color: #FFFFFF; }
@keyframes ask-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ask-out { to { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes ask-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 520px) {
  /* Phones: the question slides up from the bottom, buttons full width */
  .ask { width: 100%; max-width: 100vw; margin: auto 0 0; }
  .ask__box { border-radius: 24px 24px 0 0; padding: 24px 20px calc(18px + env(safe-area-inset-bottom)); animation-name: ask-up; }
  .ask.is-closing .ask__box { animation-name: ask-down; }
  .ask__actions { flex-direction: column-reverse; }
  .ask__actions .btn { width: 100%; }
}
@keyframes ask-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ask-down { to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .ask__box, .ask::backdrop { animation: none !important; } }

/* ---------- Loading spinner ---------- */
.spinner {
  display: inline-block; width: 22px; height: 22px; flex: none; border-radius: 999px;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-right-color: var(--coral);
  animation: accord-spin .75s linear infinite;
}
.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--light { border-color: rgba(255, 255, 255, 0.25); border-top-color: #FFFFFF; border-right-color: #FFFFFF; }
.loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 28px 16px; color: var(--muted); font-size: 14px; font-weight: 600;
}
.btn .spinner { margin-right: 2px; }
@keyframes accord-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer__inner {
  padding-top: 22px; padding-bottom: 22px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  font-size: 14px; color: var(--muted);
}
.site-footer--dark { background: var(--ink); border-top: 0; }
.site-footer--dark .site-footer__inner { color: #C9D2CF; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: #FFFFFF; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; z-index: 50; max-width: calc(100% - 32px);
}

/* =========================================================
   Scrollbars — one look for every scrolling area
   Chrome / Edge / Safari use the ::-webkit-scrollbar rules (rounded thumb);
   Firefox uses scrollbar-color / scrollbar-width (it ignores the others).
   ========================================================= */
html { scroll-padding-top: 88px; }        /* jumps to #composer etc. land below the sticky top bar */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: rgba(20, 32, 30, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(15, 118, 110, 0.65); }
::-webkit-scrollbar-thumb:active { background-color: var(--primary); }
::-webkit-scrollbar-corner { background: transparent; }

/* The page itself: a slightly wider bar on the page background */
html::-webkit-scrollbar { width: 12px; }
html::-webkit-scrollbar-track { background: #EFEDE8; }
html::-webkit-scrollbar-thumb { background-color: rgba(15, 118, 110, 0.45); border-width: 3px; }
html::-webkit-scrollbar-thumb:hover { background-color: rgba(15, 118, 110, 0.75); }

/* Rows that scroll sideways (categories, filters, "Just posted"): thin, and only strong on hover */
.scroll-x { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background-color: rgba(20, 32, 30, 0.12); }
.scroll-x:hover::-webkit-scrollbar-thumb { background-color: rgba(20, 32, 30, 0.3); }

/* Boxes that scroll inside the page (chat, conversation list): don't drag the page along at the ends */
.scroll-y { overflow-y: auto; overscroll-behavior: contain; }

/* On dark backgrounds */
.on-dark::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.22); }
.on-dark::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.45); }

/* Firefox */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: rgba(20, 32, 30, 0.28) transparent; }
  html { scrollbar-color: rgba(15, 118, 110, 0.55) #EFEDE8; }
  .on-dark { scrollbar-color: rgba(255, 255, 255, 0.3) transparent; }
}

/* ---------- Install app (js/install.js shows it only where Accord can be installed) ---------- */
.install-btn { display: inline-flex; align-items: center; gap: 7px; }
.install-btn[hidden], .account__install[hidden] { display: none !important; }
/* In the app bar: a teal circle, like the Messages button and the account picture beside it */
.appbar .install-btn { gap: 8px; padding: 0 16px 0 5px; min-height: 46px; }
.appbar .install-btn svg {
  box-sizing: border-box; width: 36px; height: 36px; padding: 9px; flex: none;
  border-radius: 999px; background: var(--primary); color: #FFFFFF;
}
.appbar .install-btn:hover svg { background: #0B5A54; }
/* On the dark landing page: a solid teal button */
.topbar .install-btn { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.topbar .install-btn:hover { background: #0B5A54; border-color: #0B5A54; }
.account__install { border-color: var(--primary); color: var(--primary); }
@media (max-width: 640px) {
  /* Phones: just the teal circle */
  .appbar .install-btn { padding: 0; min-height: 0; border: 0; background: transparent; }
  .appbar .install-btn .install-btn__label { display: none; }
}
@media (max-width: 420px) {
  .topbar .install-btn .install-btn__label { display: none; }
}