/* Salut documentation theme — "Warm Precision"
   Amber warmth from the waving hand, infrastructure-grade clarity. */

/* ── Reset ────────────────────────────────────────────────────────── */

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

/* ── Design tokens ────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  /* Brand amber — derived from the waving-hand icon */
  --salut-amber: oklch(0.75 0.14 75);
  --salut-amber-hover: oklch(0.68 0.15 75);
  --salut-amber-subtle: oklch(0.95 0.03 75);
  --salut-amber-glow: oklch(0.80 0.12 75 / 0.3);

  /* Surfaces */
  --salut-bg: light-dark(#fbfbfd, #0d0d0d);
  --salut-bg-raised: light-dark(#ffffff, #1a1a1c);
  --salut-bg-inset: light-dark(#f0f0f2, #141416);
  --salut-bg-nav: light-dark(rgba(251, 251, 253, 0.85), rgba(13, 13, 13, 0.85));

  /* Text */
  --salut-text: light-dark(#1d1d1f, #f5f5f7);
  --salut-text-secondary: light-dark(#6e6e6e, #a1a1a6);
  --salut-text-tertiary: light-dark(#999999, #6e6e73);

  /* Borders */
  --salut-border: light-dark(#d2d2d7, #38383a);
  --salut-border-subtle: light-dark(#e8e8ed, #2c2c2e);

  /* Shadows */
  --salut-shadow-sm: light-dark(
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.3)
  );
  --salut-shadow-md: light-dark(
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.4)
  );

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", "Fira Code",
    monospace;

  /* Spacing (8pt grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* Layout */
  --content-width: 720px;
  --content-wide: 960px;
  --content-max: 1120px;
  --sidebar-width: 220px;
  --nav-height: 52px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.2s;
}

/* Dark-mode amber adjustments */
@media (prefers-color-scheme: dark) {
  :root {
    --salut-amber-subtle: oklch(0.25 0.05 75);
    --salut-amber-glow: oklch(0.60 0.14 75 / 0.25);
  }
}

/* ── Base ─────────────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--sp-6));
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.625;
  color: var(--salut-text);
  background: var(--salut-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Kill Sphinx basic theme defaults */
div.document,
div.documentwrapper,
div.bodywrapper,
div.body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  background: none;
}

div.sphinxsidebar,
div.related {
  display: none;
}

/* ── Typography ───────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  color: var(--salut-text);
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 1.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-4);
}

h2 {
  font-size: clamp(1.35rem, 1rem + 1vw, 1.75rem);
  letter-spacing: -0.02em;
  margin-top: var(--sp-12);
  margin-bottom: var(--sp-4);
}

h3 {
  font-size: clamp(1.1rem, 0.9rem + 0.5vw, 1.3rem);
  letter-spacing: -0.01em;
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-3);
}

h4, h5, h6 {
  font-size: 1rem;
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-2);
}

p {
  margin: 0 0 var(--sp-4);
}

a {
  color: var(--salut-amber);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

a:hover {
  color: var(--salut-amber-hover);
}

strong {
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--salut-bg-inset);
  border: 1px solid var(--salut-border-subtle);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--salut-bg-inset);
  border: 1px solid var(--salut-border-subtle);
  overflow-x: auto;
  margin: 0 0 var(--sp-4);
}

pre code {
  padding: 0;
  background: none;
  border: none;
  font-size: inherit;
}

blockquote {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--salut-amber);
  background: var(--salut-amber-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

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

hr {
  border: none;
  height: 1px;
  background: var(--salut-border-subtle);
  margin: var(--sp-8) 0;
}

ul, ol {
  margin: 0 0 var(--sp-4);
  padding-left: var(--sp-6);
}

li {
  margin-bottom: var(--sp-2);
}

li > ul, li > ol {
  margin-top: var(--sp-2);
  margin-bottom: 0;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--sp-4);
  font-size: 0.9375rem;
}

th, td {
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  border-bottom: 1px solid var(--salut-border-subtle);
}

th {
  font-weight: 600;
  color: var(--salut-text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Definition lists (MyST field lists) */
dl {
  margin: 0 0 var(--sp-4);
}

dt {
  font-weight: 600;
  margin-top: var(--sp-3);
}

dd {
  margin-left: var(--sp-6);
  margin-bottom: var(--sp-2);
}

/* ── Navigation ───────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--salut-bg-nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--salut-border-subtle);
}

.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--salut-text);
  text-decoration: none;
}

.nav-brand:hover {
  color: var(--salut-text);
}

.nav-icon {
  border-radius: 6px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--salut-text-secondary);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
  position: relative;
}

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

.nav-links a.active {
  color: var(--salut-text);
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: -14px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--salut-amber);
  border-radius: 1px;
}

/* ── Hero ─────────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: var(--sp-24) var(--sp-6) var(--sp-16);
  position: relative;
  overflow: hidden;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: var(--salut-amber-glow);
  filter: blur(100px);
  pointer-events: none;
}

.hero-icon {
  width: 128px;
  height: 128px;
  border-radius: 28px;
  box-shadow: var(--salut-shadow-md);
  margin-bottom: var(--sp-6);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 2rem + 2.5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: var(--sp-4);
  background: linear-gradient(
    135deg,
    var(--salut-text) 0%,
    var(--salut-text-secondary) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: clamp(1.125rem, 0.9rem + 0.6vw, 1.375rem);
  color: var(--salut-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--sp-8);
  max-width: 480px;
  margin-inline: auto;
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--duration) var(--ease-out);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--salut-amber);
  color: #1a1200;
  box-shadow: var(--salut-shadow-sm);
}

.btn-primary:hover {
  background: var(--salut-amber-hover);
  color: #1a1200;
  box-shadow: var(--salut-shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--salut-bg-raised);
  color: var(--salut-text);
  border: 1px solid var(--salut-border);
}

.btn-secondary:hover {
  background: var(--salut-bg-inset);
  border-color: var(--salut-border);
}

/* ── Download card ────────────────────────────────────────────────── */

.download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: var(--sp-6) var(--sp-8);
  background: var(--salut-bg-raised);
  border: 1px solid var(--salut-border-subtle);
  border-radius: var(--radius-lg);
  margin: var(--sp-6) 0;
}

.download-info h3 {
  font-size: 1.125rem;
  margin: 0 0 var(--sp-1);
}

.download-info p {
  color: var(--salut-text-secondary);
  font-size: 0.9375rem;
  margin: 0;
  line-height: 1.5;
}

.download-btn {
  flex-shrink: 0;
  padding: var(--sp-3) var(--sp-8);
  font-size: 1rem;
}

@media (max-width: 640px) {
  .download-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ── Landing page body ────────────────────────────────────────────── */

.landing-body {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-6) var(--sp-16);
}

/* Feature grid — used on landing page via raw HTML */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
  margin: var(--sp-12) 0;
}

.feature {
  padding: var(--sp-6);
  background: var(--salut-bg-raised);
  border-radius: var(--radius-lg);
  border: 1px solid var(--salut-border-subtle);
  transition: box-shadow var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

.feature:hover {
  box-shadow: var(--salut-shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: var(--sp-3);
  display: block;
  line-height: 1;
}

.feature h3 {
  font-size: 1.125rem;
  margin-top: 0;
  margin-bottom: var(--sp-2);
}

.feature p {
  color: var(--salut-text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 0;
  line-height: 1.55;
}

/* How-it-works steps */
.steps {
  max-width: var(--content-width);
  margin: var(--sp-8) auto var(--sp-12);
}

.step {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
}

.step:not(:last-child) {
  border-bottom: 1px solid var(--salut-border-subtle);
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--salut-amber-subtle);
  color: var(--salut-amber-hover);
  font-weight: 600;
  font-size: 0.875rem;
}

.step-content h3 {
  font-size: 1rem;
  margin: 0 0 var(--sp-1);
}

.step-content p {
  color: var(--salut-text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 0;
}

/* CTA section */
.cta-section {
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  margin: var(--sp-8) calc(-1 * var(--sp-6));
  background: var(--salut-bg-inset);
  border-radius: var(--radius-lg);
}

.cta-section h2 {
  margin-top: 0;
  margin-bottom: var(--sp-3);
}

.cta-section p {
  color: var(--salut-text-secondary);
  margin-bottom: var(--sp-6);
}

/* ── Docs layout ──────────────────────────────────────────────────── */

.docs-layout {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6) var(--sp-16);
  display: flex;
  gap: var(--sp-12);
}

.docs-sidebar {
  flex-shrink: 0;
  width: var(--sidebar-width);
  position: sticky;
  top: calc(var(--nav-height) + var(--sp-8));
  align-self: flex-start;
  max-height: calc(100vh - var(--nav-height) - var(--sp-16));
  overflow-y: auto;
}

.sidebar-inner {
  padding-right: var(--sp-4);
}

.sidebar-heading {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--salut-text-tertiary);
  margin: 0 0 var(--sp-3);
}

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

.sidebar-nav li {
  margin-bottom: 1px;
}

.sidebar-nav a {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.875rem;
  color: var(--salut-text-secondary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--duration) var(--ease-out);
}

.sidebar-nav a:hover {
  color: var(--salut-text);
  background: var(--salut-bg-inset);
}

.sidebar-nav a.active {
  color: var(--salut-text);
  background: var(--salut-amber-subtle);
  font-weight: 500;
}

.docs-content {
  flex: 1;
  min-width: 0;
  max-width: var(--content-width);
}

.docs-content-full {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8125rem;
  color: var(--salut-text-tertiary);
  margin-bottom: var(--sp-6);
}

.breadcrumbs a {
  color: var(--salut-text-secondary);
}

.breadcrumbs .sep {
  color: var(--salut-text-tertiary);
}

.breadcrumbs .current {
  color: var(--salut-text);
  font-weight: 500;
}

/* Page navigation (prev/next) */
.page-nav {
  display: flex;
  gap: var(--sp-4);
  margin-top: var(--sp-12);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--salut-border-subtle);
}

.page-nav a {
  flex: 1;
  display: block;
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--salut-border-subtle);
  text-decoration: none;
  transition: all var(--duration) var(--ease-out);
}

.page-nav a:hover {
  border-color: var(--salut-amber);
  background: var(--salut-amber-subtle);
}

.page-nav-next {
  text-align: right;
}

.page-nav-label {
  display: block;
  font-size: 0.75rem;
  color: var(--salut-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-1);
}

.page-nav-title {
  font-weight: 500;
  color: var(--salut-text);
}

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

.site-footer {
  border-top: 1px solid var(--salut-border-subtle);
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--salut-text);
  margin-bottom: var(--sp-2);
}

.footer-brand img {
  border-radius: 5px;
  opacity: 0.7;
}

.footer-tagline {
  font-size: 0.875rem;
  color: var(--salut-text-secondary);
  margin-bottom: var(--sp-2);
}

.footer-meta {
  font-size: 0.8125rem;
  color: var(--salut-text-tertiary);
}

.footer-meta a {
  color: var(--salut-text-secondary);
}

/* ── Admonitions (Sphinx/MyST) ────────────────────────────────────── */

.admonition {
  margin: var(--sp-4) 0;
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--salut-border-subtle);
  background: var(--salut-bg-raised);
}

.admonition-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0 0 var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.admonition.tip,
.admonition.hint {
  border-color: color-mix(in oklch, var(--salut-amber) 40%, var(--salut-border-subtle));
  background: var(--salut-amber-subtle);
}

.admonition.warning,
.admonition.caution {
  border-color: light-dark(#e8c050, #7a6520);
  background: light-dark(#fef9e7, #1e1c10);
}

.admonition.danger,
.admonition.error {
  border-color: light-dark(#d93025, #a12020);
  background: light-dark(#fce8e6, #1e1010);
}

.admonition.note,
.admonition.important {
  border-color: light-dark(#4285f4, #3070d0);
  background: light-dark(#e8f0fe, #101820);
}

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

/* ── Sphinx highlight overrides ───────────────────────────────────── */

.highlight {
  margin: 0 0 var(--sp-4);
}

.highlight pre {
  margin: 0;
}

div.highlight {
  background: none;
  border: none;
  padding: 0;
}

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

@media (max-width: 860px) {
  .docs-layout {
    flex-direction: column;
  }

  .docs-sidebar {
    position: static;
    width: 100%;
    max-height: none;
    border-bottom: 1px solid var(--salut-border-subtle);
    padding-bottom: var(--sp-4);
    margin-bottom: var(--sp-4);
  }

  .sidebar-inner {
    padding-right: 0;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-1);
  }

  .sidebar-nav li {
    margin-bottom: 0;
  }
}

@media (max-width: 640px) {
  :root {
    --sp-6: 16px;
    --nav-height: 48px;
  }

  .hero {
    padding: var(--sp-16) var(--sp-4) var(--sp-10);
  }

  .hero-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }

  .hero-glow {
    width: 300px;
    height: 300px;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .page-nav {
    flex-direction: column;
  }

  .page-nav-next {
    text-align: left;
  }

  .nav-links {
    gap: var(--sp-4);
  }
}

/* ── Print ────────────────────────────────────────────────────────── */

@media print {
  .site-nav,
  .docs-sidebar,
  .page-nav,
  .hero-glow {
    display: none;
  }

  body {
    color: #000;
    background: #fff;
  }

  .docs-content {
    max-width: 100%;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  pre {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}

/* ── Selection ────────────────────────────────────────────────────── */

::selection {
  background: color-mix(in oklch, var(--salut-amber) 30%, transparent);
}

/* ── Focus ────────────────────────────────────────────────────────── */

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

/* ── Scrollbar ────────────────────────────────────────────────────── */

.docs-sidebar::-webkit-scrollbar {
  width: 6px;
}

.docs-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.docs-sidebar::-webkit-scrollbar-thumb {
  background: var(--salut-border);
  border-radius: 3px;
}

/* ── Anchor links ─────────────────────────────────────────────────── */

.headerlink {
  color: var(--salut-text-tertiary);
  font-weight: 400;
  text-decoration: none;
  margin-left: var(--sp-2);
  opacity: 0;
  transition: opacity var(--duration) var(--ease-out);
}

h1:hover .headerlink,
h2:hover .headerlink,
h3:hover .headerlink,
h4:hover .headerlink {
  opacity: 1;
}

.headerlink:hover {
  color: var(--salut-amber);
}
