/* ==========================================================================
   App shell: header, nav, footer, view scaffolding
   ========================================================================== */

.app-header {
  position: sticky; top: 0; z-index: 200;
  height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-header .wrap {
  height: 100%; display: flex; align-items: center; gap: 14px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); flex: none;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 1rem; letter-spacing: -.03em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2), var(--sh-1);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: .98rem; letter-spacing: -.02em; }
.brand-text span { font-size: .68rem; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  padding: 7px 13px; border-radius: var(--r-pill);
  font-size: .88rem; font-weight: 600; color: var(--ink-2);
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.is-active { background: var(--brand-soft); color: var(--brand); }

.header-tools { display: flex; align-items: center; gap: 8px; }

/* compact search that expands */
.hsearch { position: relative; }
.hsearch input {
  width: 220px; padding: 8px 12px 8px 34px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: .86rem;
  transition: width .22s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.hsearch input:focus {
  outline: none; width: 300px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hsearch .sic {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); pointer-events: none; width: 15px; height: 15px;
}
.hsearch kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: .66rem; color: var(--ink-4); padding: 2px 5px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2);
  pointer-events: none;
}
.hsearch input:focus + kbd { display: none; }

/* --- main --------------------------------------------------------------- */
.app-main { min-height: calc(100vh - var(--header-h) - 120px); padding-bottom: 60px; }

.view { padding-top: 26px; }

.view-head { margin-bottom: 22px; }
.view-head .eyebrow {
  font-size: .74rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand);
  display: block; margin-bottom: 6px;
}

.crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: .82rem; color: var(--ink-3); margin-bottom: 12px;
}
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { color: var(--ink-4); }

/* --- footer ------------------------------------------------------------- */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 30px 0;
  font-size: .82rem;
  color: var(--ink-3);
}
.app-footer .wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.app-footer a { color: var(--ink-2); }
.app-footer .fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 22px; flex: 1; }
.app-footer h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-bottom: 8px; }
.app-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }

/* --- mobile nav --------------------------------------------------------- */
.menu-btn { display: none; }

@media (max-width: 900px) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
  .hsearch input { width: 150px; }
  .hsearch input:focus { width: 190px; }
  .brand-text span { display: none; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 15px; }
  .brand-text { display: none; }
  .hsearch input { width: 120px; }
}

/* slide-out menu for small screens */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(20, 18, 15, .5);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease);
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 310;
  width: min(310px, 84vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--sh-4);
  transform: translateX(-102%);
  transition: transform .26s var(--ease-out);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer-head {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.drawer nav a {
  padding: 11px 14px; border-radius: var(--r-sm); font-weight: 600;
  color: var(--ink-2); text-decoration: none; font-size: .94rem;
  display: flex; align-items: center; gap: 11px;
}
.drawer nav a:hover { background: var(--surface-2); color: var(--ink); }
.drawer nav a.is-active { background: var(--brand-soft); color: var(--brand); }
.drawer .dsec {
  padding: 16px 20px 6px; font-size: .7rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-4); font-weight: 700;
}

/* toast */
.toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--paper);
  font-size: .86rem; font-weight: 600;
  box-shadow: var(--sh-3);
  animation: popIn .2s var(--ease-out) both;
  display: flex; align-items: center; gap: 9px;
}
.toast.toast-ok  { background: var(--ok);  color: #fff; }
.toast.toast-bad { background: var(--bad); color: #fff; }
