/* The shell around pages: the sidebar, collapsed or open, and the button that brings it back.
   Contract: contracts/views/rules.md (invariant 6) */
.shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
.rail-hidden .shell { grid-template-columns: 0 minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--side); border-right: 1px solid var(--rule);
  padding: .7rem .6rem .6rem; display: flex; flex-direction: column; gap: .9rem; }
.rail-hidden .rail { visibility: hidden; }
.icon { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.rail-head { display: flex; align-items: center; justify-content: space-between; padding: .1rem .2rem .1rem .45rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 400 1.3rem/1 var(--serif); letter-spacing: -.01em; text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 7px; background: var(--accent); color: #fff;
  font: 600 .95rem/1 var(--serif); }
.rail-btn, .rail-toggle { display: inline-grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--mute); }
.rail-btn:hover, .rail-toggle:hover { background: var(--hover); color: var(--ink); opacity: 1; }
.rail-toggle { position: fixed; top: .6rem; left: .6rem; z-index: 50; display: none; background: var(--paper); }
.rail-hidden .rail-toggle { display: inline-grid; }

.search { position: relative; }
.search .icon { position: absolute; left: .6rem; top: 50%; translate: 0 -50%; color: var(--mute); pointer-events: none; }
.search input { width: 100%; padding: .45rem .6rem .45rem 2.1rem; border-radius: 9px; background: var(--sheet); }

.rail nav { display: flex; flex-direction: column; gap: 1px; }
.rail nav a { display: flex; align-items: center; gap: .6rem; padding: .42rem .55rem; border-radius: 8px; text-decoration: none; font-size: .93rem; }
.rail nav a .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail nav a:hover { background: var(--hover); }
.rail nav a[aria-current="page"] { background: color-mix(in srgb, var(--ink) 9%, transparent); font-weight: 500; }
.rail nav a .icon { color: var(--mute); }
.rail nav a[aria-current="page"] .icon { color: var(--ink); }
.rail .work { flex: 1; min-height: 0; overflow: auto; }
.full-mode main { max-width: none; padding: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.full-mode .full-view { flex: 1; min-height: 0; overflow: hidden; }
.full-mode .full-view > * { height: 100%; }

.you { display: flex; align-items: center; gap: .6rem; padding: .5rem; border-radius: 10px; text-decoration: none; border-top: 1px solid var(--rule); }
.you:hover, .you[aria-current="page"] { background: var(--hover); }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 600; font-size: .85rem; flex: none; }
.who { display: grid; min-width: 0; font-size: .9rem; line-height: 1.25; }
.who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .ws { color: var(--mute); font-size: .78rem; }
.rail-scrim { display: none; }

/* Narrow: the sidebar slides over the page and starts closed. */
@media (max-width: 720px) {
  .shell, .rail-hidden .shell { grid-template-columns: minmax(0, 1fr); }
  .rail, .rail-hidden .rail { visibility: visible; position: fixed; inset: 0 auto 0 0; width: min(18rem, 85vw); z-index: 60; translate: -100% 0;
    transition: translate .2s ease; box-shadow: var(--shadow); }
  .rail-open .rail { translate: 0 0; }
  .rail-toggle, .rail-hidden .rail-toggle { display: inline-grid; }
  .rail-open .rail-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgb(0 0 0 / .3); }
  .rail-toggle, .rail-btn { width: 2.5rem; height: 2.5rem; }
  .rail nav a { padding: .6rem .55rem; }
  main { padding-top: 3.5rem; }
  .full-mode main { padding: 3.25rem 0 0; }
}
