/* Polaris user documentation — shared styles.
   Light/dark is driven by the `dark` class on <html> (see theme.js), mirroring
   the Polaris app itself. Works standalone (open the HTML in a tab) or embedded
   inline (load a page in an iframe inside an in-app help panel). */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e3e7ef;
  --text: #1f2533;
  --text-muted: #5b6478;
  --heading: #15224b;
  --brand: #101f64; /* Polaris navy — matches the app logo/wordmark */
  --accent: #3b5bdb;
  --accent-weak: #e8edff;
  --switch-off: #cbd2e0; /* PrimeVue ToggleSwitch track, unchecked */
  --switch-knob: #ffffff;
  --shadow: 0 1px 3px rgba(20, 34, 75, 0.08), 0 8px 24px rgba(20, 34, 75, 0.06);
  --radius: 12px;
  --maxw: 920px;
  --topbar-h: 61px; /* rendered height of the sticky .topbar */
}

html.dark {
  --bg: #0f1117;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --text-muted: #9aa3b5;
  --heading: #e9ecf5;
  --brand: #ffffff; /* logo inverts to white in dark mode, as in the app */
  --accent: #6b8afd;
  --accent-weak: #1c2440;
  --switch-off: #3a4150;
  --switch-knob: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    'Inter',
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  text-decoration: none;
}
.topbar .brand .brand-star {
  color: var(--brand);
  display: block;
}
.topbar .brand .brand-word {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-size: 16px;
  line-height: 1;
}
.topbar .spacer {
  flex: 1;
}
.topbar a.home {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}
.topbar a.home:hover {
  color: var(--accent);
}

/* Theme switch — mirrors the app's Settings → Appearance control:
   sun icon · PrimeVue-style ToggleSwitch · moon icon. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
}
.theme-toggle .ti {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .switch {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--switch-off);
  transition: background 0.18s ease;
  flex: none;
}
.theme-toggle .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--switch-knob);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}
html.dark .theme-toggle .switch {
  background: var(--accent);
}
html.dark .theme-toggle .knob {
  transform: translateX(16px);
}
.theme-toggle:hover .switch {
  filter: brightness(0.97);
}

/* In-guide search (injected into the top bar by search.js) */
.docsearch {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.docsearch-ico {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.docsearch-input {
  width: 270px;
  max-width: 40vw;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.docsearch-input:focus {
  border-color: var(--accent);
}
.docsearch-input::placeholder {
  color: var(--text-muted);
}
.docsearch-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-width: 80vw;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 50;
}
.docsearch-hit {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
}
.docsearch-hit:hover,
.docsearch-hit.on {
  background: var(--accent-weak);
}
.docsearch-hit .t {
  display: block;
  font-weight: 600;
  color: var(--heading);
  font-size: 14px;
}
.docsearch-hit .ctx {
  display: block;
  font-size: 12px;
  color: var(--accent);
  margin-top: 1px;
}
.docsearch-hit .s {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.45;
}
.docsearch-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Headings & text */
/* Anchored headings (e.g. opened from search) clear the sticky top bar instead
   of landing hidden behind it. Using scroll-margin on the targets — not
   scroll-padding on the document scroller — avoids the page scrolling while you
   type in the top-bar search input. */
h1[id],
h2[id],
h3[id] {
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
h1 {
  color: var(--heading);
  font-size: 30px;
  margin: 28px 0 6px;
  letter-spacing: -0.01em;
}
h2 {
  color: var(--heading);
  font-size: 21px;
  margin: 40px 0 10px;
}
h3 {
  color: var(--heading);
  font-size: 17px;
  margin: 24px 0 6px;
}
p {
  margin: 10px 0;
}
.lead {
  font-size: 18px;
  color: var(--text-muted);
  margin-top: 4px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
a {
  color: var(--accent);
}
code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

/* Steps */
ol.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 16px 0;
}
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 4px 0 14px 44px;
  margin: 0;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
ol.steps > li strong {
  color: var(--heading);
}

ul.tips {
  padding-left: 20px;
}
ul.tips li {
  margin: 6px 0;
}

/* Figure / screenshots */
figure {
  margin: 18px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
figure img {
  display: block;
  width: 100%;
  height: auto;
}
figcaption {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* Callout */
.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-weak);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 18px 0;
  font-size: 15px;
}
.note strong {
  color: var(--heading);
}

/* Card grid (index) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card .num {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.card h3 {
  margin: 6px 0 4px;
}
.card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* Prev/next nav */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.pager a {
  text-decoration: none;
  font-size: 14px;
}
.pager .nxt {
  margin-left: auto;
  text-align: right;
}

/* When embedded inline, the host can add .embedded to hide chrome */
html.embedded h1[id],
html.embedded h2[id],
html.embedded h3[id] {
  scroll-margin-top: 8px; /* no sticky top bar when embedded */
}
html.embedded .topbar {
  display: none;
}
html.embedded .pager {
  display: none;
}
html.embedded .wrap {
  padding-top: 8px;
}
