/* ============================================================
   GLOAM — documentation
   ============================================================ */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}

.logo__word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  color: var(--ink-100);
}

.is-docs .ambient {
  background:
    radial-gradient(90% 60% at 20% -10%, rgba(51, 41, 30, 0.7) 0%, transparent 55%),
    linear-gradient(180deg, var(--soot-700) 0%, var(--soot-900) 40%);
}

/* ============================================================
   Shell
   ============================================================ */

.docs {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr) 14rem;
  gap: var(--s-7);
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: var(--s-6) var(--s-5) var(--s-9);
  align-items: start;
}

/* Grid items default to min-width:auto, so a wide table's min-content
   drags the whole column past the viewport even though .table-scroll
   is set to scroll. This is the fix for that, and it must stay. */
.docs > *,
.docs__body {
  min-width: 0;
}

@media (max-width: 1180px) {
  .docs { grid-template-columns: 16rem minmax(0, 1fr); }
  .docs__toc { display: none; }
}

@media (max-width: 900px) {
  .docs {
    grid-template-columns: 1fr;
    gap: var(--s-4);
    padding-top: var(--s-4);
  }
}

/* ---- sidebar ---------------------------------------------- */
.docs__side {
  position: sticky;
  top: calc(var(--nav-h) + var(--s-5));
  max-height: calc(100vh - var(--nav-h) - var(--s-7));
  overflow-y: auto;
  padding-right: var(--s-2);
  padding-bottom: var(--s-5);
}

.docs__search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: var(--s-5);
}

.docs__search svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--ink-400);
  pointer-events: none;
}

.docs__search input {
  width: 100%;
  padding: 0.6rem 2.4rem 0.6rem 2.2rem;
  border: 0;
  border-radius: var(--r-md);
  background: var(--soot-800);
  box-shadow: inset 0 0 0 1px var(--line-hair);
  color: var(--ink-100);
  font: inherit;
  font-size: var(--fs-sm);
  transition: box-shadow var(--t-med) var(--ease-out);
}

.docs__search input::placeholder { color: var(--ink-500); }

.docs__search input:focus {
  outline: 0;
  box-shadow: inset 0 0 0 1px var(--line-ember), 0 0 22px -8px var(--ember-glow);
}

.docs__search kbd {
  position: absolute;
  right: 9px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  border-radius: var(--r-sm);
  background: var(--soot-700);
  box-shadow: inset 0 0 0 1px var(--line-hair);
  color: var(--ink-400);
  font-family: var(--font-mono);
  font-size: 10px;
  pointer-events: none;
}

.docs__results {
  margin-bottom: var(--s-5);
  border-radius: var(--r-md);
  background: var(--soot-800);
  box-shadow: inset 0 0 0 1px var(--line-hair);
  overflow: hidden;
}

.docs__results a {
  display: block;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-hair);
  color: var(--ink-200);
  font-size: var(--fs-sm);
}

.docs__results a:last-child { border-bottom: 0; }

.docs__results a:hover,
.docs__results a.is-active {
  background: rgba(255, 138, 61, 0.08);
  color: var(--ember);
}

.docs__results .r-sec {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.docs__results .r-empty {
  padding: var(--s-4);
  color: var(--ink-500);
  font-size: var(--fs-sm);
}

.docs__group { margin-bottom: var(--s-5); }

.docs__group-title {
  margin-bottom: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-500);
}

.docs__group ul {
  list-style: none;
  display: grid;
  gap: 1px;
  border-left: 1px solid var(--line-hair);
}

.docs__group a {
  display: block;
  padding: 0.42rem var(--s-4);
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--ink-300);
  font-size: var(--fs-sm);
  transition: color var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out);
}

.docs__group a:hover {
  color: var(--ink-100);
  border-left-color: var(--line-soft);
}

.docs__group a[aria-current="page"] {
  color: var(--ember);
  border-left-color: var(--ember);
  background: linear-gradient(90deg, rgba(255, 138, 61, 0.09), transparent 70%);
}

.docs__side-toggle {
  display: none;
  align-items: center;
  gap: var(--s-2);
  padding: 0.55rem var(--s-4);
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  color: var(--ink-200);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.docs__side-toggle svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .docs__side-toggle { display: inline-flex; }

  .docs__side {
    position: static;
    max-height: none;
    display: none;
    padding: var(--s-4);
    border-radius: var(--r-lg);
    background: var(--glass);
    box-shadow: inset 0 0 0 1px var(--line-hair);
  }

  .docs__side.is-open { display: block; }
}

/* ============================================================
   Prose
   ============================================================ */

.crumbs {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.crumbs a { color: var(--ink-400); }
.crumbs a:hover { color: var(--ember); }

.prose {
  max-width: var(--w-prose);
}

.prose h1 {
  font-size: clamp(1.9rem, 4.4vw, 2.6rem);
  margin-bottom: var(--s-5);
}

.prose .lede {
  font-size: var(--fs-md);
  color: var(--ink-300);
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line-hair);
}

.prose h2 {
  font-size: var(--fs-lg);
  margin: var(--s-8) 0 var(--s-4);
  padding-top: var(--s-2);
}

.prose h3 {
  font-size: var(--fs-md);
  margin: var(--s-6) 0 var(--s-3);
}

.prose h4 {
  font-size: var(--fs-base);
  margin: var(--s-5) 0 var(--s-2);
  color: var(--ink-200);
}

.prose p { margin-bottom: var(--s-4); }

.prose ul,
.prose ol {
  margin: 0 0 var(--s-4) var(--s-5);
  display: grid;
  gap: var(--s-2);
}

.prose li { padding-left: var(--s-1); }

.prose li::marker { color: var(--ember-dim); }

.prose ul ul,
.prose ol ol,
.prose ul ol,
.prose ol ul {
  margin-top: var(--s-2);
  margin-bottom: 0;
}

.prose strong { color: var(--ink-100); font-weight: 600; }

.prose code {
  padding: 0.15em 0.42em;
  border-radius: var(--r-sm);
  background: var(--soot-800);
  box-shadow: inset 0 0 0 1px var(--line-hair);
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--ember);
  word-break: break-word;
}

.prose pre.code {
  margin: 0 0 var(--s-5);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  background: var(--soot-800);
  box-shadow: inset 0 0 0 1px var(--line-hair);
  overflow-x: auto;
}

.prose pre.code code {
  padding: 0;
  background: none;
  box-shadow: none;
  color: var(--ink-200);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.prose blockquote {
  margin: 0 0 var(--s-5);
  padding: var(--s-1) 0 var(--s-1) var(--s-5);
  border-left: 2px solid var(--ember-dim);
  color: var(--ink-300);
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr { margin: var(--s-7) 0; }

.prose img {
  border-radius: var(--r-md);
  margin-bottom: var(--s-5);
}

/* anchor links on headings */
.anchor {
  margin-left: 0.45em;
  color: var(--ink-500);
  opacity: 0;
  font-weight: 400;
  transition: opacity var(--t-fast) var(--ease-out);
}

h2:hover .anchor,
h3:hover .anchor,
.anchor:focus-visible { opacity: 1; }

/* ---- tables ------------------------------------------------ */
.table-scroll {
  margin-bottom: var(--s-5);
  overflow-x: auto;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--line-hair);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.prose th,
.prose td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-hair);
  white-space: nowrap;
}

.prose td:first-child,
.prose th:first-child { white-space: normal; }

.prose thead th {
  background: var(--soot-800);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-400);
}

.prose tbody tr:last-child td { border-bottom: 0; }

.prose tbody tr:hover { background: rgba(255, 138, 61, 0.04); }

/* ---- callouts ---------------------------------------------- */
.callout {
  margin: 0 0 var(--s-5);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  background: rgba(255, 138, 61, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 61, 0.22);
  border-left: 2px solid var(--ember);
}

.callout__title {
  margin-bottom: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ember);
}

.callout__body p:last-child { margin-bottom: 0; }

.callout--warn {
  background: rgba(242, 193, 78, 0.06);
  box-shadow: inset 0 0 0 1px rgba(242, 193, 78, 0.26);
  border-left-color: var(--gold);
}

.callout--warn .callout__title { color: var(--gold); }

.callout--wip {
  background: rgba(154, 107, 209, 0.07);
  box-shadow: inset 0 0 0 1px rgba(154, 107, 209, 0.26);
  border-left-color: var(--violet);
}

.callout--wip .callout__title { color: var(--violet); }

/* tier colour chips used across the guides */
.t-common   { color: var(--tier-common); }
.t-uncommon { color: var(--tier-uncommon); }
.t-rare     { color: var(--tier-rare); }
.t-epic     { color: var(--tier-epic); }
.t-relic    { color: var(--tier-relic); }
.t-gloam    { color: var(--tier-gloam); }

/* ============================================================
   TOC
   ============================================================ */

.docs__toc {
  position: sticky;
  top: calc(var(--nav-h) + var(--s-5));
  max-height: calc(100vh - var(--nav-h) - var(--s-7));
  overflow-y: auto;
}

.docs__toc .label { margin-bottom: var(--s-3); }

.docs__toc ul {
  list-style: none;
  display: grid;
  gap: var(--s-2);
  border-left: 1px solid var(--line-hair);
}

.docs__toc a {
  display: block;
  padding-left: var(--s-4);
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--ink-400);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.docs__toc .lvl-3 a { padding-left: var(--s-6); font-size: var(--fs-xs); }

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

.docs__toc a.is-active {
  color: var(--ember);
  border-left-color: var(--ember);
}

/* ============================================================
   Pager
   ============================================================ */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  max-width: var(--w-prose);
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--line-hair);
}

.pager__item {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--line-hair);
  transition: box-shadow var(--t-med) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}

.pager__item:hover {
  box-shadow: inset 0 0 0 1px var(--line-ember);
  transform: translateY(-2px);
}

.pager__item--next { text-align: right; }
.pager__item--next .label { justify-content: flex-end; }
.pager__item--next .label::before { display: none; }
.pager__item--next .label::after {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.pager__title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-100);
}

@media (max-width: 620px) {
  .pager { grid-template-columns: 1fr; }
  .pager__item--next { text-align: left; }
  .pager__item--next .label { justify-content: flex-start; }
  .pager__item--next .label::before { display: block; }
  .pager__item--next .label::after { display: none; }
}

/* ============================================================
   Docs index cards
   ============================================================ */

.dcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-7);
}

.dcard {
  padding: var(--s-5);
}

.dcard ul {
  list-style: none;
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.dcard a {
  color: var(--ink-300);
  font-size: var(--fs-sm);
}

.dcard a:hover { color: var(--ember); }
