/* Melriver theme documentation and support. One stylesheet, no build step.
   Mirrors the Placebo theme: warm page, white paper, ink, rim cards, grey wells, pill controls. */
:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --paper: #ffffff;
  --ink: #22252d;
  --stone: #5d6169;
  --rim: #ecebe7;
  --well: #efeeea;
  --line: rgb(34 37 45 / .14);
  --line-strong: rgb(34 37 45 / .56);
  --button: #22252d;
  --button-label: #ffffff;
  --danger: #b3261e;
  --ok: #1d6b3a;
  --glass: rgb(251 250 247 / .78);
  --shadow-thumb: 0 1px 2px rgb(34 37 45 / .10), 0 0 0 1px rgb(34 37 45 / .04);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --r-card: 22px;
  --r-well: 16px;
  --r-field: 14px;
  --col: 44rem;
  --gutter: clamp(16px, 4vw, 40px);
  --dur-1: 120ms;
  --dur-3: 220ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --paper: #1c1e23;
    --ink: #f4f2ec;
    --stone: #a3a29f;
    --rim: #2a2d34;
    --well: #23262c;
    --line: rgb(244 242 236 / .16);
    --line-strong: rgb(244 242 236 / .6);
    --button: #f4f2ec;
    --button-label: #121316;
    --danger: #ff8a80;
    --ok: #7fd49b;
    --glass: rgb(18 19 22 / .78);
    --thumb: #353942;
    --shadow-thumb: 0 1px 2px rgb(0 0 0 / .5), 0 0 0 1px rgb(244 242 236 / .06);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.625 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -80px; z-index: 50; padding: 10px 18px; border-radius: 999px; background: var(--button); color: var(--button-label); text-decoration: none; font-weight: 500; }
.skip:focus { top: 12px; }

/* Type */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.03em; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem); }
h2 { font-size: 1.375rem; line-height: 1.2; margin-top: 3.5rem; padding-top: 1.25rem; border-top: 2px solid var(--ink); }
h3 { font-size: 1.0625rem; line-height: 1.3; letter-spacing: -.015em; margin-top: 2.25rem; }
h4 { font-size: 1rem; letter-spacing: -.01em; margin-top: 1.5rem; }
p, ul, ol, dl, table, .note, details, figure { margin: 1rem 0 0; }
ul, ol { padding-left: 1.3rem; }
li + li { margin-top: .35rem; }
li > ul, li > ol { margin-top: .35rem; }
.lead { font-size: 1.125rem; line-height: 1.55; color: var(--stone); max-width: 38rem; }
.label { font: 500 .6875rem/1.45 var(--mono); letter-spacing: .02em; color: var(--stone); }
code { font: .875em/1.4 var(--mono); background: var(--well); padding: .1em .38em; border-radius: 6px; overflow-wrap: anywhere; }
pre { margin: 1rem 0 0; padding: 14px 16px; background: var(--well); border-radius: var(--r-well); overflow-x: auto; font: .8125rem/1.6 var(--mono); }
pre code { background: none; padding: 0; font-size: inherit; }
.ui { font-weight: 550; font-size: .9375em; background: var(--well); padding: .08em .42em; border-radius: 7px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.heading-anchor { margin-left: .4em; color: var(--stone); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .heading-anchor, h3:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; padding: 10px var(--gutter); }
.site-header__bar {
  max-width: 85rem; margin: 0 auto; min-height: 52px; padding: 6px 6px 6px 20px;
  display: flex; align-items: center; gap: 8px 20px;
  background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 999px;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; margin-right: auto; min-width: 0; }
.brand__name { font-weight: 600; letter-spacing: -.03em; font-size: 1.0625rem; }
.brand__by { font: 500 .6875rem/1 var(--mono); color: var(--stone); white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { text-decoration: none; font-size: .875rem; font-weight: 500; padding: 9px 12px; border-radius: 999px; white-space: nowrap; }
.site-nav a:hover { background: var(--well); }
.site-nav a[aria-current] { background: var(--well); }
.site-nav a.button { padding: 10px 16px; }
@media (max-width: 47.99rem) {
  .site-nav .nav-wide { display: none; }
  .site-header__bar { padding-left: 16px; }
  .brand__by { display: none; }
}

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  border: 0; border-radius: 999px; background: var(--button); color: var(--button-label);
  font: 500 .9375rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .12);
  transition: transform var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.site-nav a.button, .site-nav a.button:hover { background: var(--button); color: var(--button-label); }
.button:hover { opacity: .88; }
.button:active { transform: scale(.97); }
.button--quiet { background: var(--well); color: var(--ink); box-shadow: inset 0 1px 2px rgb(0 0 0 / .05); }
.button--lg { min-height: 52px; padding: 12px 26px; font-size: 1rem; }

/* Docs layout */
.shell { max-width: 85rem; margin: 0 auto; padding: 20px var(--gutter) 0; }
.docs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px 48px; }
.docs__main { min-width: 0; padding-bottom: 96px; }
.docs__main > article { max-width: var(--col); }
.docs__main > article > :first-child { margin-top: 0; }
.page-head { padding: 28px 0 8px; }
.page-head .label { display: block; margin-bottom: 12px; }
.sidebar { min-width: 0; }
.onpage { display: none; }
@media (min-width: 60rem) {
  .docs { grid-template-columns: 16.5rem minmax(0, 1fr); }
  .sidebar { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; padding: 4px 4px 24px; margin: -4px; }
}
@media (min-width: 80rem) {
  .docs { grid-template-columns: 16.5rem minmax(0, 1fr) 13rem; }
  .onpage { display: block; position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; padding: 32px 4px 24px 0; }
}
.onpage ul { list-style: none; padding: 0; margin: 10px 0 0; border-left: 1px solid var(--line); }
.onpage li { margin: 0; }
.onpage a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; font-size: .8125rem; line-height: 1.4; color: var(--stone); text-decoration: none; }
.onpage a:hover, .onpage a.is-current { color: var(--ink); border-left-color: var(--ink); }

/* Sidebar nav: a well with one paper thumb on the current page */
.navwell { background: var(--well); border-radius: var(--r-card); padding: 6px; margin-top: 12px; box-shadow: inset 0 1px 2px rgb(0 0 0 / .04); }
.navwell ul { list-style: none; margin: 0; padding: 0; }
.navwell li { margin: 0; }
.navwell a { display: block; padding: 9px 14px; border-radius: 16px; font-size: .9063rem; line-height: 1.35; font-weight: 500; text-decoration: none; color: var(--ink); opacity: .82; }
.navwell a:hover { opacity: 1; }
.navwell a[aria-current="page"] { background: var(--thumb, var(--paper)); opacity: 1; box-shadow: var(--shadow-thumb); }
.navwell .navwell__sep { height: 1px; background: var(--line); margin: 6px 14px; }
.sidebar details > summary {
  list-style: none; cursor: pointer; margin-top: 12px; min-height: 44px; padding: 10px 16px; border-radius: 999px; background: var(--well);
  font-weight: 500; font-size: .9375rem; display: flex; align-items: center; justify-content: space-between;
}
.sidebar details > summary::-webkit-details-marker { display: none; }
.sidebar details > summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg) translateY(-2px); transition: transform var(--dur-3) var(--ease); }
.sidebar details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
@media (min-width: 60rem) { .sidebar details > summary { display: none; } }

/* Search */
.search { position: relative; }
.search__field { display: flex; align-items: center; gap: 8px; background: var(--well); border-radius: 999px; padding: 4px; box-shadow: inset 0 1px 2px rgb(0 0 0 / .04); }
.search__field input {
  flex: 1; min-width: 0; height: 40px; border: 0; border-radius: 999px; padding: 0 16px; background: var(--paper); color: var(--ink);
  font: 400 1rem/1 var(--font); box-shadow: var(--shadow-thumb); appearance: none;
}
.search__field input::placeholder { color: var(--stone); opacity: 1; }
.search__field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 999px; }
.search__panel {
  position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 8px); max-height: min(70vh, 30rem); overflow-y: auto;
  background: var(--paper); border-radius: var(--r-card); border: 6px solid var(--rim); padding: 6px; box-shadow: 0 18px 50px rgb(0 0 0 / .14);
}
@media (min-width: 60rem) { .search__panel { right: auto; width: 26rem; } }
.search__panel[hidden] { display: none; }
.search__panel ul { list-style: none; margin: 0; padding: 0; }
.search__panel li { margin: 0; }
.search__hit { display: block; padding: 10px 12px; border-radius: 12px; text-decoration: none; }
.search__hit:hover, .search__hit.is-active { background: var(--well); }
.search__hit b { display: block; font-weight: 600; font-size: .9375rem; line-height: 1.35; }
.search__hit .label { display: block; }
.search__hit span.snip { display: block; font-size: .8125rem; line-height: 1.45; color: var(--stone); margin-top: 2px; }
.search__hit mark { background: none; color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.search__empty { padding: 14px 12px; margin: 0; font-size: .9375rem; color: var(--stone); }

/* Cards and wells */
.card { background: var(--paper); border: 6px solid var(--rim); border-radius: var(--r-card); padding: 18px 20px; }
.well, .note { background: var(--well); border-radius: var(--r-well); padding: 14px 18px; }
.note { font-size: .9375rem; line-height: 1.55; }
.note > :first-child { margin-top: 0; }
.note .label { display: block; margin-bottom: 4px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); margin-top: 1.5rem; padding: 0; list-style: none; }
.grid li { margin: 0; }
.grid .card { display: flex; flex-direction: column; height: 100%; text-decoration: none; transition: transform var(--dur-1) var(--ease); }
.grid a.card:hover { border-color: var(--line); }
.grid a.card:active { transform: scale(.985); }
.grid .card b { font-weight: 600; letter-spacing: -.015em; font-size: 1.0313rem; margin-top: 6px; }
.grid .card span.desc { color: var(--stone); font-size: .875rem; line-height: 1.5; margin-top: 6px; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 0 44px; margin-top: 18px; }
.steps > li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 3px; font: 500 .75rem/1.6 var(--mono); color: var(--stone); }

/* Ledger tables */
.table-wrap { margin-top: 1rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9063rem; line-height: 1.5; }
caption { text-align: left; }
th, td { text-align: left; vertical-align: top; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--line); }
th:last-child, td:last-child { padding-right: 0; }
thead th { font: 500 .6875rem/1.45 var(--mono); color: var(--stone); border-bottom: 2px solid var(--ink); padding-top: 0; white-space: nowrap; }
tbody th { font-weight: 500; }
tr.group th { font: 500 .6875rem/1.45 var(--mono); color: var(--stone); padding-top: 22px; border-bottom-color: var(--line-strong); }
tr.para td { color: var(--stone); }
td .meta { display: block; color: var(--stone); font-size: .8438rem; margin-top: 2px; }
table.settings th[scope="row"] { width: 34%; min-width: 9rem; }
@media (max-width: 35.99rem) {
  table.settings, table.settings tbody, table.settings tr, table.settings th, table.settings td { display: block; width: auto; }
  table.settings thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.settings th[scope="row"] { width: auto; border-bottom: 0; padding: 12px 0 0; }
  table.settings td { padding: 2px 0 12px; }
  table.settings tr.group th { padding-top: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
}
details.more { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
details.more + details.more { border-top: 0; margin-top: 0; }
details.more > summary { cursor: pointer; padding: 12px 0; font-weight: 500; font-size: .9375rem; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 44px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font: 400 1.25rem/1 var(--mono); color: var(--stone); }
details.more[open] > summary::after { content: "\2212"; }
details.more > .table-wrap, details.more > div { margin: 0 0 16px; }
details.qa > summary { font-size: 1rem; font-weight: 550; letter-spacing: -.01em; padding: 16px 0; }
details.qa > div > :first-child { margin-top: 0; }
details.qa > div { color: var(--ink); max-width: 40rem; }

/* Diagrams */
figure { margin-left: 0; margin-right: 0; }
figure .card { padding: 14px; }
figure svg { display: block; width: 100%; height: auto; }
figcaption { font-size: .8438rem; color: var(--stone); margin-top: 8px; }
.dg-rim { fill: var(--well); }
.dg-paper { fill: var(--paper); stroke: var(--line); }
.dg-ink { fill: var(--ink); }
.dg-line { stroke: var(--line-strong); fill: none; }
.dg-text { fill: var(--ink); font: 500 12px var(--font); }
.dg-mono { fill: var(--stone); font: 500 10px var(--mono); }
.dg-inv { fill: var(--button-label); font: 500 12px var(--font); }

/* Pager and footer */
.pager { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 10px; margin-top: 4rem; max-width: var(--col); }
.pager a { text-decoration: none; }
.pager .card b { display: block; font-weight: 600; letter-spacing: -.015em; }
.pager .next { text-align: right; }
.help { margin-top: 3rem; max-width: var(--col); display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.help p { margin: 0; }
.site-footer { border-top: 1px solid var(--line); margin-top: 0; }
.site-footer__in { max-width: 85rem; margin: 0 auto; padding: 28px var(--gutter) 40px; display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; font-size: .875rem; color: var(--stone); }
.site-footer__in a { color: var(--ink); text-decoration: none; padding: 6px 0; }
.site-footer__in a:hover { text-decoration: underline; }
.site-footer__in .copy { margin-right: auto; }

/* Plain pages (support, thanks, themes index) */
.plain { max-width: 44rem; margin: 0 auto; padding: 28px var(--gutter) 96px; }
.plain--wide { max-width: 62rem; }
.plain h1 + .lead { margin-top: 14px; }

/* Form */
.form { margin-top: 2rem; display: grid; gap: 18px; }
.form__row { display: grid; gap: 18px; }
@media (min-width: 40rem) { .form__row--2 { grid-template-columns: 1fr 1fr; } }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label, .fld > .fld__label { font-weight: 500; font-size: .9375rem; }
.fld .opt { font-weight: 400; color: var(--stone); }
.fld .hint { font-size: .8438rem; color: var(--stone); line-height: 1.45; }
.fld input[type="text"], .fld input[type="email"], .fld select, .fld textarea {
  width: 100%; height: 56px; padding: 12px 16px; background: var(--paper); color: var(--ink);
  border: 4px solid var(--rim); border-radius: var(--r-field); font: 400 1rem/1.5 var(--font); appearance: none;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.fld select { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px; }
.fld textarea { height: auto; min-height: 11rem; resize: vertical; }
.fld input::placeholder, .fld textarea::placeholder { color: var(--stone); opacity: 1; }
.fld input:focus-visible, .fld select:focus-visible, .fld textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-radius: var(--r-field); }
.fld input[type="file"] { width: 100%; font: 400 .9375rem/1.4 var(--font); color: var(--ink); padding: 10px; background: var(--well); border-radius: var(--r-field); }
.fld input[type="file"]::file-selector-button { margin-right: 12px; min-height: 36px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--paper); color: var(--ink); font: 500 .875rem/1 var(--font); box-shadow: var(--shadow-thumb); cursor: pointer; }
.fld [aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--danger); }
.fld .err { display: flex; gap: 8px; align-items: baseline; color: var(--danger); font-size: .875rem; font-weight: 500; line-height: 1.4; }
.fld .err::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; transform: translateY(-1px); }
.fld .err:empty { display: none; }
.files { display: grid; gap: 8px; }
.form__summary { background: var(--well); border-radius: var(--r-well); padding: 14px 18px; box-shadow: inset 0 0 0 2px var(--danger); }
.form__summary[hidden] { display: none; }
.form__summary h2 { font-size: 1rem; margin: 0; padding: 0; border: 0; letter-spacing: -.01em; }
.form__summary ul { margin-top: 6px; }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.form__foot p { margin: 0; font-size: .875rem; color: var(--stone); flex: 1 1 16rem; }
.hp { position: absolute; left: -9999px; }
.two { display: grid; gap: 32px 56px; margin-top: 8px; }
@media (min-width: 60rem) { .two { grid-template-columns: minmax(0, 1fr) 18rem; align-items: start; } .two aside { position: sticky; top: 96px; margin-top: 2rem; } }
.two aside .card + .card { margin-top: 10px; }
.two aside h2 { font-size: 1rem; border: 0; padding: 0; margin: 0; letter-spacing: -.015em; }
.two aside p, .two aside ul { font-size: .9063rem; line-height: 1.55; margin-top: 8px; }
.big { font-size: clamp(3.5rem, 2rem + 8vw, 6rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; margin: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .sidebar, .onpage, .pager, .help, .site-footer { display: none; } details.more > * { display: block; } }
