/*
   Trimbound documentation.
   One stylesheet for every page. Nothing here is page-specific.

   Palette comes from the plugin's own subject: deepslate for surfaces,
   copper for the accent, oxidised copper for the secondary. Copper is one of
   the eleven trims and it weathers to teal in game, so both colours already
   belong to the material this site is about.
*/

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light;

  --paper: #f6f6f4;
  --surface: #ffffff;
  --surface-sunken: #eeeeeb;
  --ink: #17191d;
  --ink-soft: #55595f;
  --ink-faint: #85898f;
  --line: #dcdcd7;
  --line-strong: #c6c6c0;

  --copper: #a95c34;
  --copper-soft: #f3e6df;
  --oxide: #357866;
  --oxide-soft: #e2efeb;
  --warn: #8a6412;
  --warn-soft: #f7edd6;

  --radius: 6px;
  --pill: 999px;

  --sidebar-w: 258px;
  --outline-w: 208px;
  --header-h: 58px;
  --measure: 74ch;

  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --shadow-panel: 0 1px 2px rgba(23, 25, 29, 0.05), 0 8px 24px -16px rgba(23, 25, 29, 0.28);
}

[data-theme="dark"] {
  color-scheme: dark;

  --paper: #131519;
  --surface: #191c21;
  --surface-sunken: #101215;
  --ink: #e4e6e9;
  --ink-soft: #a3a8af;
  --ink-faint: #767c85;
  --line: #272b31;
  --line-strong: #363b43;

  --copper: #d98a5c;
  --copper-soft: #2a1f19;
  --oxide: #5cae98;
  --oxide-soft: #16241f;
  --warn: #d5a94a;
  --warn-soft: #262015;

  --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -16px rgba(0, 0, 0, 0.7);
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--copper);
  text-decoration-color: color-mix(in srgb, var(--copper) 35%, transparent);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  border-radius: 3px;
}

img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------- header */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.masthead__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.masthead__mark {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 3px;
  background: linear-gradient(148deg, var(--copper) 0%, var(--oxide) 100%);
}

.masthead__version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  padding: 1px 8px;
}

.masthead__spacer {
  flex: 1;
}

.masthead__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.masthead__link {
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
}

.masthead__link:hover {
  color: var(--ink);
  background: var(--surface-sunken);
}

.iconbtn {
  height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.iconbtn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.iconbtn:active {
  transform: translateY(1px);
}

.masthead__menu {
  display: none;
}

/* -------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}

/* ------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 12px 48px 20px;
  border-right: 1px solid var(--line);
}

.search {
  position: relative;
  margin-bottom: 18px;
}

.search__input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search__input::placeholder {
  color: var(--ink-faint);
}

.search__empty {
  display: none;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink-faint);
}

.search.is-empty .search__empty {
  display: block;
}

.nav__group {
  margin-bottom: 20px;
}

.nav__title {
  margin: 0 0 6px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

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

.nav__link {
  display: block;
  padding: 5px 10px;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
}

.nav__link:hover {
  color: var(--ink);
  background: var(--surface-sunken);
}

.nav__link.is-current {
  color: var(--copper);
  background: var(--copper-soft);
  border-left-color: var(--copper);
  font-weight: 500;
}

.nav__link[hidden] {
  display: none;
}

/* -------------------------------------------------------------- content */

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--outline-w);
  gap: 40px;
  padding: 40px 32px 96px;
}

.page {
  min-width: 0;
  max-width: var(--measure);
}

.page__eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}

.page > h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.022em;
  font-weight: 600;
}

.page__lede {
  margin: 0 0 30px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.page h2 {
  margin: 44px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.014em;
  font-weight: 600;
}

.page h3 {
  margin: 28px 0 8px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.008em;
}

.page h4 {
  margin: 22px 0 6px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.page p,
.page ul,
.page ol {
  margin: 0 0 14px;
}

.page ul,
.page ol {
  padding-left: 22px;
}

.page li {
  margin-bottom: 5px;
}

.page li::marker {
  color: var(--ink-faint);
}

.anchor {
  margin-left: 8px;
  font-weight: 400;
  color: var(--ink-faint);
  text-decoration: none;
  opacity: 0;
}

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

/* ----------------------------------------------------------------- code */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.08em 0.34em;
  white-space: nowrap;
}

pre {
  position: relative;
  margin: 0 0 18px;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre;
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 26px;
  padding: 0 9px;
  font: inherit;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--ink-faint);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}

pre:hover .copy,
.copy:focus-visible {
  opacity: 1;
}

.copy:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* --------------------------------------------------------------- tables */

.tablewrap {
  overflow-x: auto;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

thead th {
  background: var(--surface-sunken);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

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

td code {
  white-space: nowrap;
}

/* ---------------------------------------------------------------- notes */

.note {
  margin: 0 0 20px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-faint);
  border-radius: var(--radius);
  font-size: 14.5px;
}

.note > :last-child {
  margin-bottom: 0;
}

.note__label {
  display: block;
  margin-bottom: 3px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.note--warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.note--warn .note__label {
  color: var(--warn);
}

.note--copper {
  border-left-color: var(--copper);
  background: var(--copper-soft);
}

.note--copper .note__label {
  color: var(--copper);
}

/* ------------------------------------------- pieces bar (site signature) */

/*
   Used anywhere the docs talk about wearing 1 to 4 matching pieces. Four
   slots, filled left to right, with the resulting power printed beside them.
   It appears often enough that readers learn to scan for it.
*/

.pieces {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.pieces__slots {
  display: inline-flex;
  gap: 3px;
}

.pieces__slot {
  width: 13px;
  height: 17px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: transparent;
}

.pieces__slot.is-on {
  background: var(--copper);
  border-color: var(--copper);
}

.pieces__value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.tiers {
  display: grid;
  gap: 7px;
  margin: 0 0 20px;
  padding: 14px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------ trim cards */

.trimgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.trim {
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.trim__name {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 600;
}

.trim__name a {
  color: inherit;
  text-decoration: none;
}

.trim__name a:hover {
  color: var(--copper);
}

.trim__body {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.special {
  display: inline-block;
  margin-top: 8px;
  padding: 1px 8px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--oxide);
  background: var(--oxide-soft);
  border-radius: var(--pill);
}

/* --------------------------------------------------------------- outline */

.outline {
  position: sticky;
  top: calc(var(--header-h) + 40px);
  max-height: calc(100dvh - var(--header-h) - 80px);
  overflow-y: auto;
  font-size: 13px;
}

.outline__title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.outline__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

.outline__link {
  display: block;
  padding: 3px 0 3px 12px;
  margin-left: -1px;
  color: var(--ink-faint);
  text-decoration: none;
  border-left: 1px solid transparent;
  line-height: 1.45;
}

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

.outline__link.is-active {
  color: var(--copper);
  border-left-color: var(--copper);
}

.outline__link--sub {
  padding-left: 24px;
  font-size: 12.5px;
}

/* ------------------------------------------------------------- page foot */

.pagefoot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-faint);
}

.pagenext {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pagenext:hover {
  border-color: var(--copper);
  color: var(--copper);
}

/* ------------------------------------------------------------- homepage */

.hero {
  padding: 8px 0 34px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.028em;
  font-weight: 600;
}

.hero p {
  max-width: 62ch;
  font-size: 17px;
  color: var(--ink-soft);
}

.herolinks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.btn--primary {
  background: var(--copper);
  color: #ffffff;
  border-color: var(--copper);
}

[data-theme="dark"] .btn--primary {
  color: #1a1005;
}

.btn--primary:hover {
  filter: brightness(1.07);
}

.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn--ghost:hover {
  border-color: var(--line-strong);
}

.btn:active {
  transform: translateY(1px);
}

.cardgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.card {
  display: block;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}

.card:hover {
  border-color: var(--copper);
}

.card__name {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 600;
}

.card__body {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ------------------------------------------------------------ responsive */

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

@media (max-width: 860px) {
  .masthead__menu {
    display: inline-flex;
  }

  .masthead__links {
    display: none;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 30;
    width: 100%;
    height: auto;
    padding: 20px 20px 60px;
    background: var(--paper);
    border-right: 0;
  }

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

  .content {
    padding: 30px 20px 80px;
  }

  .page > h1 {
    font-size: 29px;
  }

  .hero h1 {
    font-size: 32px;
  }

  body {
    font-size: 15px;
  }
}

@media print {
  .masthead,
  .sidebar,
  .outline,
  .copy,
  .pagefoot {
    display: none;
  }
  .content {
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
  }
}
