/* MAVX — the handful of rules Tailwind utilities can't express.
   Everything else is Tailwind classes in the markup.
   Loaded AFTER tailwind.css, so plain declarations win on equal specificity —
   the play-CDN-era !important flags are gone. */

::selection { background: rgba(59, 78, 219, 0.16); }
/* Reserve a scrollbar strip on pages whose document scrolls, so toggling page
   height across the scrollbar threshold does not shift content sideways.
   Shell pages (org/worker, `h-dvh` + `overflow-hidden`) never scroll the
   document — their column scrolls inside — so the reservation there is just a
   phantom gap on the right edge of every app screen. They opt out via
   `data-app-shell` (set through base.html's `html_attrs` block). */
html { scrollbar-gutter: stable; }
html[data-app-shell] { scrollbar-gutter: auto; }

/* Tailwind preflight's [hidden]{display:none} loses to display utilities like .flex
   (equal specificity, utilities come later). Alpine's x-show and every hidden-attribute
   toggle depend on this winning. Keep the !important. */
[hidden] { display: none !important; }

/* Alpine: prevent the flash of un-initialised markup before x-data evaluates. */
[x-cloak] { display: none !important; }

/* Scroll reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* FAQ accordion: animating grid-template-rows gives a smooth open with no layout pop */
[data-faq-panel] {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .34s cubic-bezier(.16,1,.3,1);
}
.is-open [data-faq-panel] { grid-template-rows: 1fr; }
[data-faq-panel] > * { overflow: hidden; }
[data-faq-sign] { transition: transform .3s cubic-bezier(.16,1,.3,1); }
.is-open [data-faq-sign] { transform: rotate(45deg); }

/* Reason chip selected state */
.reason-chip.is-selected { background: #A32020; border-color: #A32020; color: #fff; }

/* Tab active states */
[data-tab] { color: #64748B; font-weight: 500; border-bottom-color: transparent; }
[data-tab].is-active { color: #0F172A; font-weight: 700; border-bottom-color: #3B4EDB; }

[data-doc-tab] { color: #9AA0AC; background: transparent; }
[data-doc-tab].is-active { color: #FFFFFF; background: #23262E; }

/* HTMX: fade the swap target while a request is in flight */
.htmx-request[data-swap-fade] { opacity: .55; transition: opacity .15s ease; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  [data-faq-panel], [data-faq-sign] { transition: none; }
}

/* Org sidebar collapse. The state lives on <html data-nav> and is written by
   an inline script in base.html before first paint, so a reload of a collapsed
   nav never flashes open. Only applies at the width where the sidebar is a
   column; below lg it is a horizontal strip and collapsing means nothing. */
@media (min-width: 1024px) {
  [data-nav="collapsed"] .nav-shell { width: 4rem; }
  /* Visually hidden, not display:none — a collapsed icon link must keep an
     accessible name, and display:none takes it out of the a11y tree. */
  [data-nav="collapsed"] .nav-label {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  [data-nav="collapsed"] .nav-aside-only { display: none; }
  [data-nav="collapsed"] .nav-brand { justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; }
  [data-nav="collapsed"] .nav-row {
    position: relative;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
  /* The unread dot is ml-auto in the open rail, which also shoves the icon
     left once the label is out of flow. Pull it out of the flex line so the
     icon stays centered and the dot sits inset from the right edge. */
  [data-nav="collapsed"] #nav-unread-dot {
    position: absolute;
    top: 50%;
    right: 8px;
    margin-left: 0;
    transform: translateY(-50%);
  }
  [data-nav="collapsed"] .nav-account { justify-content: center; padding-left: 0; padding-right: 0; }
}
.nav-shell { transition: width .18s cubic-bezier(.16, 1, .3, 1); }
@media (prefers-reduced-motion: reduce) { .nav-shell { transition: none; } }
