/* relay-docs styles — aligned to relay.md design tokens */

@font-face {
  font-family: 'geist-sans';
  src: url('/assets/fonts/geist.woff2') format('woff2');
  font-display: swap;
}

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

:root {
  --shell-max: 1280px;
  --sidebar-width: 260px;
  --content-max: 720px;

  /* Tokens aligned to relay-marketing */
  --color-bg: #ffffff;
  --color-text: #09090b;
  --color-muted: #71717a;
  --color-border: #e4e4e7;
  --color-accent: #0D9373;
  --color-active-bg: #f0fdf4;
  --color-code-bg: #f4f4f5;
  --radius: 0.5rem;

  --font-sans: 'geist-sans', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
}

[data-theme="dark"] {
  --color-bg: #09090b;
  --color-text: #fafafa;
  --color-muted: #a1a1aa;
  --color-border: #27272a;
  --color-active-bg: #052e1c;
  --color-code-bg: #18181b;
}

html {
  scroll-padding-top: 57px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ============================================================
   Header — full-width bar, content centered in shell
   ============================================================ */

.site-header {
  border-bottom: 1px solid rgba(228, 228, 231, 0.6);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
}

[data-theme="dark"] .site-header {
  background: rgba(9, 9, 11, 0.95);
  border-bottom-color: rgba(39, 39, 42, 0.6);
}

.site-header-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  color: var(--color-text);
  text-decoration: none;
  line-height: 0;
}

.logo-wordmark {
  height: 24px;
  width: auto;
  display: block;
  color: var(--color-text);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  color: rgba(9, 9, 11, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
}

.header-nav a:hover {
  color: var(--color-text);
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: calc(var(--radius) - 2px);
  color: rgba(9, 9, 11, 0.7);
  transition: background 0.1s, color 0.1s;
  /* reset button defaults */
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.header-icon-btn:hover {
  background: var(--color-active-bg);
  color: var(--color-text);
}

.header-icon-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
}

/* Dark mode: header nav link + icon button colors */
[data-theme="dark"] .header-nav a {
  color: rgba(250, 250, 250, 0.7);
}

[data-theme="dark"] .header-icon-btn {
  color: rgba(250, 250, 250, 0.7);
}

/* Theme toggle — show moon in light mode, sun in dark mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   Two-column doc layout — centered in shell
   ============================================================ */

.layout {
  display: flex;
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: calc(100vh - 57px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 1.5rem;
}

.nav-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.35rem 0.5rem;
}

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-group li a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
}

.nav-group li a:hover {
  background: var(--color-active-bg);
}

.nav-group li a.active {
  background: var(--color-active-bg);
  color: var(--color-accent);
  font-weight: 500;
}

/* ============================================================
   Main doc content
   ============================================================ */

.doc-content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: calc(var(--content-max) + 5rem);
  min-width: 0;
}

.doc-content h1 {
  margin-top: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.doc-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.doc-content h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.doc-content h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.doc-content p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.doc-content li {
  margin-bottom: 0.25rem;
}

.doc-content a {
  color: var(--color-accent);
  text-decoration: none;
}

.doc-content a:hover {
  text-decoration: underline;
}

/* Code */
.doc-content code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--color-code-bg);
  padding: 0.1em 0.35em;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--color-border);
}

.doc-content pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.25rem 0;
}

.doc-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
}

/* Images */
.doc-content img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  display: block;
  margin: 1.25rem 0;
}

/* Image captions — italic-only paragraph following an image */
.doc-content p:has(> em:only-child) {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-top: -0.75rem;
  text-align: center;
}

/* Callout blockquotes (Note / Tip / Info) */
.doc-content blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--color-active-bg);
  border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0;
  color: var(--color-text);
}

.doc-content blockquote p:first-child {
  margin-top: 0;
}

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

/* Tables */
.doc-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  display: block;
  overflow-x: auto;
}

.doc-content th,
.doc-content td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  white-space: normal;
}

.doc-content th {
  background: var(--color-code-bg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Horizontal rule */
.doc-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

/* ============================================================
   Footer — full-width bar, content centered in shell
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--color-border);
}

.site-footer-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.5rem 0;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li {
  margin-bottom: 0.35rem;
}

.footer-col a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.footer-col a:hover {
  color: var(--color-text);
}

.logo-wordmark-footer {
  height: 1.5rem;
  width: auto;
  display: block;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.footer-brand-tagline {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin: 0 0 0.5rem 0;
}

.footer-brand-attr {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-decoration: none;
}

.footer-brand-attr:hover {
  color: var(--color-text);
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.footer-bottom a {
  color: var(--color-muted);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--color-text);
}

/* ============================================================
   Mobile
   ============================================================ */

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .doc-content {
    padding: 1.5rem 1rem;
  }
  .doc-content th,
  .doc-content td {
    white-space: normal;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
