/* MARK: LAYOUT
*/
:where(
  html,
  body,
  app-container,
  main,
  article,
  section
) {
  overflow: hidden; /*
  - Ancestoral path from scrollable element to root enables closest context scrolling
  - Full Bleed layouts maximize possibilities
  - Disables horizontal scrolling (enforces accessible wrapping)
  - Eliminates most unknown variables
  - Semanticly meaningful HTML elements only */

  position: relative;
}

:where(
  app-container,
  header,
  nav,
  main,
  article,
  section,
  li,
  form,
  legend,
  footer
) {
  display: grid; /*
  - Grid level elements are listed in DOM order
  - Implicit grid columns/rows are added/removed auto-magically when dynamic data elements are added/removed 
  - Custom HTML elements allow for semantic meaning and selector grouping without adding markup
  - Custom HTML elements may be expanded into registered web-components */
}

:where(
  app-banner,
  aside
  ) {
    display: none; /*
  - Hidden until they have content */

  &:not(:empty) {
    display: grid;
  }
}

:where(
  app-banner,
  header,
  nav,
  main,
  aside,
  footer
) {
  border-radius: 0.3rem;
  margin-inline: 1rem;
}

:where(
  app-container,
  main,
  article,
  section,
  ul
) {
  grid-auto-flow: row;
}

:where(
  app-logo,
  user-name,
  h1,
  h2,
  p,
  li,
  powered-by,
  app-version
) {
  padding: 1rem; /*
  - Data elements/containers only - such as <h1>, <p>, <label>, <input>, etc.
  - Not for layout containers - such as <html>, <body>, <header>, <main>, etc.
  - Allows browsers intrinsic control over data level elements
  - Works well with implicit and responsive grid layouts
  - Less complex and easier to maintain with dynamic content
*/
}

app-container {
  grid-auto-flow: row;
  container-type: inline-size;
  container-name: app-container;
  gap: 1rem;
  height: 100dvh;
}

header,
footer {
  grid-auto-flow: column;
  justify-content: space-between;
  user-select: none;
}

app-banner {
  grid-auto-flow: column;
  justify-content: center;
  user-select: none;
  color: color-mix(in srgb, currentColor var(--45), transparent);
  font-size: 75%;

  &:first-of-type {
    margin-block-start: 1rem;
  }

  &:not(:first-of-type) {
    margin-block-end: 1rem;
  }
}

nav {
  grid-auto-flow: column;
  justify-content: end;
  user-select: none;

  [role="button"] {
    padding-inline: 1rem;
    padding-block: 0.5rem;
  }
}

article {
  grid-auto-flow: row;
  align-content: start;
}

summary { cursor: pointer; padding: .5rem 1rem; }

header ul {
  list-style: none; padding: 0; margin: 0; 
}

header li { margin-block: .25rem; }
header li {
  padding-inline: 1rem;
  padding-block: 0.5rem;
}

article {
  overflow-y: auto;
}
