/* css/chrome.css — Phase 4 step 3: the shared chrome, built once (brief 2026-10-26, "Shared chrome").
   The wordmark, the utility bar and nav (js/nav.js builds them), the footer (js/nav.js builds it into
   #psiq-footer), and the components pages compose: buttons (css/buttons.css), cards, chips and status badges.
   Every colour is a token from css/theme.css; nothing here defines its own. Load order:
   theme.css -> buttons.css -> chrome.css -> page CSS. Classes are ps- prefixed so styles.css's older .nav/.footer
   rules can't reach them. */

/* ---- Archivo, self-hosted (assets/fonts/, SIL OFL 1.1): one variable file per subset, weight and width axes ---- */
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/assets/fonts/archivo-5.3.0-latin-wdth.woff2) format('woff2-variations'), url(/assets/fonts/archivo-5.3.0-latin-wdth.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/assets/fonts/archivo-5.3.0-latin-ext-wdth.woff2) format('woff2-variations'), url(/assets/fonts/archivo-5.3.0-latin-ext-wdth.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ps-utility-h: 37px;   /* utility bar: 3px gold rule + 33px row + 1px line; 0 on phones, where it is hidden */
  --ps-nav-h: 68px;       /* the nav row; the same height as the fixed nav it replaces, so page offsets still fit */
  --ps-chrome-max: 1360px; /* Home v2's chrome width */
}

/* ---- Wordmark: PLAYSPACEIQ, tracked capitals (the one place they are allowed), IQ in gold ---- */
.ps-wordmark {
  font-family: var(--ps-font); font-weight: 700; font-size: 18px; letter-spacing: 0.22em; line-height: 1; text-transform: uppercase;
  color: var(--ps-text-primary); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center;
}
.ps-wordmark:hover { color: var(--ps-text-primary); text-decoration: none; }
.ps-wordmark .ps-wordmark-iq { color: var(--ps-highlight); }

/* ---- Header: fixed, like the nav it replaces, so every page's own top spacing (body padding-top 68px, or a first
   section padded for the nav) still clears the nav row. The utility bar sits above it; the page moves down by the
   bar's height (the html padding below, set from the placeholder so nothing shifts when nav.js runs), and js/nav.js
   slides the header up by the first scroll, so the bar scrolls away and the nav row stays. ---- */
html:has(> body > #psiq-nav), html.ps-has-header {
  padding-top: var(--ps-utility-h);
  scroll-padding-top: calc(var(--ps-nav-h) + 12px);   /* #anchors land below the nav, not under it */
}
.ps-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; font-family: var(--ps-font);
  will-change: transform;
}
.ps-utility {
  height: var(--ps-utility-h); box-sizing: border-box; background: var(--ps-surface-1);
  border-top: 3px solid var(--ps-highlight-trim); border-bottom: 1px solid var(--ps-border);
}
.ps-utility-inner {
  max-width: var(--ps-chrome-max); height: 100%; margin: 0 auto; padding: 0 32px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; line-height: 1;
}
.ps-utility-links { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.ps-utility a { color: var(--ps-text-secondary); text-decoration: none; }
.ps-utility a:hover { color: var(--ps-accent); text-decoration: underline; }
.ps-utility a.ps-utility-signin { color: var(--ps-text-primary); font-weight: 600; }

.ps-header .ps-nav {
  position: relative; height: var(--ps-nav-h); box-sizing: border-box;
  background: var(--ps-surface-0); border-bottom: 1px solid var(--ps-border);
}
.ps-nav-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 100%; max-width: var(--ps-chrome-max); margin: 0 auto; padding: 0 32px; box-sizing: border-box;
}
.ps-nav-links { display: flex; align-items: center; gap: 32px; }
.ps-nav-links a { color: var(--ps-text-primary); text-decoration: none; font-size: 16px; font-weight: 600; white-space: nowrap; }
.ps-nav-links a:hover { color: var(--ps-accent); }
.ps-nav-links a[aria-current="page"] { color: var(--ps-accent); box-shadow: inset 0 -2px 0 var(--ps-accent); padding-bottom: 4px; }
.ps-nav-actions { display: flex; align-items: center; gap: 12px; }
/* The header's buttons (Join free, the menu's Join free) size from their border, as styles.css's global reset does.
   Without this, the pages that don't load styles.css drew Join free 70px tall (min-height 44 plus padding and border),
   a tall oval instead of the 44px pill (owner, 2026-11-08). docs/retheme/chrome-check.mjs measures it on every page. */
.ps-header .pbtn { box-sizing: border-box; }
/* Seven tabs (Requests, owner 2026-11-07): a little closer together on the narrowest desktop widths, so they keep one line */
@media (max-width: 1100px) { .ps-nav-links { gap: 24px; } }
.ps-nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px;
  background: none; border: none; cursor: pointer; padding: 10px; box-sizing: border-box;
}
.ps-nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ps-text-primary); border-radius: 2px; }
.ps-nav-mobile {
  display: none; flex-direction: column; padding: 8px 24px 20px; background: var(--ps-surface-0);
  border-bottom: 1px solid var(--ps-border); max-height: calc(100vh - var(--ps-nav-h)); overflow-y: auto; box-sizing: border-box;
}
.ps-nav-mobile.open { display: flex; }
.ps-nav-mobile a:not(.pbtn) {
  color: var(--ps-text-primary); text-decoration: none; font: inherit; font-size: 16px; font-weight: 600;
  padding: 12px 0; min-height: 44px; box-sizing: border-box; background: none; border: none; text-align: left; cursor: pointer;
}
.ps-nav-mobile .ps-nav-mobile-minor { font-weight: 500; color: var(--ps-text-secondary); font-size: 15px; }
.ps-nav-mobile hr { border: none; border-top: 1px solid var(--ps-border); margin: 8px 0; width: 100%; }
.ps-nav-mobile .pbtn { margin-top: 8px; }

/* signed-in: avatar menu (kept from the old nav, colours from tokens) */
.ps-nav .nav-avatar-wrap { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.ps-nav .nav-avatar-btn {
  width: 40px; height: 40px; border-radius: 50%; padding: 0; overflow: hidden; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  background: var(--ps-accent-bg); border: 1.5px solid var(--ps-border-accent);
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ps-accent-on-tint);
}
.ps-nav .nav-avatar-btn:hover { border-color: var(--ps-accent); }
.ps-nav .nav-avatar-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ps-nav .nav-avatar-btn svg { width: 22px; height: 22px; display: block; }
.ps-nav .av-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 240px; z-index: 9999; overflow: hidden; display: none;
  background: var(--ps-surface-0); border: 1px solid var(--ps-border); border-radius: var(--ps-radius); box-shadow: var(--ps-shadow-overlay);
}
.ps-nav .av-dropdown.open { display: block; }
.ps-nav .av-dd-header { padding: 14px 16px; border-bottom: 1px solid var(--ps-border); display: flex; align-items: center; gap: 12px; }
.ps-nav .av-dd-avatar-circle {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: var(--ps-accent-bg); border: 1.5px solid var(--ps-border-accent); font-size: 15px; font-weight: 700; color: var(--ps-accent-on-tint);
}
.ps-nav .av-dd-avatar-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-nav .av-dd-avatar-circle svg { width: 28px; height: 28px; display: block; }
.ps-nav .av-dd-info { min-width: 0; flex: 1; }
.ps-nav .av-dd-name { font-size: 14px; font-weight: 700; color: var(--ps-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-nav .av-dd-email { font-size: 12px; color: var(--ps-text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-nav .av-dd-items { padding: 6px 0; }
.ps-nav .av-dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; box-sizing: border-box;
  color: var(--ps-text-primary); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; text-align: left;
  background: none; border: none; cursor: pointer; line-height: 1.3;
}
.ps-nav .av-dd-item:hover { background: var(--ps-surface-1); color: var(--ps-text-primary); text-decoration: none; }
.ps-nav .av-dd-icon { width: 20px; text-align: center; flex-shrink: 0; line-height: 1; }
.ps-nav .av-dd-item.danger, .ps-nav .av-dd-item.danger:hover { color: var(--ps-danger); }
.ps-nav .av-dd-divider { height: 1px; background: var(--ps-border); margin: 4px 0; }
/* unread messages (046): a count on the Messages item, a dot on the avatar */
.ps-nav .av-dd-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: var(--ps-radius-pill); background: var(--ps-accent-fill); color: var(--ps-on-accent); font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.ps-nav .nav-avatar-btn { position: relative; overflow: visible; }
.ps-nav .nav-avatar-btn img { border-radius: 50%; }
.ps-nav .nav-unread-dot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--ps-accent-fill); border: 2px solid var(--ps-surface-0); }

/* The five links and Join free need about 850px; below that the menu button takes over. */
@media (max-width: 960px) {
  .ps-nav-links, .ps-nav .ps-nav-desktop-only { display: none !important; }
  .ps-nav-toggle { display: flex; }
}
@media (max-width: 768px) {
  :root { --ps-utility-h: 0px; }
  .ps-utility { display: none; }
  .ps-nav-inner, .ps-nav-mobile { padding-left: 20px; padding-right: 20px; }
}

/* ---- Footer: built by js/nav.js into #psiq-footer. Colours: --ps-footer-* in theme.css ---- */
.ps-footer {
  font-family: var(--ps-font); background: var(--ps-footer-bg); color: var(--ps-footer-text);
  border-top: 3px solid var(--ps-highlight-trim);
}
.ps-footer-inner {
  max-width: var(--ps-chrome-max); margin: 0 auto; padding: 56px 32px 40px; box-sizing: border-box;
  display: grid; grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 32px;
}
.ps-footer-brand { display: flex; flex-direction: column; gap: 12px; }
.ps-footer .ps-wordmark { font-size: 16px; color: var(--ps-footer-text); }
.ps-footer .ps-wordmark .ps-wordmark-iq { color: var(--ps-footer-wordmark-iq); }
.ps-footer-tagline { font-size: 14px; color: var(--ps-footer-text-secondary); margin: 0; }
.ps-footer nav { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.ps-footer-heading { font-weight: 700; margin: 0 0 2px; font-size: 14px; color: var(--ps-footer-text); }
.ps-footer nav a { color: var(--ps-footer-text-secondary); text-decoration: none; }
.ps-footer nav a:hover { color: var(--ps-footer-text); text-decoration: underline; }
.ps-footer-bottom {
  max-width: var(--ps-chrome-max); margin: 0 auto; padding: 0 32px 32px; box-sizing: border-box;
  font-size: 13px; color: var(--ps-footer-text-secondary);
}
@media (max-width: 900px) { .ps-footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ps-footer-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .ps-footer-inner { padding: 40px 20px 28px; gap: 28px 20px; } .ps-footer-bottom { padding: 0 20px 28px; } }

/* ---- Cards: white, outlined, no heavy shadow; an empty state gets the dashed edge ---- */
.ps-card {
  background: var(--ps-surface-0); border: 1px solid var(--ps-border); border-radius: var(--ps-radius-lg);
  padding: 20px; box-sizing: border-box; color: var(--ps-text-primary);
}
.ps-card-silver { background: var(--ps-surface-1); }
.ps-card-gold { background: var(--ps-highlight-wash); border-color: var(--ps-highlight-trim); }
.ps-card-empty { background: var(--ps-surface-0); border: 1.5px dashed var(--ps-border-dashed); }
a.ps-card, .ps-card-link { text-decoration: none; color: inherit; }
a.ps-card:hover, .ps-card-link:hover { border-color: var(--ps-border-interactive); }

/* ---- Chips: pill filters; selected = cobalt tint with the word, never colour alone ---- */
.ps-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 16px; box-sizing: border-box;
  border-radius: var(--ps-radius-pill); border: 1px solid var(--ps-border-interactive); background: var(--ps-surface-0);
  color: var(--ps-text-primary); font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
}
.ps-chip:hover { border-color: var(--ps-accent); color: var(--ps-accent); }
.ps-chip[aria-pressed="true"], .ps-chip.is-selected { background: var(--ps-accent-bg); border-color: var(--ps-border-accent); color: var(--ps-accent-on-tint); }
.ps-chip:focus-visible { outline: 2px solid var(--ps-accent); outline-offset: 2px; }
.ps-chip-add { border-style: dashed; color: var(--ps-text-secondary); }

/* ---- Status badges: icon + word, always (constitution §4) ---- */
.ps-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--ps-radius-pill);
  font-size: 13px; font-weight: 600; line-height: 1.2; border: 1px solid transparent; white-space: nowrap; vertical-align: middle;
}
.ps-badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.ps-badge-verified { color: var(--ps-status-verified); background: var(--ps-status-verified-bg); border-color: var(--ps-status-verified-border); }
.ps-badge-pending  { color: var(--ps-status-pending); background: var(--ps-status-pending-bg); border-color: var(--ps-status-pending-border); }
.ps-badge-pro      { color: var(--ps-highlight); background: var(--ps-highlight-bg); border-color: var(--ps-highlight-border); }
.ps-badge-beta     { color: var(--ps-accent-on-tint); background: var(--ps-accent-bg); border-color: var(--ps-border-accent); }
.ps-badge-neutral  { color: var(--ps-text-secondary); background: var(--ps-surface-1); border-color: var(--ps-border); }

/* ---- Text controls on phones: at least 16px (owner, 2026-11-16). iOS zooms the page on focus for any input, textarea
   or select under 16px, and leaves it zoomed. This is the sitewide floor, for touch screens and phone widths, and it
   is !important so a page's own smaller size can't undo it. The three controls the site sets larger on purpose (the
   jersey number boxes on Analysis, 22px and 24px, and the invite code on Teams, 18px) are left out so they keep their
   size. Pinch-zoom stays on: no page sets maximum-scale or user-scalable.
   docs/security/input-font-size-check.mjs reads every page. ---- */
@media (max-width: 768px), (pointer: coarse) {
  :is(input, textarea, select, [contenteditable]:not([contenteditable="false"])):not(.jersey-number-input, .invite-input-large) { font-size: 16px !important; }
}
