/* Klarsyn Lese — report typography and component styles */

/* ── Font size variable (S=15, M=17, L=20) ── */
:root { --lese-fs: 17px; }

/* ── Compact text (compressed variant) ── */
.compact-text {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: var(--lese-fs, 17px);
  line-height: 1.7;
  max-width: 68ch;
  margin: 0 auto;
  padding: 0 1rem;
}
.compact-text h2 {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.35em;
  font-weight: 700;
  margin: 1.5em 0 0.4em;
  padding-left: 0.6em;
  border-left: 4px solid #3a7bd5;
  line-height: 1.3;
}
.compact-text h3 {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.1em;
  font-weight: 600;
  margin: 1.2em 0 0.3em;
  color: #2c5282;
  line-height: 1.3;
}
.compact-text ul {
  list-style: disc;
  padding-left: 1.5em;
  margin: 0.3em 0;
}
.compact-text li {
  margin-bottom: 0.35em;
}
.compact-text .table-wrap {
  overflow-x: auto;
  margin: 1em 0;
  -webkit-overflow-scrolling: touch;
}
.compact-text table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9em;
}
.compact-text th {
  background: #1a2e4a;
  color: white;
  padding: 8px;
  text-align: left;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.9em;
}
.compact-text td {
  padding: 7px 8px;
  border-bottom: 1px solid #e2e8f0;
}
.compact-text tr:nth-child(even) {
  background: #f7fafc;
}
.compact-text tr:hover {
  background: #ebf4ff;
}

/* ── Code blocks ── */
article.report code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9em;
  background: #f4f4f5;
  padding: 0.15em 0.35em;
  border-radius: 0.25rem;
}
article.report pre {
  overflow-x: auto;
  padding: 1em;
  border-radius: 0.5rem;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  font-size: 0.85em;
  line-height: 1.6;
}
article.report pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.compact-text code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9em;
  background: #f4f4f5;
  padding: 0.15em 0.35em;
  border-radius: 0.25rem;
}
.compact-text pre {
  overflow-x: auto;
  padding: 1em;
  border-radius: 0.5rem;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  font-size: 0.85em;
  line-height: 1.6;
}
.compact-text pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ── Scroll offset for sticky topbar ── */
article.report h1[id],
article.report h2[id],
article.report h3[id],
article.report h4[id],
.compact-text h2[id],
.compact-text h3[id] {
  scroll-margin-top: 5rem;
}

/* ── Base typography ── */
article.report {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: var(--lese-fs, 17px);
  line-height: 1.7;
  max-width: 68ch;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Mobil (< 640px): fullbredde, 16px padding, mindre overskrifter */
@media (max-width: 640px) {
  article.report {
    font-size: calc(var(--lese-fs, 17px) - 1px);
    line-height: 1.65;
    max-width: 100%;
    padding: 0 16px;
  }
  article.report h1 { font-size: 1.4em; }
  article.report h2 { font-size: 1.2em; margin-top: 1.5em; }
  article.report h3 { font-size: 1.15em; }
  .compact-text h2 { font-size: 1.2em; }
  .compact-text h3 { font-size: 1.1em; }
}

/* Tablet (640–1024px): sentrert, ~90% bredde */
@media (min-width: 640px) and (max-width: 1024px) {
  article.report {
    max-width: 90%;
  }
}

article.report h1,
article.report h2,
article.report h3,
article.report h4,
article.report h5,
article.report h6 {
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.3;
}

article.report h1 {
  font-size: 1.75em;
  font-weight: 700;
  margin: 0 0 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 3px solid #1a2e4a;
}

article.report h2 {
  font-size: 1.35em;
  font-weight: 700;
  margin: 2em 0 0.5em;
  padding-left: 0.6em;
  border-left: 4px solid #3a7bd5;
}

article.report h3 {
  font-size: 1.15em;
  font-weight: 600;
  margin: 1.5em 0 0.4em;
  color: #2c5282;
}

article.report p {
  margin: 0.8em 0;
}

article.report a {
  color: #1e5a99;
  text-decoration: underline;
  text-underline-offset: 2px;
}

article.report ul,
article.report ol {
  padding-left: 1.5em;
  margin: 0.8em 0;
}

article.report li {
  margin: 0.5em 0;
}

article.report hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 2em 0;
}

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

/* ── Tables ── */
article.report .table-wrap {
  overflow-x: auto;
  margin: 1em 0;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Scroll shadow indicator on right edge */
article.report .table-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to left, rgba(0,0,0,0.06), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

article.report .table-wrap.has-scroll::after {
  opacity: 1;
}

article.report table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 0.9em;
}

article.report th {
  background: #1a2e4a;
  color: white;
  padding: 10px 8px;
  text-align: left;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.9em;
}

article.report td {
  padding: 9px 8px;
  border-bottom: 1px solid #e2e8f0;
}

article.report tr:nth-child(even) {
  background: #f7fafc;
}

article.report tr:hover {
  background: #ebf4ff;
}

/* ── Color utility classes ── */
article.report .green { color: #276749; }
article.report .red { color: #c53030; }
article.report .orange { color: #9a3412; }
article.report .blue { color: #2b6cb0; }

/* ── Boxes ── */
article.report .box {
  border: 1px solid #bee3f8;
  background: #ebf8ff;
  border-radius: 6px;
  padding: 14px 18px;
  margin: 1em 0;
}

article.report .box-green {
  border: 1px solid #c6f6d5;
  background: #f0fff4;
  border-left: 4px solid #38a169;
  border-radius: 6px;
  padding: 14px 18px;
  margin: 1em 0;
}

article.report .box-red {
  border: 1px solid #fed7d7;
  background: #fff5f5;
  border-left: 4px solid #e53e3e;
  border-radius: 6px;
  padding: 14px 18px;
  margin: 1em 0;
}

article.report .box-amber,
article.report .box-yellow {
  border: 1px solid #fefcbf;
  background: #fffff0;
  border-left: 4px solid #d69e2e;
  border-radius: 6px;
  padding: 14px 18px;
  margin: 1em 0;
}

/* ── Verdict ── */
article.report .verdict {
  font-size: 1.15em;
  font-weight: bold;
  border-radius: 8px;
  padding: 18px 22px;
  margin: 1em 0;
  font-family: system-ui, -apple-system, sans-serif;
}

article.report .verdict-learn { background: #f0fff4; border: 2px solid #276749; color: #276749; }
article.report .verdict-watch { background: #fffff0; border: 2px solid #9a3412; color: #9a3412; }
article.report .verdict-skip  { background: #fff5f5; border: 2px solid #c53030; color: #c53030; }

/* ── Score badges ── */
article.report .score {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  text-align: center;
  line-height: 28px;
  font-weight: bold;
  font-size: 0.85em;
  font-family: system-ui, sans-serif;
}

article.report .score-a { background: #276749; }
article.report .score-b { background: #2b6cb0; }
article.report .score-c { background: #9a3412; }
article.report .score-d { background: #c53030; }

/* ── Actor cards ── */
article.report .actor-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin: 1em 0;
  background: #fafafa;
}

article.report .profile-box {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin: 1em 0;
  background: #f7fafc;
}

/* ── Timeline ── */
article.report .timeline-item {
  border-left: 3px solid #3a7bd5;
  padding: 8px 0 8px 16px;
  margin: 8px 0;
}

/* ── KPI table ── */
article.report .kpi-table th {
  background: #2d3748;
}

/* ── Sources ── */
article.report .kilder {
  margin: 1em 0;
  padding-left: 1.5em;
}

article.report .kilder li {
  margin: 6px 0;
  font-size: 0.9em;
}

article.report .kilder a {
  color: #1e5a99;
}

/* ── Note ── */
article.report .note {
  font-size: 0.85em;
  color: #4a5568;
  font-style: italic;
}

/* ── Search highlight ── */
mark.hl {
  background: #fef08a;
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
}

mark.hl-active {
  background: #f59e0b;
  color: #1a1a1a;
}

.dark mark.hl {
  background: #854d0e;
  color: #fef3c7;
}
.dark mark.hl-active {
  background: #d97706;
  color: #1a1a1a;
}

/* ── Trend indicators ── */
article.report .trend-up   { color: #276749; font-weight: bold; }
article.report .trend-flat { color: #4a5568; }
article.report .trend-down { color: #c53030; font-weight: bold; }


/* ════════════════════════════════════════════
   DARK MODE (class-based toggle)
   ════════════════════════════════════════════ */

.dark article.report {
  color: #e4e4e7;
}

.dark article.report h1 {
  border-bottom-color: #60a5fa;
}

.dark article.report h2 {
  border-left-color: #60a5fa;
}

.dark article.report h3 {
  color: #93c5fd;
}

.dark article.report a {
  color: #93c5fd;
}

.dark article.report hr {
  border-top-color: #3f3f46;
}

/* Tables */
.dark article.report th {
  background: #1e3a5f;
}

.dark article.report td {
  border-bottom-color: #3f3f46;
}

.dark article.report tr:nth-child(even) {
  background: #1c1c22;
}

.dark article.report tr:hover {
  background: #1e293b;
}

/* Color utilities */
.dark article.report .green { color: #68d391; }
.dark article.report .red { color: #fc8181; }
.dark article.report .orange { color: #f6ad55; }
.dark article.report .blue { color: #63b3ed; }

/* Boxes */
.dark article.report .box {
  border-color: #2a4a6b;
  background: #1a2332;
}

.dark article.report .box-green {
  border-color: #276749;
  background: #1a2e1a;
  border-left-color: #48bb78;
}

.dark article.report .box-red {
  border-color: #9b2c2c;
  background: #2d1a1a;
  border-left-color: #fc8181;
}

.dark article.report .box-amber,
.dark article.report .box-yellow {
  border-color: #975a16;
  background: #2d2a1a;
  border-left-color: #ecc94b;
}

/* Verdict */
.dark article.report .verdict-learn { background: #1a2e1a; border-color: #48bb78; color: #68d391; }
.dark article.report .verdict-watch { background: #2d2a1a; border-color: #d69e2e; color: #ecc94b; }
.dark article.report .verdict-skip  { background: #2d1a1a; border-color: #fc8181; color: #fc8181; }

/* Strength/weakness columns (inline-styled in reports) */
.dark article.report .col-green {
  background: #1a2e1a !important;
  border-color: #276749 !important;
}
.dark article.report .col-red {
  background: #2d1a1a !important;
  border-color: #9b2c2c !important;
}

/* Actor card / profile */
.dark article.report .actor-card {
  border-color: #3f3f46;
  background: #1c1c22;
}

.dark article.report .profile-box {
  border-color: #3f3f46;
  background: #1c1c22;
}

/* Timeline */
.dark article.report .timeline-item {
  border-left-color: #60a5fa;
}

/* KPI table */
.dark article.report .kpi-table th {
  background: #1e293b;
}

/* Note */
.dark article.report .note {
  color: #a1a1aa;
}

/* Trend */
.dark article.report .trend-up   { color: #68d391; }
.dark article.report .trend-flat { color: #a1a1aa; }
.dark article.report .trend-down { color: #fc8181; }

/* Score badges */
.dark article.report .score-a { background: #2f855a; }
.dark article.report .score-b { background: #2b6cb0; }
.dark article.report .score-c { background: #b45309; }
.dark article.report .score-d { background: #c53030; }

/* Sources */
.dark article.report .kilder a {
  color: #93c5fd;
}

/* Code blocks */
.dark article.report code {
  background: #27272a;
}
.dark article.report pre {
  background: #27272a;
  border-color: #3f3f46;
}
.dark .compact-text code {
  background: #27272a;
}
.dark .compact-text pre {
  background: #27272a;
  border-color: #3f3f46;
}

/* Compact text */
.dark .compact-text h2 {
  border-left-color: #60a5fa;
}
.dark .compact-text h3 {
  color: #93c5fd;
}
.dark .compact-text th {
  background: #1e3a5f;
  color: #e2e8f0;
}
.dark .compact-text td {
  border-bottom-color: #3f3f46;
}
.dark .compact-text tr:nth-child(even) {
  background: #1c1c22;
}
.dark .compact-text tr:hover {
  background: #1e293b;
}


/* ════════════════════════════════════════════
   PRINT
   ════════════════════════════════════════════ */

@media print {
  /* Hide UI elements */
  #topbar, #toc-sidebar, #toc-overlay, #progress-bar,
  [data-filename], nav, .fixed { display: none !important; }

  /* Force light colors */
  body { background: white !important; color: black !important; }
  article.report { color: #1a1a1a !important; max-width: 100%; }
  article.report h1 { border-bottom-color: #1a2e4a !important; }
  article.report h2 { border-left-color: #3a7bd5 !important; }
  article.report h3 { color: #2c5282 !important; }
  article.report a { color: #2b6cb0 !important; }
  article.report th { background: #1a2e4a !important; color: white !important; }
  article.report tr:nth-child(even) { background: #f7fafc !important; }
  article.report .box { background: #ebf8ff !important; border-color: #bee3f8 !important; }
  article.report .box-green { background: #f0fff4 !important; border-color: #c6f6d5 !important; }
  article.report .box-red { background: #fff5f5 !important; border-color: #fed7d7 !important; }
  article.report .box-amber, article.report .box-yellow { background: #fffff0 !important; border-color: #fefcbf !important; }
  article.report .actor-card, article.report .profile-box { background: #fafafa !important; border-color: #e2e8f0 !important; }
  article.report .note { color: #4a5568 !important; }
  article.report .green { color: #276749 !important; }
  article.report .red { color: #c53030 !important; }
  article.report .orange { color: #9a3412 !important; }
  article.report .blue { color: #2b6cb0 !important; }

  /* Table row breaks */
  article.report tr { page-break-inside: avoid; }
  article.report table { page-break-inside: auto; }

  /* Remove highlight marks */
  mark.hl { background: none !important; padding: 0 !important; }
}
