/* ============================================================
 * imjustdex.com — shell.css
 * Page chrome: skip link, rulers, page shell, masthead,
 * brand block, mode toggle, footer strip, focus states,
 * sr-only utility.
 *
 * Loaded on every page, after tokens.css.
 * No component-specific rules live here — only the frame
 * around the content.
 * ============================================================ */

/* ── Skip link ─────────────────────────────────────────────── */

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: var(--space-sm) var(--space-chrome);
  z-index: 999;
}

.skip-link:focus {
  left: var(--space-sm);
  top: var(--space-sm);
}

/* ── Page shell ────────────────────────────────────────────── */

.page-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-sm) var(--outer-pad) var(--space-lg);
  padding-left: max(var(--outer-pad), env(safe-area-inset-left));
  padding-right: max(var(--outer-pad), env(safe-area-inset-right));
  position: relative;
}

main {
  position: relative;
  z-index: 2;
}

/* ── Rulers ────────────────────────────────────────────────── */

.ruler-top,
.ruler-left {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  opacity: .75;
}

.ruler-top {
  top: 0;
  left: 0;
  right: 0;
  height: 22px;
  border-bottom: 1px solid var(--rule);
  background: repeating-linear-gradient(
    to right,
    transparent 0 44px,
    var(--rule) 44px 45px
  );
}

.ruler-left {
  top: 0;
  left: 0;
  bottom: 0;
  width: 22px;
  border-right: 1px solid var(--rule);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 44px,
    var(--rule) 44px 45px
  );
}

/* ── Masthead / Nav ────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--space-chrome);
  padding: var(--space-sm) 0 var(--space-chrome);
  padding-top: max(var(--space-sm), env(safe-area-inset-top));
  background: linear-gradient(to bottom, var(--bg) 70%, rgba(0, 0, 0, 0));
  margin-top: var(--space-xs);
}

/* ── Brand block ───────────────────────────────────────────── */

.brand-block {
  display: inline-flex;
  align-items: stretch;
  border: var(--border-weight-chrome) solid var(--border);
  background: var(--panel);
}

.brand-mark,
.brand-word {
  /* Phase 6 exception — 7px bottom = 1px optical pull up from
     --space-xs (8px), centering uppercase chrome inside the badge. */
  padding: var(--space-xs) var(--space-sm) 7px;
  /* Phase 5 exception — line-height: 1 is tuned for the brand
     block's tight badge proportions; not part of the --lh-* ladder. */
  line-height: 1;
  letter-spacing: var(--track-brand);
  text-transform: uppercase;
  font-weight: var(--weight-bold);
  border-right: var(--border-weight-chrome) solid var(--border);
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: var(--space-xs) var(--space-sm);
}

.brand-logo {
  height: 28px;
  width: auto;
}

.brand-word {
  font-size: var(--text-chrome);
  align-content: center;
  background: var(--ink);
  color: var(--bg);
}

.brand-block .brand-word:last-child {
  border-right: 0;
}

/* ── Mode toggle ───────────────────────────────────────────── */

.mode-toggle {
  margin-left: auto;
  appearance: none;
  border: var(--border-weight-chrome) solid var(--border);
  background: var(--panel);
  color: var(--ink);
  /* Phase 6 exception — 13px bottom = 1px optical pull up from
     --space-chrome (14px), centering uppercase chrome on the button. */
  padding: var(--space-chrome) var(--space-md) 13px;
  text-transform: uppercase;
  font: inherit;
  font-size: var(--text-nav);
  font-weight: var(--weight-bold);
  letter-spacing: var(--track-nav);
  cursor: pointer;
  min-height: 44px;
  transition: border-color var(--motion-fast) var(--ease-default), background var(--motion-fast) var(--ease-default);
}

/* ── Hover accents ─────────────────────────────────────────── */

.footer-strip a:hover,
.mode-toggle:hover,
.brand-block:hover {
  filter: invert(.02);
}

/* ── Footer strip ──────────────────────────────────────────── */

.footer-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  position: relative;
  z-index: 2;
}

.footer-strip > * {
  border: var(--border-weight-chrome) solid var(--border);
  background: var(--panel);
  /* Phase 6 exception — 11px bottom = 1px optical pull up from
     --space-sm (12px), centering uppercase chrome on the strip. */
  padding: var(--space-sm) var(--space-chrome) 11px;
  text-transform: uppercase;
  letter-spacing: var(--track-footer);
  font-size: var(--text-nav);
  font-weight: var(--weight-bold);
  min-height: 44px;
}

/* Footer link group — multiple links in the left cell, separated
   by a middot. The group inherits the cell's border + padding;
   individual links inside it are inline, unstyled. */
.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer-sep {
  color: var(--body-muted);
  font-size: var(--text-micro);
  user-select: none;
}

/* ── Focus states (chrome elements) ────────────────────────── */

.mode-toggle:focus-visible,
.brand-block:focus-visible,
.footer-strip a:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: 2px; /* focus-ring geometry, scope-excluded from --space-* */
}

/* ── sr-only utility ───────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 760px) {
  :root {
    --outer-pad: 18px; /* layout primitive, scope-excluded */
  }

  .page-shell {
    padding-top: var(--space-sm);
  }

  .masthead {
    flex-wrap: wrap;
    gap: var(--space-sm);
    background: var(--bg);
  }

  .footer-strip {
    grid-template-columns: 1fr;
  }

  .ruler-top,
  .ruler-left {
    display: none;
  }
}
