/* Kupinga — Enterprise User Manual stylesheet.
 *
 * Palette anchored to the Kupinga brand pack:
 *   Ink              #0E1116
 *   Enterprise Blue  #0057FF
 *   Bone             #F5F2EA
 *   Slate            #6B7280
 *
 * Typography: Poppins (per brand pack), Inter fallback for body copy,
 * Roboto Mono for code spans.
 */

:root {
  --ink: #0E1116;
  --ink-2: #1c2026;
  --ink-3: #2a2f37;
  --blue: #0057FF;
  --blue-2: #0044cc;
  --blue-tint: #e6efff;
  --bone: #F5F2EA;
  --bone-2: #eee9dd;
  --slate: #6B7280;
  --slate-2: #9ca3af;
  --paper: #ffffff;
  --paper-2: #fafaf7;
  --border: #e5e3dc;
  --border-strong: #d4d1c7;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(14,17,22,0.04), 0 8px 24px rgba(14,17,22,0.06);

  --max-content: 980px;
  --sidebar-w: 320px;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bone); color: var(--ink); }
body {
  font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono {
  font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
code {
  background: var(--bone-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--ink-2);
}

/* ============================ COVER ============================ */
.cover {
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: var(--bone);
  padding: 80px 56px 96px;
  position: relative;
  overflow: hidden;
}
.cover::before {
  content: '';
  position: absolute;
  right: -120px; top: -120px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(0,87,255,0.22) 0%, transparent 60%);
  pointer-events: none;
}
.cover .lockup { width: 240px; height: auto; display: block; margin-bottom: 48px; }
.cover h1 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 56px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  max-width: 820px;
}
.cover h1 .accent { color: var(--blue); }
.cover .tagline {
  font-size: 20px; color: rgba(245,242,234,0.75); margin: 0 0 56px; max-width: 720px;
}
.cover .meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  border-top: 1px solid rgba(245,242,234,0.18);
  padding-top: 32px;
  max-width: 980px;
}
.cover .meta dt {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgba(245,242,234,0.55);
  margin: 0 0 6px;
}
.cover .meta dd { margin: 0; font-size: 14px; color: var(--bone); font-weight: 500; }

/* ============================ LAYOUT ============================ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.toc {
  position: sticky;
  top: 0;
  align-self: start;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--border);
  padding: 24px 0 32px;
}
.toc-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 24px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.toc-header img { width: 28px; height: 28px; }
.toc-header .product { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 16px; color: var(--ink); }
.toc-header .label { font-size: 11px; color: var(--slate); letter-spacing: 0.06em; text-transform: uppercase; }

.toc nav { padding: 0 12px; }
.toc-section { margin-bottom: 18px; }
.toc-section > .toc-section-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--slate); padding: 4px 12px 6px; display: flex; align-items: center; gap: 8px;
}
.toc-section > .toc-section-label::before {
  content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--blue);
}
.toc-section a {
  display: block; padding: 5px 12px; border-radius: 6px; font-size: 13.5px; color: var(--ink-2);
  line-height: 1.45;
}
.toc-section a:hover { background: var(--bone); text-decoration: none; }
.toc-section a.active {
  background: var(--blue-tint); color: var(--blue); font-weight: 600;
}

.content {
  padding: 56px 56px 120px;
  max-width: calc(var(--max-content) + 112px);
  margin: 0 auto;
  background: var(--bone);
}

/* ============================ TYPOGRAPHY ============================ */
.content h1, .content h2, .content h3, .content h4 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  scroll-margin-top: 24px;
}
.content h1 { font-size: 36px; line-height: 1.15; margin: 0 0 12px; }
.content h2 {
  font-size: 28px; line-height: 1.2; margin: 64px 0 8px;
  padding-top: 32px; border-top: 1px solid var(--border-strong);
}
.content h2:first-of-type { padding-top: 0; border-top: 0; margin-top: 0; }
.content h3 { font-size: 21px; line-height: 1.25; margin: 40px 0 6px; }
.content h4 { font-size: 16px; line-height: 1.3; margin: 24px 0 6px; }

.content h2 + .subtitle, .content h3 + .subtitle {
  font-size: 14px; color: var(--slate); margin: 0 0 24px;
  font-weight: 500; letter-spacing: 0.01em;
}

.content p { margin: 0 0 14px; max-width: 760px; }
.content ul, .content ol { margin: 0 0 16px; padding-left: 22px; max-width: 760px; }
.content li { margin-bottom: 6px; }

/* ============================ SECTION INTRO ============================ */
.section-intro {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  margin: 12px 0 32px;
  box-shadow: var(--shadow);
}
.section-intro p:last-child { margin-bottom: 0; }
.section-intro .eyebrow {
  display: inline-block;
  background: var(--blue);
  color: white;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; margin-bottom: 16px;
}

/* ============================ MODULE CARD ============================ */
.module {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  margin: 24px 0 40px;
  box-shadow: var(--shadow);
}
.module h3 { margin-top: 0; }
.module .module-meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  background: var(--bone);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 14px 0 20px;
}
.module-meta dt {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--slate); margin: 0 0 4px;
}
.module-meta dd { margin: 0; font-size: 13.5px; color: var(--ink-2); }

.module h4 + ul, .module h4 + ol { margin-top: 6px; }

/* ============================ TABLES ============================ */
table.fields {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 8px 0 20px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
table.fields th, table.fields td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.fields th {
  background: var(--bone);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
table.fields tr:last-child td { border-bottom: 0; }
table.fields td.field-name { font-family: 'Roboto Mono', monospace; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
table.fields td.field-type { font-size: 12px; color: var(--slate); white-space: nowrap; }

/* ============================ CALLOUTS ============================ */
.callout {
  border-left: 4px solid;
  background: var(--paper);
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.callout strong { display: block; margin-bottom: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.callout.note { border-left-color: var(--blue); }
.callout.note strong { color: var(--blue); }
.callout.warn { border-left-color: var(--warning); background: #fff8eb; }
.callout.warn strong { color: var(--warning); }
.callout.danger { border-left-color: var(--danger); background: #fef2f2; }
.callout.danger strong { color: var(--danger); }
.callout.tip { border-left-color: var(--success); background: #f0fdf4; }
.callout.tip strong { color: var(--success); }

/* ============================ SCREENSHOTS ============================ */
figure.shot {
  margin: 18px 0 22px;
  background: var(--bone);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  overflow: hidden;
}
figure.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--paper);
}
figure.shot figcaption {
  font-size: 12.5px;
  color: var(--slate);
  padding: 10px 6px 4px;
  line-height: 1.45;
}
figure.shot figcaption strong {
  color: var(--ink);
  font-weight: 600;
  margin-right: 6px;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 22px;
}
.shot-grid figure.shot { margin: 0; }

/* ============================ BADGES ============================ */
.badge {
  display: inline-block;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  background: var(--bone); color: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  margin-right: 4px;
}
.badge.blue { background: var(--blue-tint); color: var(--blue); border-color: var(--blue-tint); }
.badge.ink  { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.badge.warn { background: #fff8eb; color: var(--warning); border-color: #fde7b9; }
.badge.danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.badge.success { background: #f0fdf4; color: var(--success); border-color: #bbf7d0; }
.badge.mono { font-family: 'Roboto Mono', monospace; }

/* ============================ AUDIENCE PILLS ============================ */
.audience-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; }

/* ============================ ANCHOR HEADER ============================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245,242,234,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px;
  color: var(--slate);
}
.top-bar .crumbs strong { color: var(--ink); font-weight: 600; }
.top-bar .version { font-family: 'Roboto Mono', monospace; }

/* ============================ FOOTER ============================ */
.footer {
  margin-top: 80px;
  padding: 32px;
  background: var(--ink);
  color: rgba(245,242,234,0.6);
  font-size: 12.5px;
  text-align: center;
  border-radius: 12px;
}
.footer img { width: 120px; height: auto; margin-bottom: 16px; opacity: 0.85; }
.footer p { margin: 4px 0; }

/* ============================ MOBILE ============================ */
.toc-toggle {
  display: none;
  position: fixed; top: 16px; left: 16px; z-index: 30;
  background: var(--ink); color: var(--bone);
  border: 0; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow);
  cursor: pointer;
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .toc {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 25;
    transform: translateX(-100%); transition: transform .2s ease;
    width: 300px; box-shadow: var(--shadow);
  }
  .toc.open { transform: translateX(0); }
  .toc-toggle { display: block; }
  .content { padding: 80px 22px 80px; }
  .cover { padding: 64px 22px 80px; }
  .cover h1 { font-size: 36px; }
  .module { padding: 20px 22px; }
  .module .module-meta { grid-template-columns: 1fr; }
  .shot-grid { grid-template-columns: 1fr; }
  .cover .meta { grid-template-columns: 1fr 1fr; }
}

/* ============================ PRINT ============================ */
@media print {
  .toc, .top-bar, .toc-toggle { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: 100%; background: #fff; }
  body { background: #fff; font-size: 11.5pt; }
  .module { box-shadow: none; page-break-inside: avoid; }
  figure.shot { page-break-inside: avoid; }
  .cover { color: #000; background: #fff; padding: 0; }
  .cover h1 { font-size: 30pt; color: #000; }
  .cover .lockup { filter: invert(1); }
  .footer { background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
  .callout { background: #fafafa !important; }
}
