/* Usage guide (/guide/). Loaded after rectoly.css on guide pages only; reuses its tokens and the
   blog's .post-body typography. Version: GUIDE_CSS_VERSION in lib/guide.js. */

/* ---------- layout ---------- */
.g-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 112px 32px 0;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 56px;
}
.g-main { max-width: 760px; min-width: 0; }

/* sidebar: a plain list on wide screens, a <details> on narrow ones */
.g-side { position: relative; font-size: 14px; }
.g-side-box { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 8px; }
.g-side-box > summary { display: none; }
.g-side-box nav ul { list-style: none; }
.g-side-home { display: block; font-family: 'Space Grotesk', sans-serif; font-weight: 600; color: #fff; text-decoration: none; margin-bottom: 14px; }
.g-side-sec { margin-bottom: 16px; }
.g-side-sec > p {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.g-side-sec li a {
  display: block;
  padding: 4px 10px;
  margin-left: -10px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.45;
}
.g-side-sec li a:hover { color: #fff; background: var(--bg-card); }
.g-side-sec li a[aria-current="page"] { color: #fff; background: var(--bg-card); box-shadow: inset 2px 0 0 var(--accent-bright); }

/* ---------- header ---------- */
.g-header h1 {
  font-size: clamp(30px, 4.2vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 14px;
}
.g-lede { font-size: 18.5px; line-height: 1.7; color: var(--text-muted); margin-bottom: 18px; }
.g-applies { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 18px; }
.g-applies-label { color: var(--text-dim); margin-right: 2px; }
.g-chip {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 100px;
  border: 1px solid var(--border-hover);
  color: var(--text-muted);
  white-space: nowrap;
}
.g-plan-free { color: #9fd3b0; border-color: rgba(159,211,176,0.35); }
.g-plan-paid, .g-plan-mixed { color: var(--warm); border-color: rgba(229,161,66,0.35); }

.g-notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--warm-dim);
  border: 1px solid rgba(229,161,66,0.3);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.g-notice a { color: var(--warm); }

/* ---------- edition / platform switch ---------- */
.g-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.g-switch[hidden] { display: none; }
.g-switch-hint { width: 100%; font-size: 13px; color: var(--text-dim); }
.g-seg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.g-seg-label { font-size: 13px; color: var(--text-dim); margin-right: 6px; }
.g-seg button {
  font: inherit;
  font-size: 13.5px;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--border-hover);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.g-seg button:hover { color: #fff; }
.g-seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent-bright); color: #fff; }
.g-seg button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* ---------- variants ---------- */
.v-tags { display: inline-flex; gap: 4px; vertical-align: 1px; margin-right: 7px; }
.v-tag {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: 4px 8px 3px;
  border-radius: 6px;
  background: var(--accent-glow);
  color: var(--accent-bright);
  white-space: nowrap;
}
.v-tag.v-e { background: var(--warm-dim); color: var(--warm); }
.v-block {
  margin: 0 0 22px;
  padding: 14px 18px 2px;
  border-left: 2px solid var(--accent);
  background: rgba(255,255,255,0.015);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.v-block > .v-tags { display: flex; margin-bottom: 10px; }

/* A chosen edition / platform hides the blocks for the others, and the chips that would only repeat
   the choice. Without JavaScript nothing is hidden. */
html[data-g-edition="mendeley"] [data-edition]:not([data-edition~="mendeley"]),
html[data-g-edition="zotero"] [data-edition]:not([data-edition~="zotero"]),
html[data-g-platform="windows"] [data-platform]:not([data-platform~="windows"]),
html[data-g-platform="android"] [data-platform]:not([data-platform~="android"]),
html[data-g-platform="apple"] [data-platform]:not([data-platform~="ipad"]):not([data-platform~="mac"]) { display: none; }
html[data-g-edition="mendeley"] .v-e,
html[data-g-edition="zotero"] .v-e,
html[data-g-platform="windows"] .v-p,
html[data-g-platform="android"] .v-p,
html[data-g-platform="apple"] .v-p { display: none; }
/* "Mac · iPad" still says so when a block is for only one of the two. */
html[data-g-platform="apple"] .v[data-platform]:not([data-platform~="ipad"][data-platform~="mac"]) > .v-tags > .v-p { display: inline-block; }

/* pages that do not apply to the chosen app */
.g-na { display: none; margin: 0 0 22px; padding: 14px 18px; border-radius: var(--radius); border: 1px dashed var(--border-hover); color: var(--text-muted); font-size: 15px; }
html[data-g-platform="windows"] .g-na[data-na-platform="windows"],
html[data-g-platform="android"] .g-na[data-na-platform="android"],
html[data-g-platform="apple"] .g-na[data-na-platform="apple"],
html[data-g-edition="mendeley"] .g-na[data-na-edition="mendeley"],
html[data-g-edition="zotero"] .g-na[data-na-edition="zotero"] { display: block; }
html[data-g-platform="windows"] [data-na-platforms~="windows"],
html[data-g-platform="android"] [data-na-platforms~="android"],
html[data-g-platform="apple"] [data-na-platforms~="apple"],
html[data-g-edition="mendeley"] [data-na-editions~="mendeley"],
html[data-g-edition="zotero"] [data-na-editions~="zotero"] { opacity: 0.4; }

/* ---------- body additions ---------- */
.g-body { margin-top: 8px; }
.g-toc { margin-top: 12px; }
.g-body h2:first-child { margin-top: 36px; }
.g-body kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-hover);
  border-bottom-width: 2px;
  background: var(--bg-card);
  color: var(--text);
  white-space: nowrap;
}
.g-body td kbd { font-size: 0.8em; }
.g-body li > ul, .g-body li > ol { margin: 8px 0 4px 20px; }
.g-body h3 { scroll-margin-top: 90px; }
.g-body .table-wrap td:first-child { color: var(--text); }
.g-body th { white-space: normal; }
.callout {
  margin: 0 0 22px;
  padding: 14px 18px 2px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.callout-tip { border-color: rgba(159,211,176,0.25); }
.callout-warning { border-color: rgba(229,161,66,0.35); }
.g-body figure, .g-body img { max-width: 100%; }

/* ---------- foot of the article ---------- */
.g-stuck {
  margin: 48px 0 0;
  padding: 22px 26px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.g-stuck h2 { font-size: 17px; color: #fff; margin-bottom: 6px; }
.g-stuck p { color: var(--text-muted); font-size: 15px; }
.g-stuck a { color: var(--accent-bright); }
.g-updated { font-size: 13px; color: var(--text-dim); margin: 22px 0 0; }
.g-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0 96px; }
.g-pager a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  line-height: 1.4;
}
.g-pager a:hover { border-color: var(--border-hover); background: var(--bg-raised); }
.g-pager a span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.g-pager-next { text-align: right; }

/* ---------- index ---------- */
.g-hero { max-width: 1000px; margin: 0 auto; padding: 140px 32px 24px; }
.g-hero h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 700; letter-spacing: -0.035em; color: #fff; margin-bottom: 14px; }
.g-hero > p { font-size: 18.5px; color: var(--text-muted); max-width: 640px; margin-bottom: 24px; }
.g-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.g-index { max-width: 1000px; margin: 0 auto; padding: 0 32px 96px; }
.g-index-sec { margin-top: 44px; scroll-margin-top: 90px; }
.g-index-sec h2 { font-size: 15px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 14px; }
.g-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.g-card {
  display: block;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.g-card:hover { border-color: var(--border-hover); background: var(--bg-raised); }
.g-card h3 { font-size: 17px; font-weight: 600; color: #fff; margin-bottom: 6px; letter-spacing: -0.01em; }
.g-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ---------- narrow screens ---------- */
@media (max-width: 1000px) {
  .g-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 96px 16px 0; }
  .g-side { order: 0; margin-bottom: 20px; }
  .g-side-box { position: static; max-height: none; overflow: visible; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
  .g-side-box > summary { display: block; cursor: pointer; padding: 12px 16px; font-size: 14px; color: var(--text); list-style: none; }
  .g-side-box > summary::-webkit-details-marker { display: none; }
  .g-side-box > summary::after { content: '▾'; float: right; color: var(--text-dim); }
  .g-side-box[open] > summary::after { content: '▴'; }
  .g-side-box nav { padding: 4px 16px 12px; }
  .g-hero { padding: 116px 16px 16px; }
  .g-index { padding: 0 16px 72px; }
  .g-pager { grid-template-columns: 1fr; }
  .g-pager-next { text-align: left; }
}
@media (max-width: 768px) {
  /* rectoly.css hides nav text links on phones; keep the two guide links. */
  #nav .nav-links a.g-nav-guide, #nav .nav-links a.g-nav-faq { display: inline; }
  .nav-links { gap: 16px; }
  .nav-links .lang-switch { display: none; }
  .post-body.g-body { font-size: 16.5px; }
  .g-lede { font-size: 17px; }
}
[dir="rtl"] .g-side-sec li a[aria-current="page"] { box-shadow: inset -2px 0 0 var(--accent-bright); }
[dir="rtl"] .v-block { border-left: 0; border-right: 2px solid var(--accent); border-radius: var(--radius) 0 0 var(--radius); }
[dir="rtl"] .g-pager-next { text-align: left; }
[dir="rtl"] .g-side-sec li a { margin-left: 0; margin-right: -10px; }
.g-body kbd { direction: ltr; unicode-bidi: isolate; }
