/* ---------- Design tokens ---------- */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #ffffff;
  --bg-raised: #fafafa;
  --bg-inset: #f3f4f6;
  --border: #e5e7eb;
  --text: #18181b;
  --heading: #333333;
  --text-body: #52525b;
  --header-bg: #f4f5f7;
  --search-bg: rgba(0, 0, 0, 0.05);
  --search-border: rgba(0, 0, 0, 0.08);
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --accent: #3c6ef6;
  --accent-hover: #2f57c9;
  --accent-tint: #eef3ff;
  --code-bg: #37474f;
  --code-text: #eceff1;
  --note-border: #3c6ef6;
  --note-bg: #eef3ff;
  --tip-border: #16a34a;
  --tip-bg: #ecfdf3;
  --warn-border: #d97706;
  --warn-bg: #fffaeb;
  --shadow: 0 8px 30px rgba(20, 20, 30, 0.08);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0c;
    --bg-raised: #131418;
    --bg-inset: #1a1b21;
    --border: #26272e;
    --text: #e7e8ea;
    --heading: #fafafa;
    --text-body: #b4b8bf;
    --header-bg: #131418;
    --search-bg: rgba(255, 255, 255, 0.05);
    --search-border: rgba(255, 255, 255, 0.08);
    --text-muted: #9aa0aa;
    --text-faint: #6b7280;
    --accent: #6b8af1;
    --accent-hover: #8ba3f5;
    --accent-tint: #182140;
    --note-border: #6b8af1;
    --note-bg: #131a33;
    --tip-border: #34d399;
    --tip-bg: #0f2419;
    --warn-border: #f0b429;
    --warn-bg: #2b2210;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0c;
  --bg-raised: #131418;
  --bg-inset: #1a1b21;
  --border: #26272e;
  --text: #e7e8ea;
  --heading: #fafafa;
  --text-body: #b4b8bf;
  --header-bg: #131418;
  --search-bg: rgba(255, 255, 255, 0.05);
  --search-border: rgba(255, 255, 255, 0.08);
  --text-muted: #9aa0aa;
  --text-faint: #6b7280;
  --accent: #6b8af1;
  --accent-hover: #8ba3f5;
  --accent-tint: #182140;
  --note-border: #6b8af1;
  --note-bg: #131a33;
  --tip-border: #34d399;
  --tip-bg: #0f2419;
  --warn-border: #f0b429;
  --warn-bg: #2b2210;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* ---------- Reset-ish base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--text-muted);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--header-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 60px;
  padding: 0 1.25rem;
  /* Logo | search | actions: equal outer columns keep search truly centred. */
  display: grid;
  grid-template-columns: 1fr minmax(0, 440px) 1fr;
  align-items: center;
  gap: 1.25rem;
}
.site-header__brand { display: flex; align-items: center; gap: 0.75rem; }
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }
/* The Minamo logo: wordmark and ripple mark both follow the text colour. */
.site-logo__svg {
  display: block;
  height: 1.15rem;
  width: auto;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  padding: 0.25rem;
  cursor: pointer;
}
.site-header__actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-trigger {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 10px;
  padding: 0 0.5rem 0 0.75rem;
  color: var(--text-faint);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease;
}
.search-trigger:hover { border-color: color-mix(in srgb, var(--text-faint) 50%, var(--border)); }
.search-trigger kbd {
  margin-left: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  color: var(--text-faint);
  font-family: inherit;
}
.theme-toggle {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ---------- Page shell (docs pages) ---------- */
/* Sidebar, content and TOC together in one centred container, the same
   width as the header so the menu lines up under the logo. */
.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 260px minmax(0, 760px) 240px;
  justify-content: space-between;
  column-gap: 3rem;
  align-items: start;
}
.sidebar {
  grid-column: 1;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 2rem 1rem 2rem 0;
  /* Items fade out as they scroll up under the header (and off the bottom). */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 1.5rem, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 1.5rem, #000 calc(100% - 1.5rem), transparent);
}
/* Thin scrollbar that fades in while the sidebar is hovered or focused.
   The thumb paints in currentColor and the sidebar transitions `color`:
   Chrome won't repaint ::-webkit-scrollbar on a parent :hover, but it
   does repaint on a color change, and color can be animated. The nav
   inside resets color so the text isn't affected. Firefox has no
   ::-webkit-scrollbar, so it gets the standard thin bar instead. */
.sidebar {
  color: transparent;
  transition: color 0.3s ease;
}
.sidebar:hover,
.sidebar:focus-within { color: color-mix(in srgb, var(--text-faint) 25%, var(--bg)); }
.sidebar > nav { color: var(--text); }
.sidebar::-webkit-scrollbar { width: 5px; }
/* Inset the track so the bar stops short of the header and the window edge. */
.sidebar::-webkit-scrollbar-track { background: transparent; margin: 2rem 0; }
.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  box-shadow: inset 0 0 0 5px currentColor;
}
@supports not selector(::-webkit-scrollbar) {
  .sidebar {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
  }
  .sidebar:hover,
  .sidebar:focus-within { scrollbar-color: color-mix(in srgb, var(--text-faint) 25%, var(--bg)) transparent; }
}
.nav-group { margin-bottom: 1.5rem; }
.nav-group__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--heading);
  margin: 0 0 0.5rem;
}
/* Indent items so their text lines up with the heading text after its icon
   (14px icon + 0.5rem gap, less the link's own 0.6rem padding). */
.nav-group ul { list-style: none; margin: 0; padding: 0 0 0 calc(14px + 0.5rem - 0.6rem); }
.nav-group li { margin: 0.05rem 0; }
.nav-group__title svg {
  flex: none;
  width: 14px;
  height: 14px;
  stroke-width: 2;
}
.nav-group a {
  display: block;
  color: var(--text-muted);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
}
.nav-group a:hover { background: var(--bg-raised); color: var(--text); text-decoration: none; }
.nav-group a.is-active {
  background: var(--bg-inset);
  color: var(--text);
}

.content { grid-column: 2; min-width: 0; padding: 2rem 0 4rem; }
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 1.25rem;
}
.breadcrumb__sep { margin: 0 0.4rem; }
.breadcrumb__current { color: var(--text-muted); }

.toc {
  grid-column: 3;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 2rem 0;
  font-size: 0.85rem;
}
.toc__title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin: 0 0 0.6rem;
}
.toc__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc__item a {
  display: block;
  color: var(--text-muted);
  padding: 0.3rem 0 0.3rem 0.75rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
}
.toc__item--h3 a { padding-left: 1.5rem; }
.toc__item a:hover, .toc__item a.is-active { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }

/* ---------- Prose ---------- */
/* Headings in near-black; body copy light, in the lead's muted grey. */
h1, h2, h3, h4, h5, h6 { color: var(--heading); }
.prose { color: var(--text-body); font-weight: 300; }
.prose h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 1rem; letter-spacing: -0.01em; }
.prose h2 { font-size: 1.4rem; margin: 2.5rem 0 1rem; padding-top: 0.5rem; letter-spacing: -0.005em; }
.prose h3 { font-size: 1.1rem; margin: 1.75rem 0 0.75rem; }
.prose p { margin: 0 0 1rem; color: var(--text-body); }
.prose p.lead { font-size: 1.1rem; color: var(--text-body); }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.prose li { margin: 0.3rem 0; }
.prose li > ul, .prose li > ol { margin-top: 0.3rem; }
.prose strong { font-weight: 600; color: var(--heading); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.prose pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 1em;
  font-weight: 400;
}

/* ---------- Code blocks (Shopify-style slate) ----------
   The header (language + copy button) sits above the scrollable code in
   its own inset boxes, never over it. Colours are the same in light and
   dark mode, as on Shopify's docs. */
.code-block {
  --code-chrome: #2a383f;
  --code-gutter: #8a9ca5;
  margin: 0 0 1.25rem;
  padding: 4px;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid #2f3f46;
}
.code-block pre { margin: 0; border-radius: 0; padding: 0.75rem 0.9rem 0.9rem 0.5rem; }
.code-block__header { display: flex; gap: 4px; }
.code-block__label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--code-chrome);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #c9d6dc;
}
.code-block__label svg { width: 15px; height: 15px; flex: none; color: #b0c2ca; }
.copy-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  background: var(--code-chrome);
  border: none;
  border-radius: 8px;
  color: #c9d6dc;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.copy-btn svg { width: 16px; height: 16px; }
.copy-btn:hover { background: #223036; color: #fff; }
.copy-btn .lucide-check,
.copy-btn.is-copied .lucide-copy { display: none; }
.copy-btn.is-copied .lucide-check { display: block; }
.copy-btn.is-copied { color: #a5e3b5; }

/* Line numbers, drawn by CSS so copying the code never includes them. */
.code-block code { counter-reset: line; }
.code-block .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2ch;
  margin-right: 1.25ch;
  text-align: right;
  color: var(--code-gutter);
  user-select: none;
}

.tok-key, .tok-attr, .tok-path, .tok-filter, .tok-command { color: #9fd2f2; }
.tok-string { color: #f7a497; }
.tok-number { color: #f6c48d; }
.tok-literal { color: #f6c48d; }
.tok-liquid, .tok-keyword, .tok-method, .tok-flag { color: #cdb0f7; }
.tok-variable { color: #ecdba0; }
.tok-tag { color: #86d4c9; }
.tok-punct { color: #9fb1b9; }
.tok-comment { color: #9aabb3; }
.tok-output { color: #b4c3c9; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.prose th { background: var(--bg-raised); font-weight: 600; }
.prose td code { white-space: nowrap; }

/* Rounded boxes with a thin border tinted to each type's colour. */
.callout {
  --callout-accent: var(--note-border);
  background: var(--note-bg);
  border: 1px solid color-mix(in srgb, var(--callout-accent) 25%, transparent);
  border-radius: 14px;
  position: relative;
  padding: 1rem 1.25rem 1rem 3.1rem;
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
}
.callout__icon {
  position: absolute;
  left: 1.15rem;
  top: 1.1rem;
  display: flex;
  color: var(--callout-accent);
}
.callout__icon svg { width: 18px; height: 18px; }
.callout p:last-child { margin-bottom: 0; }
.callout__title { font-weight: 600; margin-bottom: 0.3rem; display: block; }
.callout--tip { --callout-accent: var(--tip-border); background: var(--tip-bg); }
.callout--warn { --callout-accent: var(--warn-border); background: var(--warn-bg); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  color: var(--text);
}
.card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.card__title { font-weight: 600; margin-bottom: 0.3rem; display: flex; align-items: center; gap: 0.4rem; }
.card__desc { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.prev-next__link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex: 1;
  max-width: 48%;
  color: var(--text);
}
.prev-next__link:hover { border-color: var(--accent); text-decoration: none; }
.prev-next__link span { font-size: 0.75rem; color: var(--text-faint); }
.prev-next__link--next { text-align: right; align-items: flex-end; margin-left: auto; }

/* ---------- Search modal ---------- */
.search-modal[hidden] { display: none; }
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.search-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 15, 0.5);
}
.search-modal__panel {
  position: relative;
  width: min(560px, 90vw);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-modal__field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
}
.search-modal__field input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-size: 1rem;
  color: var(--text);
  font-family: var(--font-sans);
}
.search-modal__results {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  max-height: 55vh;
  overflow-y: auto;
}
.search-modal__results li a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  color: var(--text);
}
.search-modal__results li a:hover,
.search-modal__results li a.is-active {
  background: var(--bg-raised);
  text-decoration: none;
}
.search-modal__result-group { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); margin-bottom: 0.1rem; }
.search-modal__result-excerpt { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.1rem; }
.search-modal__empty { padding: 1.5rem 1rem; color: var(--text-faint); font-size: 0.9rem; text-align: center; }

/* ---------- Home page ---------- */
.hero {
  max-width: 860px;
  margin: 0 auto;
  padding: 5rem 1.25rem 3rem;
  text-align: center;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-tint);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: 3rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}
.hero p.lead {
  font-size: 1.2rem;
  color: var(--text-muted);
  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;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--bg-raised); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--accent); }

.audience-split {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.audience-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  color: var(--text);
}
.audience-card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); }
.audience-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.audience-card h2 { font-size: 1.3rem; margin: 0 0 0.5rem; }
.audience-card p { color: var(--text-muted); margin: 0 0 1rem; }
.audience-card__cta { font-weight: 600; color: var(--accent); font-size: 0.9rem; }

.feature-strip {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  border-top: 1px solid var(--border);
}
.feature-strip__item h3 { font-size: 1rem; margin: 0 0 0.4rem; }
.feature-strip__item p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* ---------- Responsive ---------- */
/* Hide the TOC until the content column has its full 760px, so code fits. */
@media (max-width: 1400px) {
  .page-shell { grid-template-columns: 260px minmax(0, 760px); justify-content: start; }
  .toc { display: none; }
}

@media (max-width: 780px) {
  .site-header__inner { grid-template-columns: 1fr auto auto; gap: 0.5rem; }
  .search-trigger { width: auto; height: 34px; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .page-shell { grid-template-columns: minmax(0, 1fr); padding: 0 1rem; }
  .content { grid-column: 1; }
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 78vw;
    max-width: 300px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 60px 0 0 0;
    background: rgba(10,10,15,0.4);
    z-index: 45;
  }
  .content { padding: 1.5rem 0 3rem; }
  .hero h1 { font-size: 2.1rem; }
  .audience-split { grid-template-columns: 1fr; }
  .feature-strip { grid-template-columns: 1fr; }
  .prev-next { flex-direction: column; }
  .prev-next__link { max-width: 100%; }
}
