/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* KB article prose — mirrors the Starlight content area (SC-13009). Scoped to .kb-prose. */

.kb-prose {
  max-width: 52rem;
  font-size: 1rem;
  line-height: 1.75;
  color: #1e293b;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Headings */

.kb-prose h1,
.kb-prose h2,
.kb-prose h3,
.kb-prose h4,
.kb-prose h5,
.kb-prose h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
  color: #0f172a;
}

.kb-prose h1:first-child,
.kb-prose h2:first-child,
.kb-prose h3:first-child,
.kb-prose h4:first-child,
.kb-prose h5:first-child,
.kb-prose h6:first-child {
  margin-top: 0;
}

.kb-prose h1 { font-size: 2em; }
.kb-prose h2 { font-size: 1.5em; }
.kb-prose h3 { font-size: 1.25em; }
.kb-prose h4 { font-size: 1.1em; }
.kb-prose h5 { font-size: 1em; font-weight: 600; }
.kb-prose h6 { font-size: 0.9em; font-weight: 600; }

/* Paragraphs */

.kb-prose p {
  margin-top: 0;
  margin-bottom: 1.1em;
}

.kb-prose p:last-child {
  margin-bottom: 0;
}

/* Lists — restore what Tailwind preflight strips */

.kb-prose ul,
.kb-prose ol {
  margin-top: 0;
  margin-bottom: 1.1em;
  padding-left: 1.75em;
}

.kb-prose ul {
  list-style: disc;
}

.kb-prose ol {
  list-style: decimal;
}

.kb-prose li {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

.kb-prose li > ul,
.kb-prose li > ol {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

/* Links */

.kb-prose a {
  color: var(--color-blue-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.kb-prose a:hover {
  color: var(--color-blue-700);
}

/* Strong / em */

.kb-prose strong { font-weight: 700; }
.kb-prose em     { font-style: italic; }
.kb-prose del    { text-decoration: line-through; }

/* Horizontal rule */

.kb-prose hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 2em 0;
}

/* Blockquote */

.kb-prose blockquote {
  border-left: 4px solid #94a3b8;
  margin: 1.25em 0;
  padding: 0.5em 1em;
  color: #475569;
  background-color: #f8fafc;
  border-radius: 0 0.25rem 0.25rem 0;
}

.kb-prose blockquote p:last-child {
  margin-bottom: 0;
}

/* Inline code */

.kb-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875em;
  background-color: #f1f5f9;
  color: #0f172a;
  padding: 0.15em 0.35em;
  border-radius: 0.25rem;
  border: 1px solid #e2e8f0;
}

/* Block code — pre > code resets the inline treatment */

.kb-prose pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875em;
  background-color: #1e293b;
  color: #e2e8f0;
  border-radius: 0.375rem;
  padding: 1em 1.25em;
  overflow-x: auto;
  margin: 1.25em 0;
  line-height: 1.6;
}

.kb-prose pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  border: 0;
  font-size: 1em;
}

/* Tables */

.kb-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25em 0;
  font-size: 0.9375em;
}

.kb-prose thead {
  background-color: #f1f5f9;
}

.kb-prose th {
  font-weight: 700;
  text-align: left;
  padding: 0.6em 0.85em;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.kb-prose td {
  padding: 0.6em 0.85em;
  border: 1px solid #e2e8f0;
  vertical-align: top;
}

.kb-prose tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

/* Images */

.kb-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  display: block;
  margin: 1.25em 0;
}

/* Admonitions */

.kb-admonition {
  border-left: 4px solid;
  border-radius: 0.375rem;
  padding: 0.85em 1em;
  margin: 1.25em 0;
}

.kb-admonition-title {
  font-weight: 700;
  font-size: 0.9em;
  margin: 0 0 0.5em 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kb-admonition-content > *:first-child { margin-top: 0; }
.kb-admonition-content > *:last-child  { margin-bottom: 0; }

/* note — blue */
.kb-admonition-note {
  background-color: var(--color-blue-100);
  border-color: var(--color-blue-700);
}
.kb-admonition-note .kb-admonition-title {
  color: var(--color-blue-700);
}

/* tip — green */
.kb-admonition-tip {
  background-color: var(--color-green-100);
  border-color: var(--color-green-700);
}
.kb-admonition-tip .kb-admonition-title {
  color: var(--color-green-700);
}

/* caution — amber */
.kb-admonition-caution {
  background-color: var(--color-orange-100);
  border-color: var(--color-orange-700);
}
.kb-admonition-caution .kb-admonition-title {
  color: var(--color-orange-700);
}

/* danger — red */
.kb-admonition-danger {
  background-color: var(--color-red-100);
  border-color: var(--color-red-700);
}
.kb-admonition-danger .kb-admonition-title {
  color: var(--color-red-700);
}

/* Roomier horizontal gutter for article content inside the preview drawer.
   Applies to both the .kb-prose (draft-show inline surface, SC-13009) and
   the .lexxy-content (article-preview drawer, PR2). The DS drawer body's
   default padding (~14px) is tight for a 600px reading column; this widens
   it toward the Starlight content column. Scoped to the drawer, so inline
   padded-card surfaces are unaffected. */
.tw-drawer-body .kb-prose,
.tw-drawer-body .lexxy-content {
  padding-inline: 0.75rem;
}

/* Line-level highlighted diff (Gap 4). Scoped to .kb-diff*; uses the SAME DS
   color variables as the admonitions above so add/remove highlighting tracks the
   design tokens (with literal fallbacks for any token the bundle omits). */
.kb-diff {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  border: 1px solid var(--color-neutral-200, #e2e8f0);
  border-radius: 0.375rem;
  overflow-x: auto;
  max-height: 36rem;
  overflow-y: auto;
}
.kb-diff-line {
  display: flex;
  padding-inline: 0.5rem;
}
.kb-diff-gutter {
  flex: 0 0 1.25rem;
  color: var(--color-neutral-500, #64748b);
  user-select: none;
}
.kb-diff-text {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}
.kb-diff-line-added {
  background-color: var(--color-green-100, #dcfce7);
}
.kb-diff-line-removed {
  background-color: var(--color-red-100, #fee2e2);
}
.kb-diff-line-context {
  color: var(--color-neutral-700, #334155);
}

/* Top-nav active state (EPIC E Gap 2). The DS .tw-btn-tertiary nav links are
   transparent with primary text and carry no current-page treatment, so the
   active section was indistinguishable. nav_link_to adds .kb-nav-link to every
   link and aria-current="page" to the current one; this gives that one a subtle
   filled pill built from DS color tokens. */
.kb-nav-link[aria-current="page"] {
  background-color: var(--tw-color-blue-100, #dfebfe);
  color: var(--tw-color-blue-700, #0948cf);
  font-weight: 600;
}

/* Mobile-responsive top-nav (EPIC E Gap 3). Pure-CSS disclosure: a visually
   hidden checkbox toggled by the hamburger <label>. The links are siblings of
   the checkbox (not inside a collapsing element), so desktop paints them inline
   and the hamburger is hidden; below 768px the links hide and drop down below
   the topbar when the box is checked.

   NOTE: every display rule is scoped under .kb-nav (raising specificity to
   0-2-0) because design-system.css loads AFTER application.css, so the DS
   single-class rules .tw-btn (on the label) and tw:flex (on the nav) would
   otherwise win on source order and defeat the collapse. */
.kb-nav { position: relative; }
.kb-nav .kb-nav-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.kb-nav .kb-nav-toggle { display: none; }
.kb-nav .kb-nav-links { display: flex; }

@media (max-width: 767px) {
  .kb-nav .kb-nav-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
  }
  .kb-nav .kb-nav-links { display: none; }
  .kb-nav .kb-nav-checkbox:checked ~ .kb-nav-links {
    display: flex;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    z-index: 50;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    min-width: 12rem;
    padding: 0.5rem;
    background-color: var(--tw-color-white, #fff);
    border: 1px solid var(--tw-color-neutral-200);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.08);
  }
}

/* Video embeds — responsive 16:9 */

.kb-embed {
  position: relative;
  padding-top: 56.25%;
  width: 100%;
  border-radius: 0.375rem;
  overflow: hidden;
  margin: 1.25em 0;
}

.kb-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Tom Select theming — align the section/subsection typeahead with the DS
   form-select look (border, radius, focus ring, active option). Scoped to
   .ts-* so it only touches the enhanced control. */

.ts-wrapper {
  width: 100%;
}

.ts-control {
  min-height: 2.5rem;
  padding: 0.4rem 0.625rem;
  border: 1px solid var(--color-neutral-300, #d4d4d4);
  border-radius: 0.375rem;
  background-color: var(--color-white, #fff);
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: none;
}

.ts-wrapper.focus .ts-control,
.ts-control:focus-within {
  border-color: var(--color-blue-700, #1d4ed8);
  outline: 2px solid color-mix(in oklab, var(--color-blue-700, #1d4ed8) 30%, transparent);
  outline-offset: 1px;
}

.ts-dropdown {
  border: 1px solid var(--color-neutral-200, #e5e5e5);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.08);
  font-size: 0.95rem;
}

.ts-dropdown .optgroup-header {
  font-weight: 600;
  color: var(--color-neutral-500, #737373);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ts-dropdown .option.active,
.ts-dropdown .option:hover {
  background-color: var(--color-blue-100, #dbeafe);
  color: var(--color-blue-700, #1d4ed8);
}
