/* ==========================================================================
   1. Design Tokens (Catppuccin Mocha Palette)
   ========================================================================== */
:root {
  --base: #1e1d2d;
  --mantle: #181825;
  --crust: #11111b;

  --text: #cdd6f4;
  --subtext1: #bac2de;
  --subtext0: #a6adc8;

  --surface0: #313244;
  --surface1: #45475a;
  --surface2: #585b70;

  --overlay0: #6c7086;
  --overlay1: #7f849c;
  --overlay2: #9399b2;

  --rosewater: #f5e0dc;
  --flamingo: #f2cdcd;
  --pink: #f5c2e7;
  --mauve: #cba6f7;
  --red: #f38ba8;
  --maroon: #eba0ac;
  --peach: #fab387;
  --yellow: #f9e2af;
  --green: #a6e3a1;
  --teal: #94e2d5;
  --sky: #89dceb;
  --sapphire: #74c7ec;
  --blue: #89b4fa;
  --lavender: #b4befe;

  --white: #D9E0EE;
  --black2: #252434;
  --one_bg: #2d2c3c;
  --one_bg2: #363545;
  --one_bg3: #3e3d4d;
  --grey: #474656;
  --grey_fg: #4e4d5d;
  --grey_fg2: #555464;
  --light_grey: #605f6f;
}

/* ==========================================================================
   2. Base & Typography (Sharp Corners, Zero Border-Radius)
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0;
}

body {
  font-family: 'Maple Mono NF', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  background: var(--base);
  color: var(--text);
}

div#body {
  padding: 1.5rem 2.5rem 3rem;
}

main {
  padding: 1.25rem 0 0;
  margin: 0 auto;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  margin-top: 1.25rem;
  margin-bottom: 0.6rem;
}

a {
  color: var(--peach);
  padding: 3px 6px;
  text-decoration: none;
}

a:hover,
a:active,
a.active {
  color: var(--crust) !important;
  background: var(--peach) !important;
}

a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 1px solid var(--peach);
  outline-offset: 1px;
}

code {
  background: var(--black2);
  color: var(--green);
  padding: 2px 6px;
  border: 1px solid var(--surface0);
}

pre {
  color: var(--text);
  background: var(--black2);
  border: 1px solid var(--surface1);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  overflow-x: auto;
}

pre code {
  color: var(--text);
  background: transparent;
  border: none;
  padding: 0;
}

/* ==========================================================================
   3. Global Tables & Forms
   ========================================================================== */
table {
  border-collapse: collapse;
  width: 100%;
}

table.section-table {
  margin-bottom: 1.75rem;
}

th {
  text-align: left;
  white-space: nowrap;
  color: var(--peach);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--surface1);
}

main table thead th {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.1s ease, color 0.1s ease;
}

main table thead th:hover {
  background: var(--one_bg);
  color: var(--rosewater);
}

main table thead th::after {
  content: ' ⇅';
  font-size: 0.75em;
  color: var(--overlay0);
  opacity: 0;
  margin-left: 0.35rem;
}

main table thead th:hover::after {
  opacity: 0.75;
}

main table thead th.sort-asc,
main table thead th.sort-desc {
  background: var(--one_bg);
  border-bottom: 2px solid var(--peach);
}

main table thead th.sort-asc::after {
  content: ' ▲';
  color: var(--green);
  opacity: 1;
}

main table thead th.sort-desc::after {
  content: ' ▼';
  color: var(--red);
  opacity: 1;
}

td {
  text-align: left;
  white-space: nowrap;
  padding: 0.6rem 0.9rem;
}

td a {
  color: var(--text);
}

td.mode,
th.mode {
  width: 11ch;
  font-family: inherit;
  white-space: nowrap;
  color: var(--subtext0);
}

th.mode {
  color: var(--peach);
}

tbody tr:nth-child(even) {
  background: var(--one_bg);
}

tbody tr:nth-child(odd) {
  background: var(--black2);
}

tbody tr:hover {
  background: var(--surface0);
}

tbody tr.no-background:nth-child(even),
tbody tr.no-background:nth-child(odd),
tbody tr.no-background:hover {
  background: transparent;
}

td.form {
  text-align: right;
}

td.form form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

td.form input,
td.form select {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface0);
  border: 1px solid var(--surface1);
  padding: 0.3rem 0.55rem;
}

td.form input[type="submit"] {
  cursor: pointer;
  color: var(--subtext1);
  background: var(--one_bg2);
}

td.form input[type="submit"]:hover {
  color: var(--crust);
  background: var(--peach);
  border-color: var(--peach);
}

/* ==========================================================================
   4. Header & Navigation Tabs
   ========================================================================== */
table.header {
  padding: 0.5rem 2.5rem 0;
}

table.header tr,
table.header tr:nth-child(odd),
table.header tr:nth-child(even),
table.header tr:hover {
  background: transparent;
}

td.logo {
  width: 72px;
  vertical-align: middle;
  padding: 0.75rem 0.75rem 0.75rem 2rem;
}

td.logo a:hover {
  background: transparent;
}

td.logo img {
  width: 64px;
  height: 64px;
  display: block;
}

td.main {
  font-size: 1.65rem;
  font-weight: 600;
  padding: 0.6rem 0.75rem 0.25rem;
  white-space: nowrap;
}

td.sub {
  color: var(--subtext0);
  border-top: 1px solid var(--surface1);
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

.tabs {
  background: var(--black2);
  border: 1px solid var(--surface0);
}

.tabs td {
  padding: 0.5rem 0.75rem;
}

.tabs a {
  color: var(--text);
  padding: 0.25rem 0.6rem;
  margin-right: 0.15rem;
}

.tabs a:hover,
.tabs a:active,
.tabs a.active {
  color: var(--crust);
  background: var(--peach);
}

.tree-breadcrumb {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-top: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

.show_more td,
td.show_more {
  padding: 0.45rem 0.6rem;
}

.show_more a,
.pagination a {
  color: var(--peach);
  font-size: 0.95rem;
}

.show_more a:hover,
.pagination a:hover {
  color: var(--crust);
}

.pagination {
  padding-top: 0.85rem;
  text-align: center;
}

/* ==========================================================================
   5. Metadata Badges, Avatars & Status Indicators
   ========================================================================== */
.fresh {
  color: var(--green);
  font-weight: 600;
}

.recent {
  color: var(--subtext0);
}

.stale {
  color: var(--overlay0);
}

.description {
  color: var(--subtext1);
  font-style: italic;
}

a.folder {
  color: var(--peach);
  font-weight: 600;
}

.clone-url {
  background: var(--surface0);
  color: var(--peach);
  padding: 4px 10px;
  font-size: 0.85em;
}

.badge_head {
  background: var(--crust);
  color: var(--red);
  border: 1px solid var(--red);
  padding: 1px 6px;
  margin-left: 0.35rem;
  font-size: 0.8rem;
}

.badge_branch {
  background: var(--crust);
  color: var(--green);
  border: 1px solid var(--green);
  padding: 1px 6px;
  margin-left: 0.35rem;
  font-size: 0.8rem;
}

.badge_branch:hover,
.badge_head:hover {
  color: var(--crust);
  background: var(--peach);
  border-color: var(--peach);
}

.green {
  color: var(--green);
}

.red {
  color: var(--red);
}

span.avatar {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-right: 0.25rem;
}

span.avatar img.inline {
  width: 18px;
  height: 18px;
  border: 1px solid var(--surface1);
}

span.avatar img.onhover {
  display: none;
  border: 1px solid var(--surface1);
  padding: 0;
  width: 128px;
  height: 128px;
}

span.avatar:hover > img.onhover {
  display: block;
  position: absolute;
  margin-left: 1.5em;
  background-color: var(--crust);
  z-index: 10;
}

/* ==========================================================================
   6. Commit View & Message Cell
   ========================================================================== */
td.msg {
  display: flex;
  align-items: center;
  gap: 0.4em;
  overflow: hidden;
}

td.msg .msg-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

td.author {
  white-space: nowrap;
}

.commit-info {
  margin-top: 0.5rem;
  width: auto;
  background: var(--black2);
  border: 1px solid var(--surface0);
}

.commit-info tr:nth-child(odd),
.commit-info tr:nth-child(even),
.commit-info tr:hover {
  background-color: transparent;
}

.commit-info td {
  padding: 0.3rem 1rem;
}

.commit-info td:first-child {
  color: var(--subtext0);
}

.commit-info a {
  color: var(--peach);
}

.commit-subject {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--surface0);
  margin-bottom: 1rem;
}

.commit-subject h1 {
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0.25rem 0;
}

.commit-subject h4 {
  font-weight: normal;
  color: var(--subtext0);
  white-space: pre-wrap;
  margin: 0.5rem 0 0;
}

/* ==========================================================================
   7. Tree & Blob View
   ========================================================================== */
.blob-meta {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0.5em 0.8em;
  margin-bottom: 0;
  background-color: var(--mantle);
  border: 1px solid var(--surface0);
  border-bottom: none;
  font-family: inherit;
  font-size: 0.9em;
}

.blob-meta .mode {
  white-space: nowrap;
  color: var(--green);
}

.blob-meta .blob-id {
  color: var(--subtext0);
  overflow: hidden;
  text-overflow: ellipsis;
}

.blob-meta .size {
  white-space: nowrap;
  color: var(--subtext1);
  margin-left: auto;
}

.blob-table {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
  background: var(--black2);
  border: 1px solid var(--surface0);
}

.blob-table tr:nth-child(odd),
.blob-table tr:nth-child(even) {
  background-color: transparent;
}

.blob-table tr:hover {
  background-color: var(--one_bg);
}

.blob-table .line-no {
  width: 4.5em;
  text-align: right;
  padding: 0.05rem 0.75rem;
  color: var(--overlay0);
  user-select: none;
  border-right: 1px solid var(--surface0);
  vertical-align: top;
  white-space: nowrap;
}

.blob-table .line-content {
  width: 100%;
  padding: 0.05rem 0.85rem;
  color: var(--text);
}

.blob-table .line-content pre {
  margin: 0;
  background: none;
  border: none;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   8. Diff & Diffstat
   ========================================================================== */
table.diffstat {
  background: var(--black2);
  border: 1px solid var(--surface0);
  width: auto;
  min-width: 50%;
  max-width: 100%;
  margin-bottom: 1rem;
}

table.diffstat td {
  padding: 0.3rem 0.65rem;
}

.diffstat tr,
.diffstat tr:nth-child(odd),
.diffstat tr:nth-child(even),
.diffstat tr:hover {
  background-color: transparent;
}

.diffstat .mode,
.diffstat .upd,
.diffstat .right {
  width: 1%;
}

.diffstat .right {
  text-align: right;
  color: var(--subtext0);
}

.diffstat .graph {
  min-width: 120px;
}

a.diffstat-added {
  color: var(--green);
}

a.diffstat-removed {
  color: var(--red);
}

a.diffstat-changed {
  color: var(--peach);
}

a.diffstat-added:hover,
a.diffstat-removed:hover,
a.diffstat-changed:hover {
  color: var(--crust);
}

.diffstat-addition {
  background: var(--green);
  height: 0.45rem;
  padding: 0 !important;
}

.diffstat-deletion {
  background: var(--red);
  height: 0.45rem;
  padding: 0 !important;
}

pre.diff {
  color: var(--text);
  background: var(--black2);
  border: 1px solid var(--surface0);
  font-size: 0.88rem;
  padding: 0.75rem 1rem;
  line-height: 1.45;
}

.diff-hunk {
  color: var(--blue);
  display: block;
  margin-top: 0.25rem;
}

.diff-file-header {
  font-weight: 600;
  color: var(--subtext1);
}

.diff-file-header > span > span {
  font-weight: normal;
}

.diff-addition {
  background: #243330;
  color: var(--green);
  display: block;
}

.diff-addition::before {
  content: '+ ';
  display: inline-block;
  color: var(--overlay1);
}

.diff-deletion {
  background: #362432;
  color: var(--red);
  display: block;
}

.diff-deletion::before {
  content: '- ';
  display: inline-block;
  color: var(--overlay1);
}

.diff-context::before {
  content: '  ';
  display: inline-block;
  color: var(--overlay1);
}

/* ==========================================================================
   9. Markdown & Readme
   ========================================================================== */
.readme {
  background: var(--black2);
  border: 1px solid var(--surface0);
  padding: 1.25rem 1.75rem;
}

.readme h1,
.readme h2,
.readme h3,
.readme h4,
.readme h5,
.readme h6 {
  margin-bottom: 0.75rem;
}

.readme h1,
.readme h2 {
  border-bottom: 1px solid var(--surface1);
  padding-bottom: 0.3rem;
}

.readme code {
  background: var(--crust);
  color: var(--green);
  border: 1px solid var(--surface0);
  padding: 0.1rem 0.35rem;
  font-size: 0.88em;
}

.readme pre {
  background: var(--crust);
  border: 1px solid var(--surface1);
  padding: 0.85rem 1.1rem;
  margin: 0.85rem 0;
  line-height: 1.55;
  font-size: 0.88rem;
  overflow-x: auto;
}

.readme pre code {
  background: transparent;
  color: var(--text);
  border: none;
  padding: 0;
  font-size: inherit;
}

.readme p {
  font-size: 0.92rem;
  color: var(--subtext1);
  line-height: 1.6;
}

.readme ul,
.readme ol {
  color: var(--subtext1);
  padding-left: 1.5rem;
  line-height: 1.6;
}

.readme blockquote {
  margin: 0.75rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--peach);
  background: var(--mantle);
  color: var(--subtext0);
}

.readme img,
.readme video {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--surface0);
  margin: 0.5rem 0;
}

.readme video {
  display: block;
  background: var(--crust);
}

.readme table {
  width: auto;
  border: 1px solid var(--surface1);
  margin: 1rem 0;
}

.readme th,
.readme td {
  border: 1px solid var(--surface1);
  padding: 0.45rem 0.85rem;
  white-space: normal;
}

.readme hr {
  border: none;
  border-top: 1px solid var(--surface1);
}

/* ==========================================================================
   10. Syntax Highlighting (Catppuccin Mocha — ~/.config/nvim/lua/themes/)
   ========================================================================== */
.hl-comment {
  color: var(--surface2);
  font-style: italic;
}

.hl-keyword {
  color: var(--mauve);
  font-style: italic;
}

.hl-include {
  color: var(--blue);
  font-style: italic;
}

.hl-function {
  color: var(--blue);
  font-weight: bold;
}

.hl-function-builtin {
  color: var(--peach);
  font-weight: bold;
}

.hl-macro {
  color: var(--pink);
  font-weight: bold;
}

.hl-type {
  color: var(--yellow);
  font-weight: bold;
}

.hl-type-builtin {
  color: var(--mauve);
}

.hl-module {
  color: var(--yellow);
  font-style: italic;
}

.hl-constant,
.hl-number,
.hl-boolean,
.hl-attribute {
  color: var(--peach);
}

.hl-string {
  color: var(--green);
}

.hl-escape {
  color: var(--pink);
}

.hl-label {
  color: var(--yellow);
}

.hl-property {
  color: var(--lavender);
}

.hl-parameter {
  color: var(--maroon);
}

.hl-variable,
.hl-punctuation {
  color: var(--red);
}

.hl-operator {
  color: var(--sky);
}

.hl-tag {
  color: var(--blue);
}

.hl-tag-delimiter {
  color: var(--teal);
}
