/* The site's base styles: resets and layout only. Every colour, font and component class (buttons, tiles, fields, tables, header,
   footer, tags, notices ...) comes from the theme's one stylesheet, static/css/tokens-<theme>.css, which the layouts link after this
   file (site/static/art/README-components.md lists the classes). This file adds what the component sheet does not draw: the page
   frame, the drop-down menus, the account menu, the phone Menu panel, the third menu row and the Light / System / Dark switch.
   It reads the theme's tokens only and writes no colour of its own. Author: Jeremiah Buttler */

/* Older token names, kept so pages written against them read the theme's values */
:root {
  --c-page: var(--page-bg);
  --c-band: var(--soft);
  --c-footer: var(--section-bg-footer);
  --c-ink: var(--ink);
  --c-action-hover: var(--accent-hover);
  --c-success: var(--ok);
  --c-error: var(--error);
  --shell-max: var(--container);
  --gap: var(--sp-4);
}

/* Resets */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; }
body > * { flex: none; }
body > .page-main { flex: 1 0 auto; }
html.theme-switching * { transition: none !important; }
img, svg { max-width: 100%; height: auto; }
.icon { height: 18px; }
button, input, select, textarea { font: inherit; }
h1:not(.display), h2:not(.display), h3:not(.display), h4:not(.display) { margin: 0 0 .5em; }
.tile .display + *, .form > .display { margin-top: 0; }
p { margin: 0 0 1em; }

/* The page frame: one container for the bars and the content; each place on its own tint */
.shell { width: min(100% - 2 * var(--side-gutter, 16px), var(--container, 1200px)); margin-inline: auto; }
.page-main { display: block; outline: none; min-height: 60vh; }
.page-body { padding-top: var(--sp-6); padding-bottom: var(--sp-9); }
.page-main-app .page-body { padding-top: var(--sp-3); padding-bottom: var(--sp-5); }
body[class*="band--"] { background: var(--band-bg, var(--page-bg)); }
.page-title { margin: 0 0 var(--sp-4); }
.page-purpose { margin: calc(-1 * var(--sp-2)) 0 var(--sp-5); max-width: 44em; }
.page-body > .tile + .tile, .page-body > .tile + form, .page-body > form + .tile, .page-body > .notice + .tile, .page-body > .error-summary + form { margin-top: var(--sp-5); }
.page-body > .error-summary, .page-body > .flashes { margin-bottom: var(--sp-5); }
.flashes .notice + .notice { margin-top: var(--sp-2); }
.narrow { max-width: 560px; }
.form > .actions { margin-top: 0; }

/* Header: the place tag and the door buttons beside the theme's header parts */
.site-hdr__in { flex-wrap: nowrap; min-width: 0; }
.site-hdr .logo { min-width: 0; }
.place-tag { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border: 2px solid var(--ink); font-family: var(--font-label); font-weight: var(--fw-label); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; color: var(--ink); white-space: nowrap; }
.place-tag.is-current { background: var(--ink); color: var(--on-ink); }
.btn-door { gap: 8px; }

/* Drop-downs (<details>): the disclosure pattern; menus.js closes them on Escape and outside clicks */
details.dd { position: relative; }
details.dd > summary, .menu-panel > summary { list-style: none; cursor: pointer; }
details.dd > summary::-webkit-details-marker, .menu-panel > summary::-webkit-details-marker { display: none; }
.site-nav details.dd > summary { display: flex; align-items: center; gap: 6px; min-height: 76px; border-bottom: var(--rule-band) solid transparent; margin-bottom: calc(-1 * var(--rule-band)); font-family: var(--font-label); font-weight: var(--fw-label); font-size: 15px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink); }
.site-nav details.dd > summary[aria-current], .site-nav details.dd > summary:hover, .site-nav details.dd[open] > summary { border-bottom-color: var(--accent); }
details.dd[open] > summary .icon { transform: rotate(180deg); }
.dd-list { position: absolute; top: 100%; left: 0; min-width: 240px; margin: 0; padding: var(--sp-2) 0; list-style: none; background: var(--tile-bg); border: 1px solid var(--tile-border); border-top: var(--rule-tile-top) solid var(--ink); box-shadow: var(--shadow-float); z-index: 60; }
.dd-right .dd-list { left: auto; right: 0; }
.dd-list li { margin: 0; }
.site-nav .dd .dd-list a, .dd-list a, .dd-list .link-btn { display: flex; align-items: center; width: 100%; min-height: 44px; margin: 0; padding: 0 var(--sp-4); border: 0; background: none; color: var(--ink); font-family: var(--font-text); font-weight: 400; font-size: 16px; letter-spacing: 0; text-transform: none; text-align: left; text-decoration: none; cursor: pointer; }
.site-nav .dd .dd-list a:hover, .dd-list a:hover, .dd-list .link-btn:hover { background: var(--soft); }
.site-nav .dd .dd-list a[aria-current="page"], .dd-list a[aria-current="page"] { font-weight: 600; box-shadow: inset 4px 0 0 var(--accent); }
.dd-note { padding: var(--sp-2) var(--sp-4); color: var(--muted); font-size: var(--fs-small); }
.dd-list form { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; }

/* The account menu */
.account-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); font-family: var(--font-label); font-weight: var(--fw-label); font-size: 14px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; background: var(--ink); color: var(--on-ink); font-family: var(--font-display); font-size: 18px; line-height: 1; }
.account-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Layer 2 (the theme's tab row) and layer 3 (the sub-menu): one row each, aligned with the container, scrolling sideways in its
   own box on a narrow screen, never wrapping and never scrolling the page */
.tab-row, .sub-row { padding-inline: max(var(--side-gutter), calc((100% - var(--container)) / 2)); scrollbar-width: thin; }
.sub-row { display: flex; gap: 2px; overflow-x: auto; background: var(--page-bg); border-bottom: 1px dashed var(--rule-strong); }
.sub-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--sp-3); font-size: var(--fs-small); color: var(--muted); text-decoration: none; white-space: nowrap; }
.sub-link[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* The phone Menu panel: drops down from the header; no side drawer, no bottom tab bar. Shown where the theme hides the main menu. */
.menu-panel { display: none; }
.menu-panel > .menu-btn { display: inline-flex; }
.menu-sheet { position: absolute; left: 0; right: 0; top: 100%; background: var(--tile-bg); border-bottom: var(--rule-band) solid var(--ink); box-shadow: var(--shadow-float); max-height: 75vh; overflow-y: auto; z-index: 70; }
.menu-sheet ul { list-style: none; margin: 0; padding: var(--sp-2) var(--side-gutter); }
.menu-sheet ul ul { padding: 0 0 var(--sp-2) var(--sp-4); }
.menu-sheet a { display: flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--ink); font-family: var(--font-label); font-weight: var(--fw-label); text-transform: uppercase; letter-spacing: .05em; font-size: 15px; border-bottom: 1px solid var(--rule); }
.menu-sheet ul ul a { text-transform: none; letter-spacing: 0; font-family: var(--font-text); font-weight: 400; }
.menu-sheet a[aria-current="page"] { color: var(--accent-ink); }

@media (max-width: 1100px) {
  .menu-panel { display: block; }
  .member-bar { display: none; }
  .account-name, .view-site { display: none; }
}
/* The staff and admin headers carry more items than the member header: from 900 px down the door button shows its icon only and the logo shows its mark only. */
@media (max-width: 900px) {
  .door-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .site-hdr__right .btn.btn-door { display: inline-flex; padding: 0 10px; }
  .site-hdr--work .logo__word { display: none; }
}
@media (max-width: 480px) {
  .site-hdr--work .site-hdr__right { gap: 4px; }
  .site-hdr--work .account-btn .icon { display: none; }
}
@media (max-width: 640px) {
  .door-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .site-hdr__right .btn.btn-door { display: inline-flex; padding: 0 10px; }
  .site-hdr--work .logo__word { display: none; }
  .menu-btn__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Footer: the registry's footer links in columns; the slim footer of the staff workspace and the admin console */
.site-foot__links ul { columns: 2 160px; column-gap: var(--gutter); }
.site-foot__links li { break-inside: avoid; }
body .site-foot { padding-bottom: calc(28px + var(--sp-8)); }
body .site-foot--slim { padding: var(--sp-4) 0 var(--sp-8); }
.site-foot--slim .site-foot__copy { margin-top: 0; border-top: 0; padding-top: 0; }

/* Forms: two fields side by side on a wide screen; a row of filters; small inline forms in tables */
.form-two { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
.field { align-content: start; }
@media (min-width: 640px) { .form-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: end; margin: 0 0 var(--sp-4); }
.filter-bar .field { min-width: 160px; flex: 1 1 200px; max-width: 360px; }
.filter-bar .actions { margin-top: 0; }
.inline-form { display: inline-flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin: 4px 0; }
.inline-form select, .inline-form input { width: auto; min-width: 90px; }
.switch-group { border: 0; padding: 0; margin: 0 0 var(--sp-4); min-width: 0; }
.switch-group legend { padding: 0; margin-bottom: var(--sp-2); }
.caps-warn { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-2); font-size: var(--fs-small); font-weight: 600; color: var(--error); }
.caps-warn[hidden] { display: none; }
.cards { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pager { display: flex; gap: var(--sp-3); align-items: center; margin: var(--sp-4) 0; flex-wrap: wrap; }

/* In-page view switcher (not a menu row) */
.view-switch { margin: 0 0 var(--sp-4); }
.view-switch [aria-current="page"] { background: var(--ink); color: var(--on-ink); }

/* Older class names, kept so pages written before the component sheet still take the theme's look. New pages use the sheet's
   names (btn--primary, tile tile--pad, display d2, label, lead, field__hint, form, table, notice). */
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-danger { background: var(--error); border-color: var(--error); color: var(--on-accent); }
.tile-ruled, .tile.stack { padding: var(--sp-5); }
.eyebrow { font-family: var(--font-label); font-weight: var(--fw-label); font-size: var(--fs-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--accent-ink); margin: 0 0 var(--sp-2); }
.lede { font-size: var(--fs-lead); line-height: var(--lh-lead); max-width: 44em; }
.help { font-size: var(--fs-small); color: var(--muted); }
.section-title { font-family: var(--font-label); font-weight: var(--fw-label); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.form-grid { display: grid; gap: var(--sp-5); max-width: 760px; }
.empty-state { color: var(--muted); }
.coming-soon-mark { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 2px solid var(--ink); font-family: var(--font-display); font-size: 18px; text-transform: uppercase; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; font-family: var(--font-label); font-weight: var(--fw-label); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: var(--rule-row) solid var(--ink); }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }

/* The Light / System / Dark switch (standing-rules reference), fixed bottom-right; the assistant button keeps the corner (--ts-lift) */
:root { --ts-action: var(--accent); --ts-on-action: var(--on-accent); --ts-surface: var(--tile-bg); --ts-line: var(--tile-border);
  --ts-muted: var(--muted); --ts-ink: var(--text); --ts-wash: rgba(20, 20, 20, .06); --ts-focus: var(--focus); }
:root[data-theme="dark"] { --ts-wash: rgba(255, 255, 255, .08); }
.theme-switch { --ts-size: 32px; display: inline-flex; align-items: center; gap: 2px; flex: none; padding: 3px; border: 1px solid var(--ts-line); border-radius: 999px; background: var(--ts-surface); }
.theme-opt { appearance: none; -webkit-appearance: none; display: inline-grid; place-items: center; width: var(--ts-size); height: var(--ts-size); margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ts-muted); cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.theme-opt .i, .theme-opt svg { display: block; width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.theme-opt:hover { background: var(--ts-wash); color: var(--ts-ink); }
.theme-opt[aria-checked="true"] { background: var(--ts-action); color: var(--ts-on-action); }
.theme-opt:focus-visible { outline: 2px solid var(--ts-focus); outline-offset: 2px; }
.theme-opt[aria-checked="true"]:focus-visible { outline-offset: 3px; box-shadow: 0 0 0 2px var(--ts-surface); }
@media (pointer: coarse) { .theme-switch { --ts-size: 44px; } }
.theme-float { position: fixed; z-index: 90; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + var(--ts-lift, 0px)); margin: 0; }
.theme-float .theme-switch { box-shadow: var(--shadow-float); }
html:not(.theme-js) .theme-switch { display: none; }
@media print { .theme-switch, .theme-float, .site-hdr, .soon-bar, .member-bar, .tab-row, .sub-row, .site-foot { display: none; } }
@media (forced-colors: active) { .theme-opt[aria-checked="true"] { outline: 2px solid Highlight; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* The header's items never break onto two lines; the gap tightens before anything wraps. */
.site-hdr .site-nav a, .site-hdr .site-nav details.dd > summary, .site-hdr .site-hdr__right > * { white-space: nowrap; }
.site-hdr .site-nav { gap: 20px; }
@media (max-width: 1320px) { .site-hdr .site-nav { gap: 14px; } .site-hdr .site-nav a, .site-hdr .site-nav details.dd > summary { font-size: 14px; } }
/* The logo never shrinks under the menu. The public header has six menu items and three right-hand items, so it changes
   to the Menu button a little earlier than the theme's own 1100 px, before anything can overlap. */
.site-hdr .logo { flex: none; }
@media (max-width: 1240px) {
  .site-hdr .site-nav { display: none; }
  .site-hdr .menu-panel { display: block; }
  .site-hdr .menu-btn { display: inline-flex; }
}
