/* dotpals docs. Builds on ../style.css (colors, fonts, buttons, footer). */

body.guide { font-size: 1rem; }
body.guide::before { background: radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 1.4px) 0 0 / 22px 22px, var(--bg); }

/* ---------- header ---------- */
.g-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .8rem;
  height: 60px; padding: 0 var(--gutter);
  background: var(--head-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.g-top .brand dot-pal { --dp-size: 30px; }
.g-badge {
  padding: .22rem .55rem; border-radius: 7px;
  font: 600 .72rem/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  color: var(--bg); background: var(--accent);
}
.g-toplinks { margin-left: auto; display: flex; gap: 1.2rem; font-size: .92rem; }
.g-toplinks a { color: var(--muted); text-decoration: none; }
.g-toplinks a:hover { color: var(--text); }
.g-menu {
  display: none; align-items: center; gap: .4rem;
  min-height: 38px; padding: 0 .8rem; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--text);
  font: 600 .88rem/1 var(--f-body); cursor: pointer;
}
.g-top .theme-toggle { width: 38px; height: 38px; border-radius: 10px; background: var(--card); }
.g-top .theme-toggle:hover { background: var(--card-2); }
.g-menu svg, .g-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

/* ---------- layout ---------- */
.g-layout {
  display: grid; grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter);
}
.g-side {
  position: sticky; top: 60px; align-self: start;
  height: calc(100vh - 60px); overflow-y: auto; overscroll-behavior: contain;
  padding: 1.4rem 0 2rem; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.g-main { min-width: 0; padding: 2.2rem 0 3rem; }

/* ---------- sidebar ---------- */
.g-search { position: relative; margin-bottom: 1.1rem; }
.g-search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--dim); pointer-events: none; }
.g-search input {
  width: 100%; min-height: 40px; padding: 0 2.2rem 0 2.2rem;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--input); color: var(--text);
  font: 500 .9rem/1 var(--f-body);
}
.g-search input::placeholder { color: var(--dim); }
.g-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.g-search kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); }
.g-search input:focus ~ kbd, .g-search input:not(:placeholder-shown) ~ kbd { display: none; }
.g-group { margin-bottom: 1.1rem; }
.g-group-name { margin: 0 0 .35rem .6rem; font: 600 .7rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.g-pages, .g-secs { list-style: none; margin: 0; padding: 0; }
.g-page > a {
  display: block; padding: .38rem .6rem; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500;
}
.g-page > a:hover { color: var(--text); background: var(--card); }
.g-page.is-current > a { color: var(--text); background: var(--card-2); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.g-secs { display: none; margin: .15rem 0 .5rem .75rem; border-left: 1px solid var(--line); }
.g-page.is-current > .g-secs { display: block; }
.g-secs a {
  display: block; padding: .24rem .7rem; margin-left: -1px; border-left: 1px solid transparent;
  color: var(--dim); text-decoration: none; font-size: .84rem; line-height: 1.35;
}
.g-secs a:hover { color: var(--text); }
.g-secs a.is-here { color: var(--accent); border-left-color: var(--accent); }
.g-none { color: var(--dim); font-size: .88rem; margin: .5rem .6rem; }
/* While searching: show what matches, across every page. */
.g-side.searching .g-secs { display: block; }
.g-side.searching [hidden] { display: none !important; }
.g-side mark { background: var(--mark); color: var(--text); border-radius: 3px; padding: 0 1px; }

/* ---------- the page ---------- */
.doc { max-width: 780px; }
.doc > :first-child { margin-top: 0; }
.doc .eyebrow-doc { margin: 0 0 .7rem; font: 600 .76rem/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.doc h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); line-height: 1.05; font-weight: 750; letter-spacing: -.035em; max-width: none; margin-bottom: 1rem; }
.doc h1 em { font-family: var(--f-serif); font-weight: 400; font-style: italic; color: var(--accent); }
.doc .lead { font-size: 1.14rem; color: var(--muted); margin-bottom: 1.8rem; text-wrap: pretty; }
.doc h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.8rem); line-height: 1.15; font-weight: 700; letter-spacing: -.02em;
  margin: 3rem 0 1rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
  scroll-margin-top: 76px;
}
.doc h3 { font-size: 1.14rem; margin: 2rem 0 .6rem; scroll-margin-top: 76px; }
.doc h4 { font: 600 1rem/1.3 var(--f-body); margin: 1.4rem 0 .5rem; }
.doc h2 a.g-anchor, .doc h3 a.g-anchor { margin-left: .4rem; color: var(--dim); text-decoration: none; opacity: 0; font-weight: 400; }
.doc h2:hover a.g-anchor, .doc h3:hover a.g-anchor, .doc a.g-anchor:focus { opacity: 1; }
.doc p, .doc li { color: var(--body-text); line-height: 1.68; }
.doc p { margin: 0 0 1rem; }
.doc ul, .doc ol { padding-left: 1.3rem; margin: 0 0 1.1rem; }
.doc li { margin-bottom: .35rem; }
.doc li > ul, .doc li > ol { margin: .35rem 0 .2rem; }
.doc strong, .doc b { color: var(--text); }
.doc a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: currentColor; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.doc blockquote { margin: 0 0 1.2rem; padding: .7rem 1rem; border-left: 3px solid var(--amber); border-radius: 0 10px 10px 0; background: rgb(255 181 71 / .06); }
.doc blockquote p { margin: 0; color: var(--quote-text); }

/* Inline code wraps on phones (the landing page keeps it on one line). */
.doc :is(p, li, td, th, dd, figcaption) code {
  white-space: normal; overflow-wrap: anywhere;
  font-size: .86em; padding: .08em .36em; border-radius: 6px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--code-text);
}
.doc a code { color: inherit; }
/* A code block inside a list item is still a block, not inline code. */
.doc pre code { white-space: inherit; overflow-wrap: normal; font-size: inherit; padding: 0; border-radius: 0; background: none; border: 0; color: inherit; }
kbd {
  display: inline-block; min-width: 1.5em; padding: .12em .42em; border-radius: 6px;
  font: 600 .78em/1.4 var(--f-mono); text-align: center; color: var(--text);
  background: var(--card-2); border: 1px solid var(--line-2); box-shadow: inset 0 -2px 0 var(--line);
}

/* ---------- code blocks ---------- */
.g-pre { position: relative; margin: 0 0 1.3rem; }
.doc pre {
  margin: 0 0 1.3rem; padding: 1rem 1.1rem; border-radius: 12px;
  background: #07070a; border: 1px solid var(--line);
  font: 400 .82rem/1.6 var(--f-mono); color: #e1dde8;
  overflow-x: auto; white-space: pre; tab-size: 2;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.g-pre pre { margin: 0; padding-right: 4.6rem; }
.doc pre .c { color: var(--dim); }
.g-copy {
  position: absolute; top: .5rem; right: .5rem;
  min-height: 30px; padding: 0 .7rem; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--card-2); color: var(--muted);
  font: 600 .76rem/1 var(--f-body); cursor: pointer; opacity: .85;
}
.g-copy:hover { color: var(--text); opacity: 1; }
.g-copy.ok { color: var(--green); border-color: rgb(74 222 128 / .5); }

/* ---------- tables ---------- */
.g-table { overflow-x: auto; margin: 0 0 1.4rem; border: 1px solid var(--line); border-radius: 12px; scrollbar-width: thin; }
.g-table table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.g-table th, .g-table td { padding: .6rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.g-table tr:last-child td { border-bottom: 0; }
.g-table th { font: 600 .74rem/1.2 var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); background: var(--bg-2); white-space: nowrap; }
.g-table td { color: var(--body-text); line-height: 1.5; }
.g-table td:first-child { color: var(--text); }
.g-table td:first-child code { white-space: nowrap; }

/* ---------- callouts ---------- */
.g-note {
  margin: 0 0 1.3rem; padding: .85rem 1rem .85rem 1rem; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--card);
}
.g-note > :last-child { margin-bottom: 0; }
.g-note > p:first-child::before { font-weight: 700; color: var(--text); }
.g-note.tip { border-color: rgb(74 222 128 / .35); background: rgb(74 222 128 / .05); }
.g-note.warn { border-color: rgb(255 181 71 / .45); background: rgb(255 181 71 / .06); }
.g-note.tip > p:first-child::before { content: "Tip. "; color: var(--green); }
.g-note.warn > p:first-child::before { content: "Heads up. "; color: var(--amber); }
.g-note.info > p:first-child::before { content: "Note. "; color: var(--blue); }

/* ---------- figures ---------- */
.doc figure { margin: 0 0 1.6rem; }
.doc figure img { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 18px 44px var(--shadow); }
.doc figure.narrow img { max-width: 360px; width: 100%; }
.doc figcaption { margin-top: .6rem; color: var(--dim); font-size: .86rem; }
.g-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 1.6rem; }
.g-shots figure { margin: 0; }

/* ---------- cards ---------- */
.g-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 1.6rem; }
.g-card {
  display: block; padding: 1rem 1.1rem; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  text-decoration: none !important; transition: border-color .2s, transform .2s var(--ease);
}
.g-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.g-card b { display: block; color: var(--text); font: 650 1.02rem/1.3 var(--f-display); margin-bottom: .25rem; }
.g-card span { display: block; color: var(--muted); font-size: .9rem; line-height: 1.5; }

/* numbered steps */
.g-steps { counter-reset: step; list-style: none; padding: 0 !important; }
.g-steps > li { counter-increment: step; position: relative; padding-left: 2.4rem; margin-bottom: .9rem; }
.g-steps > li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem;
  width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center;
  font: 700 .82rem/1 var(--f-mono); color: var(--bg); background: var(--accent);
}

/* definition-style lists */
.doc dl { margin: 0 0 1.3rem; }
.doc dt { font-weight: 600; color: var(--text); margin-top: .8rem; }
.doc dd { margin: .2rem 0 0; color: var(--body-text); line-height: 1.6; }

/* ---------- the flow diagram ---------- */
.g-flow { display: grid; gap: .7rem; margin: 0 0 1.6rem; padding: 1.2rem; border-radius: 16px; border: 1.5px dashed var(--line-3); background: radial-gradient(70% 80% at 50% 50%, rgb(22 198 174 / .06), transparent 70%); }
.g-flow-row { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.g-flow-row > span {
  display: inline-flex; flex-direction: column; gap: .15rem; padding: .55rem .8rem; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line); font-size: .88rem; font-weight: 600; text-align: center;
}
.g-flow-row > span small { font: 400 .74rem/1.3 var(--f-mono); color: var(--dim); }
.g-flow-arrow { text-align: center; color: var(--mine); font: 400 .78rem/1.2 var(--f-mono); }
.g-flow-arrow::before { content: "↓"; display: block; font-size: 1.1rem; line-height: 1; margin-bottom: .15rem; }
.g-flow-bridge { padding: .9rem 1rem; border-radius: 14px; background: var(--well); border: 1px solid var(--mine); box-shadow: 0 0 30px rgb(22 198 174 / .14); text-align: center; }
.g-flow-bridge b { font: 700 1.05rem/1.2 var(--f-display); }
.g-flow-bridge p { margin: .35rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.g-flow-label { margin: 0; text-align: center; font: 600 .7rem/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }

/* ---------- pager, edit link ---------- */
.g-edit { max-width: 780px; margin: 3rem 0 1rem; font-size: .88rem; }
.g-edit a { color: var(--dim); }
.g-edit a:hover { color: var(--text); }
.g-pager { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g-pager a {
  display: grid; gap: .2rem; padding: .9rem 1rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); text-decoration: none;
}
.g-pager a:hover { border-color: var(--line-2); }
.g-pager small { color: var(--dim); font-size: .8rem; }
.g-pager span { font-weight: 600; }
.g-pager-next { text-align: right; }

.guide .foot { border-top: 1px solid var(--line); margin-top: 2rem; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .g-layout { grid-template-columns: minmax(0, 1fr); }
  .g-menu { display: inline-flex; }
  .g-toplinks { margin-left: auto; }
  .g-side {
    display: none; position: fixed; inset: 60px 0 0 0; z-index: 35; height: auto; align-self: auto;
    padding: 1rem var(--gutter) 2rem; background: var(--bg); border-top: 1px solid var(--line);
  }
  body.g-nav-open .g-side { display: block; }
  body.g-nav-open { overflow: hidden; }
  .g-main { padding-top: 1.6rem; }
  .g-search kbd { display: none; }
}
@media (max-width: 640px) {
  .g-top { gap: .55rem; }
  .g-toplinks { gap: .8rem; font-size: .86rem; }
  .g-toplinks a:first-child { display: none; }
  .g-cards, .g-pager { grid-template-columns: minmax(0, 1fr); }
  .g-pager-next { text-align: left; }
  .g-shots { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .g-shots figure:nth-child(3) { display: none; }
  .doc pre { font-size: .76rem; padding: .85rem .9rem; }
  .g-pre pre { padding-right: .9rem; padding-top: 2.6rem; }
  .g-table { font-size: .86rem; }
  .g-table th, .g-table td { padding: .5rem .6rem; }
  .doc h2 { margin-top: 2.4rem; }
}
