/* Home page. Every colour, space, radius, stroke and face is a token from
   design-system/tokens.css; the rail width and column measure are layout. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Form controls do not inherit the face on their own. */
button,
input,
textarea {
  font-family: inherit;
}

/* One screen: the bar, then the rail beside the pane. The rail scrolls on its own. */
.home {
  --home-rail-width: 264px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ---------- Bar ---------- */

.home__bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-5);
  background: var(--bg-surface);
  border-bottom: var(--stroke-rule) solid var(--line-strong);
}

.home__wordmark {
  color: var(--ink-strong);
}

.home__body {
  flex: 1;
  min-height: 0;
  display: flex;
}

/* ---------- Rail ---------- */

.home__rail {
  flex: none;
  width: var(--home-rail-width);
  display: flex;
  flex-direction: column;
  background: var(--bg-sunken);
  border-right: var(--stroke-hairline) solid var(--line-hairline);
}

.home__rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-5) var(--space-4) var(--space-3);
  text-transform: uppercase;
  color: var(--ink-faint);
}

.home__count {
  letter-spacing: 0;
}

.home__rail-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.home__empty {
  margin: 0;
  padding: var(--space-2) var(--space-2);
  color: var(--ink-faint);
}

/* Something about the account worth seeing: it could not be reached. */
.home__note {
  flex: none;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  color: var(--ink-muted);
}

.home__rail-foot {
  flex: none;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: var(--stroke-hairline) solid var(--line-hairline);
}

/* ---------- Pane ---------- */

.home__pane {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg-canvas);
}

.home__col {
  width: 100%;
  max-width: 62ch;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
}

.home-new {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* The title is typed as the first line of a document, not into a box. Focus
   shows as the underline turning from nothing to line. */
.home-new__title {
  width: 100%;
  margin: 0;
  padding: 0 0 var(--space-1);
  border: none;
  border-bottom: var(--stroke-hairline) solid transparent;
  background: transparent;
  color: var(--ink-strong);
  outline: none;
}

.home-new__title::placeholder {
  color: var(--ink-faint);
}

.home-new__title:focus {
  border-bottom-color: var(--line);
}

.home-new__field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

.home-new__label {
  text-transform: uppercase;
  color: var(--ink-faint);
}

.home-new__rule {
  height: var(--stroke-hairline);
  background: var(--line-hairline);
}

/* ---------- Delete project ---------- */

.home-delete__name {
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}

/* Slimmer, quieter fields in the home page's sheets — delete, and log in: a small control's padding,
   and focus shown by the border turning line-strong instead of the ochre
   ring. A deliberate departure from the brand book, for text fields only. */
.mm-field__input {
  padding: var(--space-1) 0;
}

.mm-field__wrap:focus-within {
  outline: none;
  border-color: var(--line-strong);
}

/* ---------- Screen-reader only ---------- */

.home__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Phones ---------- */

/* The pane comes first and the rail follows it; the whole page scrolls. */
@media (max-width: 640px) {
  .home {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .home__bar {
    padding: var(--space-2) var(--space-4);
  }

  .home__body {
    flex-direction: column;
  }

  .home__pane {
    flex: none;
    order: -1;
    overflow: visible;
  }

  .home__rail {
    flex: 1;
  }

  .home__col {
    padding: var(--space-8) var(--space-4);
  }

  .home__rail {
    width: auto;
    border-right: none;
    border-top: var(--stroke-hairline) solid var(--line-hairline);
  }

  .home__rail-list {
    overflow: visible;
  }
}
