/* ---------------------------------------------------------------------------
   Application shell: global identity, global navigation, current context, and
   the workspace frame. Identical on every page regardless of which tool is
   open, so a new tool inherits orientation without touching this file.
   --------------------------------------------------------------------------- */

.shell-width { max-width: var(--shell-max); margin: 0 auto; padding-inline: var(--s-6); }

/* --- Global bar ---------------------------------------------------------- */
.app-bar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bar);
  border-bottom: 1px solid var(--bar-line);
}
.app-bar__inner {
  display: flex; align-items: center; gap: var(--s-6);
  height: var(--header-h);
}

.brand { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--bar-text); flex: none; }
.brand:hover { text-decoration: none; }
.brand__mark { display: block; flex: none; color: var(--accent-on-dark); }
.brand__name {
  font-size: var(--text-md); font-weight: 600; letter-spacing: -0.015em; line-height: 1;
}
.brand__name span { font-weight: 400; color: var(--bar-muted); }

.app-nav { margin-left: auto; }
.app-nav__list { display: flex; align-items: center; gap: var(--s-1); list-style: none; margin: 0; padding: 0; }
.app-nav__link {
  display: block; padding: var(--s-2) var(--s-3);
  font-size: var(--text-sm); font-weight: 500; color: var(--bar-muted);
  border-radius: var(--radius-sm); transition: color 120ms ease, background-color 120ms ease;
}
.app-nav__link:hover { color: var(--bar-text); background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.app-nav__link[aria-current="page"] { color: var(--bar-text); font-weight: 600; }

/* The default focus ring is the accent, which has too little contrast against
   the dark bar to be a reliable indicator. */
.app-bar :focus-visible { outline-color: var(--accent-on-dark); }

.nav-toggle { display: none; }

/* --- Context bar: where am I ---------------------------------------------- */
.context-bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.crumbs li + li::before { color: var(--faint); }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2);
  list-style: none; margin: 0; padding: var(--s-3) 0; font-size: var(--text-sm); }
.crumbs li { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); }
.crumbs li + li::before { content: "/"; color: var(--faint); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current="page"] { color: var(--ink); font-weight: 500; }

/* --- Page + tool headers -------------------------------------------------- */
.page-head { padding: var(--s-8) 0 var(--s-6); }
.page-head__title { font-size: var(--text-3xl); letter-spacing: -0.022em; }
.page-head .lede { margin-top: var(--s-3); }

.tool-head { padding: var(--s-7) 0 var(--s-6); border-bottom: 1px solid var(--line); background: var(--surface); }
.tool-head__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap; }
.tool-head__title { font-size: var(--text-2xl); letter-spacing: -0.02em; }
.tool-head__desc { margin-top: var(--s-3); max-width: 64ch; color: var(--ink-2); font-size: var(--text-md); }
.tool-head__meta { display: flex; gap: var(--s-5); font-size: var(--text-sm); color: var(--muted); }

main { display: block; }
.page { padding-bottom: var(--s-10); }

/* --- Footer --------------------------------------------------------------- */
.app-foot { background: var(--bar); margin-top: var(--s-9); }
.app-foot__inner { display: flex; flex-wrap: wrap; gap: var(--s-6); justify-content: space-between;
  padding-block: var(--s-7); font-size: var(--text-sm); color: var(--bar-muted); }
.app-foot__links { display: flex; gap: var(--s-5); list-style: none; margin: 0; padding: 0; }
.app-foot a { color: var(--bar-muted); }
.app-foot a:hover { color: var(--bar-text); }
.app-foot :focus-visible { outline-color: var(--accent-on-dark); }

/* --- Mobile --------------------------------------------------------------- */
@media (max-width: 720px) {
  .shell-width { padding-inline: var(--s-4); }

  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    margin-left: auto; padding: var(--s-2) var(--s-3);
    background: none; border: 1px solid var(--bar-line); border-radius: var(--radius);
    font: 500 var(--text-sm)/1 var(--font-sans); color: var(--bar-text); cursor: pointer;
  }
  .nav-toggle:focus-visible { outline-color: var(--accent-on-dark); }
  .app-nav {
    display: none; margin-left: 0;
    position: absolute; left: 0; right: 0; top: var(--header-h);
    background: var(--bar); border-bottom: 1px solid var(--bar-line);
    padding: var(--s-2) var(--s-4) var(--s-4);
  }
  .app-nav[data-open="true"] { display: block; }
  .app-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .app-nav__link { padding: var(--s-3) var(--s-2); font-size: var(--text-md); border-radius: var(--radius); }
  .app-nav__list li + li { border-top: 1px solid var(--bar-line); }

  .page-head { padding: var(--s-6) 0 var(--s-5); }
  .page-head__title { font-size: var(--text-2xl); }
  .tool-head { padding: var(--s-5) 0; }
  .tool-head__row { gap: var(--s-3); }
  .app-foot__inner { flex-direction: column; gap: var(--s-4); }
}
