/* App shell layout: header on top; tabs at the bottom on a phone and down
   the left side on a laptop (docs/Specification.md, "How the app functions"). */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    'header'
    'main'
    'tabs';
}

.loading {
  padding: 24px 16px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--panel);
  border: var(--line) solid var(--edge);
  border-radius: var(--radius);
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: var(--line) solid var(--edge);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-size: 1.7rem;
  text-decoration: none;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

.screen-area {
  grid-area: main;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.screen-area:focus {
  outline: none;
}

.screen-header {
  margin-bottom: 20px;
}

.screen-intro {
  margin: 0;
  color: var(--ink-muted);
  font-size: 1.125rem;
}

/* Phone: a fixed bar of four equal tabs at the bottom. */
.tabs {
  grid-area: tabs;
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: var(--line) solid var(--edge);
  background: var(--paper);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 60px;
  padding: 6px 4px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink-muted);
}

.tab[aria-current='page'] {
  color: var(--highlight-ink);
  background: var(--highlight);
}

/* Laptop and tablet: the tabs move to a rail on the left. */
@media (min-width: 768px) {
  .app {
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      'header header'
      'tabs main';
  }

  .tabs {
    position: sticky;
    top: 70px;
    align-self: start;
    grid-template-columns: 1fr;
    gap: 8px;
    border-top: 0;
    padding: 24px 12px;
  }

  .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    font-size: 1.05rem;
    border: var(--line) solid transparent;
    border-radius: var(--radius);
  }

  .tab[aria-current='page'] {
    border-color: var(--edge);
    box-shadow: var(--shadow);
  }

  .screen-area {
    padding: 32px 32px 48px;
  }
}
