/* /market visual polish: laptop and desktop layout, shared card / button / control look, consistent chrome on every market page
   (including the public office profile). Loaded LAST in market_base.html. Colours only through var(--ay-*) tokens.
   Phones keep their behaviour: the bottom tab bar, 44px targets, 16px inputs and safe areas stay as defined in market-shell.css. */

/* ── shared look (all widths) ─────────────────────────────────────────── */
body.pt .pt-btn {
  border-radius: var(--ay-r-md);
  border-color: var(--ay-border);
  background: var(--ay-surface);
  color: var(--ay-text);
  transition: border-color var(--ay-tr-fast), background var(--ay-tr-fast), box-shadow var(--ay-tr-fast), transform var(--ay-tr-fast);
}
body.pt .pt-btn:hover:not(:disabled) { border-color: var(--ay-accent); box-shadow: var(--ay-shadow-sm); }
body.pt .pt-btn.primary,
body.pt .pt-btn.primary:hover:not(:disabled) { background: var(--ay-accent-fill); color: var(--ay-on-accent); border-color: var(--ay-accent); }
body.pt .pt-btn:focus-visible,
body.pt .pt-chip:focus-visible,
body.pt .mh-link:focus-visible,
body.pt .pt-menu a:focus-visible,
body.pt .pt-dnav a:focus-visible,
body.pt .pt-top a:focus-visible { outline: 2px solid var(--ay-focus); outline-offset: 2px; }
body.pt :is(input, select, textarea):not([type=checkbox]):not([type=radio]):not([type=file]) {
  border-radius: var(--ay-r-md);
  border-color: var(--ay-border);
  background: var(--ay-surface);
  color: var(--ay-text);
  transition: border-color var(--ay-tr-fast), box-shadow var(--ay-tr-fast);
}
body.pt :is(input, select, textarea):focus-visible { outline: 2px solid var(--ay-focus); outline-offset: 1px; border-color: var(--ay-accent); }
body.pt .pt-card { border-radius: var(--ay-r-lg); border-color: var(--ay-border); background: var(--ay-surface); }
body.pt .pt-state {
  padding: 36px 20px;
  border-style: dashed;
  background: var(--ay-surface-2);
  color: var(--ay-text-muted);
  box-shadow: none;
}
body.pt .pt-state p { margin: 0 0 8px; line-height: 1.9; }
body.pt .pt-menu { background: var(--ay-surface); border-color: var(--ay-border); border-radius: var(--ay-r-lg); }
body.pt .pt-menu a:hover, body.pt .pt-menu button:hover { background: var(--ay-surface-2); color: var(--ay-accent); }
body.pt .pt-menu .pt-menu-h { background: var(--ay-surface-2); color: var(--ay-text-muted); }
body.pt .pt-menu li + li { border-color: var(--ay-border); }

/* desktop navigation lives in the header; it is hidden on phones and tablets (the bottom tab bar is used there) */
.pt-dnav { display: none; }

/* the shared footer link groups */
body.pt .pt-foot .ct-gt { color: var(--ay-text); opacity: 1; }

/* ── tablet (768 to 1023) ─────────────────────────────────────────────── */
@media (min-width: 768px) {
  body.pt .pt-main { padding-inline: 24px; }
  body.pt .pt-sheet { align-items: center; }
  body.pt .pt-sheet-body { border-radius: var(--ay-r-xl); max-height: 86dvh; }
}

/* ── laptop and desktop (1024 and up) ─────────────────────────────────── */
@media (min-width: 1024px) {
  body.pt { padding-bottom: 0; }
  body.pt .pt-tabs { display: none !important; }
  body.pt .pt-toast { bottom: 24px; }
  body.pt .ls-bar { display: none !important; }

  /* header: brand, inline navigation, actions */
  body.pt .pt-top {
    min-height: 68px;
    gap: 24px;
    padding-inline: max(24px, calc((100% - 1240px) / 2 + 32px));
  }
  body.pt .pt-brand { flex: 0 0 auto; }
  body.pt .pt-brand-info b { font-size: 15.5px; }
  body.pt .pt-dnav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; margin-inline-start: 8px; }
  body.pt .pt-dnav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--ay-r-pill);
    color: var(--ay-text-muted);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background var(--ay-tr-fast), color var(--ay-tr-fast);
  }
  body.pt .pt-dnav a:hover { background: var(--ay-surface-2); color: var(--ay-text); }
  body.pt .pt-dnav a[aria-current=page] { background: var(--ay-accent-soft); color: var(--ay-accent); }
  body.pt .pt-top-actions { gap: 10px; }
  body.pt .pt-top-actions .pt-top-search { display: none !important; }
  body.pt .pt-top-actions .pt-top-post {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--ay-r-pill);
    background: var(--ay-accent-fill);
    color: var(--ay-on-accent);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: var(--ay-shadow-sm);
    transition: box-shadow var(--ay-tr-fast), transform var(--ay-tr-fast);
  }
  body.pt .pt-top-actions .pt-top-post:hover { box-shadow: var(--ay-shadow-md); transform: translateY(-1px); }

  /* centered container */
  body.pt main.pt-main { max-width: 1240px !important; margin-inline: auto !important; padding: 28px 32px 48px !important; overflow: visible !important; }
  body.pt:is([data-page="post"], [data-page="messages"], [data-page="settings"], [data-page="my-listings"], [data-page="recent"], [data-page="searches"], [data-page="requests"]) main.pt-main { max-width: 900px !important; }
  body.pt[data-page="me"] main.pt-main { max-width: 1000px !important; }
  body.pt[data-page="login"] main.pt-main { padding-top: 64px !important; }

  /* footer */
  body.pt .pt-foot { padding: 40px max(32px, calc((100% - 1240px) / 2 + 32px)) 32px; margin-top: 48px; font-size: 13px; }

  /* home: hero, search, filters */
  body.pt .mh-hero { padding: 36px 0 24px; }
  body.pt .mh-emblem { width: 52px; height: 52px; margin-bottom: 8px; }
  body.pt .mh-h1 { font-size: 36px; }
  body.pt .mh-hero-desc { font-size: 16px; max-width: 640px; }
  body.pt .mh-hero-acts { max-width: 960px; margin-inline: auto; gap: 16px; }
  body.pt .mh-act-card { padding: 16px 18px; }
  body.pt .mh-bar { max-width: 920px; margin-inline: auto; min-height: 62px; padding-inline: 16px; box-shadow: var(--ay-shadow-md); }
  body.pt .mh-bar input { font-size: 16px; }
  body.pt .mh-chips { max-width: 920px; margin-inline: auto; flex-wrap: wrap; justify-content: center; overflow: visible; padding-block: 14px; }
  body.pt .mh-chips .pt-chip { min-height: 40px; font-size: 14px; }
  body.pt .mh-resbar { margin-top: 12px; }

  /* card grids: 3 columns on a laptop, 4 on a wide screen; the horizontal rails become grids */
  body.pt .mh-grid,
  body.pt .mh-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px !important;
    overflow: visible;
    scroll-snap-type: none;
    padding: 4px 0 8px;
  }
  body.pt .mh-rail .mh-card { flex: none !important; max-width: none !important; }
  body.pt .mh-media { aspect-ratio: 3 / 2; }
  body.pt .mh-sec h2 { font-size: 21px; margin-top: 44px; }
  body.pt .mh-acts { gap: 20px; }
  body.pt .mh-leaderboard { padding: 24px 28px; border-radius: var(--ay-r-xl); }
  body.pt .mh-advisors-grid, body.pt .mh-offices-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
  body.pt .mh-advisor-card, body.pt .mh-office-card { max-width: none; }

  /* centered dialogs instead of bottom sheets */
  body.pt .pt-sheet-body { max-width: 560px; padding: 20px 24px; }

  /* listing page: gallery and facts on one side, sticky contact panel on the other */
  body.pt .ls-crumbs ol { margin-bottom: 16px; }
  html body.pt .ls-page.pt-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    column-gap: 28px;
    align-items: start;
    padding: 0;
    overflow: visible;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  body.pt .ls-page > * { margin-inline: 0 !important; grid-column: 1; }
  body.pt .ls-gallery,
  body.pt .ls-nophoto,
  body.pt .ls-head,
  body.pt .ls-section {
    margin-block: 0 20px;
    background: var(--ay-surface);
    border: 1px solid var(--ay-border);
    border-radius: var(--ay-r-lg);
    box-shadow: var(--ay-shadow-sm);
  }
  body.pt .ls-gallery { overflow: hidden; }
  body.pt .ls-slide { aspect-ratio: 16 / 10; max-height: 560px; }
  body.pt .ls-thumbs { padding: 12px 16px; gap: 10px; }
  body.pt .ls-thumb { flex-basis: 96px; width: 96px; height: 72px; }
  body.pt .ls-nophoto { aspect-ratio: 16 / 9; max-height: 420px; }
  body.pt .ls-head, body.pt .ls-section { padding: 20px 24px; }
  body.pt .ls-head .pt-h1 { font-size: 26px; }
  body.pt .ls-aside {
    grid-column: 2;
    grid-row: 1 / span 8;
    position: sticky;
    top: 92px;
    display: grid;
    gap: 16px;
    padding: 20px;
    background: var(--ay-surface);
    border: 1px solid var(--ay-border);
    border-radius: var(--ay-r-lg);
    box-shadow: var(--ay-shadow-md);
  }
  body.pt .ls-aside > * { margin: 0 !important; }
  body.pt .ls-price-value { font-size: 24px; }
  body.pt .ls-cta { display: grid !important; gap: 10px; }
  body.pt .ls-cta .pt-btn { min-height: 48px; }
  body.pt #pt-similar-box { margin-top: 12px; }
  body.pt #pt-similar { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

  /* me, messages */
  body.pt[data-page="me"] main.pt-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  body.pt[data-page="me"] main.pt-main > :is(h1, #pt-who) { grid-column: 1 / -1; }
  body.pt[data-page="me"] main.pt-main > * { margin-block: 0; }
  body.pt .pt-chat { height: calc(100dvh - 260px); min-height: 440px; }
  body.pt .pt-conv { padding: 12px 16px; background: var(--ay-surface); border: 1px solid var(--ay-border); border-radius: var(--ay-r-md); transition: border-color var(--ay-tr-fast); }
  body.pt .pt-conv:hover { border-color: var(--ay-accent); }

  /* post form */
  body.pt #pt-pform { padding: 28px 32px; }
  body.pt #pt-pform .pt-seg { gap: 12px; }
  body.pt #pt-pform .pt-form-actions { margin-top: 20px; }

  /* office profile */
  body.pt .op-main { max-width: 1160px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; padding: 28px 32px 48px; }
  body.pt .op-main > :is(.op-crumbs, .op-hero),
  body.pt .op-main > .op-box:has(#op-about-h),
  body.pt .op-main > .op-box:has(#op-list-h) { grid-column: 1 / -1; }
  body.pt .op-hero { padding: 28px 32px; border-radius: var(--ay-r-xl); }
  body.pt .op-logo { width: 88px; height: 88px; font-size: 38px; border-radius: var(--ay-r-lg); }
  body.pt .op-id h1 { font-size: 30px; }
  body.pt .op-box { padding: 24px 28px; box-shadow: var(--ay-shadow-sm); }
  body.pt .op-box .op-p { max-width: 80ch; }
  body.pt .op-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  body.pt .op-card { background: var(--ay-surface); box-shadow: var(--ay-shadow-sm); transition: box-shadow var(--ay-tr-fast), border-color var(--ay-tr-fast); }
  body.pt .op-card:hover { box-shadow: var(--ay-shadow-md); border-color: var(--ay-accent); }
}

@media (min-width: 1024px) {
  body.pt .pt-dnav a { white-space: nowrap; }
}
@media (min-width: 1024px) and (max-width: 1179px) {
  body.pt .pt-top { gap: 12px; }
  body.pt .pt-dnav a { padding: 0 10px; }
  body.pt .pt-top-actions { gap: 6px; }
  body.pt .pt-top-actions .pt-top-home span { display: none; }
  body.pt .pt-top-actions .pt-top-home { padding: 0; width: 44px; justify-content: center; }
}

@media (min-width: 1280px) {
  body.pt .mh-grid,
  body.pt .mh-rail { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px !important; }
  body.pt .op-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.pt #pt-similar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1600px) {
  body.pt .pt-top { padding-inline: max(24px, calc((100% - 1400px) / 2 + 32px)); }
  body.pt main.pt-main { max-width: 1400px !important; }
  body.pt .pt-foot { padding-inline: max(32px, calc((100% - 1400px) / 2 + 32px)); }
  body.pt .ls-page { grid-template-columns: minmax(0, 1fr) 420px; }
  body.pt .mh-grid,
  body.pt .mh-rail { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  body.pt .pt-btn, body.pt .pt-dnav a, body.pt .pt-top-post, body.pt .op-card { transition: none; }
}

/* the header links carry the same icons as the phone's bottom bar: the same five places, recognisable on every screen */
@media (min-width: 1024px) {
  body.pt .pt-dnav a { gap: 8px; }
  body.pt .pt-dnav a svg { flex: 0 0 auto; width: 18px; height: 18px; }
}
