/* Inshipia Security Gateway — documentation portal stylesheet.
 *
 * OFFLINE BY CONSTRUCTION. Every font this file names is vendored next to it
 * under fonts/ and referenced by a relative URL. There is deliberately NO
 * reference to a web-font CDN, or to any other network origin, anywhere in the
 * generated output — the portal is shipped to air-gapped customer environments
 * where a remote asset is not "slow", it is a blank page. internal/docsgen's
 * site test greps the whole generated tree for the usual font-hosting
 * hostnames and fails on a hit, so the promise is enforced and not merely
 * intended. (Which is also why this comment does not spell those hostnames
 * out: the assertion covers the stylesheet too.)
 *
 * The fonts are IBM Plex Sans and IBM Plex Mono, SIL Open Font License 1.1 —
 * the license text ships beside them as fonts/OFL.txt.
 *
 * THE PALETTE IS MEASURED FROM THE LOGO, and is not up for casual adjustment:
 * violet → indigo → blue are the three columns of the mark, and they appear
 * together in exactly one place, the 3px rule under the header, on the same
 * left-to-right axis as the mark itself. The site test asserts the six key
 * hexes are still here, so a drift from the approved theme fails the build
 * instead of quietly shipping.
 */

/* ------------------------------------------------------------------ fonts */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/IBMPlexMono-SemiBold.woff2") format("woff2");
}

/* --------------------------------------------------------------- palette */

:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  /* the three columns of the mark */
  --violet: #633d8e;
  --indigo: #4c55a0;
  --blue: #3f63ac;

  --bg-page: #eceef4;
  --bg: #ffffff;
  --bg-subtle: #f4f5f9;
  --bg-code: #f4f5f9;
  --surface: #ffffff;

  --text: #1c1f2b;
  --text-muted: #5b6070;
  --text-faint: #8a90a0;

  --border: #e3e5ec;
  --border-strong: #d8dbe4;

  --accent: #3a5c9f;
  --accent-hover: #4c55a0;
  --nav-active: #3a5c9f;
  --nav-active-border: #4c55a0;

  --header-bg: #1c1f2b;
  --header-text: #ffffff;

  /* the logo's own gradient, read by the inline SVG's <stop> elements */
  --logo-from: #633d8e;
  --logo-to: #3f63ac;

  --note: #3f63ac;
  --note-title: #3a5c9f;
  --tip: #633d8e;
  --tip-title: #633d8e;
  --warning: #b3720c;
  --warning-title: #b3720c;
  --danger: #a8253f;
  --danger-title: #a8253f;

  /* the search hit's highlight: the violet of the mark at low opacity, so it
   * reads as this theme's own colour and not as a browser default yellow */
  --mark-bg: rgba(99, 61, 142, 0.20);

  --header-h: 51px;
  --sidebar-w: 232px;
  --toc-w: 200px;
  --content-max: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #131620;
    --bg: #131620;
    --bg-subtle: #1a1e2b;
    --bg-code: #1a1e2b;
    --surface: #1a1e2b;

    --text: #dfe3ec;
    --text-muted: #9aa1b4;
    --text-faint: #8a90a0;

    --border: #262b3a;
    --border-strong: #262b3a;

    --accent: #8ea9e0;
    --accent-hover: #8ea9e0;
    --nav-active: #8ea9e0;
    --nav-active-border: #6c7cc4;

    --header-bg: #14161f;

    /* the same mark, lifted off the dark page — the light pair goes muddy
     * against #131620, so the gradient gets its own dark-mode stops rather
     * than a second copy of the SVG. */
    /* the light-mode violet wash goes to mud on the dark page; the dark-mode
     * accent at a similar weight keeps the hit legible without glowing */
    --mark-bg: rgba(142, 169, 224, 0.28);

    --logo-from: #8a5fbd;
    --logo-to: #5c86d6;

    --note-title: #8ea9e0;
    --tip-title: #b39ae0;
    --warning-title: #e0a94f;
    --danger-title: #e08a9c;
  }
}

/* ----------------------------------------------------------------- reset */

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

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

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------------------------------------------------------------- chrome */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  color: var(--header-text);
}

/* The gradient rule belongs to the header, not to the page above it: it is
 * positioned on the header's bottom edge so the two travel together while the
 * header is stuck to the top of the viewport. */
.accent-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--indigo) 55%, var(--blue) 100%);
}

/* The header's one row: the mark on the left, the language switcher on the
 * right, both inside the same centred column the content uses — so the two
 * stay aligned with the page rather than with the viewport edges. */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--header-text);
  font-size: 15px;
  font-weight: 600;
}
.brand:hover { text-decoration: none; color: var(--header-text); }

.brand-mark { flex: none; display: block; }
.logo-stop-from { stop-color: var(--logo-from); }
.logo-stop-to { stop-color: var(--logo-to); }

.brand-text { letter-spacing: -0.01em; }

/* The language switcher. The inactive language is dimmed rather than hidden or
 * greyed to the point of looking disabled: it is the control's only purpose,
 * and a reader who wants it is looking for it. The active one is underlined in
 * the mark's blue, which is the same way the nav marks the page you are on. */
.langswitch {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.langswitch-link {
  color: var(--header-text);
  opacity: 0.55;
  padding: 2px 5px;
  border-radius: 4px;
}
.langswitch-link:hover { color: var(--header-text); opacity: 1; text-decoration: none; }
.langswitch-link.is-active {
  opacity: 1;
  box-shadow: inset 0 -2px 0 var(--blue);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1400px;
  margin: 0 auto;
  background: var(--bg);
  align-items: start;
}

/* --------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 4px);
  max-height: calc(100vh - var(--header-h) - 8px);
  overflow-y: auto;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  font-size: 13px;
  line-height: 2;
}

/* ---------------------------------------------------------------- search */

/* The field, the result list and everything in them are inserted by
 * assets/search.js — see the top of that file for why they are not in the
 * layout. These rules therefore style elements that simply do not exist on a
 * page whose script did not run, which costs nothing and is the point. */

.search { margin: 0 0 18px; }

.search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 9px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
}

.search-input::placeholder { color: var(--text-faint); }
.search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

.search-results { margin-top: 10px; line-height: 1.45; }

.search-message { margin: 6px 2px; font-size: 12px; color: var(--text-faint); }

/* One row per matching section, carrying the same 3px rail as a nav link so
 * the results read as part of the navigation rather than as a panel dropped
 * on top of it. */
.search-hit {
  display: block;
  margin-left: -16px;
  padding: 5px 8px 6px 13px;
  border-left: 3px solid transparent;
  color: var(--text-muted);
}
.search-hit:hover {
  text-decoration: none;
  background: var(--bg-subtle);
  border-left-color: var(--nav-active-border);
}

.search-hit-page {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.search-hit-section {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.search-hit-context {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.search-hit-context mark {
  background: var(--mark-bg);
  color: inherit;
  border-radius: 2px;
}

.nav-section + .nav-section { margin-top: 14px; }

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list li { margin: 0; }

/* Every link carries the 3px rail, transparent until the page is the current
 * one — so marking a page active moves no text sideways. The negative margin
 * pulls the rail out to the sidebar's own edge. */
.nav-link {
  display: block;
  margin-left: -16px;
  padding-left: 13px;
  border-left: 3px solid transparent;
  color: var(--text-muted);
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link.is-active {
  color: var(--nav-active);
  border-left-color: var(--nav-active-border);
  font-weight: 600;
}

/* --------------------------------------------------------- on this page */

.onthispage {
  position: sticky;
  top: calc(var(--header-h) + 4px);
  max-height: calc(100vh - var(--header-h) - 8px);
  overflow-y: auto;
  padding: 24px 16px;
  font-size: 12px;
  line-height: 2;
  color: var(--text-faint);
}

.onthispage-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.onthispage-list { list-style: none; margin: 0; padding: 0; }
.onthispage-list li { margin: 0; }
.onthispage-list a { display: block; color: var(--text-faint); }
.onthispage-list a:hover { color: var(--accent); text-decoration: none; }

/* --------------------------------------------------------------- content */

.content {
  min-width: 0;
  max-width: var(--content-max);
  padding: 24px 28px 48px;
}

.content h1, .content h2, .content h3, .content h4 {
  font-weight: 600;
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.content h1 { font-size: 26px; letter-spacing: -0.015em; margin: 0 0 14px; }
.content h2 {
  font-size: 18px;
  margin: 28px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.content h3 { font-size: 16px; margin: 22px 0 8px; }
.content h4 { font-size: 14px; margin: 18px 0 6px; color: var(--text-muted); }

.content p { margin: 0 0 12px; }
.content ul, .content ol { margin: 0 0 12px; padding-left: 22px; }
.content li { margin: 3px 0; }

.content hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }

.content blockquote {
  margin: 0 0 14px;
  padding: 2px 16px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- figures */

/* The diagrams are hand-written SVG that carries its own light background, so
 * the frame is what stops one from floating on the page — a border and a
 * surface, the same pair the code blocks and tables use. max-width keeps a
 * diagram inside the column on a narrow viewport instead of forcing the whole
 * page to scroll sideways; height:auto is what keeps it from being squashed
 * while it does so. */
.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 16px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ------------------------------------------------------------------ code */

.content code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-code);
  border-radius: 3px;
  padding: 1px 4px;
}

.content pre {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 14px;
  line-height: 1.55;
}
.content pre code {
  background: none;
  border-radius: 0;
  padding: 0;
}

/* ---------------------------------------------------------------- tables */

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}

.content th, .content td {
  border: 1px solid var(--border);
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
}

.content th {
  background: var(--bg-subtle);
  font-weight: 600;
  white-space: nowrap;
}

.content tbody tr:nth-child(even) { background: var(--bg-subtle); }

/* ---------------------------------------------------------- admonitions */

.admonition {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-subtle);
  font-size: 13px;
}
.admonition > :last-child { margin-bottom: 0; }
.admonition-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.admonition.note { border-left-color: var(--note); }
.admonition.note .admonition-title { color: var(--note-title); }
.admonition.tip { border-left-color: var(--tip); }
.admonition.tip .admonition-title { color: var(--tip-title); }
.admonition.warning { border-left-color: var(--warning); }
.admonition.warning .admonition-title { color: var(--warning-title); }
.admonition.danger { border-left-color: var(--danger); }
.admonition.danger .admonition-title { color: var(--danger-title); }

/* The notice on a page published in a language it does not have its own text
 * in — either not translated yet, or English on purpose. It sits ABOVE the
 * first heading and is spaced away from it, because its job is to be read
 * before the text underneath — a reader who takes English prose for a
 * translation has been misled by us, not by the page. */
.translation-note { margin-bottom: 22px; }

/* ---------------------------------------------------------------- footer */

.site-footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 28px 40px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .onthispage { display: none; }
}

@media (max-width: 840px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .content { padding: 20px 20px 40px; }
  .brand { padding: 12px 16px; }
}

@media print {
  .sidebar, .onthispage, .site-header, .search { display: none; }
  .layout { display: block; }
  .content { max-width: none; padding: 0; }
}
