/* The three page shells (app/views/layouts): the merchant dashboard with its sidebar, the back
   office with its bar, and the focused page for one task (signing in, choosing an app,
   confirming a store). Under 52rem the dashboard is one column and its navigation opens from a
   button (menu_controller.js). */
@layer tokens, base, layout, components, screens;

@layer layout {
  .skip-link {
    position: absolute;
    inset-block-start: -6rem;
    inset-inline-start: var(--space-2);
    z-index: 10;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
  }

  .skip-link:focus {
    inset-block-start: var(--space-2);
    color: var(--paper);
  }

  main:focus {
    outline: none;
  }

  /* The merchant dashboard. */
  .shell {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr);
    min-height: 100dvh;
  }

  .shell__side {
    position: sticky;
    inset-block-start: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow-y: auto;
    border-inline-end: 1px solid var(--line);
    background: var(--surface);
  }

  .shell__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
  }

  .shell__menu-button {
    display: none;
  }

  .shell__main {
    width: 100%;
    max-width: 62rem;
    padding: var(--space-6) var(--gutter) var(--space-7);
  }

  @media (max-width: 52rem) {
    .shell {
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: auto 1fr;
    }

    .shell__side {
      position: static;
      height: auto;
      overflow: visible;
      border-inline-end: 0;
      border-block-end: 1px solid var(--line);
    }

    .shell__bar {
      padding: var(--space-3) var(--gutter);
    }

    .shell__menu-button {
      display: inline-flex;
    }

    .shell__main {
      padding-block-start: var(--space-5);
    }
  }

  /* The back office: a bar across the top in a colour of its own, and room for wide tables. */
  .staff__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-5);
    padding: var(--space-3) var(--gutter);
    border-block-end: 0.25rem solid var(--staff-edge);
    background: var(--staff);
    color: var(--staff-ink);

    /* What sits on the bar takes its colours from the bar. */
    --ink: var(--staff-ink);
    --ink-soft: var(--staff-ink);
    --accent: var(--staff-ink);
    --accent-strong: var(--staff-ink);
    --line-strong: var(--staff-ink);
    --surface: transparent;
    --focus: var(--staff-ink);
  }

  .staff__nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-inline-end: auto;
  }

  .staff__nav a[aria-current="page"] {
    font-weight: 700;
    text-decoration-thickness: 0.125rem;
  }

  .staff__main {
    max-width: 76rem;
    margin-inline: auto;
    padding: var(--space-6) var(--gutter) var(--space-7);
  }

  /* One task, nothing around it. */
  .focused {
    display: grid;
    grid-template-rows: auto 1fr auto;
    justify-items: center;
    gap: var(--space-5);
    min-height: 100dvh;
    padding: var(--space-6) var(--space-4);
  }

  .focused__main {
    align-self: start;
    width: 100%;
    max-width: 34rem;
  }

  .focused__main :is(input, select, textarea) {
    max-width: none;
  }

  .focused__foot {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    width: 100%;
    max-width: 34rem;
    color: var(--ink-soft);
    font-size: var(--text-sm);
  }
}
