/* ============================================================================
   cutseq static docs — emerald-teal scientific shell
   Light theme by default; dark via prefers-color-scheme (coherent, not inverted).
   ============================================================================ */

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* brand: emerald-teal primary + amber 'cut/highlight' accent */
  --cs-primary: #0d9488;          /* teal-600 */
  --cs-primary-strong: #0f766e;   /* teal-700 */
  --cs-primary-deep: #115e59;     /* teal-800 */
  --cs-primary-ghost: rgba(13, 148, 136, 0.08);
  --cs-primary-ghost-2: rgba(13, 148, 136, 0.14);
  --cs-accent: #d97706;           /* amber-600 — cut / highlight */
  --cs-accent-soft: #f59e0b;      /* amber-500 */
  --cs-accent-ghost: rgba(245, 158, 11, 0.16);

  /* neutrals (slate) */
  --cs-text: #1f2937;
  --cs-heading: #0f172a;
  --cs-muted: #5b6572;
  --cs-faint: #94a3b8;
  --cs-border: #e2e8f0;
  --cs-border-strong: #cbd5e1;
  --cs-bg: #ffffff;
  --cs-bg-soft: #f8fafc;
  --cs-raise: #f4faf9;            /* very subtle teal-tinted layer */
  --cs-code-bg: #f2f6f7;
  --cs-table-head: #f1f5f9;

  /* links */
  --cs-link: #0f766e;
  --cs-link-hover: #115e59;

  /* callouts */
  --cs-note-border: #0f766e;
  --cs-note-bg: #ecfdf5;
  --cs-warn-border: #d97706;
  --cs-warn-bg: #fffbeb;

  /* elevation & radii */
  --cs-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --cs-shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --cs-shadow-lg: 0 16px 44px rgba(15, 23, 42, 0.16);
  --cs-radius: 10px;
  --cs-radius-sm: 8px;

  --cs-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --cs-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--cs-font-sans);
  color: var(--cs-text);
  background: var(--cs-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--cs-link); text-decoration: none; transition: color 0.12s ease; }
a:hover { text-decoration: underline; color: var(--cs-link-hover); }

code, pre, kbd, samp { font-family: var(--cs-font-mono); }
img { max-width: 100%; height: auto; }

/* accessible focus ring for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--cs-primary);
  outline-offset: 2px;
  border-radius: 3px;
}

/* form controls get a soft ring instead of a hard outline */
.site-search-input:focus,
.ad-search:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--cs-primary-ghost-2);
}

/* ---- header ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.6rem;
  background: color-mix(in srgb, var(--cs-bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--cs-border);
  box-shadow: var(--cs-shadow-sm);
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cs-primary), var(--cs-accent-soft));
  opacity: 0.9;
}
.site-title-box { display: flex; align-items: center; }
.site-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.35rem;
  font-weight: 750;
  color: var(--cs-heading);
  letter-spacing: -0.015em;
  line-height: 1;
}
.site-title:hover { text-decoration: none; color: var(--cs-primary-strong); }
.site-logo {
  width: 30px;
  height: 30px;
  padding: 4px;
  border-radius: 9px;
  background: var(--cs-primary-ghost);
  border: 1px solid var(--cs-border);
}
.site-aux { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.site-aux a {
  font-size: 0.88rem;
  font-weight: 550;
  color: var(--cs-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border-radius: var(--cs-radius-sm);
}
.site-aux a:hover { color: var(--cs-primary-strong); text-decoration: none; background: var(--cs-primary-ghost); }

/* ---- shell layout ------------------------------------------------------ */
.site-shell { display: flex; min-height: calc(100vh - 61px - 64px); }
.site-nav {
  flex: 0 0 264px;
  padding: 1.4rem 1rem 1.6rem;
  background: var(--cs-bg-soft);
  border-right: 1px solid var(--cs-border);
}
.site-main { flex: 1; min-width: 0; }
.site-content {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2.2rem 1.8rem 3.5rem;
}
.site-content-wide { max-width: none; }

/* ---- hero (index) ------------------------------------------------------ */
.hero {
  padding: 0.4rem 0 1.2rem;
  border-bottom: 1px solid var(--cs-border);
  margin-bottom: 0.4rem;
}
.hero .fs-6 { color: var(--cs-muted); max-width: 40rem; margin-bottom: 0.4rem; }

/* ---- nav list ---------------------------------------------------------- */
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item { margin: 0; }
.nav-item a {
  display: block;
  padding: 0.44rem 0.72rem;
  margin-bottom: 0.16rem;
  color: var(--cs-text);
  font-size: 0.92rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  border-radius: 0 var(--cs-radius-sm) var(--cs-radius-sm) 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item a:hover {
  background: var(--cs-primary-ghost);
  color: var(--cs-primary-strong);
  text-decoration: none;
}
.nav-item a:focus-visible { outline-offset: -2px; }
.nav-item.active a {
  color: var(--cs-primary-strong);
  font-weight: 650;
  border-left-color: var(--cs-primary);
  background: var(--cs-primary-ghost);
  box-shadow: inset 0 0 0 1px var(--cs-primary-ghost-2);
}

/* ---- search ------------------------------------------------------------ */
.search-box { margin-bottom: 1.1rem; position: relative; }
.site-search-input {
  width: 100%;
  padding: 0.52rem 0.72rem;
  font-size: 0.9rem;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius-sm);
  background: var(--cs-bg);
  color: var(--cs-text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.site-search-input::placeholder { color: var(--cs-faint); }
.site-search-input:focus {
  outline: none;
  border-color: var(--cs-primary);
  box-shadow: 0 0 0 3px var(--cs-primary-ghost-2);
}
.site-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--cs-bg);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius);
  box-shadow: var(--cs-shadow-lg);
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}
.search-results-empty,
.search-result-item {
  display: block;
  padding: 0.58rem 0.72rem;
  font-size: 0.87rem;
  color: var(--cs-text);
}
.search-result-item { border-left: 3px solid transparent; }
.search-result-item strong { display: block; color: var(--cs-primary-strong); font-weight: 650; }
.search-result-item .sr-snippet {
  display: block;
  color: var(--cs-muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
}
.search-result-item:hover { background: var(--cs-primary-ghost); border-left-color: var(--cs-primary); text-decoration: none; }
.search-results-empty { color: var(--cs-muted); }

/* ---- headings ---------------------------------------------------------- */
.site-content h1 {
  font-size: 2rem;
  margin: 0 0 0.8rem;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--cs-heading);
  font-weight: 750;
}
.site-content h2 {
  font-size: 1.45rem;
  margin: 2.1rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--cs-border);
  line-height: 1.3;
  color: var(--cs-heading);
  letter-spacing: -0.01em;
}
.site-content h3 { font-size: 1.14rem; margin: 1.6rem 0 0.55rem; line-height: 1.3; color: var(--cs-heading); }
.site-content h1 a, .site-content h2 a, .site-content h3 a { color: inherit; }
.site-content h1 a:hover, .site-content h2 a:hover, .site-content h3 a:hover {
  text-decoration: none; opacity: 0.8;
}
.site-content p { margin: 0 0 1.1rem; }

/* ---- lists ------------------------------------------------------------- */
.site-content ul, .site-content ol { margin: 0 0 1.1rem; padding-left: 1.55rem; }
.site-content li { margin: 0.3rem 0; }
.site-content li::marker { color: var(--cs-primary); }

/* ---- code -------------------------------------------------------------- */
.site-content pre {
  background: var(--cs-code-bg);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius-sm);
  padding: 0.9rem 1.05rem;
  overflow-x: auto;
  margin: 0 0 1.3rem;
  line-height: 1.55;
  box-shadow: var(--cs-shadow-sm);
}
.site-content code {
  background: var(--cs-code-bg);
  color: var(--cs-primary-deep);
  padding: 0.13rem 0.34rem;
  border-radius: 5px;
  font-size: 0.87em;
  border: 1px solid var(--cs-border);
}
.site-content pre code { background: none; padding: 0; border: 0; color: inherit; font-size: 0.85rem; }

/* ---- tables ------------------------------------------------------------ */
.site-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.4rem;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius-sm);
}
.site-content th, .site-content td {
  padding: 0.5rem 0.72rem;
  text-align: left;
  border: 1px solid var(--cs-border);
}
.site-content thead th { background: var(--cs-table-head); color: var(--cs-heading); font-weight: 650; }
.site-content tbody tr:nth-child(even) { background: var(--cs-bg-soft); }
.site-content tbody tr { transition: background 0.1s ease; }
.site-content tbody tr:hover { background: var(--cs-primary-ghost); }

/* ---- callouts ---------------------------------------------------------- */
.callout {
  border-radius: 0 var(--cs-radius-sm) var(--cs-radius-sm) 0;
  padding: 0.8rem 1rem 0.15rem;
  margin: 1.3rem 0;
  border-left: 4px solid transparent;
  box-shadow: var(--cs-shadow-sm);
}
.callout .callout-title {
  font-weight: 750;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.callout p { margin: 0 0 0.6rem; }
.callout.note { background: var(--cs-note-bg); border-left-color: var(--cs-note-border); }
.callout.note .callout-title { color: var(--cs-note-border); }
.callout.warning { background: var(--cs-warn-bg); border-left-color: var(--cs-warn-border); }
.callout.warning .callout-title { color: var(--cs-warn-border); }

/* ---- buttons (index hero + viewer) ------------------------------------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 1.2rem 0 0.4rem; }
.btn {
  display: inline-block;
  padding: 0.52rem 1.05rem;
  border-radius: var(--cs-radius-sm);
  font-size: 0.98rem;
  font-weight: 550;
  border: 1px solid var(--cs-border-strong);
  background: var(--cs-bg);
  color: var(--cs-text);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  box-shadow: var(--cs-shadow-sm);
}
.btn:hover { text-decoration: none; border-color: var(--cs-primary); color: var(--cs-primary-strong); background: var(--cs-primary-ghost); }
.btn-primary {
  background: linear-gradient(180deg, var(--cs-primary), var(--cs-primary-strong));
  border-color: var(--cs-primary-strong);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(180deg, var(--cs-primary-strong), var(--cs-primary-deep)); border-color: var(--cs-primary-deep); color: #fff; }

/* ---- footer ------------------------------------------------------------ */
.site-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.6rem;
  border-top: 1px solid var(--cs-border);
  color: var(--cs-muted);
  font-size: 0.85rem;
  background: var(--cs-bg-soft);
}
.site-footer p { margin: 0; }
.back-to-top {
  margin-left: auto;
  color: var(--cs-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 550;
  padding: 0.25rem 0.5rem;
  border-radius: var(--cs-radius-sm);
}
.back-to-top:hover { color: var(--cs-primary-strong); text-decoration: none; background: var(--cs-primary-ghost); }

/* ---- typographic utilities (from just-the-docs) ------------------------- */
.fs-3 { font-size: 1.15rem !important; }
.fs-5 { font-size: 1.15rem !important; }
.fs-6 { font-size: 1.35rem !important; }
.fs-9 { font-size: 2.75rem !important; }
.fw-200 { font-weight: 200 !important; }
.fw-300 { font-weight: 300 !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-md-0 { margin-bottom: 0 !important; }
.mr-2 { margin-right: 0.5rem !important; }

/* horizontal rule */
.site-content hr { border: none; border-top: 1px solid var(--cs-border); margin: 1.7rem 0; }

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 800px) {
  .site-header { padding: 0.7rem 1.1rem; }
  .site-shell { flex-direction: column; }
  .site-nav { flex-basis: auto; border-right: none; border-bottom: 1px solid var(--cs-border); }
  .site-content { padding: 1.6rem 1.15rem 2.6rem; }
  .site-footer { padding: 1rem 1.1rem; flex-wrap: wrap; }
}

/* ============================================================================
   DARK THEME — a coherent dark teal-slate, not a naive inversion
   ============================================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --cs-primary: #2dd4bf;
    --cs-primary-strong: #14b8a6;
    --cs-primary-deep: #0d9488;
    --cs-primary-ghost: rgba(45, 212, 191, 0.12);
    --cs-primary-ghost-2: rgba(45, 212, 191, 0.2);

    --cs-text: #e2e8f0;
    --cs-heading: #f1f5f9;
    --cs-muted: #94a3b8;
    --cs-faint: #64748b;
    --cs-border: #26303f;
    --cs-border-strong: #3b475e;
    --cs-bg: #0b1017;
    --cs-bg-soft: #101824;
    --cs-raise: #0e1526;
    --cs-code-bg: #0e1725;
    --cs-table-head: #131b2a;

    --cs-link: #5eead4;
    --cs-link-hover: #99f6e4;

    --cs-note-border: #34d399;
    --cs-note-bg: #0c211b;
    --cs-warn-border: #fbbf24;
    --cs-warn-bg: #251c0b;
  }
  .nav-item a:hover { background: rgba(45, 212, 191, 0.12); color: #99f6e4; }
  .nav-item.active a { background: rgba(45, 212, 191, 0.16); color: #99f6e4; }
  .site-content code { color: #7ce3d3; }
  .site-content tbody tr:hover { background: rgba(45, 212, 191, 0.06); }
  .site-header { background: color-mix(in srgb, var(--cs-bg) 90%, transparent); }
  .btn { background: var(--cs-bg); color: var(--cs-text); }
  .site-footer { background: var(--cs-bg-soft); }
}
