/* Home (index.html, js/home/home.mjs): your projects and the account.
 *
 * One column, set at the left of a measure and read from the top (docs/UI.md
 * §0): the ways to start, then what you have, as plain lines. The
 * name lives in the strip, beside the mark. Every line in the column starts at
 * the same edge, and every right-hand date ends at the tiles' right edge.
 * Nothing is boxed but the three things you can start.
 *
 * The column is drawn with one hairline: every line that holds something (a
 * pane's edge, the rule under Projects) is `--home-rule`. Behind it, an x and
 * a λ are cut into the ground in grey, their walls a hair wide. No accent, no
 * glow, no gradient: the panes stand half a step up, the letters a step down.
 *
 * A row says a project's name and when it was last touched, and nothing else
 * unless something needs you (docs/UI.md §2). */

.home-page {
  overflow: hidden;
}

/* The mark and the name reload the page. The icon stays where the editor's
   brand box put it; the name follows it. */
.home-page .home-brand {
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
  min-width: 0;
}
.home-page .header-brand {
  width: auto;
  justify-content: flex-start;
  gap: 0.25rem;
  margin: 0;
  color: var(--header-menu-fg-active);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  user-select: none;
}
.home-brand__name {
  position: relative;
  top: 1px;
}

/* The cloud has no name beside it here: it sits in its button like any icon. */
.home-page .sync-cloud svg {
  transform: none;
}

.home-projects[hidden],
.home-find[hidden],
.home__note[hidden] {
  display: none;
}

/* ── the column ───────────────────────────────────────────────────────────── */

/* The page is the container its corners are measured in (`cqw`, `cqh`).
   ⛔ Its focus ring is written out, not `var(--focus-ring)`: that token is
   wrapped in light-dark(), which takes only colours, so a shadow made of it is
   invalid and draws nothing (found 2026-10-08). This is the ring it means. */
.home {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  container: home / size;
  --home-focus-ring: 0 0 0 0.125rem var(--base-mid);
}

/* An x in the top left and a λ in the bottom right (index.html says how they
   are drawn). They are the page's corners, not the list's: the field is as
   tall as what can be seen and stays there while a long list scrolls under
   it, and takes no room from the column (its height, given back below it). */
.home-field {
  position: sticky;
  top: 0;
  z-index: 0;
  height: 100cqh;
  margin-bottom: -100cqh;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

/* Both letters at one size, set by the margin beside the column (less the
   gutter, so a letter never reaches it) and by the height (so the two never
   share a corner). Each box sits in its corner; the strokes leave the page
   through the two edges that meet there.

   Cut into the ground: a grey floor, and the cut's walls drawn beside it in
   CSS pixels, so they stay a hair wide at every size. The light is straight
   above, so the upper wall is in shade and the lower one catches it, and a
   stroke either way across the page shows both. One filter over the whole
   box, so where two strokes cross they are one cut. */
.home-glyph {
  --home-glyph: min(calc((100cqw - 35rem) / 2 - 2.5rem), 56cqh, 38rem);
  position: absolute;
  display: block;
  width: var(--home-glyph);
  height: var(--home-glyph);
  filter: drop-shadow(0 -1.25px 0 var(--home-cut-shade)) drop-shadow(0 1.25px 0 var(--home-cut-lit));
}

.home-glyph path {
  fill: var(--home-cut);
}

.home-glyph--x {
  top: 0;
  left: 0;
}

.home-glyph--lambda {
  right: 0;
  bottom: 0;
}

/* Big enough to be letters, or not there: under 11rem they were crumbs. */
@container home (width < 62rem) or (height < 20rem) {
  .home-glyph {
    display: none;
  }
}

@media (forced-colors: active) {
  .home-field {
    display: none;
  }
}

.home__column {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 35rem;
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(2.5rem, 18vh, 10rem) 1.5rem 1.25rem;
}

/* ── the ways to start ────────────────────────────────────────────────────── */

.home-start {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
}

.home-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5rem;
  padding: 0.875rem 0.875rem 0.75rem;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--home-pane);
  color: var(--base-highest);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  /* The edge is drawn inside, so a tile is the same size with it or without. */
  box-shadow: inset 0 0 0 1px var(--home-rule);
  transition: background-color var(--transition);
}

.home-tile__icon {
  display: flex;
  color: var(--muted-high);
}

.home-tile__icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.home-tile:focus-visible {
  outline: none;
}

.home[data-keys] .home-tile:focus-visible {
  box-shadow: var(--home-focus-ring), inset 0 0 0 1px var(--home-rule);
}

@media (hover: hover) and (pointer: fine) {
  .home-tile:hover {
    background: var(--home-pane-hover);
  }

  .home-tile:hover .home-tile__icon {
    color: var(--accent-high);
  }
}

/* ── what you have ────────────────────────────────────────────────────────── */

.home-projects {
  margin-top: 2.25rem;
}

/* The heading stands on a rule: the page's one hairline, the panes' edge. */
.home-projects__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--home-rule-gap);
  padding-bottom: var(--home-rule-gap);
  border-bottom: 1px solid var(--home-rule);
}

.home-projects__label {
  margin: 0;
  color: var(--muted-high);
  font-size: 0.8125rem;
  font-weight: 400;
}

/* Search: the palette, which is the one thing that searches, with the chord
   that opens it anywhere. */
.home-find {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-right: -0.25rem;
  padding: 0.125rem 0.25rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted-high);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.home-find:focus-visible {
  outline: none;
  box-shadow: var(--home-focus-ring);
}

@media (hover: hover) and (pointer: fine) {
  .home-find:hover {
    color: var(--base-highest);
  }
}

/* A key, where a key is the way: the editor's own key cap (the REPL's hints). */
.home-kbd {
  flex: 0 0 auto;
  padding: 0 0.3125rem;
  border-radius: var(--radius-sm);
  background: var(--repl-kbd-bg);
  color: var(--repl-kbd-fg);
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* The rows reach half a gutter past the column on each side, so their words
   start at its edge and their wash has room around them. */
.home-list {
  list-style: none;
  margin: 0 -0.5rem;
  padding: 0;
}

/* ── a project ────────────────────────────────────────────────────────────── */

.home-row {
  position: relative;
}

.home-row__open {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--base-highest);
  font-size: 0.8125rem;
  text-decoration: none;
  outline: none;
}

.home-row__name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* No project: the words sit where the first name would, quieter and a step smaller, and nothing else. */
.home-row--empty .home-row__name {
  color: var(--muted-high);
  font-size: 0.75rem;
  font-style: italic;
}

.home-row--empty .home-row__open {
  cursor: default;
}

/* Someone else's project shared with you: whose, quieter than the name and never cut before it. */
.home-row__by {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--muted-high);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Only when something needs the person: files changed in two places. */
.home-row__mark {
  flex: 0 0 auto;
  color: var(--ide-status-warning);
  font-size: 0.75rem;
}

.home-row__when {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted-high);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: opacity var(--transition);
}

/* The row's menu takes the date's place when the row is pointed at, so the
   date ends at the column's edge at rest and nothing moves. */
.home-row__more {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity var(--transition);
}

.home-row__more svg {
  width: 1rem;
  height: 1rem;
}

/* The row the keyboard is on, or the one being opened: the lists' "you are
   here" wash (no edge mark: css rule, the strip grammar). ⛔ Only once a key
   has been pressed here (`data-keys`): the page comes up with the focus on the
   last project, so Enter resumes it, and a wash on it before anyone has typed
   read as a row stuck selected. */
.home[data-keys] .home-row__open:focus-visible,
.home-row[data-opening] .home-row__open {
  background: var(--search-row-active-bg);
  color: var(--search-row-active-fg);
}

.home-row__more:focus-visible,
.home-row__more[aria-expanded="true"] {
  opacity: 1;
}

.home-row:has(.home-row__more:focus-visible) .home-row__when,
.home-row:has(.home-row__more[aria-expanded="true"]) .home-row__when {
  opacity: 0;
}

.home-row:has(.home-row__more[aria-expanded="true"]) .home-row__open {
  background: var(--menu-item-hover-wash);
}

@media (hover: hover) and (pointer: fine) {
  .home-row:not(.home-row--empty) .home-row__open:hover {
    background: var(--menu-item-hover-wash);
  }

  .home-row:hover .home-row__more {
    opacity: 1;
  }

  .home-row:hover .home-row__when {
    opacity: 0;
  }
}

/* Touch has no pointing: the menu stays, after the date. */
@media (hover: none), (pointer: coarse) {
  .home-row {
    display: flex;
    align-items: center;
  }

  .home-row__open {
    flex: 1 1 auto;
    min-width: 0;
  }

  .home-row__more {
    position: static;
    transform: none;
    opacity: 1;
    flex: 0 0 auto;
  }
}

/* ── the quiet lines ──────────────────────────────────────────────────────── */

.home__note {
  margin: 1.25rem 0 0;
  color: var(--muted-high);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* Something that will cost you work if it is not read. */
.home__note--warning {
  position: relative;
  padding-left: 0.75rem;
}

.home__note--warning::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.125rem;
  bottom: 0.125rem;
  width: var(--edge-strip-w);
  border-radius: var(--edge-strip-radius);
  background: var(--ide-status-warning);
}

/* ── where to read more ───────────────────────────────────────────────────── */

.home-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-top: auto;
  padding-top: 3rem;
}

.home-link {
  border-radius: var(--radius-sm);
  color: var(--muted-mid);
  font-size: 0.75rem;
  text-decoration: none;
}

.home-link:focus-visible {
  outline: none;
  box-shadow: var(--home-focus-ring);
}

@media (hover: hover) and (pointer: fine) {
  .home-link:hover {
    color: var(--base-highest);
  }
}

/* ── narrower ─────────────────────────────────────────────────────────────── */

/* A phone: the ways to start become three lines, the glyph before the words. */
@media (max-width: 34rem) {
  .home__column {
    padding: 2rem 1rem 1rem;
  }

  .home-start {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.375rem;
  }

  .home-tile {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    min-height: 2.75rem;
    padding: 0 0.875rem;
  }

  .home-find .home-kbd {
    display: none;
  }
}

/* ── the two views: Projects and the Library (docs/LIBRARY.md §3) ─────────── */

.home-nav {
  display: flex;
  align-items: center;
  gap: var(--lib-1);
  margin-left: var(--lib-8);
}

.home-nav__link {
  padding: var(--lib-1) var(--lib-4);
  border-radius: var(--radius-md);
  color: var(--header-menu-fg);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-decoration: none;
}

.home-nav__link.is-here {
  background: var(--lib-wash-strong);
  color: var(--header-menu-fg-active);
}

.home-nav__link:focus-visible {
  outline: none;
  box-shadow: var(--lib-focus-ring);
}

@media (hover: hover) and (pointer: fine) {
  .home-nav__link:not(.is-here):hover {
    color: var(--header-menu-fg-active);
  }
}

.home-library {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.home-library[hidden],
.home[hidden] {
  display: none;
}

.home-library__inner {
  padding: var(--lib-10) var(--lib-8) var(--lib-10);
}
