/* Refinix documentation.
 *
 * Loaded after site.css and additive to it. Every colour, face, radius and
 * rhythm here comes from the tokens declared at the top of site.css — this
 * file adds no palette of its own, so the docs and the landing page are the
 * same product seen twice rather than two sites that happen to share a logo.
 *
 * The one structural idea: documentation is read, not scanned, so the column
 * is measured for reading and the table of contents stays put beside it. The
 * page is a two-track grid, not a stack of cards.
 */

/* ================================================================== hero */

.docs-hero { padding: clamp(46px, 5vw, 78px) 0 clamp(30px, 3vw, 44px); }

.docs-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1rem + 3.4vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -.026em;
  font-weight: 700;
  margin: 0 0 18px;
  max-width: 18ch;
  text-wrap: balance;
}

.docs-hero .sec-lede { margin-bottom: 30px; }

/* Three jump links, sized as content rather than as chrome: they are the
   fastest route into the page and should read that way. */
.docs-jump {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 62rem;
}

.docs-jump a {
  display: block;
  height: 100%;
  padding: 16px 18px;
  border: var(--hair) solid var(--edge);
  border-radius: var(--r-card);
  text-decoration: none;
  transition: border-color 200ms ease, background 200ms ease, transform 200ms ease;
}

.docs-jump a:hover {
  border-color: var(--edge-hi);
  background: var(--glass);
  transform: translateY(-2px);
}

.docs-jump b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.docs-jump span { font-size: 13.5px; color: var(--ink-dim); }

.docs-jump em {
  display: block;
  font-family: var(--font-data);
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: .16em;
  color: var(--violet);
  margin-bottom: 10px;
}

/* ================================================================ layout */

.docs-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(28px, 4vw, 72px);
  align-items: start;
  padding-bottom: clamp(60px, 6vw, 110px);
}

@media (max-width: 940px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---- table of contents ------------------------------------------------ */

.toc {
  position: sticky;
  /* Clears the sticky site nav, which is --nav-h tall. */
  top: calc(var(--nav-h) + 24px);
  max-height: calc(100vh - var(--nav-h) - 48px);
  overflow-y: auto;
  padding-bottom: 12px;
}

.toc-h {
  font-family: var(--font-data);
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

.toc ol { list-style: none; margin: 0; padding: 0; }

.toc > ol > li { border-top: var(--hair) solid var(--edge); }
.toc > ol > li:last-child { border-bottom: var(--hair) solid var(--edge); }

.toc a {
  display: block;
  padding: 10px 0 10px 14px;
  border-left: 2px solid transparent;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
  transition: color 160ms ease, border-color 160ms ease;
}

.toc a:hover { color: var(--ink); }

/* Sky blue is this page's interactive colour, and "where you are" in a list
   of links is an interactive state, so the marker takes it. */
.toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); }

.toc ol ol a {
  padding-left: 26px;
  font-size: 13px;
  color: var(--ink-faint);
}

.toc ol ol a[aria-current="true"] { color: var(--ink-2); }

/* Declared AFTER the sticky rule above, not with the layout switch further up:
   same specificity means source order decides, and an override written before
   the rule it overrides simply loses. On one column a sticky contents list
   would hold a slice of a phone screen for the whole scroll. */
@media (max-width: 940px) {
  .toc { position: static; max-height: none; overflow-y: visible; }
}

/* ---- the reading column ----------------------------------------------- */

.doc-sec {
  /* So an anchored jump does not land the heading under the sticky nav. */
  scroll-margin-top: calc(var(--nav-h) + 20px);
  padding-top: clamp(34px, 4vw, 56px);
}

.doc-sec:first-child { padding-top: 0; }

.doc-sec > h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1rem + 1.9vw, 2.4rem);
  line-height: 1.1;
  letter-spacing: -.022em;
  font-weight: 700;
  margin: 0 0 14px;
  text-wrap: balance;
}

.doc-sub {
  scroll-margin-top: calc(var(--nav-h) + 20px);
  padding-top: clamp(26px, 3vw, 40px);
}

.doc-sub > h3 {
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: -.012em;
  margin: 0 0 12px;
  color: var(--ink);
}

.doc-sec p,
.doc-sub p {
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.68;
  margin: 0 0 15px;
  max-width: 68ch;
}

.doc-lede { color: var(--ink-dim) !important; font-size: 1.02rem !important; }

.doc-sec a:not(.btn),
.doc-sub a:not(.btn) { color: var(--accent); text-underline-offset: 3px; }

.doc-list {
  margin: 0 0 16px;
  padding-left: 20px;
  max-width: 68ch;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.68;
}

.doc-list li { margin-bottom: 7px; }
.doc-list li::marker { color: var(--violet); }

.doc-sec strong, .doc-sub strong { color: var(--ink); font-weight: 600; }

/* A hair rule between sections, so the page has joints without needing a box
   around every block. */
.doc-sec + .doc-sec { border-top: var(--hair) solid var(--edge); }

/* ---- numbered steps ---------------------------------------------------- */

.steps {
  counter-reset: s;
  list-style: none;
  margin: 4px 0 20px;
  padding: 0;
  max-width: 68ch;
}

.steps li {
  counter-increment: s;
  position: relative;
  padding: 0 0 20px 46px;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.62;
}

/* The connecting spine: it makes a list of steps read as one sequence rather
   than as four unrelated paragraphs that happen to be numbered. */
.steps li::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 26px;
  bottom: 2px;
  width: var(--hair);
  background: var(--edge);
}

.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }

.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: var(--hair) solid var(--edge-2);
  background: var(--glass);
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--violet);
}

.steps b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 3px; }

/* ---- callouts ---------------------------------------------------------- */

.note {
  --note: var(--accent);
  --note-soft: var(--accent-soft);
  position: relative;
  margin: 4px 0 20px;
  padding: 15px 18px 15px 20px;
  max-width: 68ch;
  border: var(--hair) solid var(--edge);
  border-left: 2px solid var(--note);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  background: var(--note-soft);
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.6;
}

.note b {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 3px;
}

.note p { margin: 0 !important; font-size: 14.5px !important; }

/* Green is the enforced-evidence colour everywhere in this product, so a
   callout stating a guarantee takes it — and nothing else does. */
.note[data-kind="enforced"] { --note: var(--ok); --note-soft: var(--ok-soft); }
.note[data-kind="caution"]  { --note: var(--violet); --note-soft: var(--violet-soft); }

/* ---- keyboard keys ----------------------------------------------------- */

kbd, .kbd {
  display: inline-block;
  padding: 2px 7px;
  border: var(--hair) solid var(--edge-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--glass);
  font-family: var(--font-data);
  font-size: 11.5px;
  color: var(--ink);
  white-space: nowrap;
}

/* ---- specification rows ------------------------------------------------ */

.spec {
  margin: 4px 0 20px;
  max-width: 68ch;
  border-top: var(--hair) solid var(--edge);
}

.spec > div {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr);
  gap: 8px 22px;
  padding: 12px 0;
  border-bottom: var(--hair) solid var(--edge);
}

@media (max-width: 560px) { .spec > div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

.spec dt { color: var(--ink-dim); font-size: 14px; }

.spec dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.spec dd code, .doc-sec code, .doc-sub code {
  font-family: var(--font-data);
  font-size: 12.5px;
  padding: 1px 6px;
  border-radius: 5px;
  border: var(--hair) solid var(--edge);
  background: var(--glass);
  color: var(--ink);
}

/* ---- the window map ----------------------------------------------------
 * A schematic of the running application, so the manual can name a part of
 * the window and the reader knows which part is meant. Drawn from boxes
 * rather than shipped as a screenshot: it stays legible at any width, follows
 * the theme, and cannot go stale the way a picture of a build does. */

.winmap { margin: 4px 0 22px; max-width: 68ch; }

.winmap-frame {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 66px;
  gap: 6px;
  height: 208px;
  padding: 6px;
  border: var(--hair) solid var(--edge-2);
  border-radius: var(--r-panel);
  background: var(--glass);
}

.wm-col {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: var(--hair) solid var(--edge);
  border-radius: 8px;
  background: var(--ground-2);
  min-width: 0;
}

.wm-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--violet);
  color: var(--on-accent);
  font-family: var(--font-data);
  font-size: 9.5px;
  z-index: 1;
}

.wm-bar { display: block; height: 7px; border-radius: 3px; background: var(--edge-2); }
.wm-bar.wm-wide { width: 100%; }
.wm-bar.wm-mid  { width: 72%; }
.wm-bar.wm-thin { width: 48%; }
.wm-brand { height: 12px; background: linear-gradient(90deg, var(--silver-3), var(--silver-4)); }

.wm-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.wm-switch i { height: 12px; border-radius: 4px; background: var(--edge); }
.wm-switch i:first-child { background: var(--accent); opacity: .75; }

.wm-main { padding: 8px; }
.wm-head { display: flex; gap: 5px; align-items: center; margin-bottom: 8px; }

.wm-thread { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.wm-bubble {
  align-self: flex-end;
  width: 46%;
  height: 18px;
  border-radius: 9px;
  border: var(--hair) solid var(--edge-2);
  background: var(--glass-2);
}
.wm-line { height: 6px; border-radius: 3px; background: var(--edge); }
.wm-line.wm-short { width: 62%; }

.wm-composer {
  margin-top: auto;
  height: 40px;
  border-radius: 9px;
  border: var(--hair) solid var(--accent);
  background: var(--accent-soft);
  position: relative;
}

.wm-rail { gap: 5px; }
.wm-rail .wm-bar { height: 5px; }

.wm-key {
  counter-reset: k;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.wm-key li {
  counter-increment: k;
  position: relative;
  padding-left: 27px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.wm-key li::before {
  content: counter(k);
  position: absolute;
  left: 0;
  top: 1px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--violet);
  color: var(--on-accent);
  font-family: var(--font-data);
  font-size: 9.5px;
}

.wm-key b { color: var(--ink); font-weight: 600; }

/* ---- questions --------------------------------------------------------- */

.faq { margin: 4px 0 0; max-width: 68ch; border-top: var(--hair) solid var(--edge); }

.faq details { border-bottom: var(--hair) solid var(--edge); }

.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 34px 15px 0;
  position: relative;
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.45;
  transition: color 160ms ease;
}

.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }

.faq summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 22px;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--ink-faint);
  border-bottom: 1.5px solid var(--ink-faint);
  transform: rotate(45deg);
  transition: transform 220ms ease, border-color 160ms ease;
}

.faq details[open] summary::after { transform: rotate(-135deg); border-color: var(--accent); }

.faq details > div { padding: 0 0 16px; }

.faq p {
  margin: 0 0 10px !important;
  color: var(--ink-dim) !important;
  font-size: 14.5px !important;
  line-height: 1.65;
}

.faq p:last-child { margin-bottom: 0 !important; }

/* ---- foot of the page -------------------------------------------------- */

.docs-end {
  margin-top: clamp(38px, 4vw, 60px);
  padding-top: clamp(26px, 3vw, 38px);
  border-top: var(--hair) solid var(--edge);
}

.docs-end p { color: var(--ink-dim); max-width: 60ch; }

@media (prefers-reduced-motion: reduce) {
  .docs-jump a:hover { transform: none; }
}
