/* ==========================================================================
   INFERISE DOCS — V7 ENVIRONMENTAL EDITORIAL DESIGN SYSTEM
   Layout for docs.inferise.com using the V7 deep sage, warm ivory, cream,
   and terracotta palette.
   ========================================================================== */

:root {
  --docs-sidebar: 16.5rem;
  --docs-toc: 13rem;
  --docs-measure: 46rem;
  --docs-gutter: clamp(1rem, 3vw, 2.5rem);
  --docs-header: 64px;

  --bg-base: #faf3e9;
  --bg-surface: #FAF5EC;
  --bg-surface-elevated: #fff8ee;
  --bg-surface-hover: #efe3d2;
  --text-primary: #171e1b;
  --text-secondary: #434d46;
  --text-muted: #586158;
  --border-subtle: #EAE0D2;
  --border-medium: #D8CBB8;
  --border-strong: #BDAE99;
  --accent-primary: #b73d0a;
  --accent-hover: #963311;
  --accent-soft: #F3E2D5;
  --accent-border: #C88E72;
  --status-success: #296B2E;
  --status-warning: #8A5A10;
  --status-error: #9E171C;
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-subtle: 0 6px 18px rgba(113, 88, 60, 0.08);
  --shadow-elevated: 0 16px 38px rgba(32, 59, 48, 0.14);
}

body.docs {
  background: radial-gradient(ellipse at 15% 35%, #fff9f0 0, transparent 45%), var(--bg-base);
  color: var(--text-primary);
  font-family: var(--body);
  font-size: 1.02rem;
  line-height: 1.65;
  overflow-x: hidden;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}
.skip-link:focus { left: 0.5rem; }

/* ---- Header (V7 Deep Sage Gradient) ------------------------------------- */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--docs-header);
  background: linear-gradient(108deg, #203b30, #304b3b 63%, #596951);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.docs-header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  padding: 0 var(--docs-gutter);
  max-width: 90rem;
  margin: 0 auto;
}

.docs-header .brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.docs-header .brand-logo { height: 25px; width: auto; }
.brand-logo-link { display: flex; align-items: center; }

.docs-header .brand-divider {
  color: rgba(240, 240, 232, 0.45);
  font-size: 1.25rem;
  font-weight: 300;
}

.docs-header .brand-subname {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 500;
  color: #F2E5D3;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.docs-header .brand-subname:hover {
  color: #ffffff;
  text-decoration: none;
}

.docs-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.docs-products { display: flex; gap: 1.25rem; }
.docs-products .nav-link {
  color: #E1E7DD;
  font-weight: 600;
  font-size: 14.5px;
  padding: 4px 0;
  text-decoration: none;
}
.docs-products .nav-link:hover,
.docs-products .nav-link.is-current {
  color: #ffffff;
  text-decoration: none;
}
.docs-products .nav-link.is-current {
  box-shadow: inset 0 -2px 0 #ff9a60;
}

.docs-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 24rem;
  margin-left: auto;
}

.docs-search input {
  width: 100%;
  height: 38px;
  padding: 0 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius-sm);
  background: #FAF5EC;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.92rem;
}
.docs-search input::placeholder {
  color: #6c756c;
}
.docs-search input:focus {
  outline: none;
  border-color: #ff9a60;
  box-shadow: 0 0 0 3px rgba(241, 90, 36, 0.25);
}

.docs-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow-y: auto;
  background: #FAF5EC;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  z-index: 60;
}
.docs-search-results a {
  display: block;
  padding: 0.65rem 0.9rem;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
}
.docs-search-results a:last-child { border-bottom: none; }
.docs-search-results a:hover,
.docs-search-results a.is-active { background: var(--bg-surface-hover); }
.docs-search-results strong { display: block; color: var(--text-primary); }
.sr-where { display: block; font-size: 0.72rem; color: var(--accent-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.sr-snippet { display: block; font-size: 0.875rem; color: var(--text-secondary); }
.search-empty { padding: 0.75rem 0.9rem; color: var(--text-secondary); margin: 0; }

.docs-header .header-actions { display: flex; align-items: center; gap: 0.5rem; }

.platform-picker select {
  height: 38px;
  padding: 0 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius-sm);
  background: #FAF5EC;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
}

/* ---- Three columns ------------------------------------------------------ */
.docs-layout {
  display: grid;
  grid-template-columns: var(--docs-sidebar) minmax(0, 1fr) var(--docs-toc);
  gap: clamp(1.5rem, 3vw, 3rem);
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 var(--docs-gutter);
}

.docs-sidebar {
  position: sticky;
  top: var(--docs-header);
  align-self: start;
  max-height: calc(100vh - var(--docs-header));
  overflow-y: auto;
  padding: 2rem 1rem 3rem 0;
  border-right: 1px solid var(--border-subtle);
}

.docs-sidebar-nav ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.docs-sidebar-nav li a,
.side-home {
  display: block;
  padding: 0.35rem 0.75rem;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.4;
}
.side-home { font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; }
.docs-sidebar-nav a:hover { color: var(--text-primary); background: rgba(239, 227, 210, 0.45); text-decoration: none; }
.docs-sidebar-nav a.is-current {
  color: var(--accent-primary);
  font-weight: 700;
  border-left-color: var(--accent-primary);
  background: var(--accent-soft);
}
.side-heading {
  margin: 0 0 0.45rem;
  padding-left: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.docs-main { min-width: 0; padding: 2.25rem 0 4rem; }
.doc { max-width: var(--docs-measure); }

.docs-toc {
  position: sticky;
  top: var(--docs-header);
  align-self: start;
  padding: 2.25rem 0;
}
.toc-title { margin: 0 0 0.55rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-primary); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block;
  padding: 0.22rem 0 0.22rem 0.75rem;
  border-left: 2px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
}
.toc a:hover { color: var(--text-primary); text-decoration: none; }
.toc a.is-current { color: var(--accent-primary); font-weight: 700; border-left-color: var(--accent-primary); }

/* ---- Page text ---------------------------------------------------------- */
.breadcrumbs { margin: 0 0 0.75rem; font-size: 0.85rem; color: var(--text-muted); }
.breadcrumbs a { color: var(--accent-primary); font-weight: 600; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.doc h1 {
  font-family: var(--display);
  font-size: clamp(2.1rem, 3.8vw, 3rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
  color: var(--text-primary);
}
.page-summary { font-size: 1.15rem; color: var(--text-secondary); margin: 0 0 1.1rem; line-height: 1.55; }
.page-meta { display: flex; gap: 0.65rem; flex-wrap: wrap; margin: 0 0 2rem; font-size: 0.82rem; color: var(--text-secondary); }
.page-meta span { padding: 0.2rem 0.65rem; background: #FAF5EC; border: 1px solid var(--border-subtle); border-radius: 999px; font-weight: 600; }

.doc-body h2 {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 2.75rem 0 0.9rem;
  scroll-margin-top: calc(var(--docs-header) + 1rem);
}
.doc-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.9rem 0 0.65rem;
  scroll-margin-top: calc(var(--docs-header) + 1rem);
}
.doc-body h4 { font-size: 1.05rem; font-weight: 700; margin: 1.4rem 0 0.5rem; }
.doc-body .anchor {
  float: left;
  margin-left: -1.1em;
  width: 1.1em;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
}
.doc-body h2:hover .anchor,
.doc-body h3:hover .anchor { opacity: 1; }

.doc-body p,
.doc-body ul,
.doc-body ol { margin: 0 0 1.1rem; }
.doc-body ul { padding-left: 1.25rem; }
.doc-body li { margin-bottom: 0.4rem; }
.doc-body a { color: var(--accent-primary); text-decoration: underline; text-underline-offset: 2px; }
.doc-body a:hover { color: var(--accent-hover); }
.doc-body strong { font-weight: 700; }
.doc-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.12em 0.38em;
  border-radius: 4px;
  background: #f2e5d4;
  color: var(--text-primary);
}
.doc-body pre {
  overflow-x: auto;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-md);
  background: #FAF5EC;
  border: 1px solid var(--border-subtle);
}
.doc-body pre code { padding: 0; background: none; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.08em 0.42em;
  border: 1px solid var(--border-medium);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff8ee;
  font-family: var(--font-mono);
  font-size: 0.82em;
  text-align: center;
  white-space: nowrap;
}
.menu-path { font-weight: 700; white-space: nowrap; }

/* Numbered steps: big counters, so a reader can keep their place. */
.doc-body ol.steps { list-style: none; counter-reset: step; padding-left: 0; }
.doc-body ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.75rem;
  margin-bottom: 1.25rem;
}
.doc-body ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.75rem;
  text-align: center;
}
.doc-body ol.steps > li > p:last-child { margin-bottom: 0; }

/* Callouts */
.callout {
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  background: #FAF5EC;
  box-shadow: var(--shadow-subtle);
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 0.35rem !important; font-weight: 700; color: var(--text-primary); }
.callout-important { border-left-color: var(--status-warning); }
.callout-privacy { border-left-color: var(--status-success); background: #E6ECE2; border-color: #C5D2BE; }

.summary-box {
  margin: 0 0 2rem;
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius-md);
  background: linear-gradient(125deg, #f5dfc5, #efe0cc);
  border: 1px solid #decbb4;
}
.summary-box > :last-child { margin-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
.doc-body table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: #FAF5EC; border-radius: var(--radius-sm); overflow: hidden; }
.doc-body th, .doc-body td { padding: 0.65rem 0.85rem; border: 1px solid var(--border-subtle); text-align: left; vertical-align: top; }
.doc-body th { font-weight: 700; background: #f2e5d4; color: var(--text-primary); }

/* ---- Figures (Light-mode screenshots for V7 palette) -------------------- */
.shot { margin: 1.5rem 0 2rem; }
.doc-body ol.steps .shot { margin: 1rem 0 0.5rem; }
.shot-img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  box-shadow: var(--shadow-subtle);
}
.shot figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--text-secondary); }
.shot video { display: block; max-width: 100%; border-radius: 12px; border: 1px solid var(--border-medium); }

.shot-light { display: block; }
.shot-dark { display: none; }

.shot-placeholder {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
  padding: 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: #FAF5EC;
  color: var(--text-secondary);
}
.shot-placeholder span { font-weight: 700; color: var(--text-primary); }
.shot-placeholder code { font-size: 0.75rem; word-break: break-all; }

/* ---- Cards (product and section home pages) ---------------------------- */
.doc-cards, .product-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.doc-card, .product-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: #FAF5EC;
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: var(--shadow-subtle);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.doc-body .doc-card { color: var(--text-primary); text-decoration: none; }
.doc-card:hover, .product-card:hover {
  border-color: var(--accent-border);
  background: #fff8ee;
  transform: translateY(-2px);
  text-decoration: none;
}
.doc-card span { color: var(--text-secondary); font-size: 0.94rem; line-height: 1.45; }
.card-time { margin-top: auto; padding-top: 0.45rem; color: var(--accent-primary); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.product-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.product-card h2 { font-family: var(--display); font-weight: 500; font-size: 1.65rem; margin: 0; }
.product-card h2 a { color: var(--text-primary); text-decoration: none; }
.product-card ul { margin: 0.35rem 0 1.1rem; padding-left: 1.15rem; }
.product-card .btn { align-self: flex-start; margin-top: auto; background: linear-gradient(110deg, #e04f16, #f15a24); }
.doc-body a.btn-primary, .doc-body a.btn-primary:hover { color: #FFFFFF; text-decoration: none; }

/* ---- End of page --------------------------------------------------------- */
.related { margin-top: 3rem; }
.related ul { list-style: none; padding: 0; }
.related li { margin-bottom: 0.75rem; }
.related li a { font-weight: 700; }
.related li span { display: block; color: var(--text-secondary); font-size: 0.95rem; }

.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}
.pn {
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #FAF5EC;
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: var(--shadow-subtle);
}
.pn:hover { border-color: var(--accent-border); background: #fff8ee; text-decoration: none; }
.pn small { color: var(--accent-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.74rem; }
.pn-next { text-align: right; grid-column: 2; }

.doc-help { margin-top: 2.5rem; font-size: 0.9rem; color: var(--text-muted); }
.doc-help a { color: var(--accent-primary); font-weight: 600; }

.docs-footer {
  background: #182522;
  color: #F4EFE7;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1.5rem var(--docs-gutter);
  font-size: 0.85rem;
  margin-top: auto;
}
.docs-footer p {
  max-width: 90rem;
  margin: 0 auto;
  color: #D1D8CF;
}
.docs-footer a { color: #F4EFE7; margin-left: 1.25rem; text-decoration: none; }
.docs-footer a:hover { color: #ff9a60; text-decoration: underline; }

/* ---- Narrower screens ---------------------------------------------------- */
@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: var(--docs-sidebar) minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 900px) {
  :root { --docs-gutter: 16px; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-menu-btn { display: inline-flex; }
  .docs-products { display: none; }
  .docs-sidebar {
    position: fixed;
    top: var(--docs-header);
    left: 0;
    bottom: 0;
    width: min(85vw, 20rem);
    max-height: none;
    padding: 1.5rem var(--docs-gutter);
    background: #FAF5EC;
    border-right: 1px solid var(--border-medium);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 40;
  }
  body.sidebar-open .docs-sidebar { transform: none; box-shadow: var(--shadow-elevated); }
  .docs-main { padding-top: 1.5rem; }
  .docs-header .brand-logo { height: 21px; }
  .brand-divider, .brand-subname { font-size: 1.15rem; }
}

@media (max-width: 560px) {
  .docs-header .brand-logo-link, .docs-header .brand-divider { display: none; }
  .docs-search { max-width: none; }
  .prev-next { grid-template-columns: 1fr; }
  .pn-next { grid-column: 1; }
  .doc-body ol.steps > li { padding-left: 2.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-sidebar { transition: none; }
}
