/* layout.css — app shell: header, nav, main column, footer. */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.app-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark { color: var(--accent); }

.app-header__tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.nav {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: var(--sp-1);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav__link {
  padding: var(--sp-2) var(--sp-3);
  font-size: .9375rem;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--r-md);
}
.nav__link:hover { background: var(--paper-3); color: var(--ink); }
.nav__link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
}
/*
 * The skip link sends focus here. Showing a ring on :focus-visible only means
 * it appears for the keyboard users who need it and stays out of the way of
 * the programmatic focus moves the router makes. Suppressing it outright, as
 * this rule used to, left skip-link users with no idea where they had landed.
 */
.app-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--r-md);
}

.app-footer {
  padding: var(--sp-4);
  font-size: .8125rem;
  color: var(--ink-faint);
  text-align: center;
  border-top: 1px solid var(--line);
}
.app-footer p { margin: 0; }
.app-footer__sep { margin: 0 var(--sp-2); }

/* Shared in-view scaffolding */

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.view-head__text { flex: 1 1 20ch; min-width: 0; }
.view-head__text p { margin: 0; color: var(--ink-soft); }
.view-head__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.stack     { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--sm { gap: var(--sp-2); }
.row       { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

.grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (max-width: 700px) {
  .app-header__inner {
    flex-wrap: wrap;
    padding: var(--sp-3);
  }
  .nav { order: 3; width: 100%; }
  .app-main { padding: var(--sp-4) var(--sp-3) var(--sp-6); }
}
