/* LinkHub documentation site - same tokens as the app's Excalidraw theme. */

:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --border: #e4e4ea;
  --text: #1b1b1f;
  --muted: #5d5d6a;
  --accent: #5b57d1;
  --accent-soft: rgba(91, 87, 209, 0.1);
  --code-bg: #f3f3f6;
  --shadow:
    0 1px 2px rgba(0, 0, 0, 0.06), 0 12px 32px -12px rgba(0, 0, 0, 0.18);
  --radius: 12px;
  --font:
    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text',
    'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
  --topbar: 60px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f0f12;
  --surface: #16161a;
  --surface-2: #1d1d23;
  --border: #2a2a31;
  --text: #ededf0;
  --muted: #a3a3ae;
  --accent: #a8a5ff;
  --accent-soft: rgba(168, 165, 255, 0.12);
  --code-bg: #1d1d23;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -12px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--topbar) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.skip:focus {
  top: 12px;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Top bar ─────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  padding: 4px;
  border-radius: 8px;
  background: #1a1a1f;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 320px;
  margin-left: auto;
}

.search svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 60vh;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  list-style: none;
}

.search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.search-results a:hover,
.search-results a[aria-selected='true'] {
  background: var(--accent-soft);
}

.search-results small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.topbar-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.topbar-link:hover {
  color: var(--text);
}

.theme-toggle,
.menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle svg {
  display: none;
}

:root[data-theme='light'] .theme-toggle svg[data-icon='dark'],
:root[data-theme='dark'] .theme-toggle svg[data-icon='light'] {
  display: block;
}

.menu-toggle {
  display: none;
}

/* ── Layout ──────────────────────────────────────────────── */

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

.sidebar {
  position: sticky;
  top: var(--topbar);
  align-self: start;
  height: calc(100vh - var(--topbar));
  padding: 28px 16px 40px 24px;
  overflow-y: auto;
}

.sidebar ul {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.nav-section {
  margin: 0 0 6px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  text-decoration: none;
}

.sidebar a:hover {
  background: var(--surface-2);
}

.sidebar a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 208px;
  gap: 40px;
  padding: 32px 32px 64px;
}

.content {
  min-width: 0;
  max-width: 760px;
}

.toc {
  position: sticky;
  top: calc(var(--topbar) + 32px);
  align-self: start;
  font-size: 14px;
}

.toc p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.toc a {
  display: block;
  padding: 3px 0;
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover,
.toc a.active {
  color: var(--accent);
}

/* ── Content ─────────────────────────────────────────────── */

.content h1 {
  margin: 0 0 16px;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.content h2 {
  margin: 48px 0 12px;
  padding-top: 8px;
  font-size: 24px;
  letter-spacing: -0.015em;
}

.content h3 {
  margin: 32px 0 8px;
  font-size: 18px;
}

.content h4 {
  margin: 24px 0 8px;
  font-size: 16px;
}

.anchor {
  float: left;
  margin-left: -22px;
  padding-right: 6px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}

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

.content p,
.content li {
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
  overflow-wrap: anywhere;
}

.content code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--code-bg);
  font: 0.88em var(--mono);
}

.content pre {
  margin: 16px 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  line-height: 1.55;
}

.content pre code {
  padding: 0;
  background: none;
  font-size: 14px;
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  font: 0.85em var(--mono);
}

.table-wrap {
  margin: 16px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

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

th {
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
}

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

figure {
  margin: 24px 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

blockquote {
  margin: 16px 0;
  padding: 4px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}

.edit {
  margin-top: 48px;
  font-size: 14px;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pager a {
  display: grid;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--accent);
}

.pager span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.pager .next {
  text-align: right;
}

/* ── Home ────────────────────────────────────────────────── */

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

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 8px 0 12px;
  font-size: 56px;
  letter-spacing: -0.035em;
}

.lead {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  border-color: var(--accent);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.hero-shot {
  margin: 32px 0 8px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.card {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 120ms,
    transform 120ms;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card span {
  color: var(--muted);
  font-size: 14px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.gallery figure {
  margin: 0;
}

/* ── Footer ──────────────────────────────────────────────── */

.footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1100px) {
  main {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .menu-toggle {
    display: inline-grid;
  }

  .topbar {
    gap: 10px;
    padding: 0 14px;
  }

  .topbar-link {
    display: none;
  }

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

  .sidebar {
    position: fixed;
    top: var(--topbar);
    left: 0;
    z-index: 15;
    width: min(300px, 86vw);
    border-right: 1px solid var(--border);
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 160ms;
  }

  body.nav-open .sidebar {
    transform: none;
    box-shadow: var(--shadow);
  }

  main {
    padding: 24px 18px 48px;
  }

  .content h1 {
    font-size: 30px;
  }

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

  .lead {
    font-size: 18px;
  }

  .anchor {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
