/* ─── Harvst app shell ────────────────────────────────────────────────────────
   Layered on top of each page's own styles. Everything here is about making a
   set of documents behave like one application: instant navigation, real
   loading skeletons, transient feedback, and keyboard reach.
   ──────────────────────────────────────────────────────────────────────────── */

/* ── Cross-document view transitions ──────────────────────────────────────── */
@view-transition { navigation: auto; }

/* The chrome stays put while only the content crossfades, which is what makes
   a multi-page app read as a single surface. */
.sidebar { view-transition-name: harvst-sidebar; }
.mobile-bar { view-transition-name: harvst-mobilebar; }

::view-transition-old(root) { animation: harvst-fade-out .16s ease both; }
::view-transition-new(root) { animation: harvst-fade-in .2s ease both; }

@keyframes harvst-fade-out { to { opacity: 0; transform: translateY(-2px); } }
@keyframes harvst-fade-in { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ── Navigation progress ──────────────────────────────────────────────────── */
#harvst-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--navy), var(--sand));
  z-index: 9999; opacity: 0; transition: width .2s ease, opacity .2s ease;
  pointer-events: none;
}
#harvst-progress.active { opacity: 1; }

/* ── Skeletons ────────────────────────────────────────────────────────────── */
.sk {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--linen) 25%, rgba(27,42,74,.05) 37%, var(--linen) 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.3s ease-in-out infinite;
}
.sk + .sk { margin-top: 8px; }
.sk-text { height: 11px; }
.sk-title { height: 16px; width: 42%; }
.sk-line-sm { width: 60%; }
.sk-line-md { width: 82%; }
.sk-row { height: 46px; border-radius: 10px; }
.sk-card { height: 84px; border-radius: 12px; }

@keyframes sk-shimmer { to { background-position: -400% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
#harvst-toasts {
  position: fixed; bottom: 18px; right: 18px; z-index: 9998;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.harvst-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--border-md);
  border-radius: 10px; padding: 11px 14px;
  font-size: 13px; line-height: 1.45; max-width: 340px;
  box-shadow: 0 10px 30px rgba(27, 28, 30, .12);
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1) both;
}
.harvst-toast.out { animation: toast-out .18s ease both; }
.harvst-toast i { font-size: 15px; line-height: 1.2; flex-shrink: 0; }
.harvst-toast.ok i { color: var(--sage); }
.harvst-toast.err i { color: var(--terra); }
.harvst-toast.info i { color: var(--navy); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* ── Command palette ──────────────────────────────────────────────────────── */
#harvst-cmdk {
  position: fixed; inset: 0; z-index: 9997; display: none;
  background: rgba(27, 28, 30, .38); backdrop-filter: blur(3px);
  align-items: flex-start; justify-content: center; padding-top: 12vh;
}
#harvst-cmdk.open { display: flex; }
.cmdk-box {
  width: min(560px, calc(100vw - 32px));
  background: var(--card); border: 0.5px solid var(--border-md);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(27, 28, 30, .22);
  animation: cmdk-in .16s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes cmdk-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.cmdk-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 0.5px solid var(--border); }
.cmdk-input-wrap i { color: var(--t3); font-size: 17px; }
#cmdkInput {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--f-b); font-size: 15px; color: var(--ink);
}
#cmdkInput::placeholder { color: var(--t3); }
.cmdk-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: var(--t2);
}
.cmdk-item i { font-size: 16px; color: var(--t3); width: 18px; }
.cmdk-item .cmdk-label { color: var(--ink); }
.cmdk-item .cmdk-sec { margin-left: auto; font-size: 10.5px; color: var(--t3); letter-spacing: .06em; text-transform: uppercase; }
.cmdk-item[aria-selected="true"] { background: var(--navy-8); }
.cmdk-item[aria-selected="true"] i, .cmdk-item[aria-selected="true"] .cmdk-label { color: var(--navy); }
.cmdk-empty { padding: 22px; text-align: center; color: var(--t3); font-size: 13px; }
.cmdk-foot {
  display: flex; gap: 14px; padding: 9px 14px;
  border-top: 0.5px solid var(--border); background: var(--canvas);
  font-size: 11px; color: var(--t3);
}
kbd {
  font-family: var(--f-b); font-size: 10px; background: var(--linen);
  border: 0.5px solid var(--border-md); border-bottom-width: 1.5px;
  border-radius: 4px; padding: 1px 5px; color: var(--t2);
}

/* ── Keyboard reach ───────────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 4px; }
.s-item:focus-visible { outline-offset: -2px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 10000;
  background: var(--navy); color: var(--canvas);
  padding: 9px 15px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.skip-link:focus { left: 12px; }

/* Sidebar hint for the palette */
.cmdk-hint {
  margin: 8px 14px 0; padding: 7px 10px;
  border: 0.5px dashed var(--border-md); border-radius: 8px;
  font-size: 11px; color: var(--t3);
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  cursor: pointer;
}
.cmdk-hint:hover { border-color: var(--navy-14); color: var(--t2); }
