/*
 * docs.pointshift.app: the app's shell (the rail on the canvas, the page in one rounded panel that scrolls on its own,
 * AppShell.tsx), with text set the way Notion sets a page: a heavy title, full-colour body text, tight block spacing,
 * light grid tables in a rounded frame, callouts with an icon, and a sidebar laid out like AI Studio's docs (32px rows, small
 * section labels). Compact, rounded everywhere, motion only where it explains a change. Tokens only; sentence case only.
 */

@font-face {
  font-family: 'Bricolage Grotesque Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url(/assets/fonts/bricolage-grotesque-latin-standard-normal.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/assets/fonts/geist-mono-latin-400-normal.woff2) format('woff2');
}

:root {
  --rail: 248px;
  --gap: 6px;
  --read: 680px;
  --ink: color-mix(in srgb, var(--color-text-primary) 88%, transparent);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
  color-scheme: dark;
}
[data-theme='light'] {
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--color-bg-canvas);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-variation-settings: var(--font-variation-sans);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.1px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  color: inherit;
}

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

.skip {
  position: fixed;
  left: 12px;
  top: -48px;
  z-index: 60;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
}
.skip:focus {
  top: 12px;
}

/* ---- Shell: on desktop the panel scrolls, the rail and the window don't (as in the app) ---- */

.shell {
  display: flex;
  gap: var(--gap);
  height: 100dvh;
  padding: var(--gap);
  overflow: hidden;
}

.rail {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--rail);
  padding: 4px 8px 8px;
  view-transition-name: rail;
}

.panel {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 32px;
  border-radius: 20px;
  background: var(--color-bg-chrome);
  view-transition-name: panel;
}
@media (prefers-reduced-motion: no-preference) {
  .panel {
    scroll-behavior: smooth;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  margin: 0;
  padding: 0 10px;
  color: var(--color-text-primary);
}
.logo svg {
  display: block;
  flex: none;
}
.logo-docs {
  font-size: 14px;
  font-weight: 600;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-icon-secondary);
  cursor: pointer;
  transition:
    background-color 100ms,
    color 100ms;
}
.icon-btn:hover {
  background: var(--color-overlay-05);
  color: var(--color-icon-primary);
}

/* ---- Sidebar (measured from AI Studio's docs, 2026-11-01): 32px rows 2px apart, 12px corners, one medium weight
   in a dim grey that lifts on hover, the current page on a soft pill; 12px section labels 16px above each group,
   aligned with the row text; no folding ---- */

.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px 16px;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.nav::-webkit-scrollbar {
  display: none;
}
.nav {
  --fade-top: 0px;
  --fade-bottom: 0px;
  mask-image: linear-gradient(to bottom, transparent 0, black var(--fade-top), black calc(100% - var(--fade-bottom)), transparent 100%);
}
.nav.more-above {
  --fade-top: 20px;
}
.nav.more-below {
  --fade-bottom: 28px;
}
.nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sec-label {
  display: flex;
  align-items: center;
  height: 26px;
  margin: 16px 0 0;
  padding: 0 10px;
  color: color-mix(in srgb, var(--color-text-tertiary) 62%, var(--color-text-disabled));
  font-size: 12px;
  letter-spacing: 0.2px;
}
.sec-label:first-child {
  margin-top: 4px;
}
.nav li + li {
  margin-top: 2px;
}
.nav a {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-lg);
  color: var(--color-text-tertiary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    background-color 100ms,
    color 100ms;
}
.nav a:hover {
  color: var(--color-text-secondary);
  background: var(--color-overlay-05);
}
.nav a[aria-current='page'] {
  background: var(--color-overlay-08);
  color: var(--ink);
}

/* The foot: one full-width button. */
.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}
.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 2px;
}
.open-app {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--color-overlay-05);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition:
    background-color 100ms,
    color 100ms;
}
.open-app:hover {
  background: var(--color-overlay-08);
  color: var(--color-text-primary);
}
/* The app's arrow-up, turned to point up-right: "opens elsewhere". */
.open-app svg {
  color: var(--color-icon-tertiary);
  transform: rotate(45deg);
}
.open-app:hover svg {
  color: var(--color-icon-primary);
}
/* Sun in dark (switch to light), moon in light. */
.theme-btn svg:last-child,
[data-theme='light'] .theme-btn svg:first-child {
  display: none;
}
[data-theme='light'] .theme-btn svg:last-child {
  display: block;
}

/* ---- Search: a sidebar row that is a field, results in a menu under it ---- */

.find {
  position: relative;
  margin: 0;
}
.find-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 4px 0 10px;
  border-radius: var(--radius-lg);
  color: var(--color-icon-tertiary);
  transition: background-color 120ms;
}
.find-field:hover {
  background: var(--color-overlay-05);
}
.find-field:focus-within {
  background: var(--color-overlay-08);
}
.find-field svg {
  flex: none;
}
.find-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--color-text-primary);
  font: inherit;
}
.find-field input::placeholder {
  color: var(--color-text-secondary);
}
.find-field input::-webkit-search-cancel-button {
  display: none;
}
.find-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 420px;
  max-height: min(460px, calc(100dvh - 120px));
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  background: var(--color-surface-overlay);
  box-shadow: var(--shadow-overlay);
  list-style: none;
  scrollbar-width: none;
  transform-origin: top left;
}
.find-list::-webkit-scrollbar {
  display: none;
}
@media (prefers-reduced-motion: no-preference) {
  .find-list:not([hidden]) {
    animation: fade-in 100ms ease-out both;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
.find-list a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  transition: background-color 100ms;
}
.find-list [aria-selected='true'] a,
.find-list a:hover {
  background: var(--color-overlay-05);
}
.r-title {
  display: block;
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.r-title span {
  color: var(--color-text-tertiary);
  font-weight: 400;
}
.r-text {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--color-text-tertiary);
  font-size: 13px;
  line-height: 18px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.r-text mark {
  background: none;
  color: var(--color-text-primary);
}
.find-empty {
  padding: 10px;
  color: var(--color-text-tertiary);
}
.find-ghost {
  padding: 10px;
}
.find-ghost .ghost + .ghost {
  margin-top: 8px;
}

/* ---- The panel's top bar: phones and tablets only (menu, logo, search) ---- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 14px;
  border-radius: 20px 20px 0 0;
  background: var(--color-bg-chrome);
}
.bar,
.find-bar {
  display: none;
}

/* ---- Page: Notion's page setting ---- */

.page {
  display: flex;
  justify-content: center;
  gap: 48px;
  padding: 56px 40px 96px;
  view-transition-name: page;
}
.doc {
  width: 100%;
  max-width: var(--read);
  min-width: 0;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--color-text-primary);
  text-wrap: balance;
}
h1 {
  font-size: 30px;
  line-height: 38px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.lead {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 24px;
  text-wrap: pretty;
}
article > .lead + * {
  margin-top: 20px;
}
h2 {
  margin: 28px 0 2px;
  font-size: 19px;
  line-height: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h3 {
  margin: 18px 0 2px;
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Body blocks: full-colour ink, 16/26, and only a small gap between blocks. */
article p,
article li {
  color: var(--ink);
  font-size: 15px;
  line-height: 24px;
  text-wrap: pretty;
}
article p {
  margin: 6px 0 0;
}
article strong {
  color: var(--color-text-primary);
  font-weight: 600;
}
article a {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms;
}
article a:hover {
  text-decoration-color: currentColor;
}

article ul,
article ol {
  margin: 6px 0 0;
  padding-left: 22px;
}
article li + li {
  margin-top: 2px;
}
article ul > li::marker {
  color: var(--ink);
  font-size: 0.9em;
}
article ol > li::marker {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

kbd,
code {
  font-family: var(--font-mono);
  font-size: 0.82em;
}
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  line-height: 18px;
  text-align: center;
}
code {
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  background: var(--color-overlay-08);
}

/* Tables: a light grid, the header row tinted. */
.table {
  margin: 12px 0 0;
  overflow-x: auto;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 7px 10px;
  border-right: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
  font-size: 13.5px;
  line-height: 20px;
  text-align: left;
  vertical-align: top;
}
th:last-child,
td:last-child {
  border-right: 0;
}
tbody tr:last-child td {
  border-bottom: 0;
}
th {
  background: var(--color-overlay-05);
  color: var(--color-text-secondary);
  font-weight: 500;
}
td {
  color: var(--ink);
}
td:first-child {
  color: var(--color-text-primary);
}
/* A key/value table (its header was left blank): no header row; the keys column is tinted instead. */
.kv td:first-child {
  width: 34%;
  background: var(--color-overlay-05);
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* Callouts: the icon, then the text, on a soft tint. */
.note {
  display: flex;
  gap: 10px;
  margin: 12px 0 0;
  padding: 12px 14px 12px 12px;
  border-radius: var(--radius-lg);
  background: var(--color-overlay-05);
}
.note > svg {
  flex: none;
  margin-top: 2px;
  color: var(--color-icon-secondary);
}
.note p {
  margin: 0;
  font-size: 14px;
  line-height: 22px;
}

figure {
  margin: 12px 0 0;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}
figcaption {
  margin-top: 6px;
  color: var(--color-text-tertiary);
  font-size: 14px;
}

/* ---- Prev / Next ---- */

.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-subtle);
}
.pn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition:
    background-color 100ms,
    color 100ms;
}
.pn-prev {
  margin-left: -8px;
}
.pn-next {
  margin-right: -8px;
}
.pn:hover {
  background: var(--color-overlay-05);
  color: var(--color-text-primary);
}
.pn svg {
  color: var(--color-icon-tertiary);
}

/* ---- On this page ---- */

.toc {
  position: sticky;
  top: 40px;
  align-self: flex-start;
  flex: none;
  width: 184px;
  padding-top: 10px;
}
.toc p {
  margin: 0 0 6px;
  color: var(--color-text-tertiary);
  font-size: 12px;
  font-weight: 500;
}
.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc a {
  display: block;
  padding: 4px 0;
  color: var(--color-text-tertiary);
  font-size: 13px;
  line-height: 18px;
  transition: color 200ms;
}
.toc a:hover,
.toc a.on {
  color: var(--color-text-primary);
}

/* ---- Ghost loading: the page's outline while the next page loads ---- */

.ghost {
  position: relative;
  display: block;
  height: 12px;
  border-radius: var(--radius-sm);
  background: var(--color-overlay-08);
}
@media (prefers-reduced-motion: no-preference) {
  .ghost-page {
    animation: breathe 1.6s ease-in-out infinite;
  }
}
@keyframes breathe {
  50% {
    opacity: 0.5;
  }
}
.ghost-title {
  width: 52%;
  height: 28px;
  border-radius: var(--radius-md);
}
.ghost-lead {
  width: 78%;
  height: 14px;
  margin-top: 12px;
}
.ghost-h2 {
  width: 30%;
  height: 16px;
  margin-top: 32px;
}
.ghost-line {
  margin-top: 10px;
}

/* ---- Page changes: only the page fades across; the rail and the bar swap in place ---- */

@view-transition {
  navigation: auto;
  types: page;
}
@media (prefers-reduced-motion: no-preference) {
  html:active-view-transition-type(page)::view-transition-old(root) {
    display: none;
  }
  html:active-view-transition-type(page)::view-transition-new(root) {
    animation: none;
  }
  html:active-view-transition-type(page)::view-transition-group(panel),
  html:active-view-transition-type(page)::view-transition-group(page) {
    animation: none;
  }
  html:active-view-transition-type(page)::view-transition-old(panel) {
    display: none;
  }
  html:active-view-transition-type(page)::view-transition-new(panel) {
    animation: none;
  }
  html:active-view-transition-type(page)::view-transition-old(page) {
    animation: page-out 70ms linear both;
  }
  html:active-view-transition-type(page)::view-transition-new(page) {
    animation: fade-in 140ms ease-out both;
  }
  html:active-view-transition-type(page)::view-transition-group(rail),
  html:active-view-transition-type(page)::view-transition-new(rail) {
    animation: none;
  }
  html:active-view-transition-type(page)::view-transition-old(rail) {
    display: none;
  }
  /* The theme switch: one soft cross-fade of everything. */
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 160ms;
  }
}
@keyframes page-out {
  to {
    opacity: 0;
  }
}

/* ---- Smaller screens ---- */

@media (max-width: 1199px) {
  .toc {
    display: none;
  }
}

@media (max-width: 1023px) {
  /* Phones and tablets: the window scrolls, the rail is a sheet. */
  .shell {
    display: block;
    height: auto;
    padding: 0;
    overflow: visible;
  }
  .panel {
    min-height: 100dvh;
    overflow: visible;
    border-radius: 0;
  }
  html {
    scroll-padding-top: 72px;
  }
  .rail {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: min(88vw, 300px);
    height: 100dvh;
    padding: 8px 10px 10px;
    border-right: 1px solid var(--color-border-default);
    border-radius: 0 12px 12px 0;
    background: var(--color-bg-canvas);
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 260ms var(--ease-out),
      visibility 260ms;
    view-transition-name: none;
  }
  .nav-open .rail {
    transform: none;
    visibility: visible;
  }
  body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--color-overlay-scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms var(--ease-out);
  }
  .nav-open::after {
    opacity: 1;
    pointer-events: auto;
  }
  .find-rail {
    display: none;
  }
  .bar {
    display: flex;
    height: 52px;
    padding: 0 8px;
    border-radius: 0;
  }
  .bar > .logo {
    margin: 0;
    padding: 0 6px;
  }
  .search-open {
    margin-left: auto;
  }
  .bar.searching > :not(.find-bar) {
    display: none;
  }
  .bar.searching .find-bar {
    display: block;
    flex: 1;
    margin: 0;
  }
  .find-bar .find-field {
    background: var(--color-overlay-08);
  }
  .find-bar .find-list {
    position: fixed;
    top: 52px;
    left: 8px;
    right: 8px;
    width: auto;
  }
  .page {
    padding: 16px 20px 72px;
  }
}

@media (max-width: 479px) {
  .page {
    padding: 12px 16px 64px;
  }
  h1 {
    font-size: 26px;
    line-height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail,
  body::after {
    transition: none;
  }
}
