/* Self-hosted fonts (OFL, see fonts/OFL.txt). Subsets via Fontsource. */

/* Doto — dot-matrix display face, hero moments only (36px+). */
@font-face {
  font-family: "Doto";
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
  src: url(../fonts/doto-latin-ext-wght.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Doto";
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
  src: url(../fonts/doto-latin-wght.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Space Grotesk — body and UI (variable 300–700). */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(../fonts/space-grotesk-vietnamese-wght.woff2) format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(../fonts/space-grotesk-latin-ext-wght.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(../fonts/space-grotesk-latin-wght.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Space Mono — data, labels and code. */
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/space-mono-vietnamese-400.woff2) format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/space-mono-latin-ext-400.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/space-mono-latin-400.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/space-mono-vietnamese-700.woff2) format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/space-mono-latin-ext-700.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/space-mono-latin-700.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/*
 * Design tokens — Nothing design system.
 *
 * Every color is written once as light-dark(LIGHT, DARK). The active side is
 * picked by `color-scheme`: the OS preference by default, or forced by the
 * [data-theme] attribute set from the server config / theme toggle.
 */

:root {
  color-scheme: light dark;
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

:root {
  /* Surfaces: OLED black / printed-manual off-white. */
  --black: light-dark(#F5F5F5, #000000);
  --surface: light-dark(#FFFFFF, #111111);
  --surface-raised: light-dark(#F0F0F0, #1A1A1A);
  --border: light-dark(#E8E8E8, #222222);
  --border-visible: light-dark(#CCCCCC, #333333);

  /* Text: the gray scale is the hierarchy. */
  --text-disabled: light-dark(#999999, #666666);
  --text-secondary: light-dark(#666666, #999999);
  --text-primary: light-dark(#1A1A1A, #E8E8E8);
  --text-display: light-dark(#000000, #FFFFFF);

  /* Accent & status — identical in both modes. */
  --accent: #D71921;
  --accent-subtle: rgba(215, 25, 33, 0.15);
  --success: #4A9E5C;
  --warning: #D4A843;
  --error: #D71921;
  --info: var(--text-secondary);
  --interactive: light-dark(#007AFF, #5B9BF6);

  /* Empty segment in segmented bars. */
  --segment-empty: light-dark(#E0E0E0, #222222);

  /* Type families. --font-code may be overridden via ui.code_font. */
  --font-display: "Doto", "Space Mono", monospace;
  --font-body: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  --font-mono: "Space Mono", "JetBrains Mono", "SF Mono", monospace;
  --font-code: var(--font-mono);

  /* Type scale. */
  --display-xl: 72px;
  --display-lg: 48px;
  --display-md: 36px;
  --heading: 24px;
  --subheading: 18px;
  --body: 16px;
  --body-sm: 14px;
  --caption: 12px;
  --label: 11px;

  /* Spacing (8px base). */
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Layout. */
  --gutter: var(--space-md);
  --page-max: 1200px;
  --rail: 280px;

  /* Motion: subtle ease-out only. */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur-micro: 150ms;
  --dur: 300ms;
}

@media (min-width: 768px) {
  :root {
    --gutter: var(--space-xl);
  }
}

@media (min-width: 1200px) {
  :root {
    --gutter: var(--space-2xl);
  }
}

/* Base: reset, document typography, page shell. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--body);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  color: var(--text-display);
}

ul, ol {
  padding: 0;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--interactive);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

code, kbd, samp, pre {
  font-family: var(--font-code);
  font-size: var(--body-sm);
}

::selection {
  background: var(--text-display);
  color: var(--black);
}

:focus-visible {
  outline: 1px solid var(--text-display);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* Page shell: one centered column with responsive gutters. */
.shell {
  width: 100%;
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main.shell {
  flex: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
  }
}

/* Components: labels, display type, top bar, theme switch, page patterns. */

/* ---- Type roles ------------------------------------------------------- */

.label {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.dim {
  color: var(--text-disabled);
}

.doto {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-display);
}

.display-xl {
  font-size: var(--display-xl);
  line-height: 1;
  letter-spacing: -0.03em;
}

.display-lg {
  font-size: var(--display-lg);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.display-md {
  font-size: var(--display-md);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Inline status text: [LOADING], [COPIED], [ERROR: …]. */
.status {
  font-family: var(--font-mono);
  font-size: var(--caption);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.status-error {
  color: var(--error);
}

/* ---- Buttons ---------------------------------------------------------- */

.btn-ghost {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: none;
  border: 0;
  transition: color var(--dur-micro) var(--ease);
}

.btn-ghost:hover {
  color: var(--text-display);
  text-decoration: none;
}

/* ---- Top bar ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 64px;
  padding-block: var(--space-md);
}

.topbar-home {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  color: var(--text-display);
}

.topbar-home .label {
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* `site.logo`: sized by height so any aspect ratio fits the bar. */
.topbar-logo {
  flex: none;
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.topbar-home:hover {
  text-decoration: none;
}

/* ---- Segmented control ------------------------------------------------ */

.segmented {
  display: inline-flex;
  flex: none;
  padding: var(--space-2xs);
  border: 1px solid var(--border-visible);
  border-radius: 999px;
}

.segmented button,
.segmented a {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 var(--space-md);
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition:
    background-color 200ms var(--ease),
    color 200ms var(--ease);
}

.segmented button:hover,
.segmented a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.segmented button[aria-pressed="true"],
.segmented a[aria-current="true"] {
  background: var(--text-display);
  color: var(--black);
}

.segmented-sm button,
.segmented-sm a {
  height: 26px;
  padding: 0 var(--space-sm);
}

@media (pointer: coarse) {
  .segmented button,
  .segmented a {
    height: 40px;
  }
}

/* The theme switch needs JS; without it the OS preference applies. */
html:not(.js) .theme-switch {
  display: none;
}

/* ---- Site header / footer --------------------------------------------- */

.site-header {
  padding-block: var(--space-sm);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-4xl);
  padding-block: var(--space-xl);
}

.site-footer {
  font-size: var(--body-sm);
  color: var(--text-secondary);
}

/* ---- Index ------------------------------------------------------------ */

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md) var(--space-xl);
  padding-top: var(--space-3xl);
}

.hero-main {
  min-width: 0;
}

.hero h1 {
  overflow-wrap: anywhere;
}

.hero-desc {
  margin-top: var(--space-sm);
  max-width: 60ch;
  color: var(--text-secondary);
}

.hero-meta {
  white-space: nowrap;
  padding-bottom: var(--space-xs);
}

/* ---- Inputs ----------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-sm) 0;
  border: 0;
  border-bottom: 1px solid var(--border-visible);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--body);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--dur-micro) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.field input::placeholder {
  color: var(--text-disabled);
}

.field input:focus {
  border-bottom-color: var(--text-primary);
}

.field input::-webkit-search-cancel-button {
  display: none;
}

/* ---- Index: filter, sort, repository rows ----------------------------- */

.index-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md) var(--space-xl);
  margin-top: var(--space-2xl);
}

.index-tools .field {
  flex: 1 1 240px;
  max-width: 360px;
}

/* Bracket nav: [ ACTIVE ]  INACTIVE */
.sort,
.bracket-nav {
  display: flex;
  gap: var(--space-sm);
}

.sort a,
.bracket-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-xs);
  color: var(--text-disabled);
  transition: color var(--dur-micro) var(--ease);
}

.sort a:hover,
.bracket-nav a:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.sort a.active,
.bracket-nav a.active {
  color: var(--text-display);
}

.sort a.active::before,
.bracket-nav a.active::before {
  content: "[ ";
  white-space: pre;
}

.sort a.active::after,
.bracket-nav a.active::after {
  content: " ]";
  white-space: pre;
}

.repo-section {
  margin-top: var(--space-2xl);
}

.section-label {
  padding-bottom: var(--space-sm);
}

.repo-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.repo-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.repo-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  flex: 1;
  min-width: 0;
  padding-block: 14px;
  color: var(--text-primary);
}

.repo-link:hover {
  text-decoration: none;
}

.repo-name {
  font-weight: 500;
  color: var(--text-display);
  overflow-wrap: anywhere;
}

.repo-link:hover .repo-name {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.repo-desc {
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .repo-link {
    flex-direction: row;
    align-items: baseline;
    gap: var(--space-md);
  }

  .repo-name {
    flex: none;
    max-width: 50%;
  }

  .repo-desc {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

.repo-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  flex: none;
  color: var(--text-disabled);
  white-space: nowrap;
}

.repo-lang {
  color: var(--text-secondary);
}

.repo-lang::after {
  content: "\00B7";
  margin-left: var(--space-sm);
  color: var(--text-disabled);
}

/* Data-status dot: pushed in the last 24 hours. */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.no-matches {
  padding-block: var(--space-2xl);
}

/* ---- Empty state ------------------------------------------------------ */

.empty {
  padding-block: var(--space-4xl);
  text-align: center;
}

.empty-title {
  color: var(--text-secondary);
}

.empty-desc {
  margin-top: var(--space-xs);
  color: var(--text-disabled);
}

/* ---- Error page ------------------------------------------------------- */

.error-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
  padding-top: var(--space-4xl);
}

.error-page .btn-ghost {
  margin-top: var(--space-xl);
}

/* Repository pages: nav, ref picker, summary, tree, blob, refs, Markdown. */

.mono {
  font-family: var(--font-mono);
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
}

/* ---- Repository bar: [ SUMMARY ]  TREE  REFS · ref picker ------------- */

.repo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  padding-top: var(--space-sm);
}

.bracket-nav {
  overflow-x: auto;
  scrollbar-width: none;
}

.bracket-nav a {
  white-space: nowrap;
}

/* margin-left: auto keeps the picker at the right edge when the bar wraps
   (narrow screens), so the right-anchored menu opens on screen. */
.ref-picker {
  position: relative;
  margin-left: auto;
}

.ref-picker summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid var(--border-visible);
  border-radius: 999px;
  list-style: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color var(--dur-micro) var(--ease);
}

.ref-picker summary::-webkit-details-marker {
  display: none;
}

.ref-picker summary:hover,
.ref-picker[open] summary {
  border-color: var(--text-secondary);
}

.ref-current {
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-primary);
}

.ref-picker[open] .chevron {
  transform: rotate(180deg);
}

.ref-menu {
  position: absolute;
  z-index: 10;
  right: 0;
  top: calc(100% + var(--space-xs));
  width: max-content;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 2 * var(--gutter)));
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-sm) 0;
  border: 1px solid var(--border-visible);
  border-radius: 8px;
  background: var(--surface-raised);
}

.ref-group {
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  color: var(--text-disabled);
}

.ref-menu ul {
  list-style: none;
}

.ref-menu li a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-md);
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.ref-menu li a:hover {
  color: var(--text-display);
  text-decoration: none;
}

.ref-menu li a.active {
  border-left-color: var(--accent);
  color: var(--text-display);
}

.ref-all {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-md);
  margin-top: var(--space-xs);
  border-top: 1px solid var(--border);
}

/* ---- Breadcrumb: secondary path, current segment in display ------------ */

.crumbs {
  padding-top: var(--space-2xl);
  font-size: var(--heading);
  font-weight: 400;
  line-height: 1.25;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.crumbs a {
  color: var(--text-secondary);
}

.crumbs a:hover {
  color: var(--text-display);
}

.crumb-sep {
  padding: 0 var(--space-sm);
  color: var(--text-disabled);
}

.crumb-here {
  color: var(--text-display);
}

/* ---- Summary ------------------------------------------------------------ */

.repo-hero {
  padding-top: var(--space-2xl);
}

.repo-title {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.repo-about {
  margin-top: var(--space-sm);
  max-width: 60ch;
  color: var(--text-secondary);
}

.repo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xl);
  margin-top: var(--space-xl);
}

@media (min-width: 768px) {
  .repo-grid {
    grid-template-columns: minmax(0, 1fr) var(--rail);
    gap: var(--space-xl);
  }
}

@media (min-width: 1200px) {
  .repo-grid {
    gap: var(--space-2xl);
  }
}

.rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  min-width: 0;
}

.stats {
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-block: 12px;
  border-bottom: 1px solid var(--border);
}

.stat dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--body-sm);
  color: var(--text-primary);
  text-align: right;
  overflow-wrap: anywhere;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 30px;
}

.rail-block > .label {
  display: block;
}

.clone-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.clone-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border-visible);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-primary);
  outline: none;
  text-overflow: ellipsis;
}

.clone-input:focus {
  border-bottom-color: var(--text-primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-secondary);
  transition: color var(--dur-micro) var(--ease);
}

.icon-btn:hover {
  color: var(--text-display);
}

/* Copying and switching protocols need JS; without it every URL shows. */
html:not(.js) .clone-switch,
html:not(.js) [data-copy],
html:not(.js) .copy-status {
  display: none;
}

.copy-status {
  min-height: 1.4em;
  margin-top: var(--space-xs);
}

/* The one break on the summary: a segmented language bar. */
.lang-bar {
  display: grid;
  grid-template-columns: repeat(40, 1fr);
  gap: 2px;
  margin-top: var(--space-sm);
}

.lang-bar i {
  aspect-ratio: 1;
}

.lang-bar i,
.lang-legend i {
  background: var(--text-display);
}

.lang-bar .o1,
.lang-legend .o1 {
  opacity: 0.7;
}

.lang-bar .o2,
.lang-legend .o2 {
  opacity: 0.45;
}

.lang-bar .o3,
.lang-legend .o3 {
  opacity: 0.25;
}

.lang-legend {
  list-style: none;
  margin-top: var(--space-sm);
}

.lang-legend li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-block: 2px;
}

.lang-legend i {
  width: 8px;
  height: 8px;
  flex: none;
}

.lang-legend .label {
  flex: 1;
}

.lang-pct {
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-secondary);
}

.latest-subject {
  margin-top: var(--space-sm);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.latest-meta {
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-secondary);
}

.sha {
  font-family: var(--font-mono);
}

/* ---- Tree listing --------------------------------------------------------- */

.tree {
  list-style: none;
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.repo-main > .tree:first-child {
  margin-top: 0;
}

.tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 44px;
  border-bottom: 1px solid var(--border);
}

.tree-name {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
  min-height: 44px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.tree-name .icon {
  color: var(--text-disabled);
}

.tree-name .icon-folder {
  color: var(--text-secondary);
}

.tree-meta {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-disabled);
  white-space: nowrap;
}

.tree-foot {
  margin-top: var(--space-md);
}

/* ---- README ------------------------------------------------------------- */

.readme {
  margin-top: var(--space-2xl);
}

.readme-name {
  display: inline-block;
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

/* ---- Blob --------------------------------------------------------------- */

.blob-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
}

.blob-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
}

.blob-note {
  padding-block: var(--space-2xl);
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.code-wrap {
  margin-top: var(--space-sm);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.code {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 20px;
  tab-size: 4;
}

.code td {
  padding: 0;
  vertical-align: top;
}

.code .ln {
  width: 1%;
  border-left: 2px solid transparent;
  text-align: right;
  user-select: none;
  -webkit-user-select: none;
}

.code .ln a {
  display: block;
  padding: 0 var(--space-md) 0 var(--space-sm);
  color: var(--text-disabled);
}

.code .ln a:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.code .lc {
  padding: 0 var(--space-md);
  white-space: pre;
  color: var(--text-primary);
}

.code tr:first-child td {
  padding-top: var(--space-sm);
}

.code tr:last-child td {
  padding-bottom: var(--space-sm);
}

/* Selected lines: #L12 (CSS) or #L12-L20 (JS). */
.code tr:target,
.code tr.selected {
  background: var(--surface-raised);
}

.code tr:target .ln,
.code tr.selected .ln {
  border-left-color: var(--accent);
}

.code tr:target .ln a,
.code tr.selected .ln a {
  color: var(--text-display);
}

/* The one break on the blob page: images float on a dot grid. */
.image-view {
  display: flex;
  justify-content: center;
  margin-top: var(--space-sm);
  padding: var(--space-xl) var(--space-md);
  border: 1px solid var(--border);
  border-radius: 4px;
  background-image: radial-gradient(circle, var(--border-visible) 1px, transparent 1px);
  background-size: 16px 16px;
}

.image-view img {
  max-height: 70vh;
  object-fit: contain;
}

.blob-markdown {
  margin-top: var(--space-xl);
}

/* ---- Refs --------------------------------------------------------------- */

.refs-section {
  margin-top: var(--space-2xl);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--border-visible);
  text-align: left;
  font-weight: 400;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: baseline;
}

.data-table .num {
  padding-right: 0;
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-disabled);
}

.data-table th.num {
  font-size: var(--label);
  color: var(--text-secondary);
}

.ref-name {
  font-family: var(--font-mono);
  font-size: var(--body-sm);
  overflow-wrap: anywhere;
}

.ref-subject {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.ref-archives {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xs);
}

.ref-archives a {
  color: var(--text-secondary);
}

.ref-archives a:hover {
  color: var(--text-display);
}

.chip {
  display: inline-block;
  margin-left: var(--space-sm);
  padding: 2px var(--space-sm);
  border: 1px solid var(--border-visible);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---- Log ------------------------------------------------------------------ */

.log-tools {
  margin-top: var(--space-lg);
  max-width: 420px;
}

.log-day {
  margin-top: var(--space-xl);
}

.log {
  list-style: none;
  border-top: 1px solid var(--border);
}

.log-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-block: 12px;
  border-bottom: 1px solid var(--border);
}

.log-main {
  min-width: 0;
}

.log-subject {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.log-meta {
  margin-top: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-secondary);
}

.log-sha {
  flex: none;
  font-size: var(--caption);
  color: var(--interactive);
}

.log-note {
  margin-top: var(--space-lg);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* ---- Commit --------------------------------------------------------------- */

.commit-head {
  margin-top: var(--space-lg);
}

.commit-subject {
  font-size: var(--heading);
  font-weight: 400;
  line-height: 1.25;
  color: var(--text-display);
  overflow-wrap: anywhere;
}

.commit-body {
  max-width: 72ch;
  margin-top: var(--space-md);
  font-family: var(--font-body);
  font-size: var(--body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
}

.commit-grid {
  display: grid;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

@media (min-width: 768px) {
  .commit-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}

/* The one break on the commit page: a hero diffstat. */
.diffstat-hero {
  text-align: right;
}

.diffstat-num {
  font-family: var(--font-mono);
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-display);
  white-space: nowrap;
}

.diffstat-hero .label {
  margin-top: var(--space-sm);
}

.add {
  color: var(--success);
}

.del {
  color: var(--accent);
}

.commit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.context-ctl {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.context-ctl a,
.context-ctl > span:first-child,
.context-ctl > span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
}

.file-list {
  list-style: none;
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.file-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 40px;
  padding-block: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.file-status {
  flex: none;
  width: 1.5em;
  font-family: var(--font-mono);
  font-size: var(--caption);
  color: var(--text-secondary);
}

.file-path {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--body-sm);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.file-path .dim,
.diff-path .dim {
  color: var(--text-disabled);
}

.file-counts {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--caption);
  white-space: nowrap;
}

.blocks {
  display: inline-flex;
  flex: none;
  gap: 2px;
}

.blocks i {
  width: 8px;
  height: 8px;
  background: var(--segment-empty);
}

.blocks i.add {
  background: var(--success);
}

.blocks i.del {
  background: var(--accent);
}

.diff-file {
  margin-top: var(--space-2xl);
}

.diff-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 44px;
  background: var(--black);
  border-bottom: 1px solid var(--border-visible);
}

.diff-path {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--body-sm);
  color: var(--text-display);
  overflow-wrap: anywhere;
}

.diff-view {
  flex: none;
}

.diff-note {
  padding-block: var(--space-md);
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.diff-file .code-wrap {
  margin-top: 0;
  border-top: 0;
}

.code.diff .ln {
  padding: 0 var(--space-sm);
  color: var(--text-disabled);
  font-size: 12px;
}

.code.diff .ln + .ln {
  border-left: 0;
}

.code.diff .sign {
  width: 1%;
  padding: 0 var(--space-xs) 0 var(--space-sm);
  color: var(--text-disabled);
  user-select: none;
  -webkit-user-select: none;
}

.code.diff .lc {
  padding-left: 0;
}

.code.diff tr.add .ln:first-child {
  border-left-color: var(--success);
}

.code.diff tr.add .sign {
  color: var(--success);
}

.code.diff tr.del .ln:first-child {
  border-left-color: var(--accent);
}

.code.diff tr.del .sign {
  color: var(--accent);
}

.code.diff tr.del .lc {
  opacity: 0.55;
}

.code.diff tr.hunk td {
  padding-block: var(--space-xs);
  color: var(--text-disabled);
}

.code.diff tr.hunk .lc {
  font-family: var(--font-mono);
  font-size: 12px;
}

.code.diff tr.hunk:not(:first-child) td {
  border-top: 1px solid var(--border);
}

/* ---- Find ----------------------------------------------------------------- */

.find-count {
  margin-top: var(--space-lg);
}

.find-list {
  margin-top: var(--space-sm);
}

.find-dir {
  color: var(--text-disabled);
}

/* ---- Blame ---------------------------------------------------------------- */

.code.blame .blame-meta {
  width: 1%;
  max-width: 320px;
  padding: 0 var(--space-md) 0 var(--space-sm);
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: var(--caption);
  line-height: 20px;
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code.blame .blame-meta .sha {
  color: var(--interactive);
}

.code.blame .blame-meta time {
  color: var(--text-disabled);
}

.code.blame tr.hunk-start td {
  border-top: 1px solid var(--border);
}

.code.blame tr:first-child td {
  border-top: 0;
}

/* The one break on the blame page: heat by opacity, newest to oldest. */
.code.blame .age-8 {
  border-left-color: var(--text-display);
}

.code.blame .age-7 {
  border-left-color: color-mix(in srgb, var(--text-display) 90%, transparent);
}

.code.blame .age-6 {
  border-left-color: color-mix(in srgb, var(--text-display) 80%, transparent);
}

.code.blame .age-5 {
  border-left-color: color-mix(in srgb, var(--text-display) 70%, transparent);
}

.code.blame .age-4 {
  border-left-color: color-mix(in srgb, var(--text-display) 60%, transparent);
}

.code.blame .age-3 {
  border-left-color: color-mix(in srgb, var(--text-display) 50%, transparent);
}

.code.blame .age-2 {
  border-left-color: color-mix(in srgb, var(--text-display) 40%, transparent);
}

.code.blame .age-1 {
  border-left-color: color-mix(in srgb, var(--text-display) 30%, transparent);
}

.code.blame .age-0 {
  border-left-color: color-mix(in srgb, var(--text-display) 20%, transparent);
}

/* ---- Markdown ------------------------------------------------------------ */

.markdown {
  max-width: 72ch;
  overflow-wrap: break-word;
  color: var(--text-primary);
}

.markdown > * + * {
  margin-top: var(--space-md);
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin-top: var(--space-xl);
  line-height: 1.25;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown h1 {
  font-size: var(--heading);
}

.markdown h2 {
  font-size: var(--subheading);
}

.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  font-size: var(--body);
}

.markdown a.anchor {
  display: none;
}

.markdown ul,
.markdown ol {
  padding-left: var(--space-lg);
}

.markdown li + li,
.markdown li > ul,
.markdown li > ol {
  margin-top: var(--space-xs);
}

.markdown .contains-task-list {
  list-style: none;
  padding-left: var(--space-xs);
}

.markdown input[type="checkbox"] {
  margin: 0 var(--space-sm) 0 0;
  vertical-align: middle;
  accent-color: var(--text-display);
}

.markdown code {
  padding: 1px var(--space-xs);
  border-radius: 4px;
  background: var(--surface-raised);
  font-size: 0.875em;
}

.markdown pre {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow-x: auto;
  line-height: 20px;
  tab-size: 4;
}

.markdown pre code {
  padding: 0;
  background: none;
  font-size: 13px;
}

.markdown pre.plain {
  max-width: none;
  white-space: pre-wrap;
}

.markdown blockquote {
  padding-left: var(--space-md);
  border-left: 2px solid var(--border-visible);
  color: var(--text-secondary);
}

.markdown hr {
  border: 0;
  border-top: 1px solid var(--border);
}

.markdown img {
  display: inline-block;
}

.markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown th,
.markdown td {
  padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.markdown th {
  border-bottom-color: var(--border-visible);
  font-weight: 500;
  text-align: left;
}

.markdown .markdown-alert {
  padding-left: var(--space-md);
  border-left: 2px solid var(--border-visible);
}

.markdown .markdown-alert-warning,
.markdown .markdown-alert-caution {
  border-left-color: var(--accent);
}

.markdown .markdown-alert-title {
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.markdown .footnotes {
  font-size: var(--body-sm);
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

/*
 * Syntax highlighting: monochrome, by weight of gray. The classes come from
 * src/render/highlight.rs and are shared by the blob view and README code.
 */

.hl-k {
  color: var(--text-display);
  font-weight: 700;
}

.hl-d {
  color: var(--text-display);
}

.hl-s {
  color: var(--text-secondary);
}

.hl-c {
  color: var(--text-disabled);
}

.hl-x {
  color: var(--accent);
}

