/* ============================================================================
   OpsWiki — Reset, typography, layout primitives
   ========================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--med), color var(--med);
}

::selection { background: var(--red); color: #fff; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.15;
  color: var(--ink);
}

h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.02rem; }

p  { color: var(--ink-soft); }
a  { color: var(--red); text-decoration: none; transition: color var(--fast); }
a:hover { color: var(--red-bright); }

code, kbd, pre, .mono {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  background: var(--code-bg);
  padding: 0.14em 0.42em;
  border-radius: 5px;
  border: 1px solid var(--line-soft);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
}
pre code { background: none; border: none; padding: 0; }

kbd {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--ink-soft);
  white-space: nowrap;
}

hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

img, video { max-width: 100%; height: auto; display: block; }

/* ---------------------------------------------------------------------------
   Default icon size.

   Icons are generated as inline <svg viewBox="0 0 24 24"> with no width or
   height attributes. Without a rule, a browser falls back to roughly 300x150px
   — so any icon whose parent lacked a specific size rule rendered enormous and
   blew out the page width.

   Specificity here is deliberately the lowest possible (0,0,1) so every
   contextual rule (.btn svg, .nav-item svg, .badge svg …) still wins.
   --------------------------------------------------------------------------- */
svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* The Opsynth mark fills whatever box it is given, rather than taking the
   icon default. Sized by its container. */
.ow-logo { width: 100%; height: 100%; }

ul, ol { padding-left: 1.3em; }
li { margin: 0.25em 0; }

blockquote {
  border-left: 3px solid var(--red);
  padding: 4px 0 4px 16px;
  margin: 14px 0;
  color: var(--ink-soft);
  font-style: italic;
}

table { border-collapse: collapse; width: 100%; }

/* Everything wide scrolls inside its own box — the page body never does. */
.scroll-x { overflow-x: auto; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Scrollbars ------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); background-clip: content-box; }


/* ============================================================================
   Layout primitives
   ========================================================================== */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 24px; }

.row    { display: flex; align-items: center; gap: 10px; }
.row-t  { display: flex; align-items: flex-start; gap: 10px; }
.col    { display: flex; flex-direction: column; gap: 10px; }
.wrap   { flex-wrap: wrap; }
.between{ justify-content: space-between; }
.center { justify-content: center; }
.grow   { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }

.mt-4{margin-top:4px}  .mt-8{margin-top:8px}   .mt-12{margin-top:12px}
.mt-16{margin-top:16px} .mt-24{margin-top:24px} .mt-32{margin-top:32px}
.mb-4{margin-bottom:4px} .mb-8{margin-bottom:8px} .mb-12{margin-bottom:12px}
.mb-16{margin-bottom:16px} .mb-24{margin-bottom:24px}

.hide { display: none !important; }

/* Secondary detail that gets in the way on narrow screens — tag chips on list
   rows, the inline password column in the vault. */
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
}

/* Type helpers ----------------------------------------------------------- */
.t-display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; }
.t-mono    { font-family: var(--font-mono); }
.t-mute    { color: var(--ink-mute); }
.t-faint   { color: var(--ink-faint); }
.t-soft    { color: var(--ink-soft); }
.t-red     { color: var(--red); }
.t-xs { font-size: 0.75rem; }
.t-sm { font-size: 0.84rem; }
.t-lg { font-size: 1.08rem; }
.t-bold { font-weight: 700; }
.t-med  { font-weight: 600; }
.t-upper { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; font-weight: 700; }
.t-center { text-align: center; }
.t-right  { text-align: right; }

.truncate {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.clamp-3 {
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}


/* ============================================================================
   Boot screen — shown until app.js takes over
   ========================================================================== */
.boot-screen {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  background: var(--page-wash);
}

.boot-logo {
  width: 56px; height: 56px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--bg-pure) 0 20%, transparent 21%),
    conic-gradient(from 180deg, var(--red) 0deg 180deg, transparent 180deg),
    var(--ink);
  box-shadow: 0 12px 32px -8px var(--red-glow);
  animation: boot-spin 1.1s var(--ease) infinite;
}

@keyframes boot-spin {
  0%   { transform: rotate(0deg)   scale(1);    opacity: 1; }
  50%  { transform: rotate(180deg) scale(0.92); opacity: 0.75; }
  100% { transform: rotate(360deg) scale(1);    opacity: 1; }
}

.boot-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
