/* Cutaway at home -- the page in home mode (docs/superpowers/specs/
 * 2026-11-01-cutaway-at-home-design.md, "The app, as the person sees it").
 *
 * EVERYTHING here is scoped: `body.home-mode` (set from /api/me `home`, never
 * on the site) or the Library's own `.lh-*` / `#library-view` / `#ai-panel`
 * ids, which exist only in home mode's markup flow. The site is unchanged.
 * Colours are style.css tokens (all four themes); targets are 44px.
 */

/* ── hidden chrome: one rule, every element marked `data-home-hide` ───────── */
body.home-mode [data-home-hide] { display: none !important; }

/* ── the home bar's ⋯ is a <button> wearing the bar's item style ──────────── */
.appnav--home button.appnav__item {
  background: none; border: 0; font: inherit; font-size: 10px; cursor: pointer;
  color: var(--muted); }
.appnav--home .appnav__item { min-height: 44px; }
@media (min-width: 720px) {
  .appnav--home button.appnav__item { font-size: 13px; }
}

/* ── the Library ──────────────────────────────────────────────────────────── */
.lh-head { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 4px 2px 12px; flex-wrap: wrap; }
.lh-title { margin: 0; font-size: 22px; }
.lh-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lh-actions .btn-primary, .lh-actions .btn-ghost { min-height: 44px; padding: 0 16px; white-space: nowrap; }
.lh-help-btn { min-width: 44px; min-height: 44px; border-radius: 50%; font-weight: 700; }

.lh-empty { border: 2px dashed var(--line2); border-radius: 18px; padding: 44px 22px;
  text-align: center; color: var(--muted); font-size: 16px; line-height: 1.5;
  background: linear-gradient(180deg, var(--panel), var(--bg2)); }

.lh-group { margin: 0 0 18px; }
.lh-group-h { margin: 0 2px 8px; font-size: 14px; color: var(--muted); font-weight: 650;
  letter-spacing: .02em; display: flex; align-items: center; gap: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-count { font-size: 12px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 8px; min-width: 20px; text-align: center; }
.lh-grid { display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.lh-card { position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; box-shadow: var(--elev-1);
  display: flex; flex-direction: column; }
.lh-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.lh-open { display: flex; flex-direction: column; text-align: left; width: 100%;
  background: none; border: 0; padding: 0 0 8px; color: var(--text); font: inherit;
  cursor: pointer; min-height: 44px; }
.lh-open:focus-visible, .lh-remove:focus-visible, .lh-locate:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px; }
.lh-open[disabled] { cursor: default; }
.lh-thumb { display: block; aspect-ratio: 16 / 9; background: var(--panel2); overflow: hidden; }
.lh-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lh-thumb.lh-nothumb::after { content: "🎞"; display: flex; align-items: center;
  justify-content: center; height: 100%; font-size: 28px; color: var(--muted); }
.lh-text { display: block; }
.lh-name { display: block; padding: 8px 10px 0; font-size: 14px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-meta { display: block; padding: 2px 10px 0; font-size: 12px; color: var(--muted); }
.lh-tag { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line2); }
.lh-tag--detecting { color: var(--accent); border-color: var(--accent); }
.lh-tag--check { color: var(--pen-ink); border-color: var(--pen-ink); }
.lh-tag--done { color: var(--green); border-color: var(--green); }
.lh-tag--scored { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; }
.lh-remove { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: transparent; color: var(--text);
  font-size: 15px; cursor: pointer; opacity: 0; }
.lh-card:hover .lh-remove, .lh-card:focus-within .lh-remove { opacity: .9; }
@media (hover: none) { .lh-remove { opacity: .75; } }
.lh-gone .lh-thumb, .lh-gone .lh-name { opacity: .45; }
.lh-locate { margin: 6px 10px 10px; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer; }

/* the whole window is a drop target */
body.lh-dropping::after { content: "Drop to add"; position: fixed; inset: 8px; z-index: 60;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
  border: 3px dashed var(--accent); border-radius: 18px; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 80%, transparent); color: var(--text); }

/* ── sheets (the ? sheet, Settings): the placeholders Task 6 fills ────────── */
.lh-sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end;
  justify-content: center; background: rgba(0, 0, 0, .55); }
.lh-sheet .lh-sheet-box { background: var(--panel); color: var(--text); width: min(560px, 100%);
  max-height: 85dvh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 18px 22px;
  border: 1px solid var(--line); }
.lh-sheet h3 { margin: 0 0 8px; }
@media (min-width: 720px) {
  .lh-sheet { align-items: center; }
  .lh-sheet .lh-sheet-box { border-radius: 18px; }
}

/* ── the AI panel (right pane; Task 6 fills it) and the centre hint ───────── */
#ai-panel, #lh-centre { display: none; }

/* ── three panes: the library left, the clip in the middle, the AI right ──── *
 * Below 1100px nothing here applies: the site's phone layout. */
@media (min-width: 1100px) {
  body.home-mode #app-main:not(.hidden) {
    display: grid; max-width: none; align-items: start; column-gap: 18px;
    grid-template-columns: minmax(240px, 17rem) minmax(0, 1fr) minmax(240px, 18rem);
    grid-template-rows: minmax(0, 1fr);
    padding-left: 18px; padding-right: 18px; }
  body.home-mode #app-main > .view:not(#library-view) { grid-column: 2; grid-row: 1; }
  /* the library stays visible on every page of the window, as a list */
  body.home-mode #library-view, body.home-mode #library-view.hidden {
    display: block !important; grid-column: 1; grid-row: 1; min-width: 0;
    max-height: calc(100dvh - 90px); overflow-y: auto; }
  body.home-mode #library-view .lh-grid { grid-template-columns: 1fr; gap: 8px; }
  body.home-mode #library-view .lh-card { flex-direction: row; align-items: center; }
  body.home-mode #library-view .lh-open { flex-direction: row; align-items: center; gap: 10px;
    padding: 6px 44px 6px 6px; min-height: 56px; }
  body.home-mode #library-view .lh-thumb { width: 84px; flex: 0 0 84px; border-radius: 8px; }
  body.home-mode #library-view .lh-text { flex: 1 1 0; min-width: 0; }
  body.home-mode #library-view .lh-name, body.home-mode #library-view .lh-meta { padding: 0; }
  body.home-mode #library-view .lh-tag { top: 6px; left: 6px; font-size: 10px; padding: 1px 6px; }
  body.home-mode #library-view .lh-remove { opacity: .7; }
  body.home-mode #library-view .lh-card { flex-wrap: wrap; }
  body.home-mode #library-view .lh-locate { margin: 0 6px 6px 100px; flex: 1 1 100%; }
  body.home-mode #library-view .lh-empty { padding: 24px 14px; font-size: 14px; }
  /* the middle pane, when no clip is open */
  body.home-mode.on-library #lh-centre { display: block; grid-column: 2; grid-row: 1;
    color: var(--muted); text-align: center; padding: 80px 20px; font-size: 16px; }
  body.home-mode #ai-panel { display: block; grid-column: 3; grid-row: 1; min-width: 0;
    max-height: calc(100dvh - 90px); overflow-y: auto; }
  /* the editor in a middle pane is the site's phone layout (single column)
     until the pane is wide enough for its own two columns, below */
  body.home-mode .editor-shell.editor-cols { display: flex; flex-direction: column; }
  /* the phone app-frame's flex arithmetic (style.css, max-width: 819px): the
     tool area keeps 160px, the stage gives way, the tab bar stays in view */
  body.home-mode.editing #editor-view .editor-shell.editor-cols .stage { flex: 0 1 auto; min-height: 0; }
  body.home-mode.editing #editor-view .editor-shell.editor-cols .tool-area { flex: 1 0 160px; }
  /* editing: the page keeps its one-screen frame */
  body.home-mode.editing #library-view, body.home-mode.editing #ai-panel {
    max-height: 100%; }
  body.home-mode.editing #app-main:not(.hidden) { min-height: 0; max-width: none; }
  body.home-mode.editing #editor-view { min-height: 0; height: 100%; }
  body.home-mode.editing .appnav { display: none; }
}
/* wide enough for the editor's own two columns beside both panes */
@media (min-width: 1440px) {
  body.home-mode .editor-shell.editor-cols {
    display: grid; grid-template-columns: minmax(420px, 1fr) minmax(360px, 520px); }
  body.home-mode.editing #editor-view .editor-shell.editor-cols .stage { flex: none; }
  body.home-mode.editing #editor-view .editor-shell.editor-cols .tool-area { flex: none; }
  body.home-mode .editor-shell.editor-cols.hide-stage,
  body.home-mode .editor-shell.editor-cols.stage-mini { display: flex; flex-direction: column; }
}

/* ── the AI pill, the AI panel's list, Settings, the ? sheet ──────────────── */
.ai-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line2); background: var(--panel2); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.ai-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ai-pill.is-on { color: var(--green); border-color: var(--green); }
.ai-pill.is-on::before { background: var(--green); }
.ai-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Below 1100px the AI panel is hidden, so the pill sits in the Library header
   and "Open Claude Code here" in the ⋯ menu; the panel has both at >= 1100px.
   `.ai-pill`'s own display would beat the `hidden` attribute on the site. */
.lh-ai-pill[hidden] { display: none; }
@media (min-width: 1100px) {
  body.home-mode .lh-ai-pill, body.home-mode .home-claude-btn { display: none; }
}

.hp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-wrap: wrap; margin: 0 0 10px; }
.hp-title { margin: 0; font-size: 16px; }
.hp-none { margin: 8px 2px 14px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.hp-scored { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; font-size: 13px; font-weight: 650;
  border: 1px solid var(--pen-ink); color: var(--pen-ink); }
.hp-log { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.hp-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.hp-sum { flex: 1 1 100%; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.hp-when { flex: 1 1 auto; font-size: 12px; color: var(--muted); }
.hp-undo { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font: inherit;
  font-size: 13px; font-weight: 650; cursor: pointer; }
.hp-open-claude { width: 100%; min-height: 44px; }

.hs-field { margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.hs-field > label, .hs-field > legend, .hs-field > h4 { display: block; margin: 0 0 4px; padding: 0;
  font-size: 14px; font-weight: 700; }
.hs-hint { margin: 0 0 6px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.hs-inline { display: flex; gap: 8px; align-items: center; }
.hs-inline input { flex: 1 1 auto; min-width: 0; }
.hs-field input, .hs-field textarea { min-height: 44px; width: 100%; box-sizing: border-box; padding: 8px 10px;
  border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font: inherit; }
.hs-field textarea { min-height: 88px; resize: vertical; }
.hs-enc { display: flex; width: 100%; box-sizing: border-box; align-items: center; gap: 10px; min-height: 44px;
  padding: 0 4px; cursor: pointer; }
.hs-enc input { width: 20px; min-height: 0; height: 20px; flex: 0 0 20px; padding: 0; }
.hs-enc-name { font-size: 15px; font-weight: 650; }
.hs-enc-state { margin-left: auto; text-align: right; font-size: 13px; color: var(--green); }
.hs-enc-state.is-missing { color: var(--muted); }
.hs-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.hp-keys { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.hp-keys kbd { display: inline-block; min-width: 2.2em; text-align: center; padding: 2px 8px; margin-right: 6px;
  border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2); font: inherit;
  font-size: 13px; font-weight: 700; }
