/* ============================================================
   Shared primitives for both dataroom apps.

   The brand grammar from assets/site.css, expressed as reusable
   classes rather than page-specific rules: 1px rules do the
   separating, mono micro-labels do the labelling, headings are
   ultralight with one bold fragment, and there is exactly one accent.

   No bare element selectors beyond the document defaults — the whole
   reason this app does not link site.css is that site.css styles `nav`
   and `footer` themselves.
   ============================================================ */

/* Every size in this app is in rem, and the scale was drawn against the
   browser's 16px default — which put 32 declarations under 12px and the
   smallest chrome labels at 9.9px. At that size a mono face with wide
   letter-spacing on a dark ground reads as blurry rather than small.
   Moving the root to 18px lifts the whole scale by an eighth without
   touching the proportions between any two elements. One number: raise
   or lower it here rather than editing sizes individually. */
html {
  font-size: 112.5%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  /* Deliberately NOT -webkit-font-smoothing: antialiased. That disables
     subpixel rendering and makes light-on-dark text thinner still, which
     is the opposite of what small chrome labels need. */
}

img { max-width: 100%; }

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

:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 3px;
}

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

/* ---------- type ---------- */

.dr-eyebrow,
.dr-mono {
  font-family: var(--mono);
  font-size: 0.70rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.dr-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
}
.dr-eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: currentColor;
}

/* ---------- buttons ---------- */

.dr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 9px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.dr-btn:hover { border-color: var(--ink-faint); }
.dr-btn:disabled { opacity: 0.5; cursor: default; }

.dr-btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.dr-btn-primary:hover:not(:disabled) { background: var(--blue-d); border-color: var(--blue-d); }

.dr-btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-mid);
  padding: 7px 10px;
}
.dr-btn-quiet:hover { background: var(--bg-off); border-color: var(--rule); }

.dr-btn-danger { color: #9b1c1c; }
.dr-btn-danger:hover { background: #fdf2f2; border-color: #e7c3c3; }

.dr-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: none;
  color: var(--ink-mid);
  cursor: pointer;
}
.dr-icon-btn:hover { background: var(--bg-off); border-color: var(--rule); color: var(--ink); }

/* ---------- form controls ---------- */

.dr-field { display: block; margin-bottom: 16px; }
.dr-field > label {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 7px;
}

.dr-field input,
.dr-field select,
.dr-field textarea,
.dr-input {
  width: 100%;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 9px 11px;
  transition: border-color 0.18s var(--ease);
}
.dr-field input:focus,
.dr-field select:focus,
.dr-field textarea:focus { border-color: var(--blue); outline: none; }
.dr-field textarea { resize: vertical; min-height: 76px; line-height: 1.55; }

/* ---------- chips ---------- */

.dr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  color: var(--ink-mid);
  white-space: nowrap;
}
.dr-chip.is-good { color: #1a7a4a; border-color: #bfe0cd; background: #f1f9f4; }
.dr-chip.is-warn { color: #b3831a; border-color: #ecdcb4; background: #fdf8ec; }
.dr-chip.is-bad  { color: #9b1c1c; border-color: #e7c3c3; background: #fdf2f2; }

/* ---------- colour dot ---------- */

.dr-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* ---------- right-click menu ---------- */

.ctx-menu { position: fixed; min-width: 194px; }
.ctx-menu button.is-danger { color: #9b1c1c; }
.ctx-menu button.is-danger:hover { background: #fdf2f2; }
.ctx-menu button:disabled { opacity: 0.4; cursor: default; }

.ctx-sep { height: 1px; background: var(--rule); margin: 5px 0; }

.ctx-group { padding: 8px 10px 10px; }
.ctx-group-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 9px;
}

/* An even 6 x 3 for the 18 swatches. */
.ctx-menu .ctx-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

/* The selectors here are deliberately two classes deep: .blk-menu button
   sets width:100%, and a swatch that inherits that renders as a
   full-width bar instead of a dot. */
.ctx-menu .ctx-swatch {
  width: 20px;
  height: 20px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.16);
  background-clip: padding-box;
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.ctx-menu .ctx-swatch:hover { transform: scale(1.2); }
.ctx-menu .ctx-swatch.is-active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--ink);
}
/* "None" reads as a struck-through ring rather than a white dot. */
.ctx-menu .ctx-swatch.is-none {
  background:
    linear-gradient(45deg, transparent 43%, var(--ink-faint) 43%, var(--ink-faint) 57%, transparent 57%),
    #fff;
}

/* ---------- misc ---------- */

.dr-empty {
  font-size: 0.9rem;
  color: var(--ink-faint);
  padding: 40px 0;
  text-align: center;
}

.dr-error {
  font-size: 0.82rem;
  color: #9b1c1c;
  background: #fdf2f2;
  border: 1px solid #e7c3c3;
  border-radius: var(--r);
  padding: 10px 12px;
}

.dr-dots { background-image: var(--dots); background-size: var(--dots-size); }
.dr-dots-dark { background-image: var(--dots-dark); background-size: var(--dots-size); }

/* Thin scrollbars so the panes read as panels rather than windows. */
.dr-scroll { overflow-y: auto; scrollbar-width: thin; }
.dr-scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.dr-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.16);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}
.dr-scroll::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); background-clip: content-box; }

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