/* Signed-in app shell: meadow background, side nav and fixed footer on
   desktop; top wordmark and bottom tab bar below 64rem. */
body:has(> .app-shell) { background-color: var(--color-meadow); }
.app-shell {
  --page-bg: var(--color-meadow);
  --app-sidebar-width: 15rem;
  --app-footer-height: 2.5rem;
  --app-tabs-height: 3.5rem;
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
  padding-bottom: calc(var(--app-tabs-height) + env(safe-area-inset-bottom));
}
.app-shell__decor {
  display: none;
  top: 0;
  right: 0;
  width: clamp(9rem, 18vw, 18rem);
  height: auto;
  opacity: .45;
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.app-main {
  position: relative;
  min-width: 0;
  padding-block: 1.5rem 2.5rem;
}
.app-disclosure {
  margin-top: 2rem;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.app-brand { display: block; }
.app-brand__wordmark { width: 9rem; height: auto; }

.app-topbar {
  position: relative;
  padding: 1rem 1.25rem 0;
}
.app-sidebar { display: none; }

/* Links, shared by the side nav and the More sheet */
.app-nav__group { margin-top: .75rem; }
.app-nav__heading {
  margin-bottom: .25rem;
  padding-bottom: .25rem;
  border-bottom: 2px solid var(--brand-ink);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand-ink);
}
.app-nav__link {
  display: block;
  width: 100%;
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--color-ink);
}
.app-nav__button { cursor: pointer; }
@media (hover: hover) {
  .app-nav__link:hover { background-color: var(--color-grey-green); }
}
.app-nav__link[aria-current] {
  background-color: var(--color-grey-green);
  font-weight: var(--font-weight-semibold);
  color: var(--color-cta);
}
.app-nav__actions {
  margin-top: 1rem;
  padding-top: .5rem;
  border-top: 1px solid var(--color-grey-green);
}

/* Phone tab bar and More sheet */
.app-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--app-tabs-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 2px solid var(--brand-ink);
  background-color: var(--color-paper);
}
.app-tabs__item {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--brand-ink);
}
.app-tabs__item[aria-current] {
  background-color: var(--color-grey-green);
  color: var(--color-cta);
}
.app-more {
  position: fixed;
  right: 0;
  bottom: calc(var(--app-tabs-height) + env(safe-area-inset-bottom));
  left: 0;
  z-index: 50;
  max-height: calc(100dvh - var(--app-tabs-height) - 3rem);
  overflow-y: auto;
  padding: .25rem 1.25rem 1.25rem;
  background-color: var(--color-paper);
  box-shadow: 0 -10px 25px -5px #19381f40;
}
.app-more__legal {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  margin-top: 1rem;
  font-size: var(--text-sm);
  text-decoration: underline;
  color: var(--color-text-muted);
}

.site-footer { display: none; }

@media (min-width: 64rem) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
    align-content: start;
    padding-bottom: var(--app-footer-height);
  }
  .app-shell__decor { display: block; }
  .app-topbar,
  .app-mobile-nav { display: none; }
  .app-sidebar {
    position: sticky;
    top: 0;
    display: block;
    height: calc(100vh - var(--app-footer-height));
    overflow-y: auto;
    padding: 1.25rem 1rem;
    background-color: var(--color-paper);
    box-shadow: 1px 0 2px #19381f1a;
    font-size: var(--brand-fs-sm);
  }
  /* The column beside the side nav is narrower than the viewport */
  .app-main.site-container {
    max-width: 80rem;
    padding: 2.5rem 2rem;
  }
  .site-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--app-footer-height);
    padding-inline: 1.25rem;
    background-color: var(--color-text-muted);
    font-size: var(--text-xs);
    color: var(--color-paper);
  }
  .site-footer__links { display: flex; gap: 1.25rem; }
  .site-footer__link {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .site-footer__link:hover { color: var(--color-highlight); }
}

/* Content paints over the decorative art */
.app-main > .site-main__content { position: relative; }

/* Feedback and Sign out stay in view however short the window is */
.app-sidebar .app-nav__actions {
  position: sticky;
  bottom: -1.25rem;
  padding-bottom: .5rem;
  background-color: var(--color-paper);
}
