/* chrome.css — the one header and footer for every public ScopeLock page.
 *
 * WHY THIS FILE EXISTS
 * The site used to render four different mastheads (the landing page's favicon
 * wordmark, /vs/<slug>'s checkmark box, the generated pages' h-masthead and the
 * policy shell's CSS-drawn square), three different menus and two different
 * footers, each styled by a different sheet at a different content width. A
 * reader moving from / to anything else saw the whole page furniture change
 * under them. This sheet is the single source for that furniture: every public
 * surface links it — index.html, the server-rendered shell routes, and every
 * page scripts/build-vs-pages.mjs writes — so the logo, the menu, the actions,
 * the footer and the content width can only be one thing.
 *
 * WHAT OWNS WHAT NOW
 * index.html and app.html get these same rules from home.css's copied base
 * layer, which tests/stylesheet-integrity.test.mjs pins byte-for-byte against
 * styles.css. This file repeats them rather than replacing those copies,
 * because app.html cannot load chrome.css without also dragging in rules it
 * must not receive. The pin test is what keeps the two copies honest; if you
 * change a rule here, change its pinned twin (or accept that /app has
 * deliberately kept its own look).
 *
 * WIDTHS
 * One measure everywhere: full-bleed bands, content padded to
 * max(var(--sl-gutter), calc((100% - var(--sl-max)) / 2)) — the model
 * brand.css already applies to the landing page's sections, extended here to
 * the footer, the policy shell and the generated pages' containers. 1312px of
 * content, 64px gutters, 20px under 620px.
 *
 * CSP-CLEAN like everything else: no inline styles anywhere; `style-src 'self'`
 * would drop them on the floor.
 */

/* The footer and header rules below read the old-site palette custom properties
 * (--ink, --paper, --steel, --rule, --lime). styles.css defines them for the app
 * surfaces and home.css re-declares them for the landing page; neither sheet is
 * linked by the generated pages or the guides, which load only brand.css — so
 * the subset those rules actually read is declared here. Same values as the two
 * existing declarations; a var() resolving to nothing drops the whole
 * declaration, which is how a footer loses its borders silently. */
:root {
  --ink: #102019;
  --paper: #f7f8f4;
  --steel: #526158;
  --rule: #d7ded7;
  --lime: #c7f45b;
}

/* Shared gutter behaviour. brand.css owns the desktop value (64px); the phone
 * step lives here because every public page loads this sheet, and the landing
 * page's own media override was the only place it existed before. */
@media (max-width: 620px) {
  :root {
    --sl-gutter: 20px;
  }
}

/* --------------------------------------------------------------- header -- */
/* Copied from home.css's base layer (and through it, styles.css). Keep the two
 * copies byte-identical — the header must not be the thing that drifts again. */
.site-header {
  position: relative;
  z-index: 5;
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -0.045em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 4px solid var(--ink);
  border-bottom-color: var(--lime);
  border-left-color: var(--lime);
}

.brand-mark span {
  width: 10px;
  height: 6px;
  border-bottom: 3px solid var(--ink);
  border-left: 3px solid var(--ink);
  transform: rotate(-45deg) translateY(-1px);
}

.site-header nav a,
.site-footer nav a,
.footer-bottom a {
  text-decoration: none;
}

/* The landing page's own overrides, verbatim from home.css. Every public page
 * renders the same header markup, so every public page gets the same header. */
.sl-header {
  width: 100%;
  margin-inline: 0;
  min-height: 0;
  padding-block: 14px;
  gap: 16px;
  background: var(--sl-paper);
  border-bottom: 1px solid var(--sl-rule);
  justify-content: space-between;
}

.sl-header .brand {
  gap: 10px;
  font: 800 20px/1 var(--sl-display-font);
  letter-spacing: -0.02em;
  color: var(--sl-ink);
}

.sl-brand-mark {
  display: block;
  width: 26px;
  height: 26px;
}

.sl-brand-tag {
  font: 500 10px/1 var(--sl-mono-font);
  letter-spacing: 0.14em;
  color: var(--sl-ink-4);
  border: 1px solid var(--sl-rule-strong);
  padding: 3px 5px;
}

.sl-header-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sl-header-nav a {
  color: var(--sl-ink-3);
  text-decoration: none;
  font: 500 14px/1 var(--sl-display-font);
  padding: 12px 10px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.sl-header-nav a:hover {
  color: var(--sl-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 779px) {
  .sl-header-nav {
    display: none;
  }
}

.sl-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Sign in stays the quiet action. Start free is the loud one.
 *
 * On the landing page and /app these two are <button>s carrying styles.css's
 * button classes; everywhere else server-rendered markup turns them into plain
 * anchors — there is no dialog on those documents to open — so the rules below
 * carry the inline-flex centring and the no-underline an anchor needs and a
 * button gets for free. */
.sl-header-signin {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sl-ink-3);
  font: 500 14px/1 var(--sl-display-font);
  padding: 12px 14px;
  min-height: 44px;
  text-decoration: none;
  cursor: pointer;
}

.sl-header-signin:hover {
  color: var(--sl-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.sl-header-cta {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: var(--sl-ink);
  color: var(--sl-paper);
  font: 700 14px/1 var(--sl-display-font);
  padding: 12px 16px;
  min-height: 44px;
  box-shadow: 3px 3px 0 var(--sl-yellow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-decoration: none;
  cursor: pointer;
}

.sl-header-cta:hover:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--sl-yellow);
}

/* Under 400px the brand mark, Sign in and Start free stop fitting on one line together.
 * Start free is the one that has to survive, so Sign in folds to a link-sized target and
 * the padding comes off both. */
@media (max-width: 400px) {
  .sl-brand-tag {
    display: none;
  }

  .sl-header-signin {
    padding-inline: 6px;
  }

  .sl-header-cta {
    padding-inline: 12px;
    box-shadow: 2px 2px 0 var(--sl-yellow);
  }
}

/* --------------------------------------------------------------- footer -- */
/* <scope-lock-footer> (site-footer.js) renders light-DOM markup shared by every
 * public page; these rules style it identically everywhere. Copied from
 * home.css's pinned base layer except where marked. */
.site-footer {
  /* The policy shell loads styles.css, whose six-selector group still boxes this
   * element at min(100% - 48px, 1248px); these two declarations retire that box
   * everywhere the sheet below is linked. */
  width: 100%;
  margin-inline: 0;
  display: grid;
  grid-template-columns: 1.15fr 0.65fr 1fr;
  gap: 56px;
  padding-block: 56px 30px;
  border-top: 1px solid var(--rule);
  /* CHANGED vs the home.css copy, deliberately: the old rule boxed the footer
   * at min(100% - 48px, 1248px) while the header above it sat on brand.css's
   * 1312px gutter model, so the footer's edges never lined up with anything.
   * Every container now shares the one formula — see WIDTHS at the top. */
  padding-inline: max(var(--sl-gutter), calc((100% - var(--sl-max)) / 2));
  /* The generated pages' sheets set Archivo on body; the landing page's footer
   * speaks Inter. One footer, one typeface: name it here rather than inherit. */
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.footer-brand p,
.footer-boundary p,
.footer-support p {
  max-width: 390px;
  margin: 16px 0 0;
  color: var(--steel);
  line-height: 1.6;
}

.footer-brand .footer-operator {
  font-size: 13px;
}

.site-footer nav {
  display: grid;
  align-content: start;
  gap: 10px;
}

.footer-links > div {
  display: grid;
  gap: 10px;
}

.site-footer nav strong,
.footer-boundary strong,
.footer-support strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.site-footer nav a {
  width: fit-content;
  color: var(--steel);
}

.site-footer nav a:hover,
.footer-bottom a:hover,
.footer-support a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-support p {
  margin-top: 10px;
}

.footer-support a {
  color: var(--ink);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.footer-boundary {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(150px, 0.35fr) minmax(0, 1.65fr);
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.footer-boundary p {
  max-width: 820px;
  margin-top: 0;
}

.footer-bottom {
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  color: var(--steel);
  font-size: 13px;
}

@media (max-width: 820px) {
  .site-footer {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-boundary,
  .footer-bottom {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .footer-boundary {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .brand {
    font-size: 20px;
  }

  .brand-mark {
    width: 27px;
    height: 27px;
  }

  .site-footer {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 40px;
  }

  .footer-brand,
  .footer-bottom {
    grid-column: auto;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 390px) {
  .brand {
    gap: 8px;
    font-size: 18px;
  }
}
