/* The shell's stylesheet, and the look it lends modules, on brand.css's values and fonts, which the
   page loads first. A module renders into the shell's page, so three things here reach it without being
   passed: plain elements come styled; the custom properties
   below are its to read, and to set within its own root element; and three layout classes,
   fw-stack, fw-row and fw-grid, are its to use, as is fw-primary for a page's main button. The rest
   (fw- classes not named here) is the shell's own, and may change. Services share a look without
   sharing a component library, which would tie them to one framework. */
:root {
  /* The brand's values (colours, type, spacing, radii, sizes, focus) are in brand.css, loaded first.
     These are the shell's own: a dialog's shadow, and the layout classes' defaults, the gap between
     children, and fw-grid's narrowest column. */
  --fw-shadow: 0 4px 24px rgba(0, 0, 0, .3);
  --fw-gap: var(--fw-space-3);
  --fw-column: 16rem;
}

body { margin: 0; font: var(--fw-font); color: var(--fw-text); background: var(--fw-background); }
#featurewise { max-width: 60rem; margin: 0 auto; padding: 3.5rem 1.5rem 2rem; }
/* In a frame, the page around it gives the margins and the background, and there's no pill to clear. */
.fw-framed body { background: transparent; }
.fw-framed #featurewise { max-width: none; margin: 0; padding: 0 0 var(--fw-space-2); }

/* Plain elements. Each rule is wrapped in :where(), so any class, or any rule of a module's, outranks it. */
:where(h1, h2) { font-family: var(--fw-font-heading); font-weight: 700; color: var(--fw-brand); }
:where(h1) { font-size: var(--fw-size-h1); line-height: 1.2; margin: 0 0 var(--fw-space-1); }
:where(h2) { font-size: var(--fw-size-h2); margin: 0; }
:where(a) { color: var(--fw-accent); }
:where(button) { font: inherit; color: var(--fw-text); background: var(--fw-surface); border: 1px solid var(--fw-border);
                 border-radius: var(--fw-radius-small); padding: var(--fw-space-1) var(--fw-space-4); cursor: pointer; }
:where(button:hover) { background: var(--fw-hover); }
:where(button:disabled) { opacity: .5; cursor: default; }
:where(input, textarea, select) { font: inherit; color: var(--fw-text); background: var(--fw-surface);
                                  border: 1px solid var(--fw-border); border-radius: var(--fw-radius-small);
                                  padding: var(--fw-space-1) var(--fw-space-2); }
:where(button, input, textarea, select, a):focus-visible { outline: none; box-shadow: var(--fw-focus); }
/* A label holding a field puts its text above it; one holding a checkbox or a radio button leaves it inline. */
:where(label:has(> input:not([type=checkbox], [type=radio]), > textarea, > select)) { display: grid; gap: var(--fw-space-1); }
:where(table) { width: 100%; border-collapse: collapse; background: var(--fw-surface); border-radius: var(--fw-radius); overflow: hidden; }
:where(th, td) { text-align: left; vertical-align: top; padding: var(--fw-space-2) var(--fw-space-4); border-bottom: 1px solid var(--fw-border); }
:where(th) { color: var(--fw-muted); font-weight: 500; font-size: var(--fw-size-small); }

/* A page's main button. */
.fw-primary { color: var(--fw-on-accent); background: var(--fw-accent); border-color: var(--fw-accent); }
.fw-primary:hover { background: var(--fw-accent); filter: brightness(1.1); }

/* Layout, without breakpoints, so a module fits the space it's given, whether a page or a panel embedded
   in another. fw-stack puts its children one above another; fw-row puts them side by side, wrapping when
   they run out of room; fw-grid makes as many equal columns as fit, each at least --fw-column wide. */
.fw-stack { display: flex; flex-direction: column; gap: var(--fw-gap); }
.fw-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fw-gap); }
.fw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--fw-column), 100%), 1fr)); gap: var(--fw-gap); }

/* Where services.json lists demos, the shell is their site: a bar across the top, with the site's title and
   a link to each demo, and each demo's text in a sidebar on the left of its pages. Below 52rem the
   sidebar goes under the page, so the demo itself comes first. The bar leaves room for the pill. */
.fw-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fw-space-2) var(--fw-space-5);
          padding: var(--fw-space-3) 12rem var(--fw-space-3) var(--fw-space-5);
          background: var(--fw-surface); border-bottom: 1px solid var(--fw-border); }
.fw-bar-title { display: inline-flex; align-items: center; gap: var(--fw-space-2); font-family: var(--fw-font-heading);
                font-weight: 700; font-size: var(--fw-size-h2); color: var(--fw-text); text-decoration: none; }
.fw-bar-title img { height: 1.75rem; width: 1.75rem; }
.fw-bar nav { display: flex; flex-wrap: wrap; gap: var(--fw-space-4); }
.fw-bar nav a { color: var(--fw-muted); text-decoration: none; }
.fw-bar nav a:hover, .fw-bar nav a[aria-current] { color: var(--fw-text); }
.fw-bar nav a[aria-current] { text-decoration: underline; text-decoration-color: var(--fw-accent);
                              text-decoration-thickness: 2px; text-underline-offset: .45em; }
.fw-site { display: grid; grid-template-columns: 20rem minmax(0, 1fr); gap: var(--fw-space-5) 2.5rem; align-items: start;
           max-width: 82rem; margin: 0 auto; padding: 2rem var(--fw-space-5); }
.fw-site > #featurewise { max-width: none; margin: 0; padding: 0; min-width: 0; }
.fw-site > .fw-demo[hidden] + #featurewise { grid-column: 1 / -1; }
.fw-site > .fw-demo { max-width: none; margin: 0; padding: 0 0 0 0; position: sticky; top: 2rem;
                      max-height: calc(100vh - 4rem); overflow-y: auto; font-size: var(--fw-size-small); }
.fw-site > .fw-demo .fw-demo-title { font-size: var(--fw-size-h2); }
@media (max-width: 52rem) {
  .fw-bar { padding-right: var(--fw-space-5); padding-top: 3.5rem; }
  .fw-site { grid-template-columns: minmax(0, 1fr); }
  .fw-site > .fw-demo { position: static; max-height: none; order: 1; border-top: 1px solid var(--fw-border);
                        padding-top: var(--fw-space-5); }
}
/* Who the visitor is, and plain or dressed: a row of buttons each, with the one chosen filled in. */
.fw-demo-choice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fw-space-2); color: var(--fw-muted); }
.fw-demo-choice + .fw-demo-choice { margin-top: var(--fw-space-2); }
.fw-demo-choice > span { min-width: 2.75rem; }
.fw-demo-choice button { border-radius: 999px; padding: .1rem .8rem; }
.fw-demo-choice button[aria-pressed=true] { color: var(--fw-on-accent); background: var(--fw-accent); border-color: var(--fw-accent); cursor: default; }
.fw-home-card { background: var(--fw-surface); border: 1px solid var(--fw-border); border-radius: var(--fw-radius);
                padding: var(--fw-space-4); }
.fw-home-card p { margin: var(--fw-space-2) 0 0; }
.fw-home-card .fw-home-chapter { color: var(--fw-muted); margin-top: 0; }
.fw-home-card h2 a { text-decoration: none; }

/* A demo's text, its personas, its view and its reset. */
.fw-demo { max-width: 60rem; margin: 0 auto; padding: 3.5rem 1.5rem 0; }
.fw-demo[hidden] { display: none; }
:not(.fw-site) > .fw-demo:not([hidden]) + #featurewise { padding-top: 1rem; }
.fw-demo-title { font-size: 1.1rem; }
.fw-demo-title strong { font-family: var(--fw-font-heading); color: var(--fw-brand); }
.fw-demo-chapter { display: block; color: var(--fw-muted); font-size: var(--fw-size-small); }
.fw-demo-about { margin: .25rem 0 .5rem; }
.fw-demo-fold { margin: .25rem 0; }
.fw-demo-fold summary { cursor: pointer; color: var(--fw-muted); }
.fw-demo-fold p, .fw-demo-fold ol { margin: .25rem 0 .5rem 1.1rem; }
.fw-demo-fold ol { padding-left: 1.1rem; }
.fw-demo-controls { margin: var(--fw-space-3) 0; padding-bottom: var(--fw-space-3); border-bottom: 1px solid var(--fw-border); }
.fw-persona-name { font: inherit; color: var(--fw-accent); background: none; border: none; padding: 0; cursor: pointer;
                   text-decoration: underline dotted; text-underline-offset: .2em; }
.fw-persona-name:disabled { opacity: 1; color: inherit; text-decoration: none; cursor: default; font-weight: 600; }
.fw-demo-reset { font: inherit; color: var(--fw-muted); background: none; border: 1px solid var(--fw-border); border-radius: 999px;
                 padding: .2rem .8rem; cursor: pointer; display: block; margin-top: var(--fw-space-3); }
.fw-demo-reset:hover { background: var(--fw-hover); }

.fw-generic ul { list-style: none; margin: 0; padding-left: 1.25rem; border-left: 1px solid var(--fw-border); }
.fw-punct { color: var(--fw-muted); }
.fw-feature { font-size: 1.05rem; margin-bottom: .25rem; }
.fw-feature-service { color: var(--fw-muted); }
.fw-key { color: var(--fw-muted); }
.fw-null { color: var(--fw-muted); font-style: italic; }
/* A link's value: a small button on the line, after its property's name. */
.fw-link { font-size: .85em; line-height: 1.3; color: var(--fw-accent); background: none;
           border-color: var(--fw-accent); padding: 0 .45rem; vertical-align: baseline; }
.fw-link:hover { background: var(--fw-hover); }

.fw-link-dialog { border: none; border-radius: var(--fw-radius); padding: var(--fw-space-4) 1.25rem; min-width: min(36rem, 90vw);
                  box-shadow: var(--fw-shadow); }
.fw-link-dialog h2 { font-size: 1rem; margin: 0 0 .75rem; }
.fw-link-dialog textarea { width: 100%; box-sizing: border-box; font: 13px/1.4 ui-monospace, monospace; }
.fw-actions { display: flex; justify-content: flex-end; gap: var(--fw-space-2); margin-top: var(--fw-space-3); }
.fw-error { color: var(--fw-error); min-height: 1.5em; margin: .25rem 0 0; }

.fw-toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex;
             flex-direction: column; gap: .5rem; z-index: 1001; }
.fw-toast { background: var(--fw-text); color: var(--fw-surface); padding: .5rem 1rem; border-radius: 6px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }

.fw-services table { width: auto; }
.fw-message { color: var(--fw-muted); }
