/* legibility.css — RCR interface type scale and touch-target floor.
   Added 2026-09-18 for review findings R1 (interface text far below a readable
   size) and R2 (touch targets under the 44px minimum).

   This file is a LAYER, not a redesign. It is linked last in index.html so it
   wins the cascade over styles.css -> premium-product.css -> mobile-fixes.css ->
   native-layout.css, which is how every other override in this app is applied.
   Nothing here changes markup, colour, or layout structure: it only raises font
   sizes, loosens uppercase tracking, and floors control heights.

   To revert: delete this file and its <link> in public/index.html. No other file
   depends on it.

   Tuning: change the five custom properties below, not the rules. */

:root {
  --rcr-label: 11px;      /* smallest interface label we will paint (Apple floor) */
  --rcr-label-lg: 12px;   /* buttons and anything a finger aims at */
  --rcr-body-sm: 13px;    /* secondary reading text: descriptions, values, notes */
  --rcr-track: .04em;     /* uppercase tracking; was .1em-.21em and stretched words */
  --rcr-track-eyebrow: .08em; /* eyebrows are 1-3 words, they can keep some air */
  --rcr-tap: 44px;        /* minimum height and width of anything tappable */
}

/* ---------------------------------------------------------------- R1: type */

/* Bottom navigation labels. These were painting at 6.5-8px. nowrap is kept so a
   label never breaks into two lines; tracking goes to zero to buy the width the
   larger size costs. */
.app-nav span {
  font-size: var(--rcr-label);
  letter-spacing: 0;
}

/* Buttons and button-shaped links. */
.primary,
.secondary,
.text-button,
.link-button,
.favorite,
.dashboard-button,
.auth-form > a,
.contact-action-grid a,
.contact-action-grid button {
  font-size: var(--rcr-label-lg);
  letter-spacing: var(--rcr-track);
}

/* Eyebrows and short uppercase headers. */
.eyebrow,
.screen-header .eyebrow,
.section-heading .eyebrow,
.hub-section > .section-heading > small,
.pro-badge,
.free-plan-note span,
.agent-dashboard-metrics span,
.broker-metrics span,
.property-facts dt,
.property-features h3,
.listing-attribution dt,
.profile-screen-form label,
.auth-form label {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track-eyebrow);
}

/* Status chips. */
.stage {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track);
}

/* The broker Dashboard button is set by an id rule elsewhere, so it needs id
   weight here to be reached at all. */
#brokerDashboard.dashboard-button {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track);
  min-height: var(--rcr-tap);
}

/* Listing view toggle: the rule that wins is .view-toggle button, not the data
   attribute, so match its weight. */
.view-toggle button,
.listing-toolbar .view-toggle button {
  font-size: var(--rcr-label-lg);
  letter-spacing: var(--rcr-track);
  min-height: var(--rcr-tap);
}

/* Listing card attribution: "Listed by" / "Brokerage" and their values. */
.property-card-attribution dt {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track-eyebrow);
}

.property-card-attribution dd {
  font-size: var(--rcr-body-sm);
}

/* CRM seller rows: the client line and its activity caption. */
.seller-row p,
.seller-row small {
  font-size: var(--rcr-body-sm);
}

/* Transaction workspace: the file-count summary, the search label and the status
   filter rail. transaction-workspace.css is linked before this file, so plain
   class weight is enough. */
.transaction-summary article span,
.transaction-list-toolbar label,
.transaction-list-toolbar label span {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track-eyebrow);
}

.transaction-filters button {
  min-height: var(--rcr-tap);
  font-size: var(--rcr-label-lg);
  letter-spacing: var(--rcr-track);
}

.transaction-filters button span {
  font-size: var(--rcr-label);
}

/* Open transaction file. These only render once a file is open, which is why the
   first pass missed them; test/interface-legibility.test.mjs now opens one. */
.transaction-status {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track);
}

/* The status stepper: five uppercase step names across the width of a phone.
   At 11px "under contract" needs two lines, so let it wrap instead of clip. */
.transaction-progress small {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track);
  white-space: normal;
  line-height: 1.15;
}

.transaction-tabs button {
  font-size: var(--rcr-label-lg);
  letter-spacing: var(--rcr-track);
}

.review-inbox-row small {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track);
}

.review-inbox-row p {
  font-size: var(--rcr-body-sm);
}

/* Tabs inside an open file. Broker audit rows (event, actor, payload keys),
   the Documents tab's version history, and the Closeout status grid. `small`
   inherits 83% of its parent, so it is set explicitly rather than left to fall
   just under the floor. */
.audit-row {
  font-size: var(--rcr-body-sm);
}

.audit-row small,
.audit-row code {
  font-size: var(--rcr-label);
}

.transaction-version-group p,
.transaction-version {
  font-size: var(--rcr-body-sm);
}

.transaction-version small {
  font-size: var(--rcr-label);
}

.closeout-money-grid small,
.closeout-status-grid {
  font-size: var(--rcr-label);
  letter-spacing: var(--rcr-track);
}

/* Support dialog. transaction-workspace.css sets .support-search and
   .support-form p with !important, so this is the one place the layer has to
   say it too. */
.support-search {
  font-size: var(--rcr-label) !important;
  letter-spacing: var(--rcr-track-eyebrow) !important;
}

.support-form p {
  font-size: var(--rcr-body-sm) !important;
}

.support-form p.eyebrow {
  font-size: var(--rcr-label) !important;
}

.support-heading p {
  font-size: var(--rcr-body-sm);
}

.support-heading p.eyebrow {
  font-size: var(--rcr-label);
}

/* Pro feature grid step numbers (01-06). */
.pro-feature-grid article span {
  font-size: var(--rcr-label);
}

/* Secondary reading text: metric captions, card descriptions, list values,
   timeline entries, task notes. These carry real information and were 7-10px. */
.agent-dashboard-metrics small,
.broker-metrics small,
.website-addon-actions small,
.pro-offer-copy small,
.agent-task small,
.dashboard-event p,
.notification-item p,
.glance-card p,
.hub-module > p,
.broker-event time span,
.broker-event p,
.broker-event small,
.broker-roster small,
.listing-attribution dd,
.property-facts dd {
  font-size: var(--rcr-body-sm);
  line-height: 1.5;
}

/* The narrow-phone media queries in premium-product.css drop several of these
   below the floor again (7px nav labels, 7px metric captions, 7px Dashboard
   button). Re-assert the floor at every width. */
@media (max-width: 430px) {
  .app-nav span {
    font-size: var(--rcr-label);
  }

  .agent-dashboard-metrics small,
  .broker-metrics small {
    font-size: var(--rcr-body-sm);
  }

  .dashboard-button {
    font-size: var(--rcr-label);
    letter-spacing: var(--rcr-track);
  }
}

/* ------------------------------------------------------- R2: touch targets */

/* Every control a finger aims at gets 44px of height. Height comes from padding
   and min-height, never from font size, so the type scale above is unaffected. */
.primary,
.secondary,
.text-button,
.link-button,
.favorite,
.dashboard-button,
.header-icon,
.avatar,
.gallery-arrow,
#listingSort,
.stage-select,
[data-listing-view],
.community-card > header > a {
  min-height: var(--rcr-tap);
}

/* The top bar is a two-column grid: brand, then the action row. On a 390px phone
   the broker's action row (messages, notifications, Dashboard, avatar, menu)
   needs 287px once every control clears 44px, and only 261px is available, so it
   used to run past the right edge. Buy the 26px back from the chrome around it
   rather than from the controls: a slightly smaller wordmark, tighter page
   padding, tighter gaps. Measured at 390px this leaves 7px of slack.

   The existing rules for these three are written as `.topbar .brand` and
   `body:not(.auth-active) .topbar .brand`, so match that weight or they win. */
@media (max-width: 430px) {
  body:not(.auth-active) .topbar,
  .topbar {
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    padding-left: 8px;
    padding-right: 8px;
    column-gap: 6px;
  }

  body:not(.auth-active) .topbar .brand,
  .topbar .brand {
    width: 78px;
  }

  body:not(.auth-active) .topbar .top-actions,
  .topbar .top-actions {
    flex-wrap: nowrap;
    gap: 4px;
  }
}

/* The bottom navigation is five equal columns, so every label is sized for the
   shortest one ("CRM"). At 11px "Transactions" needs 85px and the column is 71,
   which ran the last label off the edge. Size the columns by their content and
   space them apart: the five labels need 331px of the 366px available. */
.app-nav {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, max-content);
  justify-content: space-between;
  padding-inline: 4px;
}

/* Content-sized columns make a short label like "CRM" a narrow target, so keep
   a 44px floor on the button itself. The five buttons then need 350px of 366. */
.app-nav button {
  min-width: var(--rcr-tap);
  min-height: var(--rcr-tap);
}

/* Icon-only buttons in the transaction file (suggested-file dismiss) and the close
   button in dialog headings. */
.file-icon-button,
.dialog-heading .icon-button {
  width: var(--rcr-tap);
  height: var(--rcr-tap);
  min-width: var(--rcr-tap);
  min-height: var(--rcr-tap);
  flex-basis: var(--rcr-tap);
}

/* Width matters as much as height for round and icon-only controls. */
.header-icon,
.avatar,
.gallery-arrow {
  min-width: var(--rcr-tap);
  width: var(--rcr-tap);
  height: var(--rcr-tap);
  flex-basis: var(--rcr-tap);
}

/* The listing view toggle and the "Presentation" links in the brokerage hub are
   plain buttons and anchors with no padding of their own. */
[data-listing-view],
.community-card > header > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: var(--rcr-label-lg);
  letter-spacing: var(--rcr-track);
}

/* Selects render their own box; min-height alone is not always honoured. */
#listingSort {
  height: var(--rcr-tap);
  font-size: var(--rcr-label-lg);
}

/* mobile-fixes.css shrinks conversation actions to 28-32px on narrow phones.
   Those are the message thread's Archive / Disconnect controls. */
.conversation-actions .text-button {
  min-height: var(--rcr-tap);
  font-size: var(--rcr-label-lg);
}

@media (max-width: 430px) {
  .conversation-actions .text-button,
  .dashboard-button,
  .header-icon,
  .avatar,
  .favorite {
    min-height: var(--rcr-tap);
  }

  .header-icon,
  .avatar {
    width: var(--rcr-tap);
    height: var(--rcr-tap);
    flex-basis: var(--rcr-tap);
  }

  .favorite {
    height: auto;
  }
}

/* The message dialog deliberately uses sentence case at 13px and already clears
   44px; leave it exactly as native-layout.css sets it. */
#messageDialog .conversation-actions .text-button {
  font-size: 13px;
  letter-spacing: normal;
}

/* ------------------------------------------------------------------ 2026-09-18
   Display serif at card size. Playfair Display 500 reads well at hero size
   (Welcome back, Sign in.) and too thin at 20–40px: stat values ("0", "RCR Pro"),
   panel titles ("Coming up", "Latest listings"), dialog headings. Those move to
   600, which is a loaded weight (500/600 + italic 500; 700 would be synthesised).
   Hero-size headings keep 500. Owner's request from the iPhone screenshots. */
.stat strong,
.agent-dashboard-metrics strong,
.broker-metrics strong,
.hub-number,
.pro-price strong,
.section-heading h2,
.dialog-heading h2,
.transaction-summary strong,
.transaction-card h2,
.transaction-coming-soon h2,
.transaction-detail-grid h2,
.dashboard-event h3,
.broker-event h3,
.broker-event time strong,
.notification-item h3,
.settings-grid h2,
.conversation-header h3,
.new-conversation h3,
.hub-native-summary h3,
.action-confirm-dialog h2,
.notification-empty h3,
.support-form h3,
.pro-feature-grid h3,
.agent-contact-screen h2,
.canonical-profile h2,
.property-detail-price {
  font-weight: 600;
}

/* mobile-fixes sets this one with !important; match it so the weight lands. */
dialog .dialog-heading h2 {
  font-weight: 600 !important;
}

/* Focus rings: only for keyboard focus, in the app's colour. Without this the
   browser's default halo (blue on iOS) appears on any focused control, e.g. the
   dialog close button that showModal() focuses. */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
summary:focus:not(:focus-visible) {
  outline: 0;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--red, #9f171c);
  outline-offset: 2px;
}

dialog .icon-button:focus-visible {
  outline-offset: 1px;
}

/* The R6 overflow's summary sits inside a clipped row; keep its ring inside. */
.record-overflow > summary:focus-visible {
  outline-offset: -2px;
}

/* A modal is a container, not a control: no ring on the dialog frame when the
   browser hands it focus on open. */
dialog:focus,
dialog:focus-visible {
  outline: 0;
}
