/* ============================================================================
   Barmaso — app shell: header, drawer, route outlet, footer
   ============================================================================ */

/* --- Header ---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--brand-color);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* --- Hamburger ------------------------------------------------------------- */
.menu-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.menu-btn:hover { border-color: var(--ink-faint); }

/* Three bars drawn from one element: the middle bar is the element itself,
   the outer two are its pseudo-elements. */
.menu-btn-bars,
.menu-btn-bars::before,
.menu-btn-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.menu-btn-bars { position: relative; }

.menu-btn-bars::before,
.menu-btn-bars::after {
  content: '';
  position: absolute;
  left: 0;
}
.menu-btn-bars::before { top: -6px; }
.menu-btn-bars::after  { top: 6px; }

/* --- Drawer ---------------------------------------------------------------- */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(16, 32, 58, 0.45);
  backdrop-filter: blur(2px);
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: min(var(--drawer-w), 86vw);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
}

.drawer.is-open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 24px;
  line-height: 1;
}
.drawer-close:hover { background: var(--surface-alt); color: var(--ink); }

.drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-radius: var(--radius-md);
  color: var(--ink);
  transition: background-color 0.15s ease;
}
.drawer-link:hover { background: var(--surface-alt); }

.drawer-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.drawer-link svg { flex: none; }

.drawer-link-title {
  display: block;
  font-weight: 600;
  font-size: 15px;
}

.drawer-link-note {
  display: block;
  font-size: 12px;
  color: var(--ink-faint);
}
.drawer-link.is-active .drawer-link-note { color: var(--accent); }

.drawer-foot {
  margin-top: auto;
  padding-top: 16px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* --- Route outlet + footer -------------------------------------------------- */
.route-outlet {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--gutter);
}
.route-outlet:focus { outline: none; }

/* Purchase takes the whole window. Its tables are purchase invoices — a
   dozen columns of code, description, quantity and money — and squeezing
   them into a reading measure means every one of them scrolls sideways
   inside a box while two-fifths of the screen sits empty. The desktop tool
   gives them the window and so does this. */
.route-outlet.is-wide { max-width: none; }

.site-footer {
  padding: 18px var(--gutter);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}

/* reCAPTCHA (App Check) says so here instead of its floating badge. */
.recaptcha-note { display: block; margin-top: 6px; font-size: 12px; line-height: 1.5; }
.recaptcha-note[hidden] { display: none; }
.recaptcha-note a { color: inherit; text-decoration: underline; }
.grecaptcha-badge { visibility: hidden !important; }

/* --- Placeholder (routes still to be built) --------------------------------- */
.placeholder {
  display: grid;
  gap: 12px;
  justify-items: start;
  max-width: 520px;
  margin: 48px auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.placeholder-title { font-size: 24px; }
.placeholder-sub { color: var(--ink-soft); }

.placeholder-phase {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
}

/* A preview looks exactly like the live site. This says which it is, and
   whether what is typed here reaches the shops' real books. */
.env-strip {
  padding: 6px 14px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
}

.env-strip--live { background: var(--danger); }

/* A save not yet on the server, or a page read from the device's copy (sync-watch.js). */
.sync-bar {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 2000; width: min(640px, calc(100vw - 24px)); box-sizing: border-box;
  padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); background: #fef3c7; color: #78350f; border: 1px solid #f59e0b;
}
.sync-bar[data-tone="offline"] { background: #f1f5f9; color: #1e293b; border-color: #94a3b8; }
.sync-bar[data-tone="done"] { background: #dcfce7; color: #14532d; border-color: #22c55e; }
.sync-bar[hidden] { display: none; }
