/* ============================================================================
   Barmaso — reset, typography and shared controls
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }

/* The browser hides [hidden] with display:none from its own stylesheet, which
   any class here outranks — .btn sets display:inline-flex, so a button hidden
   in JavaScript stayed on screen with the attribute set and nothing to show
   for it. Said once, here, rather than discovered again on the next screen. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* A tap on a phone used to leave a blue block sitting over whatever was
   pressed until the browser felt like clearing it. That is the browser's own
   highlight, and it is no use here: every button already says it was pressed
   by doing what it was pressed for. The keyboard ring stays -- it is
   :focus-visible below, which a tap does not trigger. */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Safari keeps its own grey wash on a pressed button unless told otherwise. */
button, a, label, summary, [role="button"], [role="tab"] {
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* The drawer takes over the viewport on phones; freezing the body underneath
   stops the page scrolling behind it. */
body.has-drawer-open { overflow: hidden; }

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* --- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--primary {
  background: var(--action);
  color: var(--action-ink);
}
.btn--primary:hover { background: var(--action-hover); }

.btn--outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}
.btn--outline:hover { border-color: var(--ink-faint); }

/* The third weight: a button that reads as a link, for the thing beside the
   primary that is worth offering and not worth shouting. */
.btn--ghost {
  border: 1px solid transparent;
  background: none;
  color: var(--ink-soft);
}
.btn--ghost:hover { background: var(--surface-alt); color: var(--ink); }
.btn--ghost.is-danger { color: var(--danger); }
.btn--ghost.is-danger:hover { background: var(--danger-soft); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* An error that names a command has to keep its line breaks, and the command
   has to be readable as one. */
.state-sub--pre {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  max-width: 46ch;
  margin-inline: auto;
}

/* A page fetched when opened (core/lazy.js): its holder takes no room of its own. */
.lazy-view { display: contents; }

/* A small button's two or three words stay on one line: broken in two, "ထည့်မည်"
   read as a broken button. A full-size button with a sentence on it — in a row
   of two on a phone — may still wrap; forcing those onto one line pushed the
   page sideways. */
.btn--sm { white-space: nowrap; }

/* Long tables fit the screen (app.js fitTables, 2026-10-31): headings pinned,
   the sideways bar at the bottom of the screen, and the rows scroll only once
   the box has reached the top — before that the page scrolls. */
.fit-screen {
  max-height: var(--fit-room, calc(100dvh - var(--fit-top, 0px) - 8px)) !important;
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-margin-top: var(--fit-top, 0px);
}
.fit-screen.is-docked { overflow-y: auto !important; }

.fit-screen thead { position: sticky; top: var(--fit-shift, 0px); z-index: 4; }
.fit-screen thead th { top: auto; }
.fit-solid-head thead th { background-color: var(--surface, #fff); }

/* Guidance text is off (config.js GUIDES_OFF): a hint left empty takes no room. */
.field-hint:empty, .rb-lede:empty, .ucx-hint:empty, .co-hint:empty, .rb-hint:empty,
.wr-hint:empty, .tgm-hint:empty, .scan-hint:empty, .op-file-hint:empty, .s2s-file-hint:empty,
.co-file-hint:empty, .op-card-hint:empty, .s2s-field-hint:empty, .sv-fact-hint:empty,
.wayc-lead:empty, .login-intro:empty, .form-note:empty, .state-sub:empty, .panel-sub:empty { display: none; }
