/* Public sub-pages: marketplace, comparison, resources and the two calculators.
   Every size, spacing and dark colour is read from the Paper file "Nexus · Landing mockup", artboards
   "Public — Marketplace", "Public — Compare", "Public — Resources", "Public — Calculator · Practice valuation"
   and "Public — Calculator · Loan cost vs. income".
   Loaded after base.css and clinical.css: nav, footer, buttons, tags, the listing card and both themes come from there.
   Colours are tokens only; the one value Paper uses that has no token yet is added below with a white-view pair. */

:root { --mk-slash: #6B6E73; }
:root[data-theme="light"] { --mk-slash: #8E9094; }

/* Paper: the nav row is 40 + 44 + 24 = 108px tall and in the flow; here the nav is fixed, so the page starts below it */
.mk { display: block; padding-top: 108px; }
.mk-head, .mk-body { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: var(--gutter); }

/* ───────── Page head ───────── */
.mk-head { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding-top: 72px; padding-bottom: 40px; }
.mk-head.is-48 { padding-bottom: 48px; }
.mk-head.is-calc { padding-block: 48px; }
.mk-head h1 { font-size: 60px; line-height: 66px; font-weight: 300; letter-spacing: -0.03em; color: var(--ink); text-wrap: wrap; }
.mk-sub { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 30px; color: var(--c-sub); }
.mk-crumbs { flex-shrink: 0; display: flex; align-items: center; gap: 10px; height: 44px; font-size: 13px; line-height: 16px; font-weight: 500; color: var(--c-label); }
.mk-crumbs a { display: flex; align-items: center; height: 44px; transition: color 150ms ease; }
.mk-crumbs .sep { font-weight: 400; color: var(--mk-slash); }
.mk-crumbs [aria-current] { color: var(--ink); }

.mk-body { display: flex; flex-direction: column; gap: 28px; padding-bottom: 96px; }
.mk-chip { background: var(--row-2); color: var(--chip-ink); }
.mk-btn-40 { padding: 10px 18px; }
.mk .register { background: var(--panel); }

/* ───────── Marketplace: search panel, results bar, cards ───────── */
.mk .search { background: color-mix(in srgb, var(--panel) 88%, transparent); }
.mk .select select, .mk .field input { background: var(--row-2); }
.mk .shortlist { position: relative; transition: scale 150ms ease-out; }
.mk .shortlist::after { content: ""; position: absolute; inset: -14px -8px; }
.mk .shortlist:active { scale: 0.97; }
.mk .shortlist[aria-pressed="true"] { text-decoration: underline 1px; text-underline-position: from-font; }

.mk-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; }
.mk-bar-count { display: flex; align-items: center; gap: 12px; }
.mk-count { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.mk-sort { display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 16px; color: var(--c-label); }
.mk-sort .select { flex-shrink: 0; width: 220px; }
.mk-sort .select select { font-size: 16px; line-height: 20px; font-weight: 400; }
.mk-sort .select svg { color: var(--ink); }

.mk .card { background: var(--panel); }
.mk .card .chip:not(.chip-blue, .chip-black) { background: var(--row-2); color: var(--chip-ink); }
.mk .fact { background: var(--row-2); }
.mk .compare[aria-pressed="true"] { color: var(--ink); }
/* Title links and the inline "Clear filters" get a 44px hit area without changing the layout */
.mk .card h3 a, .cmp-title a { display: block; margin-block: -9px; padding-block: 9px; }
.mk .empty .link { position: relative; }
.mk .empty .link::after { content: ""; position: absolute; inset: -13px -6px; }
.mk .compare, .mk .save { transition: color 150ms ease, scale 150ms ease-out; }
.mk .compare:active, .mk .save:active { scale: 0.97; }

/* Compare tray (not drawn in Paper): appears once a practice is picked, holds up to three */
.tray { position: fixed; left: 50%; bottom: 24px; z-index: 35; translate: -50% 0; max-width: calc(100% - 24px); display: flex; align-items: center; gap: 16px; padding: 10px 10px 10px 20px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); animation: tray-in 280ms var(--ease-out) both; }
@keyframes tray-in { from { opacity: 0; transform: translateY(14px); } }
.tray-label { flex-shrink: 0; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.1em; color: var(--c-sub); }
.tray-items { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.tray-item { position: relative; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 12px; border-radius: 8px; background: var(--row-2); font-size: 13px; line-height: 16px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: scale 150ms ease-out; }
.tray-item::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.tray-item:active { scale: 0.97; }
.tray-item svg { flex-shrink: 0; color: var(--c-label); }
.tray-go { flex-shrink: 0; min-height: 44px; padding: 0 16px 0 20px; font-variant-numeric: tabular-nums; }
.tray-go[aria-disabled="true"] { opacity: 0.55; }
body.has-tray .toasts { bottom: 104px; }

/* ───────── Compare ───────── */
.cmp { display: flex; flex-direction: column; padding: 28px; border-radius: 12px; background: var(--panel); border: 1px solid var(--c-line); }
/* The 4px ring of padding keeps focus outlines from being clipped by the scroll container */
.cmp-scroll { margin: -4px; padding: 4px; overflow-x: auto; }
.cmp-grid { display: flex; flex-direction: column; gap: 8px; }
.cmp-head { display: flex; gap: 20px; padding-bottom: 20px; }
.cmp-row { display: flex; align-items: center; gap: 20px; min-height: 56px; border-top: 1px solid var(--c-line); }
.cmp-label { flex-shrink: 0; width: 208px; font-size: 13px; line-height: 18px; color: var(--c-label); }
.cmp-head .cmp-label { display: flex; flex-direction: column; justify-content: flex-end; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.1em; color: var(--c-sub); font-variant-numeric: tabular-nums; }
.cmp-col { position: relative; flex: 1 1 0%; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.cmp-photo { flex-shrink: 0; display: block; height: 150px; overflow: clip; border-radius: 8px; background: var(--row); }
.cmp-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cmp-name { display: flex; flex-direction: column; gap: 4px; }
.cmp-id { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.04em; color: var(--c-dim); }
.cmp-title { font-size: 20px; line-height: 26px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
.cmp-remove { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; background: color-mix(in srgb, var(--page) 78%, transparent); color: var(--ink); transition: scale 150ms ease-out, background-color 150ms ease; }
.cmp-remove::after { content: ""; position: absolute; inset: -6px; }
.cmp-remove:active { scale: 0.97; }
.cmp-add { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 150px; border-radius: 8px; border: 1px dashed var(--c-line-dash); font-size: 14px; line-height: 18px; font-weight: 500; color: var(--c-label); transition: color 150ms ease, border-color 150ms ease; }
.cmp-cell { flex: 1 1 0%; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 22px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.cmp-cell.is-locked { color: var(--c-sub); }
.cmp-cell svg { flex-shrink: 0; }
.cmp-row.is-actions { min-height: 0; padding-top: 20px; }
.cmp-row.is-actions .cmp-label { color: var(--c-dim); }
.cmp-view { min-height: 44px; padding: 0 14px 0 18px; gap: 8px; font-size: 13px; line-height: 16px; }
.mk-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 40px; border-radius: 12px; border: 1px dashed var(--line-2); }
.mk-empty h2 { font-size: 24px; line-height: 30px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
.mk-empty p { max-width: 560px; font-size: 15px; line-height: 24px; color: var(--c-sub); }
.mk-empty .btn { margin-top: 6px; }

/* ───────── Resources ───────── */
.mk .calc { justify-content: space-between; }
.mk .calc-title { font-size: 24px; line-height: 30px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
.mk-later { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 8px; background: var(--row); }
.mk-later .chip { flex-shrink: 0; }
.mk-later p { font-size: 15px; line-height: 22px; color: var(--c-sub); }

/* ───────── Calculators ───────── */
.mk-body.is-calc { flex-direction: row; align-items: flex-start; gap: 20px; }
.cx-panel { flex: 1 1 0%; min-width: 0; display: flex; flex-direction: column; gap: 24px; padding: 32px; border-radius: 12px; background: var(--panel); border: 1px solid var(--c-line); }
.cx-result { flex: 0 0 520px; }
.cx-eyebrow { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.1em; color: var(--c-sub); }
.cx-row { display: flex; gap: 16px; }
.cx-field { flex: 1 1 0%; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cx-label { font-size: 13px; line-height: 16px; color: var(--c-label); }
.cx-select { position: relative; display: block; }
.cx-select svg { position: absolute; right: 16px; top: 17px; color: var(--ink); pointer-events: none; }
.cx-input, .cx-select select { display: block; width: 100%; height: 48px; margin: 0; padding: 0 16px; border: 0; border-radius: 8px; background: var(--row-2); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 20px; font-weight: 400; font-variant-numeric: tabular-nums; -webkit-appearance: none; appearance: none; }
.cx-select select { padding-right: 40px; cursor: pointer; }
.cx-input:focus-visible, .cx-select select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cx-actions { display: flex; align-items: center; gap: 20px; padding-top: 8px; }
.cx-go { flex-shrink: 0; min-height: 48px; padding: 0 18px 0 22px; font-size: 15px; line-height: 20px; }
.cx-note { font-size: 13px; line-height: 20px; color: var(--c-sub); }
.cx-result .chip { align-self: flex-start; }
.cx-total { display: flex; flex-direction: column; gap: 6px; }
.cx-total span { font-size: 13px; line-height: 16px; color: var(--c-sub); }
.cx-total b { font-size: 56px; line-height: 62px; font-weight: 300; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cx-lines { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.cx-line { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 48px; padding-inline: 16px; border-radius: 8px; background: var(--row-2); font-size: 14px; line-height: 20px; }
.cx-line dt { min-width: 0; color: var(--chip-ink); }
.cx-line dd { flex-shrink: 0; margin: 0; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.cx-pending { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 8px; background: var(--row); }
.cx-pending span { font-size: 13px; line-height: 16px; color: var(--c-sub); }
.cx-pending b { font-size: 16px; line-height: 22px; font-weight: 500; color: var(--c-label); }
.cx-talk { align-self: flex-start; min-height: 44px; padding: 0 20px; }

@media (hover: hover) and (pointer: fine) {
  .mk-crumbs a:hover, .cmp-add:hover { color: var(--ink); }
  .cmp-add:hover { border-color: var(--ink); }
  .cmp-remove:hover { background: var(--page); }
  .tray-item:hover svg { color: var(--ink); }
  .cmp-title a:hover, .mk .card h3 a:hover { text-decoration: underline 1px; text-underline-position: from-font; }
}

/* White view: the pale accent ring is too faint on a light page (same rule as clinical.css, for the fields here) */
:root[data-theme="light"] .cx-input:focus-visible, :root[data-theme="light"] .cx-select select:focus-visible { outline-color: var(--teal); }

/* ───────── Below the 1440 artboard's range (not drawn in Paper): one column ───────── */
@media (max-width: 1199px) {
  .mk-head h1 { font-size: 48px; line-height: 54px; }
  .cx-result { flex-basis: 420px; }
  .cmp-label { width: 160px; }
}
@media (max-width: 1000px) {
  .mk-body.is-calc { flex-direction: column; align-items: stretch; }
  .cx-result { flex: none; }
  /* The table keeps its columns and scrolls sideways inside its own card */
  .cmp-grid { min-width: 820px; }
}
@media (max-width: 700px) {
  .mk { padding-top: 68px; }
  .mk-head, .mk-head.is-48, .mk-head.is-calc { padding-top: 24px; padding-bottom: 28px; gap: 14px; }
  .mk-head h1 { font-size: 34px; line-height: 40px; letter-spacing: -0.02em; }
  .mk-sub { font-size: 18px; line-height: 26px; }
  .mk-crumbs { flex-wrap: wrap; height: auto; min-height: 44px; row-gap: 0; }
  .mk-body { gap: 20px; padding-bottom: 64px; }
  .mk .search-top { gap: 12px; }
  .mk .search-top .eyebrow-l { letter-spacing: 0.1em; }
  .mk .shortlist { flex-shrink: 0; white-space: nowrap; }
  .mk-bar { flex-direction: column; align-items: stretch; }
  .mk-sort { justify-content: space-between; }
  .mk-sort .select { flex: 1 1 0%; width: auto; max-width: 220px; }
  .mk .register-text { align-items: flex-start; }
  .mk-later { flex-direction: column; align-items: flex-start; }
  .cmp { padding: 20px; }
  .cmp-label { width: 132px; }
  .cmp-grid { min-width: 760px; }
  .mk-empty { padding: 24px 20px; }
  .cx-panel { padding: 20px; gap: 20px; }
  .cx-row { flex-direction: column; }
  .cx-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .cx-total b { font-size: 40px; line-height: 46px; }
  .cx-line { height: auto; min-height: 48px; padding-block: 10px; }
  .tray { left: 12px; right: 12px; bottom: 12px; translate: none; max-width: none; flex-wrap: wrap; gap: 10px; padding: 12px; }
  .tray-items { flex: 1 1 0%; }
  .tray-go { flex: 1 1 100%; }
  body.has-tray .toasts { bottom: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .tray { animation: none; }
}
