/* ============================================================
   Kast Rider — Public / Print styles
   ============================================================ */

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

body.kast-rider-page {
  background: #e8e8e8;
  font-family: var(--kr-font, 'Helvetica Neue', Arial, sans-serif);
  color: var(--kr-fg, #111);
}

/* ---- Toolbar ---- */
.kr-toolbar {
  display: flex; justify-content: flex-end;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid #ddd;
  position: sticky; top: 0; z-index: 50;
}
.kr-print-btn {
  background: var(--kr-accent, #c4941a); color: #fff;
  border: none; padding: 9px 20px; border-radius: 4px;
  font-size: 14px; font-weight: 600; cursor: pointer; letter-spacing: .02em;
}
.kr-print-btn:hover { filter: brightness(1.1); }

/* ---- Document ---- */
.kr-public-wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }

.kr-document {
  background: var(--kr-bg, #fff);
  color: var(--kr-fg, #111);
  padding: 48px 56px;
  border-radius: 4px;
  box-shadow: 0 2px 16px rgba(0,0,0,.12);
  min-height: 200px;
}

/* ---- Document header ---- */
.kr-doc-header { text-align: center; margin-bottom: 40px; padding-bottom: 28px; border-bottom: 2px solid var(--kr-accent, #c4941a); }
.kr-doc-logo { margin-bottom: 20px; }
.kr-logo-img { max-height: 120px; max-width: 280px; object-fit: contain; }
.kr-doc-title { font-size: 28px; font-weight: 700; letter-spacing: .02em; }

/* ---- Sections ---- */
.kr-section { margin-bottom: 32px; }
.kr-section:last-child { margin-bottom: 0; }

/* Section heading */
.kr-section-heading {
  font-size: 18px; font-weight: 700; margin-bottom: 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--kr-accent, #c4941a);
  color: var(--kr-fg, #111);
}

/* Text section */
.kr-text-content { line-height: 1.7; font-size: 15px; }
.kr-text-content h1, .kr-text-content h2, .kr-text-content h3 {
  font-weight: 700; margin: 1.2em 0 .5em; color: var(--kr-fg, #111);
}
.kr-text-content h1 { font-size: 22px; }
.kr-text-content h2 { font-size: 18px; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.kr-text-content h3 { font-size: 15px; }
.kr-text-content p  { margin-bottom: .8em; }
.kr-text-content ul, .kr-text-content ol { padding-left: 1.5em; margin-bottom: .8em; }
.kr-text-content strong { font-weight: 700; }
.kr-text-content em { font-style: italic; }

/* Table section */
.kr-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.kr-table th, .kr-table td {
  border: 1px solid #ddd; padding: 8px 12px; text-align: left;
}
.kr-table thead th {
  background: var(--kr-accent, #c4941a); color: #fff; font-weight: 700;
  font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
}
.kr-table tbody tr:nth-child(even) { background: rgba(0,0,0,.03); }
.kr-table tbody tr:hover { background: rgba(0,0,0,.05); }

/* Table scroll on mobile */
.kr-section--table { overflow-x: auto; }

/* Scene section */
.kr-scene-wrap {
  overflow: auto; display: flex; justify-content: center;
  background: #fafafa; border: 1px solid #eee; border-radius: 4px; padding: 8px;
}
/* Fabric sets inline width/height on both canvas and .canvas-container — need !important */
.kr-scene-wrap .canvas-container,
.kr-scene-wrap .canvas-container canvas,
.kr-scene-canvas { max-width: 100% !important; height: auto !important; display: block; }
.kr-scene-wrap img.kr-scene-print-img { display: none; max-width: 100%; height: auto; }

/* ============================================================
   Print
   ============================================================ */
@media print {
  body { background: #fff; }

  .kr-toolbar.no-print { display: none !important; }

  .kr-public-wrap { max-width: 100%; padding: 0; }

  .kr-document {
    box-shadow: none; border-radius: 0;
    padding: 0; margin: 0;
  }

  .kr-section { page-break-inside: avoid; }

  .kr-scene-wrap canvas { display: none !important; }
  .kr-scene-wrap img.kr-scene-print-img { display: block !important; max-width: 100%; }

  .kr-section--table { overflow: visible; }
  .kr-table { font-size: 11px; width: 100%; }
  .kr-table th, .kr-table td { padding: 4px 6px; }
  .kr-table thead th { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .kr-table tbody tr:nth-child(even) { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  @page { margin: 20mm; }
}
