.project-header .page-title {
  margin: 0;
  font-size: 29px;
  font-weight: 600;
  color: var(--text);
}

.project-header {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.project-desc {
  margin: 0;
  max-width: 80ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
}

/* projects_page.css spaces the chips for the card footer */
.project-meta .project-chips {
  margin-top: 0;
}

.project-when {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  color: var(--muted);
  font-size: 13.5px;
}

.project-header .back-link {
  display: inline-block;
  justify-self: start;
  color: var(--text);
  opacity: 0.85;
  text-decoration: none;
  font-size: 14px;
}

.project-header .back-link:hover {
  text-decoration: underline;
}

.error {
  margin: 0 0 12px 0;
  color: #8b0000;
  font-size: 14px;
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

/* left column: file list now, README below it later */
.main-col {
  display: grid;
  gap: 18px;
  min-width: 0;
}

/* Panels */
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

/* Force panel typography down */
/* the README panel sets its own type scale (readme.css) */
.panel:not(.readme),
.panel:not(.readme) * {
  font-size: 14px;
  line-height: 1.45;
}

.panel-title {
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.panel-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--accent);
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 7px;
  margin: 0 0 10px 0;
}

.crumb a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.crumb a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.crumb .crumb-sep {
  color: var(--muted);
  opacity: 0.6;
}

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

/* Column header above the file list */
.tree-head {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 64px 84px;
  gap: 14px;
  padding: 0 9px 10px 9px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.tree-head span:first-child {
  grid-column: 2;
}

/* File tree */
.tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.row a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 64px 84px;
  gap: 14px;
  align-items: center;
  padding: 9px 9px;
  text-decoration: none;
  color: var(--text);

  /* Change this to adjust folder/file font size */
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 400;
}

.row:not(:last-child) a {
  border-bottom: 1px solid var(--line);
}

.row:nth-child(odd) a {
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

/* Ensure the name text cannot inherit a bigger font from elsewhere */
.row a .name {
  font-size: 15.5px;   /* Change this to match .row a if you adjust sizes */
  line-height: 1.35;
  font-weight: 400;
  color: var(--muted);
}

/* Folder names bold */
.folder .name {
  font-weight: 600;
  color: var(--text);
}

/* File names normal */
.file .name {
  font-weight: 400;
  color: color-mix(in srgb, var(--text) 55%, var(--muted));
}

.row a .name {
  /* undo the sidebar's .name (centred, top margin) from layout.css */
  margin: 0;
  text-align: left;
  font-family: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row a .type-tag {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.row a .size {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.tree-head .size {
  text-align: right;
}

.row a .icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 6px;
}

.row a .icon svg {
  width: 18px;
  height: 18px;
}

.icon-folder {
  color: var(--accent);
}

.icon-file {
  color: var(--muted);
}

.row a:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

/* Right side panels */
.side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 24px;
}

.kv {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

.kv li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.k {
  color: var(--muted);
  font-size: 14px;
}

.v {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13.5px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 10px 0;
}

/* "Show all" for the file types past the first five */
.more-types {
  margin-top: 7px;
}

.more-types summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}

.more-types summary::-webkit-details-marker {
  display: none;
}

.more-types summary:hover {
  color: var(--accent);
}

.more-types .more-open,
.more-types[open] .more-closed {
  display: none;
}

.more-types[open] .more-open {
  display: inline;
}

/* expanded rows sit above the toggle so it reads as one continuous list */
.more-types[open] {
  display: flex;
  flex-direction: column-reverse;
  gap: 7px;
}

/* Stacked language bar + legend */
.lang-stack {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}

.lang-seg {
  flex: 0 1 0;
  min-width: 3px;
}

.lang-legend {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
  display: grid;
  gap: 7px;
}

.lang-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.lang-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  font-size: 13.5px;
}

@media (max-width: 1100px) {
  .project-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  /* rail drops under the files; its panels sit side by side while there's room */
  .side {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
  }
}

@media (max-width: 520px) {
  .tree-head,
  .row a {
    grid-template-columns: 26px minmax(0, 1fr) 72px;
    gap: 10px;
  }

  .tree-head .type-tag,
  .row a .type-tag {
    display: none;
  }
}

