/*
 * Rhine Docs. Same fonts and colours as the web app (src/styles/tokens.css), kept as plain CSS
 * because the docs are static pages without the Angular build.
 */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/BricolageGrotesque-Variable-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Variable-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Variable-latin.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --mist: #f5f6f7;
  --line: #e4e6ea;
  --slate: #5a6170;
  --ink: #0f1114;
  --blue: #1d4b7a;
  --blue-tint: #eef3f8;
  --code-bg: #0f1114;
  --code-fg: #e8e9ec;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121418;
    --mist: #1a1d22;
    --line: #2a2e35;
    --slate: #a9afb9;
    --ink: #e8e9ec;
    --blue: #8fb3d9;
    --blue-tint: #1a2633;
    --code-bg: #0a0b0d;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--blue);
  text-underline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--paper);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--ink);
  text-decoration: none;
}
.brand__word {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand__docs {
  color: var(--slate);
  font-weight: 500;
}
.top__site {
  font-size: 14px;
}

.frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1120px;
  margin: 0 auto;
}

.side {
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.side ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.side a {
  display: inline-block;
  padding: 4px 0;
  color: var(--slate);
  font-size: 14px;
  text-decoration: none;
}
.side a:hover,
.side a[aria-current='page'] {
  color: var(--ink);
}
.side a[aria-current='page'] {
  font-weight: 600;
}

.content {
  min-width: 0;
  padding: 24px var(--gutter) 64px;
}
.content > :first-child {
  margin-top: 0;
}

@media (min-width: 860px) {
  .frame {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 48px;
    padding: 0 24px;
  }
  .side {
    position: sticky;
    top: 0;
    align-self: start;
    padding: 32px 0;
    border-bottom: 0;
  }
  .side ul {
    flex-direction: column;
  }
  .content {
    padding: 32px 0 96px;
    max-width: 760px;
  }
}

h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.15;
  letter-spacing: -0.015em;
}
h1 {
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 800;
  margin: 0 0 12px;
}
h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 48px 0 12px;
}
h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 32px 0 8px;
}
.lead {
  font-size: 19px;
  color: var(--slate);
  margin: 0 0 24px;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--mist);
  overflow-wrap: anywhere;
}
pre {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-fg);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
}
pre code {
  padding: 0;
  background: none;
  color: inherit;
  overflow-wrap: normal;
}

.table {
  overflow-x: auto;
  margin: 16px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
th,
td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 600;
  white-space: nowrap;
}

.note {
  margin: 20px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  background: var(--blue-tint);
}
.note p {
  margin: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}
.cards li + li {
  margin-top: 0;
}
.cards a {
  display: block;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}
.cards a:hover {
  border-color: var(--blue);
}
.cards strong {
  display: block;
  font-family: var(--display);
  font-size: 17px;
  margin-bottom: 4px;
}
.cards span {
  color: var(--slate);
  font-size: 14px;
}

ol,
ul {
  padding-left: 22px;
}
li + li {
  margin-top: 4px;
}

.foot {
  padding: 24px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--slate);
  font-size: 14px;
  text-align: center;
}
.foot p {
  margin: 4px 0;
}

/* Tool names stay whole; a wide table scrolls inside its .table box instead. */
td code {
  white-space: nowrap;
  overflow-wrap: normal;
}
.side li + li {
  margin-top: 0;
}

/* Tool tables on phones: one card per tool (name, description, then permission and kind on one line). */
@media (max-width: 640px) {
  .tools table,
  .tools tbody,
  .tools tr,
  .tools td {
    display: block;
  }
  .tools tr:first-child {
    display: none;
  }
  .tools tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .tools td {
    padding: 2px 0;
    border: 0;
  }
  .tools td:nth-child(3),
  .tools td:nth-child(4) {
    display: inline;
    color: var(--slate);
    font-size: 14px;
  }
  .tools td:nth-child(3)::before {
    content: 'Permission: ';
  }
  .tools td:nth-child(4)::before {
    content: ' · ';
  }
}
