/* Full-viewport reader layout; shared tokens and controls live in theme.css. */
html { height: 100%; }
body {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.reader-header {
  border-bottom: 1px solid var(--line);
  padding: 0 var(--page-gutter) var(--space-4);
}
.reader-topline { border-bottom: 0; }
.reader-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.reader-header h1 {
  margin: var(--space-2) 0 var(--space-1);
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.reader-file-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  color: var(--muted);
  font-size: var(--text-label);
}
.file-path { min-width: 0; overflow-wrap: anywhere; font-family: var(--font-mono); }
.reader-file-meta time { font-variant-numeric: tabular-nums; }
.reader-workspace { min-height: 0; min-width: 0; position: relative; background: var(--surface); }
.code-scroller {
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) var(--surface);
}
.code-scroller:focus-visible { outline-offset: -2px; }
.code-grid { display: grid; grid-template-columns: auto minmax(max-content, 1fr); min-width: 100%; min-height: 100%; align-content: start; }
.line-numbers, .code-grid pre {
  margin: 0;
  padding-block: var(--space-6) calc(var(--space-8) * 2);
  font: var(--text-body)/1.75 var(--font-mono);
  font-variant-ligatures: none;
  tab-size: 4;
  white-space: pre;
}
.line-numbers {
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding-inline: var(--page-gutter) var(--space-4);
  color: var(--muted);
  text-align: right;
  user-select: none;
}
.code-grid pre { padding-inline: var(--space-6) calc(var(--space-6) * 2); color: var(--ink); }
.code-grid code, .code-grid code.hljs {
  display: block;
  overflow: visible;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font: inherit;
}
/* Preserve the bundled syntax themes; correct their low-contrast exceptions. */
.code-grid .hljs-built_in, .code-grid .hljs-symbol { color: var(--syntax-built-in); }
.code-grid .hljs-section { color: var(--syntax-section); }
.reader-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
  color: var(--muted);
}
.state-mark { font: 1.75rem/1 var(--font-mono); color: var(--accent); }
.reader-state p { margin: 0; }
.reader-statusbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  min-height: 36px;
  border-top: 1px solid var(--line);
  padding: var(--space-2) var(--page-gutter);
  color: var(--muted);
  font-size: var(--text-meta);
}
.file-status { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.branch-dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--accent); }
#copy-status { overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .reader-topline { flex-wrap: wrap; gap: var(--space-2); padding-block: var(--space-2); }
  .reader-file-meta { flex-direction: column; gap: var(--space-1); }
  .line-numbers { padding-inline: var(--space-3); }
  .code-grid pre { padding-inline: var(--space-4) var(--space-6); }
}
/* Let short viewports scroll the document instead of trapping an oversized header. */
@media (max-height: 480px) {
  body { height: auto; min-height: 100dvh; grid-template-rows: auto minmax(180px, 1fr) auto; }
  .code-scroller { height: auto; min-height: 180px; }
}
