/*
 * Base app styles — buttons, initial welcome screen, layout primitives.
 * Per-page styles live alongside their components in later tasks.
 */

/* Paper grain — global texture overlay, imperceptible individually,
   grounds the warm-paper palette. Mirrors marketing/src/styles/global.css;
   the same 240x240 SVG noise sheet ships from public/paper-grain.svg. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url('/paper-grain.svg');
  background-size: 240px 240px;
  opacity: 0.03;
  pointer-events: none;
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  body::before {
    opacity: 0.05;
    mix-blend-mode: screen;
  }
}

:root[data-theme='dark'] body::before {
  opacity: 0.05;
  mix-blend-mode: screen;
}

:root[data-theme='light'] body::before {
  opacity: 0.03;
  mix-blend-mode: multiply;
}

body > * {
  position: relative;
  z-index: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background var(--motion-fast) var(--easing-out),
              color var(--motion-fast) var(--easing-out),
              border-color var(--motion-fast) var(--easing-out),
              transform var(--motion-fast) var(--easing-out);
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--color-fg); color: var(--color-bg); }
.btn--primary:hover { background: #000; }

.btn--ghost {
  background: transparent;
  color: var(--color-fg);
  border-color: var(--color-border-strong);
}
.btn--ghost:hover {
  background: var(--color-surface);
  border-color: var(--color-muted);
}

.btn--accent { background: var(--color-accent); color: #fff; }
.btn--accent:hover { background: var(--color-accent-hover); }
.btn--accent:disabled {
  background: var(--color-surface-2);
  color: var(--color-muted);
  border-color: var(--color-border);
}
.btn--accent:hover:disabled { background: var(--color-surface-2); }

.btn--destructive { background: var(--color-destructive); color: #fff; }

/* ---- WebSocket notification banner ---- *
 * Single-slot inline banner rendered at the top of the authenticated
 * shell. Gets populated by the WS listener on approval-request
 * events and auto-dismisses after 8s.
 */
.ws-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-accent);
  color: var(--color-fg);
  font-size: var(--text-sm);
  animation: ws-banner-in var(--motion-normal) var(--easing-out);
}
@keyframes ws-banner-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ws-banner__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ws-banner__body strong { color: var(--color-fg); font-weight: var(--weight-semi); }
.ws-banner__actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ---- Push-subscribe prompt ----
 * Lives at the top of the authenticated shell, right under the WS
 * notification banner. Deliberately quieter than `.ws-banner`: the
 * prompt is ambient, not urgent — we never block the vault behind it.
 */
.push-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-fg);
  font-size: var(--text-sm);
}
.push-prompt__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.push-prompt__copy strong { font-weight: var(--weight-semi); }
.push-prompt__actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ---- Welcome placeholder (replaced in Task 4.11 with full editorial page) ---- */
.welcome {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-6);
  background:
    radial-gradient(60% 60% at 50% 20%, var(--color-surface-2), var(--color-bg));
}

.welcome__header { display: flex; align-items: center; justify-content: space-between; }

.logo {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  color: var(--color-accent);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}

.welcome__hero {
  margin: var(--space-8) auto 0;
  max-width: 560px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.welcome__hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}
.welcome__hero h1 em { font-style: italic; }

.lede { color: var(--color-muted); font-size: var(--text-md); max-width: 420px; }

.cta-row { display: flex; gap: var(--space-3); margin-top: var(--space-4); }

/* ---- Utility — number display (used later for codes) ---- */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Monospace with hard-wrap — SSH public keys, hashes, long tokens. */
.mono--wrap {
  font-family: var(--font-mono);
  word-break: break-all;
  white-space: pre-wrap;
}

/* Secondary text colour — used across push prompts, ws banners, sidebar,
   devices table. Keep in sync with the muted token for dark/light flip. */
.muted {
  color: var(--color-muted);
}

/* Two sub-variants of `.btn` for in-card density. `small` is the
   standard-density compact action; `tiny` sits inline with body text
   (e.g. the Reveal / Hide toggle on masked secret values). */
.btn--tiny {
  padding: 4px var(--space-2);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
}

.btn--small {
  padding: 7px var(--space-3);
  font-size: var(--text-sm);
}

.form-field small,
.form-help {
  color: var(--color-muted);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

.form-help {
  margin: calc(-1 * var(--space-2)) 0 0;
}

.forget-browser {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.forget-browser > .btn {
  justify-self: start;
}

.forget-browser__confirm {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.forget-browser__confirm h2 {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
}

.forget-browser__confirm p {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.forget-browser__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
