/* Peregrine Docs — single small stylesheet, no frameworks. */

:root {
  --ink: #16181d;
  --ink-soft: #5a616e;
  --line: #e6e8ec;
  --accent: #0f62fe;
  --accent-ink: #0043ce;
  --surface: #f6f7f9;
  --code-bg: #f0f2f5;
  --max: 1200px;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  line-height: 1.65;
  background: #fff;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Top bar ---------- */
.topbar { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 50; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.topbar__brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.topbar__brand:hover { text-decoration: none; }
.topbar__brand-sub { color: var(--accent); font-weight: 600; margin-left: 0.35rem; font-size: 0.9rem; }
.topbar__nav { display: flex; gap: 1.5rem; }
.topbar__nav a { color: var(--ink-soft); font-size: 0.9375rem; font-weight: 500; }
.topbar__nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------- Landing ---------- */
.hero { padding: 5rem 0 4rem; text-align: center; }
.hero h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 1rem; }
.hero p.lede { font-size: 1.1875rem; color: var(--ink-soft); max-width: 640px; margin: 0 auto 2rem; }
.hero__actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; padding: 0.7rem 1.4rem; border-radius: var(--radius); font-weight: 600; font-size: 0.9375rem; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); text-decoration: none; }
.btn--ghost { border: 1px solid var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink-soft); text-decoration: none; }

/* ---------- Support form ---------- */
.support-form { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin: 1.5rem 0 2.5rem; max-width: 640px; }
.support-form .form-row { margin-bottom: 1.1rem; }
.support-form label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
.support-form .label-optional { font-weight: 400; color: var(--ink-soft); }
.support-form input[type="text"],
.support-form input[type="email"],
.support-form select,
.support-form textarea { width: 100%; padding: 0.55rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; color: var(--ink); background: #fff; }
.support-form input:focus,
.support-form select:focus,
.support-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.15); }
.support-form textarea { resize: vertical; }
.support-form input[type="file"] { font-size: 0.9rem; }
.support-form .btn { border: 0; cursor: pointer; }
.form-hint { color: var(--ink-soft); font-size: 0.85rem; margin-top: 0.3rem; }
.field-error { display: block; color: #b3261e; font-size: 0.85rem; margin-top: 0.3rem; }
.field-error:empty { display: none; }
.form-alert { background: #fdeded; border: 1px solid #f2b8b5; border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1.1rem; font-size: 0.9375rem; }
.form-success { background: #edf7ed; border: 1px solid #b6dfb8; border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0 2.5rem; max-width: 640px; }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; padding: 2rem 0 4rem; }
.feature-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.feature-card h3 { font-size: 1.0625rem; margin-bottom: 0.5rem; letter-spacing: -0.01em; }
.feature-card p { font-size: 0.9375rem; color: var(--ink-soft); }
.feature-card a { font-size: 0.875rem; font-weight: 600; display: inline-block; margin-top: 0.75rem; }

/* ---------- Docs layout ---------- */
.docs-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 3rem; padding-top: 2.5rem; padding-bottom: 4rem; }

.docs-sidebar { position: sticky; top: 84px; align-self: start; }
.docs-sidebar__list { list-style: none; display: flex; flex-direction: column; gap: 0.125rem; }
.docs-sidebar__list a { display: block; padding: 0.4rem 0.75rem; border-radius: 6px; color: var(--ink-soft); font-size: 0.9375rem; }
.docs-sidebar__list a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.docs-sidebar__list a.is-active { background: var(--surface); color: var(--accent-ink); font-weight: 600; }

.docs-content { max-width: 760px; }
.docs-content h1 { font-size: 2rem; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.docs-content h2 { font-size: 1.4rem; letter-spacing: -0.01em; margin: 2.25rem 0 0.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.docs-content h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.docs-content h4 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
.docs-content .doc-note { font-size: 0.875rem; color: var(--ink-soft); }
.docs-content p { margin-bottom: 1rem; }
.docs-content ul, .docs-content ol { margin: 0 0 1rem 1.4rem; }
.docs-content li { margin-bottom: 0.375rem; }
.docs-content .lede { font-size: 1.0625rem; color: var(--ink-soft); margin-bottom: 1.5rem; }

.docs-content code {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.callout { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: 0.875rem 1.125rem; margin: 1.25rem 0; font-size: 0.9375rem; }
.callout--tip { border-left-color: #24a148; }
.callout strong { display: inline-block; }

.steps { counter-reset: step; list-style: none; margin-left: 0 !important; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.5rem; margin-bottom: 0.875rem; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.1rem;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; font-weight: 700; color: var(--accent-ink);
}

.setting-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.9rem; }
.setting-table th, .setting-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.setting-table th { font-weight: 600; background: var(--surface); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 2rem; }
.footer__inner { padding: 2rem 1.25rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-size: 0.875rem; color: var(--ink-soft); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .docs-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .docs-sidebar { position: static; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; }
  .docs-sidebar__list { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
  .topbar__nav { gap: 1rem; }
  .hero { padding: 3rem 0 2.5rem; }
}

/* Diagrams — inline SVG rather than screenshots.
   Screenshots of the Shopify admin go stale every time Shopify redesigns it,
   and a stale screenshot is worse than none: it sends a merchant to a panel
   that has moved. These draw arrangements and rules, which only change when
   the theme changes, and they inherit the page's own colours. */
.diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 1.5rem;
}
.diagram-grid--pair { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.diagram-grid figure { margin: 0; }
.diagram-grid svg {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.diagram-grid figcaption {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.4rem;
  text-align: center;
}
.diagram-grid figcaption strong { color: var(--ink); display: block; }

/* Shared SVG vocabulary, so every diagram reads the same way. */
.dg-frame { fill: #fff; stroke: var(--line); }
.dg-media { fill: #eceff3; stroke: #dadee5; }
.dg-thumb { fill: #cdd3dc; }
.dg-info  { fill: none; stroke: var(--line); stroke-dasharray: 3 3; }
.dg-line  { fill: #c9cfd8; }
.dg-text  { fill: #c9cfd8; }
.dg-accent { fill: var(--accent); }
.dg-crop  { fill: none; stroke: var(--accent); stroke-dasharray: 3 2; }

/* ---------- Home: pitch sections ---------- */
.pitch-heading { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.02em; text-align: center; margin-top: 2.5rem; }
.pitch-sub { color: var(--ink-soft); text-align: center; max-width: 680px; margin: 0.5rem auto 2rem; }
.pitch-note { color: var(--ink-soft); font-size: 0.875rem; text-align: center; max-width: 720px; margin: 1.25rem auto 3rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1rem; text-align: center; background: #fff; }
.stat__n { display: block; font-size: 2.25rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--accent-ink); }
.stat__n small { font-size: 1rem; font-weight: 600; margin-left: 0.1rem; }
.stat__l { display: block; margin-top: 0.5rem; font-size: 0.875rem; font-weight: 600; line-height: 1.3; }
.stat__l small { font-weight: 400; color: var(--ink-soft); }

.inventory { padding-bottom: 2rem; scroll-margin-top: 90px; }
.inventory__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.inventory__group { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; background: #fff; }
.inventory__group h3 { font-size: 1.0625rem; margin-bottom: 0.75rem; letter-spacing: -0.01em; }
.inventory__group ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.inventory__group li { font-size: 0.9375rem; color: var(--ink-soft); padding-left: 1.1rem; position: relative; line-height: 1.5; }
.inventory__group li::before { content: ""; position: absolute; left: 0; top: 0.6rem; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent); }
.inventory__group code { font-size: 0.85em; background: var(--code-bg); padding: 0.05rem 0.3rem; border-radius: 4px; }
.inventory__group > a { font-size: 0.875rem; font-weight: 600; display: inline-block; margin-top: 1rem; }

.proof { padding: 1rem 0 2rem; }
.proof__list { list-style: none; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.75rem; }
.proof__list li { border-left: 3px solid #24a148; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: 0.875rem 1.125rem; font-size: 0.9375rem; color: var(--ink-soft); }
.proof__list strong { color: var(--ink); }

.support-cta { padding: 1rem 0 4rem; }
.support-cta__box { border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem 1.5rem; text-align: center; background: var(--surface); }
.support-cta__box h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.support-cta__box p { color: var(--ink-soft); max-width: 640px; margin: 0 auto 1.5rem; }
