/* The frame: Drive's shell. A top bar and a sidebar on one ground, the apps
   on a sheet inset from the window's edge. Desktop first; phone.css takes
   over below 64rem (where the sidebar becomes a drawer). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--chrome); color: var(--foreground);
  font: 400 14px/1.45 var(--ff-sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgb(224 86 29 / 0.22); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: fixed; top: 8px; inset-inline-start: 8px; z-index: 200; padding: 8px 14px; border-radius: var(--radius-control);
  background: var(--foreground); color: var(--chrome); font-weight: 500; text-decoration: none; transform: translateY(-200%);
}
.skip:focus { transform: none; }

.app {
  display: grid; height: 100vh; height: 100dvh;
  grid-template: "top top" var(--topbar-h) "side sheet" minmax(0, 1fr) / var(--sidebar-w) minmax(0, 1fr);
  transition: grid-template-columns 200ms var(--ease-out);
}

/* ---- Top bar ---------------------------------------------------------------- */
.top { grid-area: top; display: flex; align-items: center; gap: 16px; padding-inline-end: 16px; min-width: 0; }
.lead { display: flex; align-items: center; gap: 6px; min-width: var(--sidebar-w); padding-inline-start: 16px; flex: none; transition: min-width 200ms var(--ease-out); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; flex: none;
  color: var(--muted-strong); transition: background-color 150ms, color 150ms, transform var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-3); color: var(--foreground); }
.icon-btn:active, .card:active, .nav-row:active, .seg button:active, .secondary:active { transform: scale(0.97); }
.fold { width: 40px; height: 40px; }
.menu { display: none; }
[dir="rtl"] .fold svg { transform: scaleX(-1); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; border-radius: var(--radius-control); padding: 2px 4px 2px 2px; }
.mark { width: 32px; height: 32px; display: block; }
.wordmark { font: 600 21px/1 var(--ff-brand); letter-spacing: -0.02em; color: var(--foreground); }

.find { position: relative; flex: 1; min-width: 0; max-width: 680px; margin-inline: auto; display: flex; align-items: center; }
.find input {
  width: 100%; height: 44px; border: 0; border-radius: 999px; padding: 0 64px 0 44px;
  background: color-mix(in srgb, var(--surface-3) 70%, transparent); color: var(--foreground);
  font: 400 15px var(--ff-sans); outline: none; -webkit-appearance: none; appearance: none;
  transition: background-color 150ms, box-shadow 150ms;
}
.find input::placeholder { color: var(--muted); }
.find input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.find input:hover { background: var(--surface-3); }
.find input:focus { background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-md); }
.find-icon { position: absolute; inset-inline-start: 16px; color: var(--muted); pointer-events: none; }
.find kbd {
  position: absolute; inset-inline-end: 16px; display: grid; place-items: center; height: 24px; min-width: 24px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-chip); color: var(--muted);
  font: 400 12px var(--ff-sans); pointer-events: none;
}
.find:focus-within kbd, .find input:not(:placeholder-shown) ~ kbd { display: none; }
.clear {
  position: absolute; inset-inline-end: 8px; display: none; place-items: center; width: 32px; height: 32px;
  border-radius: 999px; color: var(--muted);
}
.clear:hover { color: var(--foreground); background: var(--surface-2); }
.find input:not(:placeholder-shown) ~ .clear { display: grid; }
.trail { display: flex; align-items: center; gap: 4px; flex: none; }

/* ---- Sidebar ---------------------------------------------------------------- */
.side { grid-area: side; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 4px 12px 16px; }
.drawer-brand { display: none; }
#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-row {
  --nav-c: var(--accent);
  display: flex; align-items: center; gap: 14px; height: 40px; padding-inline: 16px 12px; border-radius: var(--radius-control);
  color: var(--muted-strong); text-decoration: none; font-size: 14px; white-space: nowrap;
  transition: background-color 100ms, color 100ms, transform var(--dur-fast) var(--ease-out);
}
.nav-row svg { color: var(--nav-c); }
.nav-row:hover { background: color-mix(in srgb, var(--nav-c) 14%, transparent); color: var(--foreground); }
.nav-row[aria-current="page"] { background: color-mix(in srgb, var(--nav-c) 20%, transparent); color: var(--foreground); font-weight: 500; }
.nav-row[aria-current="page"] svg { stroke-width: 2.1; }
.nav-row:focus-visible { outline-offset: -2px; } /* the nav scrolls, so an outside ring would be clipped */
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-size: 12.5px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: 16px 16px 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.side-foot p { margin: 0; }
.side-foot p:first-child { color: var(--muted-strong); font-weight: 500; margin-bottom: 2px; }

/* ---- The sheet -------------------------------------------------------------- */
.sheet {
  grid-area: sheet; min-width: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 var(--sheet-inset) var(--sheet-inset) 0; padding: 26px 28px 48px;
  background: var(--sheet); border: 1px solid var(--sheet-edge); border-radius: var(--radius-sheet);
}
[dir="rtl"] .sheet { margin: 0 0 var(--sheet-inset) var(--sheet-inset); }
.title-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 22px; min-height: 40px; }
.title-row h1 {
  margin: 0; font: 500 28px/1.15 var(--ff-display); letter-spacing: -0.02em; color: var(--foreground);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.title-count { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.seg {
  margin-inline-start: auto; align-self: center; display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border);
}
.seg button { display: inline-grid; place-items: center; width: 36px; height: 32px; border-radius: 999px; color: var(--muted-strong); transition: color 100ms, background-color 100ms; }
.seg button:hover { color: var(--foreground); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--foreground); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
#content:focus { outline: none; }
.noscript { color: var(--muted-strong); }
